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
253,446
<p>How does one add a comment to an MS Access Query, to provide a description of what it does?</p> <p>Once added, how can one retrieve such comments programmatically?</p>
[ { "answer_id": 253714, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 4, "selected": false, "text": "<p>It is not possible to add comments to 'normal' Access queries, that is, a QueryDef in an mdb, which is why a number of ...
2008/10/31
[ "https://Stackoverflow.com/questions/253446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6613/" ]
How does one add a comment to an MS Access Query, to provide a description of what it does? Once added, how can one retrieve such comments programmatically?
**NOTE:** Confirmed with Access 2003, don't know about earlier versions. For a query in an MDB you can right-click in the query designer (anywhere in the empty space where the tables are), select Properties from the context menu, and enter text in the *Description* property. You're limited to 256 characters, but it'...
253,468
<p>For my apps, I store some configuration file in xml along with the assembly(exe), and something other temporary files for proccessing purpose. </p> <p>I found some quirk with <code>".\\"</code> and <code>Application.StartupPath</code>.</p> <p>I've been using </p> <pre><code>String configPath = ".\\config.xml"; <...
[ { "answer_id": 253486, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>Do you want the actual working directory, or the directory containing the assembly? It's not entirely clear.</p>\n\n<...
2008/10/31
[ "https://Stackoverflow.com/questions/253468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20007/" ]
For my apps, I store some configuration file in xml along with the assembly(exe), and something other temporary files for proccessing purpose. I found some quirk with `".\\"` and `Application.StartupPath`. I've been using ``` String configPath = ".\\config.xml"; ``` It works fine until I called `OpenFIleDialog` ...
``` System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)) ```
253,469
<p>I have a <code>CMFCRibbonStatusBar</code> in my mainframe to which I add a <code>CMFCRibbonButtonsGroup</code> which again has a <code>CMFCRibbonButton</code>. This button has the same ID as a menu entry.</p> <p>Creating the button is done as follows:</p> <pre><code>CMFCRibbonButtonsGroup* pBGroup = new CMFCRibbon...
[ { "answer_id": 505535, "author": "demoncodemonkey", "author_id": 61697, "author_profile": "https://Stackoverflow.com/users/61697", "pm_score": 3, "selected": true, "text": "<p>I don't think it's possible to show the tooltip without the mouse cursor being over the control. That's all done...
2008/10/31
[ "https://Stackoverflow.com/questions/253469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27596/" ]
I have a `CMFCRibbonStatusBar` in my mainframe to which I add a `CMFCRibbonButtonsGroup` which again has a `CMFCRibbonButton`. This button has the same ID as a menu entry. Creating the button is done as follows: ``` CMFCRibbonButtonsGroup* pBGroup = new CMFCRibbonButtonsGroup(); CMFCToolBarImages images; images.SetI...
I don't think it's possible to show the tooltip without the mouse cursor being over the control. That's all done automatically. However if you want to have a nice looking tooltip like in your screenshot, you need to call `SetToolTipText` and `SetDescription`, like this: ``` CMFCRibbonButton* pBtn = new CMFCRibbonButt...
253,475
<pre><code>struct elem { int i; char k; }; elem user; // compile error! struct elem user; // this is correct </code></pre> <p>In the above piece of code we are getting an error for the first declaration. But this error doesn't occur with a C++ compiler. In C++ we don't need to use the keyword struct again and again...
[ { "answer_id": 253484, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 1, "selected": false, "text": "<p>Because C is Standardized. Compiler could offer that feature and some do, but using it means that the source code...
2008/10/31
[ "https://Stackoverflow.com/questions/253475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31116/" ]
``` struct elem { int i; char k; }; elem user; // compile error! struct elem user; // this is correct ``` In the above piece of code we are getting an error for the first declaration. But this error doesn't occur with a C++ compiler. In C++ we don't need to use the keyword struct again and again. So why doesn't any...
Because it takes years for a new Standard to evolve. They are working on a new C++ Standard ([C++0x](http://en.wikipedia.org/wiki/C%2B%2B0x)), and also on a new C standard (C1x), but if you remember that it usually takes between 5 and 10 years for each iteration, i don't expect to see it before 2010 or so. Also, just ...
253,490
<p>I have a problem with the <a href="http://freetextbox.com/" rel="nofollow noreferrer">FreeTextBox</a> rich Text Editor in my ASP.NET site. The problem occurs when I access the site with firefox, and I have a freetextbox instance in a hidden div. The hidden div might also be an AJAX Tab Panel. The actual problem is t...
[ { "answer_id": 254064, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Firefox has a problem with being inside anything with a style of display:none. What I did was to use a div with a zIndex t...
2008/10/31
[ "https://Stackoverflow.com/questions/253490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932/" ]
I have a problem with the [FreeTextBox](http://freetextbox.com/) rich Text Editor in my ASP.NET site. The problem occurs when I access the site with firefox, and I have a freetextbox instance in a hidden div. The hidden div might also be an AJAX Tab Panel. The actual problem is that when the page loads it throws an unc...
I recently met a similar problem with jQuery UI tabs. What you need to do is to change the CSS for hidden tabs to something like: ``` .hiddentab { position: absolute; left: -99999999999999; } ``` This puts hidden tabs far to the left, and in absolute position mode this does not cause horizontal scroll bars...
253,492
<p>I was looking at the Java code for <code>LinkedList</code> and noticed that it made use of a static nested class, <code>Entry</code>.</p> <pre><code>public class LinkedList&lt;E&gt; ... { ... private static class Entry&lt;E&gt; { ... } } </code></pre> <p>What is the reason for using a static nested class, rathe...
[ { "answer_id": 253507, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": false, "text": "<p>To my mind, the question ought to be the other way round whenever you see an inner class - does it <em>really</em> ne...
2008/10/31
[ "https://Stackoverflow.com/questions/253492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10171/" ]
I was looking at the Java code for `LinkedList` and noticed that it made use of a static nested class, `Entry`. ``` public class LinkedList<E> ... { ... private static class Entry<E> { ... } } ``` What is the reason for using a static nested class, rather than an normal inner class? The only reason I could think...
The Sun page you link to has some key differences between the two: > > A nested class is a member of its enclosing class. Non-static nested classes (inner classes) have access to other members of the enclosing class, even if they are declared private. Static nested classes do not have access to other members of the e...
253,517
<p>I want to create a subclass of TabPage that contains some control, and I want to control the layout and properties of those controls through the designer. However, if I open my subclass in the designer, I can't position them like I could on a UserControl. I don't want to have to create a TabPage with an UserContro...
[ { "answer_id": 254210, "author": "Hath", "author_id": 5186, "author_profile": "https://Stackoverflow.com/users/5186", "pm_score": 3, "selected": false, "text": "<p>I've had a similar problem in the past.</p>\n\n<p>What i did first was switch from inheriting Usercontrol to tabpage like so...
2008/10/31
[ "https://Stackoverflow.com/questions/253517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15371/" ]
I want to create a subclass of TabPage that contains some control, and I want to control the layout and properties of those controls through the designer. However, if I open my subclass in the designer, I can't position them like I could on a UserControl. I don't want to have to create a TabPage with an UserControl ins...
I've had a similar problem in the past. What i did first was switch from inheriting Usercontrol to tabpage like so class UserInterface : UserControl // Do designer bit then change it to class UserInterface : TabPage Second i Just put all my controls and stuff in the usercontrol and docked that into a tabpage. thi...
253,544
<p>I have been reading the post here:</p> <p><a href="http://encosia.com/2008/10/04/using-jquery-to-enhance-aspnet-ajax-progress-indication/" rel="nofollow noreferrer">http://encosia.com/2008/10/04/using-jquery-to-enhance-aspnet-ajax-progress-indication/</a></p> <p>But it wants to use the following object:</p> <pre>...
[ { "answer_id": 253526, "author": "Peter Parker", "author_id": 23264, "author_profile": "https://Stackoverflow.com/users/23264", "pm_score": 5, "selected": true, "text": "<p>NO. numerical primary keys will not reused, except you specify them manually(you should really avoid this!)</p>\n"...
2008/10/31
[ "https://Stackoverflow.com/questions/253544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24227/" ]
I have been reading the post here: <http://encosia.com/2008/10/04/using-jquery-to-enhance-aspnet-ajax-progress-indication/> But it wants to use the following object: ``` Sys.WebForms.PageRequestManager.getInstance() ``` Which doesn't exist when using the MVC AJAX code. Has anyone tried to hook when the postback en...
NO. numerical primary keys will not reused, except you specify them manually(you should really avoid this!)
253,546
<p>I have a line (actually a cube) going from (x1,y1,z1) to (x2,y2,z2). I would like to rotate it so that it is aligned along another line going from (x3,y3,z3) to (x4,y4,z4). Presently I am using <code>Math::Atan2</code> along with <code>Matrix::RotateYawPitchRoll</code>. Any better ways to do this?</p> <p>Edit: I th...
[ { "answer_id": 253674, "author": "timday", "author_id": 24283, "author_profile": "https://Stackoverflow.com/users/24283", "pm_score": 3, "selected": true, "text": "<p>Yes you can do this without needing to think in terms of angles at all.</p>\n\n<p>Since you have a cube, suppose you pick...
2008/10/31
[ "https://Stackoverflow.com/questions/253546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45603/" ]
I have a line (actually a cube) going from (x1,y1,z1) to (x2,y2,z2). I would like to rotate it so that it is aligned along another line going from (x3,y3,z3) to (x4,y4,z4). Presently I am using `Math::Atan2` along with `Matrix::RotateYawPitchRoll`. Any better ways to do this? Edit: I think I've worded this post very b...
Yes you can do this without needing to think in terms of angles at all. Since you have a cube, suppose you pick one corner and then define the 3 edges radiating out from it as vectors f0, f1, f2 (these are direction vectors, relative to the corner you've picked). Normalise those and write them as columns in a matrix F...
253,549
<p>I have the following code which works just fine when the method is "POST", but changing to "GET" doesn't work:</p> <pre><code>HttpWebRequest request = null; request = HttpWebRequest.Create(uri) as HttpWebRequest; request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; request.Method = "POST"; // D...
[ { "answer_id": 253559, "author": "Mark Renouf", "author_id": 758, "author_profile": "https://Stackoverflow.com/users/758", "pm_score": 3, "selected": false, "text": "<p>Does it make sense for a GET request to send a Content-Type? Did you try removing the third line?</p>\n" }, { "...
2008/10/31
[ "https://Stackoverflow.com/questions/253549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/986/" ]
I have the following code which works just fine when the method is "POST", but changing to "GET" doesn't work: ``` HttpWebRequest request = null; request = HttpWebRequest.Create(uri) as HttpWebRequest; request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; request.Method = "POST"; // Doesn't work wi...
This is [specified in the documentation](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetrequeststream.aspx). Basically GET requests aren't meant to contain bodies, so there's no sensible reason to call `BeginGetRequestStream`.
253,574
<p>I've written some custom model binders (implementing IModelBinder) in our ASP.NET MVC application. I'm wondering what is a good approach to unittest them (binders)?</p>
[ { "answer_id": 254447, "author": "Korbin", "author_id": 17902, "author_profile": "https://Stackoverflow.com/users/17902", "pm_score": 5, "selected": true, "text": "<p>I did it this way: </p>\n\n<pre><code>var formElements = new NameValueCollection() { {\"FirstName\",\"Bubba\"}, {\"Middle...
2008/10/31
[ "https://Stackoverflow.com/questions/253574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3182/" ]
I've written some custom model binders (implementing IModelBinder) in our ASP.NET MVC application. I'm wondering what is a good approach to unittest them (binders)?
I did it this way: ``` var formElements = new NameValueCollection() { {"FirstName","Bubba"}, {"MiddleName", ""}, {"LastName", "Gump"} }; var fakeController = GetControllerContext(formElements); var valueProvider = new Mock<IValueProvider>(); var bindingContext = new ModelBindingContext(fakeContro...
253,587
<p>I've recently started using code coverage tools (particularily Emma and EclEmma), and I really like the view that it gives me as to the completeness of my unit tests - and the ability to see what areas of the code my unit tests aren't hitting at all. I currently work in an organization that doesn't do a lot of unit ...
[ { "answer_id": 253612, "author": "chills42", "author_id": 23855, "author_profile": "https://Stackoverflow.com/users/23855", "pm_score": 2, "selected": false, "text": "<p>It may not be too complicated now, but a simple check to verify that it is still working as expected can be very usefu...
2008/10/31
[ "https://Stackoverflow.com/questions/253587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4249/" ]
I've recently started using code coverage tools (particularily Emma and EclEmma), and I really like the view that it gives me as to the completeness of my unit tests - and the ability to see what areas of the code my unit tests aren't hitting at all. I currently work in an organization that doesn't do a lot of unit tes...
I use code coverage to give me hints on places where I may have an incomplete set of tests. For example, I may write a test for some given functionality, then go develop the code that satisfies that functionality, but in doing so actually write code that does more than it is supposed to -- say it might catch an excepti...
253,614
<p>I'm trying to generate code coverage reports with <a href="http://emma.sourceforge.net/" rel="nofollow noreferrer">EMMA</a> using tests of which some use <a href="http://jmockit.dev.java.net" rel="nofollow noreferrer">JMockit</a> as a mocking framework. For the most part, it works, but a few of my tests crash with a...
[ { "answer_id": 253677, "author": "Epaga", "author_id": 6583, "author_profile": "https://Stackoverflow.com/users/6583", "pm_score": 2, "selected": true, "text": "<p>Seems to be a bug in JMockit: After the class was already instrumented by EMMA, JMockit seems to have issues creating \"reen...
2008/10/31
[ "https://Stackoverflow.com/questions/253614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I'm trying to generate code coverage reports with [EMMA](http://emma.sourceforge.net/) using tests of which some use [JMockit](http://jmockit.dev.java.net) as a mocking framework. For the most part, it works, but a few of my tests crash with a ClassFormatError, like so: ``` java.lang.ClassFormatError at sun.instru...
Seems to be a bug in JMockit: After the class was already instrumented by EMMA, JMockit seems to have issues creating "reentry=true" mock methods. Removing the "reentry=true" "worked around" the issue.
253,666
<p>In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine:</p> <pre><code>module M { type T { Text : Text; } } </code></pre> <p>while compiling the below code leads to the error "M0197: 'Text' cannot be used in a Type context"</p> <pre><code>module M { type T { ...
[ { "answer_id": 253672, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 1, "selected": false, "text": "<p>CHUI is faster in execution speed, not user interaction speed. I write embedded systems (as well as GUIs), so I'...
2008/10/31
[ "https://Stackoverflow.com/questions/253666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3588/" ]
In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine: ``` module M { type T { Text : Text; } } ``` while compiling the below code leads to the error "M0197: 'Text' cannot be used in a Type context" ``` module M { type T { Text : Text; Value : Text; /...
The primary benefits of a CHUI (that is something with forms and fields, not necessarily command line interfaces) is the keyboard for navigation and consistent layout. That is key. If your GUI can be completely, and efficiently, keyboard navigated, then your CHUI user base should be happy. This is because in time, the...
253,689
<p>I am making an expand/collapse call rates table for the company I work for. I currently have a table with a button under it to expand it, the button says "Expand". It is functional except I need the button to change to "Collapse" when it is clicked and then of course back to "Expand" when it is clicked again. The wr...
[ { "answer_id": 253710, "author": "Nick", "author_id": 26161, "author_profile": "https://Stackoverflow.com/users/26161", "pm_score": 9, "selected": false, "text": "<pre><code>$('#divID').css(\"background-image\", \"url(/myimage.jpg)\"); \n</code></pre>\n\n<p>Should do the trick, just hoo...
2008/10/31
[ "https://Stackoverflow.com/questions/253689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26823/" ]
I am making an expand/collapse call rates table for the company I work for. I currently have a table with a button under it to expand it, the button says "Expand". It is functional except I need the button to change to "Collapse" when it is clicked and then of course back to "Expand" when it is clicked again. The writi...
``` $('#divID').css("background-image", "url(/myimage.jpg)"); ``` Should do the trick, just hook it up in a click event on the element ``` $('#divID').click(function() { // do my image switching logic here. }); ```
253,691
<p>I have an abstract base class which inherits from <code>UserControl</code> and which is then used to derive a number of classes. </p> <p>The problem I have is how to elegantly ensure that the generated function <code>InitializeComponent()</code> is called for each layer of class. </p> <p>So the (abstract) base cla...
[ { "answer_id": 253739, "author": "Nick", "author_id": 26161, "author_profile": "https://Stackoverflow.com/users/26161", "pm_score": 1, "selected": false, "text": "<p>public DerivedClass() : base()\n{}</p>\n\n<p>This will call your base constructor, there isn't usually a magic way to do t...
2008/10/31
[ "https://Stackoverflow.com/questions/253691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2902/" ]
I have an abstract base class which inherits from `UserControl` and which is then used to derive a number of classes. The problem I have is how to elegantly ensure that the generated function `InitializeComponent()` is called for each layer of class. So the (abstract) base class has a number of controls on it that ...
public DerivedClass() : base() {} This will call your base constructor, there isn't usually a magic way to do things, if you need InitializeComponents called, you'll probably have to call it yourself.
253,695
<p>I have a Silverlight 2 application that validates data OnTabSelectionChanged. Immediately I began wishing that UpdateSourceTrigger allowed more than just LostFocus because if you click the tab without tabbing off of a control the LINQ object is not updated before validation. </p> <p>I worked around the issue for Te...
[ { "answer_id": 1654968, "author": "bugfixr", "author_id": 36620, "author_profile": "https://Stackoverflow.com/users/36620", "pm_score": -1, "selected": false, "text": "<p>I know it's old news... but I got around this by doing this:</p>\n\n<p>Text=\"{Binding Path=newQuantity, UpdateSource...
2008/10/31
[ "https://Stackoverflow.com/questions/253695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33102/" ]
I have a Silverlight 2 application that validates data OnTabSelectionChanged. Immediately I began wishing that UpdateSourceTrigger allowed more than just LostFocus because if you click the tab without tabbing off of a control the LINQ object is not updated before validation. I worked around the issue for TextBoxes by...
[You can do it with a behavior applied to the textbox too](http://blog.mustoverride.com/2010/01/silverlight-updatesourcetrigger.html?showComment=1279149377285_AIe9_BFLaR4pbpg_swaitgIUU0PR-hQVluTHi6P3siH156dRQIYsaNKVxx_ptreNpwv-HaozS_tab7wC55uFRxgzpOU22HtkC6-Cz2DwtrHdnmZZ5dn0sOwczJ_MpPg5K5LsT24F6GdNHZyI9LYI4kQQaU0V7rtwu...
253,701
<p>I have a web application that allows a user to search on some criteria, select an object, edit it and then return to the previous search. All the editing takes place on a separate page linked to the datagrid of returned results. I was wondering what is the best way to store the previous search parameters so that w...
[ { "answer_id": 253845, "author": "Jason Kealey", "author_id": 20893, "author_profile": "https://Stackoverflow.com/users/20893", "pm_score": 2, "selected": true, "text": "<p>In our app, we have dozens of lists with search fields. We've designed a simple utility class that generates a uniq...
2008/10/31
[ "https://Stackoverflow.com/questions/253701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30383/" ]
I have a web application that allows a user to search on some criteria, select an object, edit it and then return to the previous search. All the editing takes place on a separate page linked to the datagrid of returned results. I was wondering what is the best way to store the previous search parameters so that when t...
In our app, we have dozens of lists with search fields. We've designed a simple utility class that generates a unique string based on the current Page and stores it in the session. ``` public static string GenerateSessionKeyFromPage(Page page) { return "__" + page.Request.Path; } ``` This allows ...
253,705
<p>I have a dropdown list that stores name/value pairs. The dropdown appears in each row of a gridview.</p> <p>The values in the dropdown correspond to a third attribute (data type) not persisted in the dropdown list. I'd like to create a client-side "lookup" table so that when a user chooses a dropdown value, the pro...
[ { "answer_id": 253715, "author": "Ady", "author_id": 31395, "author_profile": "https://Stackoverflow.com/users/31395", "pm_score": 0, "selected": false, "text": "<p>If you want it all to run client side, then your only option is probably JavaScript.</p>\n\n<pre><code>var oVals = new Arr...
2008/10/31
[ "https://Stackoverflow.com/questions/253705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335036/" ]
I have a dropdown list that stores name/value pairs. The dropdown appears in each row of a gridview. The values in the dropdown correspond to a third attribute (data type) not persisted in the dropdown list. I'd like to create a client-side "lookup" table so that when a user chooses a dropdown value, the proper data t...
Found a nice solution at snipplr.com (<http://tinyurl.com/67rzav>) The function call looks something like this: ``` var profileHeaders = new AArray(); profileHeaders .add("k01", "hi"); profileHeaders .add("k02", "ho"); var oC = profileHeaders .get("k02"); alert(oC); ```
253,724
<p>I'm looking for a way to supply an argument to a ruby on rails project at runtime. Essentially, our project uses public key cryptography to encrypt some sensitive client data and we want the ability to supply the password to the private key file at runtime.</p>
[ { "answer_id": 253980, "author": "Micah", "author_id": 19964, "author_profile": "https://Stackoverflow.com/users/19964", "pm_score": 1, "selected": false, "text": "<p>What is wrong with putting the password in a file that is chmod'ed to only be readable by the web server user?</p>\n" }...
2008/10/31
[ "https://Stackoverflow.com/questions/253724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11042/" ]
I'm looking for a way to supply an argument to a ruby on rails project at runtime. Essentially, our project uses public key cryptography to encrypt some sensitive client data and we want the ability to supply the password to the private key file at runtime.
An easy way to do this would be to create a Rails plugin that takes arguments using 'gets' in its 'init.rb'. Allow me to cook-up a quick code sample: Make a directory: '$railsRoot/vendor/plugins/startup\_args/lib' Create an object to store argument data in '$railsRoot/vendor/plugins/startup\_args/lib/startup\_args.rb...
253,727
<p>When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant be found with my library.lib. Apparently, as a result, the edit and continue feature of the IDE fails to work any project that incorporates library.lib</p> <p>What magic is needed to tell VS2005 to produce a static lib with...
[ { "answer_id": 254257, "author": "Steve Steiner", "author_id": 3892, "author_profile": "https://Stackoverflow.com/users/3892", "pm_score": 4, "selected": true, "text": "<p>vc80.pdb is the file that contains the debug information for your lib. In the ide Property pages:configuration prop...
2008/10/31
[ "https://Stackoverflow.com/questions/253727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27491/" ]
When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant be found with my library.lib. Apparently, as a result, the edit and continue feature of the IDE fails to work any project that incorporates library.lib What magic is needed to tell VS2005 to produce a static lib with edit and ...
vc80.pdb is the file that contains the debug information for your lib. In the ide Property pages:configuration properties:c\c++:output files allows you to rename this to something more appropriate, such as the name of your lib. When the linker links your lib into the target exe it looks for this pdb (there is a pointer...
253,731
<p>I have a web page that has a web form for signing up. I want to remove fields. I've tried removing the field code from the .asp file but obviously there are other things that I need to remove along those lines. I have full access to all the code but I need help knowing where things are linked as far as making the fo...
[ { "answer_id": 253762, "author": "John", "author_id": 30006, "author_profile": "https://Stackoverflow.com/users/30006", "pm_score": 2, "selected": false, "text": "<p>If they're just .ASP files, you should be fine removing the field tag, along with any references to it.</p>\n\n<p>I.e. you...
2008/10/31
[ "https://Stackoverflow.com/questions/253731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a web page that has a web form for signing up. I want to remove fields. I've tried removing the field code from the .asp file but obviously there are other things that I need to remove along those lines. I have full access to all the code but I need help knowing where things are linked as far as making the form ...
If they're just .ASP files, you should be fine removing the field tag, along with any references to it. I.e. you'd delete this line: ``` <asp:TextBox id="text1" runat="server" /> ``` and do a search for the 'id' attribute in the rest of the file (a find on 'text1' in this case), and remove those lines.
253,735
<p>I have a report that is used by a windows service and a form application. So, I want to put embed the report in a DLL file that can be used by both.</p> <p>The problem is that if I try to set the ReportEmbeddedResource property of a ReportViewer control in my windows form app, it will search the windows form app f...
[ { "answer_id": 261842, "author": "DrCamel", "author_id": 4168, "author_profile": "https://Stackoverflow.com/users/4168", "pm_score": 4, "selected": false, "text": "<p>Probably the best thing to do would be to get a stream to the RDLC resource from the other assembly, then pass that to th...
2008/10/31
[ "https://Stackoverflow.com/questions/253735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681/" ]
I have a report that is used by a windows service and a form application. So, I want to put embed the report in a DLL file that can be used by both. The problem is that if I try to set the ReportEmbeddedResource property of a ReportViewer control in my windows form app, it will search the windows form app for the reso...
Something like this should do it: ``` Assembly assembly = Assembly.LoadFrom("Reports.dll"); Stream stream = assembly.GetManifestResourceStream("Reports.MyReport.rdlc"); reportViewer.LocalReport.LoadReportDefinition(stream); ```
253,746
<p>In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine:</p> <pre><code>module T { type A { Id : Integer32 = AutoNumber(); } where identity Id; As : A*; type B { Id : Integer32 = AutoNumber(); // A : A; // } where A in As &amp;&amp; identity Id...
[ { "answer_id": 254473, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 2, "selected": true, "text": "<p>I think what you want is:</p>\n\n<pre><code>type A {\n Id : Integer32 = AutoNumber();\n} where identity Id;\n\nAs : A*;...
2008/10/31
[ "https://Stackoverflow.com/questions/253746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3588/" ]
In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine: ``` module T { type A { Id : Integer32 = AutoNumber(); } where identity Id; As : A*; type B { Id : Integer32 = AutoNumber(); // A : A; // } where A in As && identity Id; } where identity...
I think what you want is: ``` type A { Id : Integer32 = AutoNumber(); } where identity Id; As : A*; type B { Id : Integer32 = AutoNumber(); A : A; } where identity Id; Bs : (B where value.A in As)*; type C { Id : Integer32 = AutoNumber(); B : B; } where identity Id && B in Bs; Cs : (C where va...
253,747
<p>I'm using .NET typed datasets on a project, and I often get into situations where I prefetch data from several tables into a dataset and then pass that dataset to several methods for processing. It seems cleaner to let each method decide exactly which data it needs and then load the data itself. However, several of ...
[ { "answer_id": 254473, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 2, "selected": true, "text": "<p>I think what you want is:</p>\n\n<pre><code>type A {\n Id : Integer32 = AutoNumber();\n} where identity Id;\n\nAs : A*;...
2008/10/31
[ "https://Stackoverflow.com/questions/253747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33096/" ]
I'm using .NET typed datasets on a project, and I often get into situations where I prefetch data from several tables into a dataset and then pass that dataset to several methods for processing. It seems cleaner to let each method decide exactly which data it needs and then load the data itself. However, several of the...
I think what you want is: ``` type A { Id : Integer32 = AutoNumber(); } where identity Id; As : A*; type B { Id : Integer32 = AutoNumber(); A : A; } where identity Id; Bs : (B where value.A in As)*; type C { Id : Integer32 = AutoNumber(); B : B; } where identity Id && B in Bs; Cs : (C where va...
253,757
<p>In following code, I want to extend the behaviour of a class by deriving/subclassing it, and make use of an event of the base class:</p> <pre><code>public class A { public event EventHandler SomeEvent; public void someMethod() { if(SomeEvent != null) SomeEvent(this, someArgs); } } public c...
[ { "answer_id": 253776, "author": "Todd White", "author_id": 30833, "author_profile": "https://Stackoverflow.com/users/30833", "pm_score": 6, "selected": true, "text": "<p>The standard practice here is to have a protected virtual method OnSomeEvent on your base class, then call that metho...
2008/10/31
[ "https://Stackoverflow.com/questions/253757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26070/" ]
In following code, I want to extend the behaviour of a class by deriving/subclassing it, and make use of an event of the base class: ``` public class A { public event EventHandler SomeEvent; public void someMethod() { if(SomeEvent != null) SomeEvent(this, someArgs); } } public class B : A { ...
The standard practice here is to have a protected virtual method OnSomeEvent on your base class, then call that method in derived classes. Also, for threading reasons you will want to keep a reference to the handler before checking null and calling it. For an explanation of the why read [Jon Skeet's](https://stackover...
253,780
<p>I'd like to return an object with the following signature</p> <pre><code>class AnonClass{ string Name {get;} IEnumerable&lt;Group&gt; Groups {get;} } </code></pre> <p>I have tried the following query, but g only returns a single entity, not all the joined entities</p> <pre><code>var q = from t in dc.Theme...
[ { "answer_id": 253774, "author": "ine", "author_id": 4965, "author_profile": "https://Stackoverflow.com/users/4965", "pm_score": 2, "selected": false, "text": "<p>The de-facto OS X IDE and compiler is <a href=\"http://developer.apple.com/tools/xcode/\" rel=\"nofollow noreferrer\">Xcode</...
2008/10/31
[ "https://Stackoverflow.com/questions/253780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2086/" ]
I'd like to return an object with the following signature ``` class AnonClass{ string Name {get;} IEnumerable<Group> Groups {get;} } ``` I have tried the following query, but g only returns a single entity, not all the joined entities ``` var q = from t in dc.Themes join g in dc.Groups on t.K equals g.Theme...
Xcode is the IDE for Mac OS X, you can download the latest version by joining the Apple Developer Connection with a free Online membership. I don't believe there are any supported APIs for controlling wireless networking adaptors. The closest thing would be the System Configuration framework, but I don't know if it wi...
253,834
<p>Has anyone found a good class, or other file that will convert a .doc file into html or something that I can read and turn into html? </p> <p>I have been looking around for a couple hours now and have only found ones that require msword on the server in order to convert the file. I am pretty sure that is not an opt...
[ { "answer_id": 556403, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>A project called phpLiveDocx does what you want. It is a SOAP based service, but can be used free of charge. For a basic in...
2008/10/31
[ "https://Stackoverflow.com/questions/253834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1925/" ]
Has anyone found a good class, or other file that will convert a .doc file into html or something that I can read and turn into html? I have been looking around for a couple hours now and have only found ones that require msword on the server in order to convert the file. I am pretty sure that is not an option but I ...
intall and use abiword, like this: ``` AbiWord --to=html archivo.doc ``` you can call this command from php.
253,843
<p>What is the best way to refresh a <code>DataGridView</code> when you update an underlying data source?</p> <p>I'm updating the datasource frequently and wanted to display the outcome to the user as it happens.</p> <p>I've got something like this (and it works), but setting the <code>DataGridView.DataSource</code> ...
[ { "answer_id": 253863, "author": "Georg", "author_id": 30776, "author_profile": "https://Stackoverflow.com/users/30776", "pm_score": -1, "selected": false, "text": "<p>Try this Code</p>\n\n<pre><code>List itemStates = new List();\n\nfor (int i = 0; i &lt; 10; i++)\n{ \n itemStates.Add...
2008/10/31
[ "https://Stackoverflow.com/questions/253843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21180/" ]
What is the best way to refresh a `DataGridView` when you update an underlying data source? I'm updating the datasource frequently and wanted to display the outcome to the user as it happens. I've got something like this (and it works), but setting the `DataGridView.DataSource` to `null` doesn't seem like the right w...
Well, it doesn't get much better than that. Officially, you should use ``` dataGridView1.DataSource = typeof(List); dataGridView1.DataSource = itemStates; ``` It's still a "clear/reset source" kind of solution, but I have yet to find anything else that would reliably refresh the DGV data source.
253,868
<p>I'm looking at all the CSS Drop shadow tutorials, which are great. Unfortunately, I need to put a shadow on three sides of a block element (left, bottom, right). All the tutorials talk about shifting your block element up and to the left. Anyone have insights into putting a shadow on three or even four sides?</p>...
[ { "answer_id": 253878, "author": "Filini", "author_id": 21162, "author_profile": "https://Stackoverflow.com/users/21162", "pm_score": 2, "selected": false, "text": "<p>make your block element larger/higher, so that it exceeds the sides you want.</p>\n" }, { "answer_id": 253915, ...
2008/10/31
[ "https://Stackoverflow.com/questions/253868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1753/" ]
I'm looking at all the CSS Drop shadow tutorials, which are great. Unfortunately, I need to put a shadow on three sides of a block element (left, bottom, right). All the tutorials talk about shifting your block element up and to the left. Anyone have insights into putting a shadow on three or even four sides?
Thanks everyone. The way I ended up doing it was sorta like this: ``` <div id="top_margin"></div> <div id="left_right_shadow">this div has a 5 px tall repeating background that is a bit bigger than the width of my content block, shadow on the left, white space, shadow on the right <div id="content">Content as normal...
253,881
<p>Can't figure out why I'm getting 'SQL Statement ignored' and 'ORA-01775: looping chain of synonyms' on line 52 of this stored procedure. Got any ideas?</p> <pre><code>CREATE OR REPLACE PACKAGE PURGE_LOG_BY_EVENT_DAYS AS TYPE dual_cursorType IS REF CURSOR RETURN dual%ROWTYPE; PROCEDURE log_master_by_event_day...
[ { "answer_id": 253909, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<pre><code>SELECT table_owner, table_name, db_link\n FROM dba_synonyms \n WHERE owner = 'PUBLIC' and db_link is not nu...
2008/10/31
[ "https://Stackoverflow.com/questions/253881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Can't figure out why I'm getting 'SQL Statement ignored' and 'ORA-01775: looping chain of synonyms' on line 52 of this stored procedure. Got any ideas? ``` CREATE OR REPLACE PACKAGE PURGE_LOG_BY_EVENT_DAYS AS TYPE dual_cursorType IS REF CURSOR RETURN dual%ROWTYPE; PROCEDURE log_master_by_event_days (event_id NUM...
I have no idea why you're getting the synonym error. But that's a lot of code for something that should be a single DELETE statement. I assume you've changed it to commit-every-n to avoid rollback errors. It would be nice if you could get your DBA to increase the undo space so you can actually do the work you need to d...
253,911
<p>I have a case that keeps coming up where I'm using a ListView or similar control with a simple array such as string[].</p> <p>Is there a way to use the DataKeyNames property when you are binding to simple collections?</p>
[ { "answer_id": 253939, "author": "craigmoliver", "author_id": 12252, "author_profile": "https://Stackoverflow.com/users/12252", "pm_score": 0, "selected": false, "text": "<p>Try using a Generic List with objects object. The example below is C# 3.0. Say you want a list of letters:</p>\n...
2008/10/31
[ "https://Stackoverflow.com/questions/253911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10115/" ]
I have a case that keeps coming up where I'm using a ListView or similar control with a simple array such as string[]. Is there a way to use the DataKeyNames property when you are binding to simple collections?
You could do this with Linq: ``` string [] files = ...; var list = from f in files select new { Letter = f }; // anonymous type created with member called Letter lv.DataKeyNames = "Letter"; lv.DataSource = list; lv.DataBind(); ```
253,913
<p>I have a function I've written that was initially supposed to take a string field and populate an excel spreadsheet with the values. Those values continually came up null. I started tracking it back to the recordset and found that despite the query being valid and running properly through the Access query analyzer...
[ { "answer_id": 253926, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 1, "selected": false, "text": "<p>Description is a reserved word - put some [] brackets around it in the SELECT statement</p>\n\n<p>EDIT</p>\n\n<p>Try naming...
2008/10/31
[ "https://Stackoverflow.com/questions/253913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33124/" ]
I have a function I've written that was initially supposed to take a string field and populate an excel spreadsheet with the values. Those values continually came up null. I started tracking it back to the recordset and found that despite the query being valid and running properly through the Access query analyzer the ...
When using ADO LIKE searches must use % instead of \*. I know \* works in Access but for some stupid reason ADO won't work unless you use % instead. I had the same problem and ran accoss this forum while trying to fix it. Replacing \*'s with %'s worked for me.
253,937
<p>If I wanted to find checked check boxes on an ASP.NET page I could use the following LINQ query.</p> <pre><code>var checkBoxes = this.Controls .OfType&lt;CheckBox&gt;() .TakeWhile&lt;CheckBox&gt;(cb =&gt; cb.Checked); </code></pre> <p>That works fine if the checkboxes are ...
[ { "answer_id": 253962, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": "<p>Take the type/ID checking out of the recursion, so just have a \"give me all the controls, recursively\" method, e.g.<...
2008/10/31
[ "https://Stackoverflow.com/questions/253937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29294/" ]
If I wanted to find checked check boxes on an ASP.NET page I could use the following LINQ query. ``` var checkBoxes = this.Controls .OfType<CheckBox>() .TakeWhile<CheckBox>(cb => cb.Checked); ``` That works fine if the checkboxes are nested in the current control collection,...
Take the type/ID checking out of the recursion, so just have a "give me all the controls, recursively" method, e.g. ``` public static IEnumerable<Control> GetAllControls(this Control parent) { foreach (Control control in parent.Controls) { yield return control; foreach(Control descendant in con...
253,938
<p>I have some complex stored procedures that may return many thousands of rows, and take a long time to complete.</p> <p>Is there any way to find out how many rows are going to be returned before the query executes and fetches the data?</p> <p>This is with Visual Studio 2005, a Winforms application and SQL Server 20...
[ { "answer_id": 253952, "author": "craigmoliver", "author_id": 12252, "author_profile": "https://Stackoverflow.com/users/12252", "pm_score": 0, "selected": false, "text": "<p>make a stored proc to count the rows first.</p>\n\n<p>SELECT COUNT(*) FROM table</p>\n" }, { "answer_id": ...
2008/10/31
[ "https://Stackoverflow.com/questions/253938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18854/" ]
I have some complex stored procedures that may return many thousands of rows, and take a long time to complete. Is there any way to find out how many rows are going to be returned before the query executes and fetches the data? This is with Visual Studio 2005, a Winforms application and SQL Server 2005.
A solution to your problem might be to re-write the stored procedure so that it limits the result set to some number, like: ``` SELECT TOP 1000 * FROM tblWHATEVER ``` in SQL Server, or ``` SELECT * FROM tblWHATEVER WHERE ROWNUM <= 1000 ``` in Oracle. Or implement a paging solution so that the result set of each c...
253,987
<p><code>select max(DELIVERY_TIMESTAMP) from DOCUMENTS;</code> will return the time that the latest document was delivered. How do I return <strong>the other columns</strong> for the latest document? For example I want <code>DOC_NAME</code> for the document that was most recently delivered?</p> <p>I'm not sure how to ...
[ { "answer_id": 253995, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<pre><code>Select Max(DELIVERY_TIMESTAMP), \n Doc_Name\nFrom TableName\nGroup By Doc_Name\n</code></pre>\n\n<p>That shou...
2008/10/31
[ "https://Stackoverflow.com/questions/253987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18995/" ]
`select max(DELIVERY_TIMESTAMP) from DOCUMENTS;` will return the time that the latest document was delivered. How do I return **the other columns** for the latest document? For example I want `DOC_NAME` for the document that was most recently delivered? I'm not sure how to form the `WHERE` clause.
You have a few options ``` SELECT DOC_NAME FROM DOCUMENTS WHERE DELIVERY_TIMESTAMP IN ( SELECT MAX(DELIVERY_TIMESTAMP) FROM DOCUMENTS ) ``` Or with joins ``` SELECT DOC_NAME FROM DOCUMENTS INNER JOIN ( SELECT MAX(DELIVERY_TIMESTAMP) AS MAX_DELIVERY_TIMESTAMP FROM DOCUMENTS ) AS M ON M.MAX_DELIVE...
254,002
<p>I am looking for an expression for the .hgignore file, to ignore all files beneath a specified folder.</p> <p>eg: I would like to ignore all files and folders beneath bin</p> <p>Actually any advice on how the expressions are formed would be great</p>
[ { "answer_id": 254049, "author": "Xian", "author_id": 4642, "author_profile": "https://Stackoverflow.com/users/4642", "pm_score": 2, "selected": false, "text": "<p>Nevermind, I got it</p>\n\n<pre><code>syntax: regexp\nbin\\\\*\n</code></pre>\n\n<p>expressions follow standard perl regular...
2008/10/31
[ "https://Stackoverflow.com/questions/254002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4642/" ]
I am looking for an expression for the .hgignore file, to ignore all files beneath a specified folder. eg: I would like to ignore all files and folders beneath bin Actually any advice on how the expressions are formed would be great
Alternately: ``` syntax: glob bin/** ```
254,004
<p>I am using the EMMA tool for code coverage yet despite my best efforts, EMMA is refusing to see the original .java files and generate coverage on a line-by-line basis.</p> <p>We are using ANT to build the code and debug is set to true. I know that EMMA is measuring coverage as the .emma files seem to be generating ...
[ { "answer_id": 254041, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "<p>Are you setting the <code>sourcepath</code> in your <code>report</code> element?</p>\n\n<pre><code>&lt;report&gt;\n &lt;...
2008/10/31
[ "https://Stackoverflow.com/questions/254004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using the EMMA tool for code coverage yet despite my best efforts, EMMA is refusing to see the original .java files and generate coverage on a line-by-line basis. We are using ANT to build the code and debug is set to true. I know that EMMA is measuring coverage as the .emma files seem to be generating and mergin...
Are you setting the `sourcepath` in your `report` element? ``` <report> <sourcepath> <pathelement path="${java.src.dir}" /> </sourcepath> <fileset dir="data"> <include name="*.emma" /> </fileset> <txt outfile="coverage.txt" /> <html outfile="coverage.html" /> </report> ```
254,009
<p>This probably has a simple answer, but I must not have had enough coffee to figure it out on my own:</p> <p>If I had a comma delimited string such as:</p> <pre><code>string list = "Fred,Sam,Mike,Sarah"; </code></pre> <p>How would get each element and add quotes around it and stick it back in a string like this:</...
[ { "answer_id": 254012, "author": "FOR", "author_id": 27826, "author_profile": "https://Stackoverflow.com/users/27826", "pm_score": 8, "selected": true, "text": "<pre><code>string s = \"A,B,C\";\nstring replaced = \"'\"+s.Replace(\",\", \"','\")+\"'\";\n</code></pre>\n\n<p>Thanks for the ...
2008/10/31
[ "https://Stackoverflow.com/questions/254009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12999/" ]
This probably has a simple answer, but I must not have had enough coffee to figure it out on my own: If I had a comma delimited string such as: ``` string list = "Fred,Sam,Mike,Sarah"; ``` How would get each element and add quotes around it and stick it back in a string like this: ``` string newList = "'Fred','Sam...
``` string s = "A,B,C"; string replaced = "'"+s.Replace(",", "','")+"'"; ``` Thanks for the comments, I had missed the external quotes. Of course.. if the source was an empty string, would you want the extra quotes around it or not ? And what if the input was a bunch of whitespaces... ? I mean, to give a 100% comple...
254,060
<p>I am using the WMD markdown editor in a project for a large number of fields that correspond to a large number of properties in a large number of Entity classes. Some classes may have multiple properties that require the markdown.</p> <p>I am storing the markdown itself since this makes it easier to edit the fields...
[ { "answer_id": 254114, "author": "Jasper Bekkers", "author_id": 31486, "author_profile": "https://Stackoverflow.com/users/31486", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>The classes that require this are not part of a single inheritance hierarchy.</p>\n</blockquote>\...
2008/10/31
[ "https://Stackoverflow.com/questions/254060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27439/" ]
I am using the WMD markdown editor in a project for a large number of fields that correspond to a large number of properties in a large number of Entity classes. Some classes may have multiple properties that require the markdown. I am storing the markdown itself since this makes it easier to edit the fields later. Ho...
> > The classes that require this are not part of a single inheritance hierarchy. > > > They should at least implement a common interface, otherwise coming up with a clean generic solution is going to be cumbersome. > > The other option I am considering is doing this in the controller rather than the model. What...
254,066
<p>On Windows XP, the following command in a script will prevent any power saving options from being enabled on the PC (monitor sleep, HD sleep, etc.). This is useful for kiosk applications.</p> <pre><code>powercfg.exe /setactive presentation </code></pre> <p>What is the equivalent on Vista?</p>
[ { "answer_id": 254112, "author": "Martin Beckett", "author_id": 10897, "author_profile": "https://Stackoverflow.com/users/10897", "pm_score": 0, "selected": false, "text": "<p>In Vista you create a power profile and use the commandline powercfg to select that profile <a href=\"http://ww...
2008/10/31
[ "https://Stackoverflow.com/questions/254066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1490/" ]
On Windows XP, the following command in a script will prevent any power saving options from being enabled on the PC (monitor sleep, HD sleep, etc.). This is useful for kiosk applications. ``` powercfg.exe /setactive presentation ``` What is the equivalent on Vista?
powercfg.exe works a little differently in Vista, and the "presentation" profile isn't included by default (at least on my machine. so you can setup a "presentation" profile and then use the following to get the GUID > > > ``` > powercfg.exe -list > > ``` > > and the following to set it to that GUID: > > > ``...
254,071
<p>I tried to use <code>OPTION (MAXRECURSION 0)</code> in a view to generate a list of dates. This seems to be unsupported. Is there a workaround for this issue?</p> <p>EDIT to Explain what I actually want to do:</p> <p>I have 2 tables.</p> <p>table1: int weekday, bool available</p> <p>table2: datetime date, bool a...
[ { "answer_id": 254174, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 0, "selected": false, "text": "<p>You can use a <a href=\"http://blog.crowe.co.nz/archive/2007/09/06/Microsoft-SQL-Server-2005---CTE-Example-of-a-simple.asp...
2008/10/31
[ "https://Stackoverflow.com/questions/254071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13376/" ]
I tried to use `OPTION (MAXRECURSION 0)` in a view to generate a list of dates. This seems to be unsupported. Is there a workaround for this issue? EDIT to Explain what I actually want to do: I have 2 tables. table1: int weekday, bool available table2: datetime date, bool available I want the result: view1: date (...
[No](http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=124653) - if you can find a way to do it within 100 levels of recusion (have a table of numbers), which will get you to within 100 recursion levels, you'll be able to do it. But if you have a numbers or pivot table, you won't need the rec...
254,076
<p>This is the error Dependency Walker gives me on an executable that I am building with VC++ 2005 Express Edition. When trying to run the .exe, I get:</p> <pre><code>This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. </code></pre...
[ { "answer_id": 254106, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 2, "selected": false, "text": "<p>Run Event Viewer: it'll have more information.</p>\n\n<p>Probably you've attempted to run your program on a machi...
2008/10/31
[ "https://Stackoverflow.com/questions/254076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2666/" ]
This is the error Dependency Walker gives me on an executable that I am building with VC++ 2005 Express Edition. When trying to run the .exe, I get: ``` This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. ``` (I am new to the man...
Open the properties sheet for your project, go to the Configuration Properties -> C/C++ -> Code Generation page, and change the Runtime Library selection to /MT or /MTd so that your project does not use the DLL runtime libraries. The C/C++ DLL runtimes used by VS2003 and up are not automatically distributed with the l...
254,080
<p>I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony silence ;)</p> <p>Does anyone have se...
[ { "answer_id": 255151, "author": "Dave Verwer", "author_id": 4496, "author_profile": "https://Stackoverflow.com/users/4496", "pm_score": 9, "selected": true, "text": "<pre><code>afconvert -f caff -d LEI16@44100 -c 1 in.wav out.caf\n</code></pre>\n\n<p>References:</p>\n\n<ul>\n<li>Apple's...
2008/10/31
[ "https://Stackoverflow.com/questions/254080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4496/" ]
I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony silence ;) Does anyone have settings for...
``` afconvert -f caff -d LEI16@44100 -c 1 in.wav out.caf ``` References: * Apple's [Multimedia Programming Guide: Using Audio: Preferred Audio Formats in iOS](https://developer.apple.com/library/ios/documentation/audiovideo/conceptual/multimediapg/usingaudio/usingaudio.html#//apple_ref/doc/uid/TP40009767-CH2-SW28) *...
254,099
<p>I'm trying to write some LINQ To SQL code that would generate SQL like</p> <pre><code>SELECT t.Name, g.Name FROM Theme t INNER JOIN ( SELECT TOP 5 * FROM [Group] ORDER BY TotalMembers ) as g ON t.K = g.ThemeK </code></pre> <p>So far I have</p> <pre><code>var q = from t in dc.Themes join g in dc.Groups on t.K...
[ { "answer_id": 254105, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>Just bracket your query expression and call Take on it:</p>\n\n<pre><code>var q = from t in dc.Themes \njoin g in dc....
2008/10/31
[ "https://Stackoverflow.com/questions/254099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2086/" ]
I'm trying to write some LINQ To SQL code that would generate SQL like ``` SELECT t.Name, g.Name FROM Theme t INNER JOIN ( SELECT TOP 5 * FROM [Group] ORDER BY TotalMembers ) as g ON t.K = g.ThemeK ``` So far I have ``` var q = from t in dc.Themes join g in dc.Groups on t.K equals g.ThemeK into groups select ...
Here's a faithful translation of the original query. This should not generate repeated roundtrips. ``` var subquery = dc.Groups .OrderBy(g => g.TotalMembers) .Take(5); var query = dc.Themes .Join(subquery, t => t.K, g => g.ThemeK, (t, g) => new { ThemeName = t.Name, GroupName = g.Name } ); ``` T...
254,111
<p>I have a flash app in my page, and when a user interacts with the flash app, the browser/html/javascript stops receiving keyboard input. </p> <p>For example, in Firefox control-t no longer opens a new tab.</p> <p>However, if I click on part of the page that isn't flash, the browser starts receiving these events a...
[ { "answer_id": 254130, "author": "user32141", "author_id": 32141, "author_profile": "https://Stackoverflow.com/users/32141", "pm_score": 2, "selected": false, "text": "<p>I think Adobe needs to drop the focus when the mouse goes out of its client area, or provide an option to do so. </p>...
2008/10/31
[ "https://Stackoverflow.com/questions/254111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32951/" ]
I have a flash app in my page, and when a user interacts with the flash app, the browser/html/javascript stops receiving keyboard input. For example, in Firefox control-t no longer opens a new tab. However, if I click on part of the page that isn't flash, the browser starts receiving these events again. Is there an...
You can use the ExternalInterface class within Flash to call JavaScript. For example you could set up a function on an interval (Event.ENTER\_FRAME for example) to call the JavaScript function that @Diodeus mentioned: ``` document.body.focus(); ``` Or, an even better solution would be to add an event listener to the...
254,121
<p>I have an application in which most requests are submitted via AJAX, though some are submitted via "regular" HTTP requests. If a request is submitted and the user's session has timed out, the following JSON is returned:</p> <pre><code>{"authentication":"required"} </code></pre> <p>The JavaScript function which sub...
[ { "answer_id": 254142, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "<p>3) Change your AJAX code to add a variable to the GET or POST: <code>outputJson=1</code></p>\n" }, { "answer_id": ...
2008/10/31
[ "https://Stackoverflow.com/questions/254121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
I have an application in which most requests are submitted via AJAX, though some are submitted via "regular" HTTP requests. If a request is submitted and the user's session has timed out, the following JSON is returned: ``` {"authentication":"required"} ``` The JavaScript function which submits all AJAX requests han...
You cannot add a handler to the JSP that way. Anything you add to it will make it a non-JSON producing page. There are two options that I can see: Add a parameter to the page by appending a URL parameter to the screen that modifies the output. URL: <http://domain/page.jsp?ajaxRequest=true> would output json only URL...
254,125
<p>I'm writing a mapping app that uses a Canvas for positioning elements. For each element I have to programatically convert element's Lat/Long to the canvas' coordinate, then set the Canvas.Top and Canvas.Left properties.</p> <p>If I had a 360x180 Canvas, can I convert the coordinates on the canvas to go from -180 t...
[ { "answer_id": 254155, "author": "MojoFilter", "author_id": 93, "author_profile": "https://Stackoverflow.com/users/93", "pm_score": 0, "selected": false, "text": "<p>I'm pretty sure you can't do that exactly, but it would be pretty trivial to have a method which translated from lat/long ...
2008/10/31
[ "https://Stackoverflow.com/questions/254125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4580/" ]
I'm writing a mapping app that uses a Canvas for positioning elements. For each element I have to programatically convert element's Lat/Long to the canvas' coordinate, then set the Canvas.Top and Canvas.Left properties. If I had a 360x180 Canvas, can I convert the coordinates on the canvas to go from -180 to 180 rathe...
Here's an all-XAML solution. Well, mostly XAML, because you have to have the IValueConverter in code. So: Create a new WPF project and add a class to it. The class is MultiplyConverter: ``` namespace YourProject { public class MultiplyConverter : System.Windows.Data.IValueConverter { public object Conv...
254,129
<p>How can I display a sort arrow in the header of the sorted column in a list view which follows the native look of the operating system?</p>
[ { "answer_id": 254139, "author": "Andrew Moore", "author_id": 26210, "author_profile": "https://Stackoverflow.com/users/26210", "pm_score": 7, "selected": true, "text": "<p>You can use the following extension method to set the sort arrow to a particular column:</p>\n\n<pre><code>[EditorB...
2008/10/31
[ "https://Stackoverflow.com/questions/254129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26210/" ]
How can I display a sort arrow in the header of the sorted column in a list view which follows the native look of the operating system?
You can use the following extension method to set the sort arrow to a particular column: ``` [EditorBrowsable(EditorBrowsableState.Never)] public static class ListViewExtensions { [StructLayout(LayoutKind.Sequential)] public struct HDITEM { public Mask mask; public int cxy; [Marshal...
254,132
<p>I am wondering what are the possible value for *_la_LDFLAGS in Makefile.am ? </p> <p>If I ask this question, it is because I would like the following :</p> <pre><code>Actual shared library : libA.so (or with the version number I don't care) Symbolic links : libA-X.Y.Z.so, libA-X.so, libA.so soname : ...
[ { "answer_id": 255663, "author": "adl", "author_id": 27835, "author_profile": "https://Stackoverflow.com/users/27835", "pm_score": 3, "selected": true, "text": "<p>You should use the <code>-version-info</code> option of Libtool to specify the interface version of the library, but be sure...
2008/10/31
[ "https://Stackoverflow.com/questions/254132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20986/" ]
I am wondering what are the possible value for \*\_la\_LDFLAGS in Makefile.am ? If I ask this question, it is because I would like the following : ``` Actual shared library : libA.so (or with the version number I don't care) Symbolic links : libA-X.Y.Z.so, libA-X.so, libA.so soname : libA-X.so...
You should use the `-version-info` option of Libtool to specify the interface version of the library, but be sure to read [how versioning works](http://sources.redhat.com/autobook/autobook/autobook_91.html) (or [here](http://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning) for the official man...
254,152
<p>I'm curious to know how NULLs are stored into a database ?</p> <p>It surely depends on the database server but I would like to have an general idea about it.</p> <hr> <p>First try:</p> <p>Suppose that the server put a undefined value (could be anything) into the field for a NULL value.</p> <p>Could you be very ...
[ { "answer_id": 254162, "author": "Adam Davis", "author_id": 2915, "author_profile": "https://Stackoverflow.com/users/2915", "pm_score": 2, "selected": false, "text": "<p>The server typically uses meta information rather than a magic value. So there's a bit off someplace that specifies w...
2008/10/31
[ "https://Stackoverflow.com/questions/254152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14673/" ]
I'm curious to know how NULLs are stored into a database ? It surely depends on the database server but I would like to have an general idea about it. --- First try: Suppose that the server put a undefined value (could be anything) into the field for a NULL value. Could you be very lucky and retrieve the NULL valu...
On PostgreSQL, it uses an optional bitmap with one bit per column (0 is null, 1 is not null). If the bitmap is not present, all columns are not null. This is completely separate from the storage of the data itself, but is on the same page as the row (so both the row and the bitmap are read together). References: * <...
254,168
<p>I have two tables:</p> <p>Table 1: ID, PersonCode, Name, </p> <p>Table 2: ID, Table1ID, Location, ServiceDate</p> <p>I've got a query joining table 1 to table 2 on table1.ID = table2.Table1ID where PersonCode = 'XYZ'</p> <p>What I want to do is return Table1.PersonCode,Table1.Name, Table2.Location, Table2.Servic...
[ { "answer_id": 254176, "author": "dove", "author_id": 30913, "author_profile": "https://Stackoverflow.com/users/30913", "pm_score": 0, "selected": false, "text": "<p>Use MAX(ServiceDate)</p>\n" }, { "answer_id": 254185, "author": "Tony Andrews", "author_id": 18747, "a...
2008/10/31
[ "https://Stackoverflow.com/questions/254168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
I have two tables: Table 1: ID, PersonCode, Name, Table 2: ID, Table1ID, Location, ServiceDate I've got a query joining table 1 to table 2 on table1.ID = table2.Table1ID where PersonCode = 'XYZ' What I want to do is return Table1.PersonCode,Table1.Name, Table2.Location, Table2.ServiceDate, I don't want all rows, I...
Something like this: ``` SELECT Table1.PersonCode, Table1.Name, Table2.Location, MAX(Table2.ServiceDate) FROM Table1 INNER JOIN Table2 on Table1.ID = Table2.Table1ID WHERE TABLE1.PersonCode = 'XYZ' GROUP BY Table1.PersonCode,Table1.Name, Table2.Location ```
254,178
<p>Currently I'm using</p> <pre><code>var x = dict.ContainsKey(key) ? dict[key] : defaultValue </code></pre> <p>I'd like some way to have dictionary[key] return null for nonexistant keys, so I could write something like</p> <pre><code>var x = dict[key] ?? defaultValue; </code></pre> <p>this also winds up being par...
[ { "answer_id": 254188, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 3, "selected": false, "text": "<p>You can use a helper method:</p>\n\n<pre><code>public abstract class MyHelper {\n public static V GetValueOrDefault&lt;...
2008/10/31
[ "https://Stackoverflow.com/questions/254178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4435/" ]
Currently I'm using ``` var x = dict.ContainsKey(key) ? dict[key] : defaultValue ``` I'd like some way to have dictionary[key] return null for nonexistant keys, so I could write something like ``` var x = dict[key] ?? defaultValue; ``` this also winds up being part of linq queries etc. so I'd prefer one-line sol...
With an extension method: ``` public static class MyHelper { public static V GetValueOrDefault<K, V>(this IDictionary<K, V> dic, K key, V defaultVal = default(V)) { V ret; bool found = dic.TryGetValue(key,...
254,184
<p>I have a simple HTML upload form, and I want to specify a default extension ("*.drp" for example). I've read that the way to do this is through the ACCEPT attribute of the input tag, but I don't know how exactly.</p> <pre><code>&lt;form enctype="multipart/form-data" action="uploader.php" method="POST"&gt; Upload DR...
[ { "answer_id": 254195, "author": "Brian Cline", "author_id": 32536, "author_profile": "https://Stackoverflow.com/users/32536", "pm_score": 3, "selected": false, "text": "<p>The accept attribute expects MIME types, not file masks. For example, to accept PNG images, you'd need accept=\"ima...
2008/10/31
[ "https://Stackoverflow.com/questions/254184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
I have a simple HTML upload form, and I want to specify a default extension ("\*.drp" for example). I've read that the way to do this is through the ACCEPT attribute of the input tag, but I don't know how exactly. ``` <form enctype="multipart/form-data" action="uploader.php" method="POST"> Upload DRP File: <input name...
I use javascript to check file extension. Here is my code: HTML ``` <input name="fileToUpload" type="file" onchange="check_file()" > ``` .. .. javascript ``` function check_file(){ str=document.getElementById('fileToUpload').value.toUpperCase(); suffix=".JPG"; suffix2=".JPEG"; ...
254,197
<p>What I am looking for is the equivalent of <code>System.Windows.SystemParameters.WorkArea</code> for the monitor that the window is currently on.</p> <p><strong>Clarification:</strong> The window in question is <code>WPF</code>, not <code>WinForm</code>.</p>
[ { "answer_id": 254241, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 8, "selected": true, "text": "<p><code>Screen.FromControl</code>, <code>Screen.FromPoint</code> and <code>Screen.FromRectangle</code> should help you ...
2008/10/31
[ "https://Stackoverflow.com/questions/254197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28736/" ]
What I am looking for is the equivalent of `System.Windows.SystemParameters.WorkArea` for the monitor that the window is currently on. **Clarification:** The window in question is `WPF`, not `WinForm`.
`Screen.FromControl`, `Screen.FromPoint` and `Screen.FromRectangle` should help you with this. For example in WinForms it would be: ``` class MyForm : Form { public Rectangle GetScreen() { return Screen.FromControl(this).Bounds; } } ``` I don't know of an equivalent call for WPF. Therefore, you need to do ...
254,200
<p>Unsure if I've phrased this correctly, but in the callback how do I reference the controls property of the base class?</p> <p>This has been bugging me for some time and I usually work around it, but I'd be grateful if anybody can enlighten me on how I should do this properly.</p> <pre><code>var base = function() {...
[ { "answer_id": 254233, "author": "Peter Bailey", "author_id": 8815, "author_profile": "https://Stackoverflow.com/users/8815", "pm_score": 1, "selected": false, "text": "<p>You need to leverage closures here.</p>\n\n<pre><code>var base = function() {\nvar controls = {};\n\nreturn {\n i...
2008/10/31
[ "https://Stackoverflow.com/questions/254200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9948/" ]
Unsure if I've phrased this correctly, but in the callback how do I reference the controls property of the base class? This has been bugging me for some time and I usually work around it, but I'd be grateful if anybody can enlighten me on how I should do this properly. ``` var base = function() { var controls = {...
Use the power of closures: ``` var base = function() { var controls = {}; return { init: function(c) { this.controls = c }, foo: function(args) { var self = this; this.init(args.controls); $(this.controls.DropDown).change...
254,207
<p>Anyone familiar with error below? When I run my webapp to generate a dynamic excel doc from my local machine it works fine but when the same piece of code is invoked on the server I get the below error. It seems like it's a permissions issues since it works on my machine but not the server but I don't know where to ...
[ { "answer_id": 254218, "author": "Dave Ward", "author_id": 60, "author_profile": "https://Stackoverflow.com/users/60", "pm_score": 3, "selected": true, "text": "<p>Using Office Interop requires that the Office components you're using actually be installed on the server.</p>\n" }, { ...
2008/10/31
[ "https://Stackoverflow.com/questions/254207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/877/" ]
Anyone familiar with error below? When I run my webapp to generate a dynamic excel doc from my local machine it works fine but when the same piece of code is invoked on the server I get the below error. It seems like it's a permissions issues since it works on my machine but not the server but I don't know where to sta...
Using Office Interop requires that the Office components you're using actually be installed on the server.
254,213
<p>I need to handle resultsets returning stored procedures/functions for three databases (Oracle, sybase, MS-Server). The procedures/functions are generally the same but the call is a little different in Oracle.</p> <pre><code>statement.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); ... statement.execute(); ...
[ { "answer_id": 254220, "author": "Justin Cave", "author_id": 10397, "author_profile": "https://Stackoverflow.com/users/10397", "pm_score": 6, "selected": false, "text": "<p>I suspect you would want to use the DatabaseMetaData class. Most likely <a href=\"http://docs.oracle.com/javase/8/...
2008/10/31
[ "https://Stackoverflow.com/questions/254213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to handle resultsets returning stored procedures/functions for three databases (Oracle, sybase, MS-Server). The procedures/functions are generally the same but the call is a little different in Oracle. ``` statement.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); ... statement.execute(); ResultSet rs ...
I suspect you would want to use the DatabaseMetaData class. Most likely [DatabaseMetaData.getDatabaseProductName](http://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getDatabaseProductName--) would be sufficient, though you may also want to use the getDatabaseProductVersion method if you have code t...
254,214
<p>Is there any good software that will allow me to search through my SVN respository for code snippets? I found 'FishEye' but the cost is 1,200 and well outside my budget.</p>
[ { "answer_id": 254305, "author": "Will Hartung", "author_id": 13663, "author_profile": "https://Stackoverflow.com/users/13663", "pm_score": 1, "selected": false, "text": "<p>A lot of SVN repos are \"simply\" HTTP sites, so you might consider looking at some off the shelf \"web crawling\"...
2008/10/31
[ "https://Stackoverflow.com/questions/254214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33149/" ]
Is there any good software that will allow me to search through my SVN respository for code snippets? I found 'FishEye' but the cost is 1,200 and well outside my budget.
If you're searching only for the filename, use: ``` svn list -R file:///subversion/repository | grep filename ``` Windows: ``` svn list -R file:///subversion/repository | findstr filename ``` Otherwise checkout and do filesystem search: ``` egrep -r _code_ . ```
254,216
<p>My table structure looks like this:</p> <pre><code> tbl.users tbl.issues +--------+-----------+ +---------+------------+-----------+ | userid | real_name | | issueid | assignedid | creatorid | +--------+-----------+ +---------+------------+-----------+ | 1 | test_1 | | ...
[ { "answer_id": 254232, "author": "Elie", "author_id": 23249, "author_profile": "https://Stackoverflow.com/users/23249", "pm_score": 0, "selected": false, "text": "<pre><code>SELECT DISTINCT (i.issueid, i.creatorid, i.assignedid, u.real_name)\nFROM issues i, users u\nWHERE u.userid = i.cr...
2008/10/31
[ "https://Stackoverflow.com/questions/254216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2025/" ]
My table structure looks like this: ``` tbl.users tbl.issues +--------+-----------+ +---------+------------+-----------+ | userid | real_name | | issueid | assignedid | creatorid | +--------+-----------+ +---------+------------+-----------+ | 1 | test_1 | | 1 | 1 ...
``` SELECT IssueID, AssignedID, CreatorID, AssignedUser.real_name AS AssignedName, CreatorUser.real_name AS CreatorName FROM Issues LEFT JOIN Users AS AssignedUser ON Issues.AssignedID = AssignedUser.UserID LEFT JOIN Users AS CreatorUser ON Issues.CreatorID = CreatorUser.UserID ORDE...
254,229
<p>I have a project that I thought was going to be relatively easy, but is turning out to be more of a pain that I had hoped. First, most of the code I'm interacting with is legacy code that I don't have control over, so I can't do big paradigm changes.</p> <p>Here's a simplified explanation of what I need to do: Sa...
[ { "answer_id": 254283, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 0, "selected": false, "text": "<p>I think you've made a very good start to your problem by using the popen2() function to abstract away the cros...
2008/10/31
[ "https://Stackoverflow.com/questions/254229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33152/" ]
I have a project that I thought was going to be relatively easy, but is turning out to be more of a pain that I had hoped. First, most of the code I'm interacting with is legacy code that I don't have control over, so I can't do big paradigm changes. Here's a simplified explanation of what I need to do: Say I have a l...
On Windows, you invoke CreatePipe first (similar to pipe(2)), then CreateProcess. The trick here is that CreateProcess has a parameter where you can pass stdin, stdout, stderr of the newly-created process. Notice that when you use stdio, you need to do fdopen to create the file object afterwards, which expects file nu...
254,238
<p>I have a table with columns</p> <blockquote> <p>Index, Date</p> </blockquote> <p>where an Index may have multiple Dates, and my goal is the following: select a list that looks like</p> <blockquote> <p>Index, MinDate, MaxDate</p> </blockquote> <p>where each Index is listed only once, and MinDate (MaxDate) rep...
[ { "answer_id": 254249, "author": "John", "author_id": 33149, "author_profile": "https://Stackoverflow.com/users/33149", "pm_score": -1, "selected": false, "text": "<p>You don't need the sub-select in the where clause. Also, you could add indexes to the date column. How many rows in the...
2008/10/31
[ "https://Stackoverflow.com/questions/254238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10675/" ]
I have a table with columns > > Index, Date > > > where an Index may have multiple Dates, and my goal is the following: select a list that looks like > > Index, MinDate, MaxDate > > > where each Index is listed only once, and MinDate (MaxDate) represents the earliest (latest) date present *in the entire tab...
I would recommend a derived table approach. Like this: ``` SELECT myTable.Index, MIN(myTable.[Date]), MAX(myTable.[Date]) FROM myTable Inner Join ( SELECT Index From myTable WHERE [Date] BETWEEN '1/1/2000' AND '12/31/2000') As AliasName On myTable.Index = AliasName.In...
254,244
<p>I am wrestling with a php 5.2.6 problem. An api we use returns dates in this format DDMMYYYYHHMM. Exactly that format, fixed length, no delimiters. However, in my experimentation, this format seems to break strptime, which returns a false (fail) when I feed it a date in this format. It can reproduced, at least on my...
[ { "answer_id": 254398, "author": "Michael Johnson", "author_id": 17688, "author_profile": "https://Stackoverflow.com/users/17688", "pm_score": 0, "selected": false, "text": "<p>Nothing obvious since both versions work fine in PHP 5.2.0. I can't readily check 5.2.6 at the moment, though. ...
2008/10/31
[ "https://Stackoverflow.com/questions/254244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33150/" ]
I am wrestling with a php 5.2.6 problem. An api we use returns dates in this format DDMMYYYYHHMM. Exactly that format, fixed length, no delimiters. However, in my experimentation, this format seems to break strptime, which returns a false (fail) when I feed it a date in this format. It can reproduced, at least on my sy...
This function is locale-dependent. Have you tried setting different locale? (see `setlocale()`)
254,259
<p>I use vim (7.1) on OpenVMS V7.3-2.</p> <p>I connect to VMS trough a telnet session with SmartTerm, a terminal emulator.</p> <p>It works fine.</p> <p>But when I start a telnet session from a VMS session (connected via SmartTerm) to another VMS session, some keys doesn't work properly.</p> <pre><code>|------------...
[ { "answer_id": 254286, "author": "Nic Wise", "author_id": 2947, "author_profile": "https://Stackoverflow.com/users/2947", "pm_score": 0, "selected": false, "text": "<p>Usually this is because of the terminal emulation - so something isn't passing the right keys thru. It's been ages since...
2008/10/31
[ "https://Stackoverflow.com/questions/254259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14673/" ]
I use vim (7.1) on OpenVMS V7.3-2. I connect to VMS trough a telnet session with SmartTerm, a terminal emulator. It works fine. But when I start a telnet session from a VMS session (connected via SmartTerm) to another VMS session, some keys doesn't work properly. ``` |--------------| telnet |-------------| telnet...
In addition to tweaking which terminal emulation is used, it's also a good idea to learn vim's keystrokes for the actions you're trying to perform. These are more reliable and don't depend on the terminal or the keyboard. For instance: * Insert: i * Home: ^ goes to first non-whitespace char, 0 goes to first column alw...
254,260
<p>This question is a follow up to: <a href="https://stackoverflow.com/questions/252267/why-cant-i-call-a-method-outside-of-an-anonymous-class-of-the-same-name">Why can’t I call a method outside of an anonymous class of the same name</a></p> <p>This previous question answer <b>why</b>, but now I want to know if javac ...
[ { "answer_id": 254272, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p>Sounds like a recipe for ambiguity and fragility to me - as soon as a new method is added in your base class (okay, n...
2008/10/31
[ "https://Stackoverflow.com/questions/254260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21838/" ]
This question is a follow up to: [Why can’t I call a method outside of an anonymous class of the same name](https://stackoverflow.com/questions/252267/why-cant-i-call-a-method-outside-of-an-anonymous-class-of-the-same-name) This previous question answer **why**, but now I want to know if javac **should** find run(int ...
This behavior of javac conforms to the spec. See [§15.12 Method Invocation Expressions](http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#20448) in the Java Language Specification, specifically the paragraph under "Compile Time Step 1" explaining the meaning of an unqualified method invocation: > ...
254,267
<p>I'm thinking about how to do this, but I have several different shapes of Data in my Database, Articles, NewsItems, etc. </p> <p>They All have something in common, they all have IDs (in the DB they're named ArticleID, NewsID etc. )</p> <p>They all have a <strong>Title</strong></p> <p>They all have <strong>BodyTe...
[ { "answer_id": 254359, "author": "Omer van Kloeten", "author_id": 4979, "author_profile": "https://Stackoverflow.com/users/4979", "pm_score": 1, "selected": false, "text": "<p>I'm not sure whether you're talking about LINQ to SQL, but there are a few resources online about how to create ...
2008/10/31
[ "https://Stackoverflow.com/questions/254267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26931/" ]
I'm thinking about how to do this, but I have several different shapes of Data in my Database, Articles, NewsItems, etc. They All have something in common, they all have IDs (in the DB they're named ArticleID, NewsID etc. ) They all have a **Title** They all have **BodyText**. They all have a **Status** They all ...
This is what Interfaces are for. Have each class implement an IContent interface that contains your Title, BodyText, Status and DateAdded properties. Now you can pass around a collection ( `List<IContent>` ) around that could containt different types of content. If you're using LinqToSql you can create partial class f...
254,271
<p>The WPF control WindowsFormsHost inherits from IDisposable.</p> <p>If I have a complex WPF visual tree containing some of the above controls what event or method can I use to call IDispose during shutdown?</p>
[ { "answer_id": 255334, "author": "Pop Catalin", "author_id": 4685, "author_profile": "https://Stackoverflow.com/users/4685", "pm_score": -1, "selected": false, "text": "<p>You don't need to dispose controls when closing a form, the API will do it for you automatically if the control is i...
2008/10/31
[ "https://Stackoverflow.com/questions/254271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5427/" ]
The WPF control WindowsFormsHost inherits from IDisposable. If I have a complex WPF visual tree containing some of the above controls what event or method can I use to call IDispose during shutdown?
Building from Todd's answer I came up with this generic solution for any WPF control that is hosted by a Window and want's to guarantee disposal when that window is closed. (Obviously if you can avoid inheriting from IDisposable do, but sometimes you just can't) Dispose is called when the the first parent window in t...
254,273
<p>Why does this lambda expression not compile?</p> <pre><code>Action a = () =&gt; throw new InvalidOperationException(); </code></pre> <p>Conjecture is fine, but I would really appreciate references to the C# language specification or other documentation.</p> <p>And yes, I know that the following is valid and will ...
[ { "answer_id": 254298, "author": "Nic Wise", "author_id": 2947, "author_profile": "https://Stackoverflow.com/users/2947", "pm_score": 1, "selected": false, "text": "<p>All the references I can find, from here:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/ms364047(VS.80).as...
2008/10/31
[ "https://Stackoverflow.com/questions/254273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26627/" ]
Why does this lambda expression not compile? ``` Action a = () => throw new InvalidOperationException(); ``` Conjecture is fine, but I would really appreciate references to the C# language specification or other documentation. And yes, I know that the following is valid and will compile: ``` Action a = () => { thr...
Hmm. I've got an answer, but it's not great. I don't believe that there's a "throw" *expression*. There's a throw *statement*, but not just an expression. Compare this with "Console.WriteLine()" which is a method invocation expression with a void type. As a parallel, you can't have a switch statement, or an if statem...
254,276
<p>First off, I know next to nothing about language theory, and I barely know any other languages except Java, but I had an idea that I think would be cool, but I need you guys to tell me:<br> a: why it sucks<br> b: how language x has had that for years<br> c: how my mind sucks<br> d: all of the above</p> <p>The idea ...
[ { "answer_id": 254317, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 0, "selected": false, "text": "<p>I'm not sure that I see a clear advantage to doing this though. I understand the point you are making. At the...
2008/10/31
[ "https://Stackoverflow.com/questions/254276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4120/" ]
First off, I know next to nothing about language theory, and I barely know any other languages except Java, but I had an idea that I think would be cool, but I need you guys to tell me: a: why it sucks b: how language x has had that for years c: how my mind sucks d: all of the above The idea would give com...
I think if you restricted it such that a class could only use this feature to compose a single class it would be somewhat useful and would avoid a lot of the headaches that are being discussed. Personally I hate inheritance of concrete classes. I'm a big proponent of Item 14 from Bloch's *Effective Java*, [Favor compo...
254,278
<p>I'm trying to define a table to store student grades for a online report card. I can't decide how to do it, though.</p> <p>The grades are given by subject, in a trimestral period. Every trimester has a average grade, the total missed classes and a "recovering grade" (I don't know the right term in English, but it's...
[ { "answer_id": 254304, "author": "davr", "author_id": 14569, "author_profile": "https://Stackoverflow.com/users/14569", "pm_score": 0, "selected": false, "text": "<p>I think the best solution is to store one row per period. So you'd have a table like:</p>\n\n<pre><code>grades\n------\nst...
2008/10/31
[ "https://Stackoverflow.com/questions/254278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9835/" ]
I'm trying to define a table to store student grades for a online report card. I can't decide how to do it, though. The grades are given by subject, in a trimestral period. Every trimester has a average grade, the total missed classes and a "recovering grade" (I don't know the right term in English, but it's an extra ...
You could try structuring it like this with your tables. I didn't have all the information so I made some guesses at what you might need or do with it all. TimePeriods: * ID(INT) * PeriodTimeStart(DateTime) * PeriodTimeEnd(DateTime) * Name(VARCHAR(50) Students: * ID(INT) * FirstName(VARCHAR(60)) * LastName(VARCHAR(...
254,281
<p>How do you properly override <code>isEqual:</code> in Objective-C? The "catch" seems to be that if two objects are equal (as determined by the <code>isEqual:</code> method), they must have the same hash value.</p> <p>The <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObje...
[ { "answer_id": 254315, "author": "Jens Ayton", "author_id": 6443, "author_profile": "https://Stackoverflow.com/users/6443", "pm_score": 4, "selected": false, "text": "<p>The easy but inefficient way is to return the same <code>-hash</code> value for every instance. Otherwise, yes, you mu...
2008/10/31
[ "https://Stackoverflow.com/questions/254281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26825/" ]
How do you properly override `isEqual:` in Objective-C? The "catch" seems to be that if two objects are equal (as determined by the `isEqual:` method), they must have the same hash value. The [Introspection](http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#//ap...
Start with ``` NSUInteger prime = 31; NSUInteger result = 1; ``` Then for every primitive you do ``` result = prime * result + var ``` For objects you use 0 for nil and otherwise their hashcode. ``` result = prime * result + [var hash]; ``` For booleans you use two different values ``` result = prime * r...
254,291
<p>I'm working through <a href="https://rads.stackoverflow.com/amzn/click/com/1590599063" rel="nofollow noreferrer" rel="nofollow noreferrer">Practical Web 2.0 Appications</a> currently and have hit a bit of a roadblock. I'm trying to get PHP, MySQL, Apache, Smarty and the Zend Framework all working correctly so I can...
[ { "answer_id": 254358, "author": "Noah Goodrich", "author_id": 20178, "author_profile": "https://Stackoverflow.com/users/20178", "pm_score": 4, "selected": true, "text": "<p>The problem isn't with the $name variable but rather with the $_engine variable. It's currently empty. You need to...
2008/10/31
[ "https://Stackoverflow.com/questions/254291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27673/" ]
I'm working through [Practical Web 2.0 Appications](https://rads.stackoverflow.com/amzn/click/com/1590599063) currently and have hit a bit of a roadblock. I'm trying to get PHP, MySQL, Apache, Smarty and the Zend Framework all working correctly so I can begin to build the application. I have gotten the bootstrap file f...
The problem isn't with the $name variable but rather with the $\_engine variable. It's currently empty. You need to verify that the path specification to Smarty.class.php is correct. You might try this to begin your debugging: ``` $this->_engine = new Smarty(); print_r($this->_engine); ``` If it turns out that $\_...
254,295
<p>In a table, I have three columns - id, name, and count. A good number of name columns are identical (due to the lack of a UNIQUE early on) and I want to fix this. However, the id column is used by other (4 or 5, I think - I would have to check the docs) tables to look up the name and just removing them would break t...
[ { "answer_id": 254353, "author": "jonnii", "author_id": 4590, "author_profile": "https://Stackoverflow.com/users/4590", "pm_score": 0, "selected": false, "text": "<p>Why can't you do something like</p>\n\n<pre><code>update dependent_table set name_id = &lt;id you want to keep&gt; where n...
2008/10/31
[ "https://Stackoverflow.com/questions/254295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
In a table, I have three columns - id, name, and count. A good number of name columns are identical (due to the lack of a UNIQUE early on) and I want to fix this. However, the id column is used by other (4 or 5, I think - I would have to check the docs) tables to look up the name and just removing them would break thin...
This kind of question comes up from time to time. No, there's not a really clean way to do it. You have to change all the rows in the child table that depend on unwanted values in the parent table before you can eliminate the unwanted rows in the parent table. MySQL supports multi-table `UPDATE` and `DELETE` statement...
254,302
<p>I need a way to determine the type of an HTML element in JavaScript. It has the ID, but the element itself could be a <code>&lt;div&gt;</code>, a <code>&lt;form&gt;</code> field, a <code>&lt;fieldset&gt;</code>, etc. How can I achieve this?</p>
[ { "answer_id": 254308, "author": "Brian Cline", "author_id": 32536, "author_profile": "https://Stackoverflow.com/users/32536", "pm_score": 6, "selected": false, "text": "<p>What about <a href=\"http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-104682815\" rel=\"norefer...
2008/10/31
[ "https://Stackoverflow.com/questions/254302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1103/" ]
I need a way to determine the type of an HTML element in JavaScript. It has the ID, but the element itself could be a `<div>`, a `<form>` field, a `<fieldset>`, etc. How can I achieve this?
[`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName) is the attribute you are looking for. For example: ``` var elt = document.getElementById('foo'); console.log(elt.nodeName); ``` Note that `nodeName` returns the element name capitalized and without the angle brackets, which means that if yo...
254,340
<p>I've tried variations of this, but had no luck other than the ability to start a cygwin window. (wrapped on <strong>;</strong> for clarity)</p> <pre><code>Filename: "c:\cygwin\bin\bash.exe"; Parameters: "-c c:/scripts/step1.sh paramX"; Flags: shellexec waituntilterminated; StatusMsg: "Running the script..." <...
[ { "answer_id": 254370, "author": "Ken Gentle", "author_id": 8709, "author_profile": "https://Stackoverflow.com/users/8709", "pm_score": 1, "selected": false, "text": "<p>I think you're going to need to make the whole thing part of a <code>cmd.exe</code> invocation, and then I'm not sure ...
2008/10/31
[ "https://Stackoverflow.com/questions/254340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6144/" ]
I've tried variations of this, but had no luck other than the ability to start a cygwin window. (wrapped on **;** for clarity) ``` Filename: "c:\cygwin\bin\bash.exe"; Parameters: "-c c:/scripts/step1.sh paramX"; Flags: shellexec waituntilterminated; StatusMsg: "Running the script..." ``` (this is for an intern...
Your problem is that `-c` tells bash to read instructions from the next parameter: e.g. ``` c:\cygwin\bin\bash.exe -c 'for NUM in 1 2 3 4 5 6 7 8 9 10; do echo $NUM; done' ``` you just need: ``` c:\cygwin\bin\bash.exe "/scripts/step1.sh paramX" ``` So your code would look like: ``` Filename: "c:\cygwin\bin\bash....
254,345
<p>I previously asked how to do this in Groovy. However, now I'm rewriting my app in Perl because of all the CPAN libraries.</p> <p>If the page contained these links:</p> <pre> &lt;a href="http://www.google.com"&gt;Google&lt;/a&gt; &lt;a href="http://www.apple.com"&gt;Apple&lt;/a&gt; </pre> <p>The output would be:...
[ { "answer_id": 254381, "author": "Sherm Pendley", "author_id": 27631, "author_profile": "https://Stackoverflow.com/users/27631", "pm_score": 4, "selected": false, "text": "<p>Have a look at <a href=\"http://search.cpan.org/perldoc?HTML::LinkExtractor\" rel=\"nofollow noreferrer\">HTML::L...
2008/10/31
[ "https://Stackoverflow.com/questions/254345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I previously asked how to do this in Groovy. However, now I'm rewriting my app in Perl because of all the CPAN libraries. If the page contained these links: ``` <a href="http://www.google.com">Google</a> <a href="http://www.apple.com">Apple</a> ``` The output would be: ``` Google, http://www.google.com Apple, h...
Please look at using the [WWW::Mechanize](http://search.cpan.org/dist/WWW-Mechanize/) module for this. It will fetch your web pages for you, and then give you easy-to-work with lists of URLs. ``` my $mech = WWW::Mechanize->new(); $mech->get( $some_url ); my @links = $mech->links(); for my $link ( @links ) { printf...
254,347
<p>We currently have developed an application using WCF. Our clients make connections to different WCF servicehosts located on the server, and the servicehosts return the data from the DB that the clients need. Standard model. However, this current design has all of our WCF data in app.config files both on the client s...
[ { "answer_id": 254381, "author": "Sherm Pendley", "author_id": 27631, "author_profile": "https://Stackoverflow.com/users/27631", "pm_score": 4, "selected": false, "text": "<p>Have a look at <a href=\"http://search.cpan.org/perldoc?HTML::LinkExtractor\" rel=\"nofollow noreferrer\">HTML::L...
2008/10/31
[ "https://Stackoverflow.com/questions/254347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4539/" ]
We currently have developed an application using WCF. Our clients make connections to different WCF servicehosts located on the server, and the servicehosts return the data from the DB that the clients need. Standard model. However, this current design has all of our WCF data in app.config files both on the client side...
Please look at using the [WWW::Mechanize](http://search.cpan.org/dist/WWW-Mechanize/) module for this. It will fetch your web pages for you, and then give you easy-to-work with lists of URLs. ``` my $mech = WWW::Mechanize->new(); $mech->get( $some_url ); my @links = $mech->links(); for my $link ( @links ) { printf...
254,349
<p>I have a page with some dynamically added buttons. If you click a button before the page has fully loaded, it throws the classic exception:</p> <blockquote> <pre><code>Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For </code></pre> <p>security purposes...
[ { "answer_id": 254387, "author": "Handruin", "author_id": 26173, "author_profile": "https://Stackoverflow.com/users/26173", "pm_score": 0, "selected": false, "text": "<p>What if you set those button's visible property to false by default and at the end of the page load or event validatio...
2008/10/31
[ "https://Stackoverflow.com/questions/254349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
I have a page with some dynamically added buttons. If you click a button before the page has fully loaded, it throws the classic exception: > > > ``` > Invalid postback or callback argument. > Event validation is enabled using in configuration or in a page. For > > ``` > > security purposes, > this feature veri...
I answered a similar question [here](https://stackoverflow.com/questions/140303/aspnet-unable-to-validate-data#254581). To quote: Essentially, you'll want to get the ViewState to load at the top of the page. In .NET 3.5 SP1 the *RenderAllHiddenFieldsAtTopOfForm* property was added to the PagesSection configuration. ...
254,350
<p>I don't care what the differences are. I just want to know whether the contents are different.</p>
[ { "answer_id": 254357, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 8, "selected": true, "text": "<p>The low level way:</p>\n\n<pre><code>from __future__ import with_statement\nwith open(filename1) as f1:\n ...
2008/10/31
[ "https://Stackoverflow.com/questions/254350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9328/" ]
I don't care what the differences are. I just want to know whether the contents are different.
The low level way: ``` from __future__ import with_statement with open(filename1) as f1: with open(filename2) as f2: if f1.read() == f2.read(): ... ``` The high level way: ``` import filecmp if filecmp.cmp(filename1, filename2, shallow=False): ... ```
254,351
<p>I wanted to make Map of Collections in Java, so I can make something like </p> <pre><code>public void add(K key, V value) { if (containsKey(key)) { get(key).add(value); } else { Collection c = new Collection(); c.add(value); put(key, value); } } </code></pre> <p>I've ...
[ { "answer_id": 254372, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 5, "selected": true, "text": "<p>If <code>map</code> is a <code>Map&lt;K, Collection&lt;V&gt;&gt;</code>, use the idiom <a href=\"http://docs.oracle.com/j...
2008/10/31
[ "https://Stackoverflow.com/questions/254351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4433/" ]
I wanted to make Map of Collections in Java, so I can make something like ``` public void add(K key, V value) { if (containsKey(key)) { get(key).add(value); } else { Collection c = new Collection(); c.add(value); put(key, value); } } ``` I've tried to make it with somet...
If `map` is a `Map<K, Collection<V>>`, use the idiom [`computeIfAbsent(...).add(...)`,](http://docs.oracle.com/javase/8/docs/api/java/util/Map.html#computeIfAbsent-K-java.util.function.Function-) like this: ``` map.computeIfAbsent(key, k -> new ArrayList<>()).add(value); ``` Or, for a `Set`: ``` map.computeIfAbsent...
254,354
<p><strong>General Description:</strong></p> <p>To start with what works, I have a <code>UITableView</code> which has been placed onto an Xcode-generated view using Interface Builder. The view's File Owner is set to an Xcode-generated subclass of <code>UIViewController</code>. To this subclass I have added working i...
[ { "answer_id": 254813, "author": "keremk", "author_id": 29475, "author_profile": "https://Stackoverflow.com/users/29475", "pm_score": 2, "selected": false, "text": "<p>Yes for some reason (please chime in if anybody knows why...) <code>tableView</code> property of the <code>UITableViewCo...
2008/10/31
[ "https://Stackoverflow.com/questions/254354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33164/" ]
**General Description:** To start with what works, I have a `UITableView` which has been placed onto an Xcode-generated view using Interface Builder. The view's File Owner is set to an Xcode-generated subclass of `UIViewController`. To this subclass I have added working implementations of `numberOfSectionsInTableView:...
I followed your steps, recreated the project and ran into the same problem. Basically you are almost there. There are 2 things missing (once fixed it works): * You need to connect the `tableView` of the `TableTestTableViewController` to the `UITableView` you have on the screen. As I said before because it is not `IBOu...
254,385
<p>I want to simplify my execution of a Groovy script that makes calls to an Oracle database. How do I add the ojdbc jar to the default classpath so that I can run:</p> <pre><code>groovy RunScript.groovy </code></pre> <p>instead of:</p> <pre><code>groovy -cp ojdbc5.jar RunScript.groovy </code></pre>
[ { "answer_id": 254431, "author": "mipadi", "author_id": 28804, "author_profile": "https://Stackoverflow.com/users/28804", "pm_score": 1, "selected": false, "text": "<p><code>groovy</code> is just a wrapper script for the Groovy JAR that sets up the Java classpath. You could modify that s...
2008/10/31
[ "https://Stackoverflow.com/questions/254385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6013/" ]
I want to simplify my execution of a Groovy script that makes calls to an Oracle database. How do I add the ojdbc jar to the default classpath so that I can run: ``` groovy RunScript.groovy ``` instead of: ``` groovy -cp ojdbc5.jar RunScript.groovy ```
Summarized from *Groovy Recipes*, by Scott Davis, **Automatically Including JARs in the ./groovy/lib Directory**: 1. Create `.groovy/lib` in your login directory 2. Uncomment the following line in ${GROOVY\_HOME}/conf/groovy-starter.conf `load !{user.home}/.groovy/lib/*.jar` 3. Copy the jars you want included to `.gr...
254,388
<p>How does one go about converting an image to black and white in PHP?</p> <p>Not just turning it into greyscale but every pixel made black or white?</p>
[ { "answer_id": 254393, "author": "jonnii", "author_id": 4590, "author_profile": "https://Stackoverflow.com/users/4590", "pm_score": 3, "selected": false, "text": "<p>You could shell out to imagemagick, assuming your host supports it. What function do you want to use for deciding if a pi...
2008/10/31
[ "https://Stackoverflow.com/questions/254388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2118/" ]
How does one go about converting an image to black and white in PHP? Not just turning it into greyscale but every pixel made black or white?
Simply round the grayscale color to either black or white. ``` float gray = (r + g + b) / 3 if(gray > 0x7F) return 0xFF; return 0x00; ```
254,397
<p>I'm extracting a folder from a tarball, and I see these zero-byte files showing up in the result (where they are not in the source.) Setup (all on OS X):</p> <p>On machine one, I have a directory /My/Stuff/Goes/Here/ containing several hundred files. I build it like this</p> <pre><code>tar -cZf mystuff.tgz /My/St...
[ { "answer_id": 254417, "author": "Rich", "author_id": 22003, "author_profile": "https://Stackoverflow.com/users/22003", "pm_score": -1, "selected": false, "text": "<p>I don't know (and boy is this a hard problem to Google for!), but here's a troubleshooting step: try <code>tar</code> wit...
2008/10/31
[ "https://Stackoverflow.com/questions/254397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm extracting a folder from a tarball, and I see these zero-byte files showing up in the result (where they are not in the source.) Setup (all on OS X): On machine one, I have a directory /My/Stuff/Goes/Here/ containing several hundred files. I build it like this ``` tar -cZf mystuff.tgz /My/Stuff/Goes/Here/ ``` O...
You can get a table of contents from the tarball by doing `tar tZvf mystuff.tgz` If those zero-byte files are listed in the table of contents, then the problem is on the computer making the tarball. If they aren't listed, then the problem is on the computer decompressing the tarball.
254,407
<p>I want to create a string that spans multiple lines to assign to a Label Caption property. How is this done in Delphi?</p>
[ { "answer_id": 254412, "author": "Brendan", "author_id": 199, "author_profile": "https://Stackoverflow.com/users/199", "pm_score": 5, "selected": false, "text": "<p><code>my_string := 'Hello,' + #13#10 + 'world!';</code></p>\n\n<p><code>#13#10</code> is the CR/LF characters in decimal</p...
2008/10/31
[ "https://Stackoverflow.com/questions/254407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199/" ]
I want to create a string that spans multiple lines to assign to a Label Caption property. How is this done in Delphi?
In the System.pas (which automatically gets used) the following is defined: ``` const sLineBreak = {$IFDEF LINUX} AnsiChar(#10) {$ENDIF} {$IFDEF MSWINDOWS} AnsiString(#13#10) {$ENDIF}; ``` This is from Delphi 2009 (notice the use of AnsiChar and AnsiString). (Line wrap added by me.) So if you want...
254,419
<p>I have an aspx page which will upload images to server harddisk from client pc</p> <p>But now i need to change my program in such a way that it would allow me to resize the image while uploading.</p> <p>Does anyone has any idea on this ? I couldnt not find such properties/methods with Input file server control</p>...
[ { "answer_id": 254430, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 3, "selected": false, "text": "<p>You will not be able to resize \"on the fly\" since you will need to have the full image before you perform any image transf...
2008/10/31
[ "https://Stackoverflow.com/questions/254419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29982/" ]
I have an aspx page which will upload images to server harddisk from client pc But now i need to change my program in such a way that it would allow me to resize the image while uploading. Does anyone has any idea on this ? I couldnt not find such properties/methods with Input file server control Any one there to gu...
Once the file has been saved to the server you can use code like this to resize. This code will take care of length/width ratio on the resize. ``` public static Bitmap CreateThumbnail(string lcFilename, int lnWidth, int lnHeight) { System.Drawing.Bitmap bmpOut = null; try { Bitmap loBMP = new Bit...
254,438
<p>every time i create a FileInfo object and access it's lastaccesstime property, it's always a few minutes off. the file property window remains constant, however the application shows that it is usually a few minutes after the property window time.</p> <p>Also, i noticed that if i drag the file to the cmd window to ...
[ { "answer_id": 254508, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 0, "selected": false, "text": "<p>Hmm, possibly <a href=\"http://msdn.microsoft.com/en-us/library/system.io.filesysteminfo.lastaccesstime.aspx\" rel=\"nofo...
2008/10/31
[ "https://Stackoverflow.com/questions/254438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33082/" ]
every time i create a FileInfo object and access it's lastaccesstime property, it's always a few minutes off. the file property window remains constant, however the application shows that it is usually a few minutes after the property window time. Also, i noticed that if i drag the file to the cmd window to pass the f...
In my experience, last access time is notoriously unreliable. According to <http://technet.microsoft.com/en-us/library/cc781134.aspx>... > > The Last Access Time on disk is not always current because NTFS looks for a one-hour interval before forcing the Last Access Time updates to disk. NTFS also delays writing the ...
254,441
<p>I'm having problems with Iterator.remove() called on a HashSet.</p> <p>I've a Set of time stamped objects. Before adding a new item to the Set, I loop through the set, identify an old version of that data object and remove it (before adding the new object). the timestamp is included in hashCode and equals(), but ...
[ { "answer_id": 254480, "author": "Ken Gentle", "author_id": 8709, "author_profile": "https://Stackoverflow.com/users/8709", "pm_score": 1, "selected": false, "text": "<p>Have you tried something like</p>\n\n<pre><code>boolean removed = allResults.remove(oldData)\nif (!removed) // COMPLAI...
2008/10/31
[ "https://Stackoverflow.com/questions/254441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32978/" ]
I'm having problems with Iterator.remove() called on a HashSet. I've a Set of time stamped objects. Before adding a new item to the Set, I loop through the set, identify an old version of that data object and remove it (before adding the new object). the timestamp is included in hashCode and equals(), but not equalsDa...
I was very curious about this one still, and wrote the following test: ``` import java.util.HashSet; import java.util.Iterator; import java.util.Random; import java.util.Set; public class HashCodeTest { private int hashCode = 0; @Override public int hashCode() { return hashCode ++; } public ...
254,458
<p><strong>Update</strong></p> <p><em>Got it! See my solution (fifth comment)</em></p> <p>Here is my problem:</p> <p>I have created a small binary called "jail" and in /etc/password I have made it the default shell for a test user.</p> <p>Here is the -- simplified -- source code:</p> <pre><code>#define HOME "/home...
[ { "answer_id": 254467, "author": "dexedrine", "author_id": 20266, "author_profile": "https://Stackoverflow.com/users/20266", "pm_score": 2, "selected": false, "text": "<p>The shell isn't interactive. Try adding -i to the list of arguments.</p>\n" }, { "answer_id": 254529, "a...
2008/10/31
[ "https://Stackoverflow.com/questions/254458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6253/" ]
**Update** *Got it! See my solution (fifth comment)* Here is my problem: I have created a small binary called "jail" and in /etc/password I have made it the default shell for a test user. Here is the -- simplified -- source code: ``` #define HOME "/home/user" #define SHELL "/bin/bash" ... if(chdir(HOME) || chroot(...
The shell isn't interactive. Try adding -i to the list of arguments.
254,461
<p>I have a method with an out parameter that tries to do a type conversion. Basically:</p> <pre><code>public void GetParameterValue(out object destination) { object paramVal = "I want to return this. could be any type, not just string."; destination = null; // default out param to null destination = Conv...
[ { "answer_id": 254464, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 0, "selected": false, "text": "<p>In your example it would be null of type <code>System.Object</code>.</p>\n\n<p>Does your example even compile? I get ...
2008/10/31
[ "https://Stackoverflow.com/questions/254461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28278/" ]
I have a method with an out parameter that tries to do a type conversion. Basically: ``` public void GetParameterValue(out object destination) { object paramVal = "I want to return this. could be any type, not just string."; destination = null; // default out param to null destination = Convert.ChangeType...
> > So is there any way to get the type of an object that is set to null? I would think there would have to be a way to know what type a storage location is without it being assigned anything. > > > Not necessarily. The best that you can say is that it is an `object`. A `null` reference does not point to any stora...
254,486
<p>Some of my MS SQL stored procedures produce messages using the 'print' command. In my Delphi 2007 application, which connects to MS SQL using TADOConnection, how can I view the output of those 'print' commands?</p> <p>Key requirements: 1) I can't run the query more than once; it might be updating things. 2) I need...
[ { "answer_id": 254504, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": 1, "selected": false, "text": "<p>I dont think that is possible.\nYou might use a temp table to dump print statements and return it alongwith results...
2008/10/31
[ "https://Stackoverflow.com/questions/254486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42219/" ]
Some of my MS SQL stored procedures produce messages using the 'print' command. In my Delphi 2007 application, which connects to MS SQL using TADOConnection, how can I view the output of those 'print' commands? Key requirements: 1) I can't run the query more than once; it might be updating things. 2) I need to see the...
That was an interesting one... **The OnInfoMessage event from the ADOConnection works but the Devil is in the details!** **Main points:** use CursorLocation = clUseServer instead of the default clUseClient. use Open and not ExecProc with your ADOStoredProc. use NextRecordset from the current one to get the...
254,494
<p>I've been struggling coming up with a good solution to separate my testing data from unit tests (hard coded values). Until it dawned on me that I could create beans with spring and use those beans to hold my data. </p> <p>Are there any draw backs to coding my unit tests this way? Albeit they run a bit slower ...
[ { "answer_id": 254504, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": 1, "selected": false, "text": "<p>I dont think that is possible.\nYou might use a temp table to dump print statements and return it alongwith results...
2008/10/31
[ "https://Stackoverflow.com/questions/254494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17337/" ]
I've been struggling coming up with a good solution to separate my testing data from unit tests (hard coded values). Until it dawned on me that I could create beans with spring and use those beans to hold my data. Are there any draw backs to coding my unit tests this way? Albeit they run a bit slower seeing as how...
That was an interesting one... **The OnInfoMessage event from the ADOConnection works but the Devil is in the details!** **Main points:** use CursorLocation = clUseServer instead of the default clUseClient. use Open and not ExecProc with your ADOStoredProc. use NextRecordset from the current one to get the...
254,509
<p>I need to leave some instructional comments for other developers on a page/user control. Is there a better way to do this besides the below?</p> <pre><code> &lt;% /* DO NOT rename control IDs here, because blah blah blah... */ %&gt; </code></pre>
[ { "answer_id": 254525, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 0, "selected": false, "text": "<p>That is about it, barring a HTML comment. </p>\n\n<p>Your options are:</p>\n\n<pre><code> &lt;!-- Renders to ClientOutput...
2008/10/31
[ "https://Stackoverflow.com/questions/254509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22303/" ]
I need to leave some instructional comments for other developers on a page/user control. Is there a better way to do this besides the below? ``` <% /* DO NOT rename control IDs here, because blah blah blah... */ %> ```
``` <%-- Comment Here --%> ```
254,514
<p>I know that PHP doesn't yet have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto-completion features could understand.</p> <p>Constants do the trick, but there's the namespace collision problem and (or actual...
[ { "answer_id": 254523, "author": "Noah Goodrich", "author_id": 20178, "author_profile": "https://Stackoverflow.com/users/20178", "pm_score": 3, "selected": false, "text": "<p>The most common solution that I have seen to enum's in PHP has been to create a generic enum class and then exten...
2008/10/31
[ "https://Stackoverflow.com/questions/254514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2238/" ]
I know that PHP doesn't yet have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto-completion features could understand. Constants do the trick, but there's the namespace collision problem and (or actually *becau...
Depending upon use case, I would normally use something *simple* like the following: ``` abstract class DaysOfWeek { const Sunday = 0; const Monday = 1; // etc. } $today = DaysOfWeek::Sunday; ``` However, other use cases may require more validation of constants and values. Based on the comments below ab...
254,544
<p>What do I put in my order by?? I want to order by Name. I have moved the orderby after the distinct because I read that it needs to be done last.</p> <pre><code> var result = (from r in db.RecordDocs where r.RecordID == recordID select new { ...
[ { "answer_id": 254547, "author": "Jacob Carpenter", "author_id": 26627, "author_profile": "https://Stackoverflow.com/users/26627", "pm_score": 5, "selected": true, "text": "<p>Just do</p>\n\n<pre><code>.OrderBy(doc =&gt; doc.Name)\n</code></pre>\n" }, { "answer_id": 254624, "...
2008/10/31
[ "https://Stackoverflow.com/questions/254544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
What do I put in my order by?? I want to order by Name. I have moved the orderby after the distinct because I read that it needs to be done last. ``` var result = (from r in db.RecordDocs where r.RecordID == recordID select new { ...
Just do ``` .OrderBy(doc => doc.Name) ```
254,558
<p>I'm trying to build a hoverable Jquery tooltip. This tooltip should appear when I hover over some element, and stay put if I choose to hover over the tooltip itself too. The tooltip should disappear only if I hover away from the original element or from the tooltip body.</p> <p>Based on an example I found, I manage...
[ { "answer_id": 254738, "author": "Tim Scott", "author_id": 29493, "author_profile": "https://Stackoverflow.com/users/29493", "pm_score": 2, "selected": false, "text": "<p>There is a <a href=\"http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/\" rel=\"nofollow noreferrer\">toolti...
2008/10/31
[ "https://Stackoverflow.com/questions/254558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to build a hoverable Jquery tooltip. This tooltip should appear when I hover over some element, and stay put if I choose to hover over the tooltip itself too. The tooltip should disappear only if I hover away from the original element or from the tooltip body. Based on an example I found, I managed to creat...
There is a [tooltip plugin](http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/) for JQuery. If you'd rather roll your own, I'm sure you can get ideas by looking at what they have done.
254,573
<p>Is there a way to use a <code>foreach</code> loop to iterate through a collection backwards or in a completely random order?</p>
[ { "answer_id": 254601, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 0, "selected": false, "text": "<p>you can do it backwards:</p>\n\n<pre><code>for (int i=col.count-1; i&gt;0; i--){ \n DoSomething ( col.item[...
2008/10/31
[ "https://Stackoverflow.com/questions/254573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2470/" ]
Is there a way to use a `foreach` loop to iterate through a collection backwards or in a completely random order?
As other answers mention, the [`Reverse()` extension method](http://msdn.microsoft.com/en-us/library/bb358497.aspx) will let you enumerate a sequence in reverse order. Here's a random enumeration extension method: ``` public static IEnumerable<T> OrderRandomly<T>(this IEnumerable<T> sequence) { Random random = ne...
254,613
<p>When a web site is licensed under Creative Commons, I use the <a href="http://microformats.org/wiki/rel-license" rel="noreferrer">rel-license microformat</a>. When a web site is licensed under regular copyright, I have a boring paragraph element.</p> <pre><code>&lt;p id="copyright"&gt;&amp;copy; 2008 Example Corpor...
[ { "answer_id": 254642, "author": "Marcin", "author_id": 21640, "author_profile": "https://Stackoverflow.com/users/21640", "pm_score": 1, "selected": false, "text": "<p>Why not use the CC format, but indicate that no rights are granted?</p>\n\n<p>In any case, the main problem with the use...
2008/10/31
[ "https://Stackoverflow.com/questions/254613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6126/" ]
When a web site is licensed under Creative Commons, I use the [rel-license microformat](http://microformats.org/wiki/rel-license). When a web site is licensed under regular copyright, I have a boring paragraph element. ``` <p id="copyright">&copy; 2008 Example Corporation</p> ``` That id attribute on there is just f...
Thanks to Owen for pointing me in the direction of RDFa, I think I've got the solution now: ``` <div id="footer" xmlns:dc="http://purl.org/dc/elements/1.1/"> <p id="copyright" property="dc:rights">&copy; <span property="dc:dateCopyrighted">2008</span> <span property="dc:publisher">Example Corporation</span> </p> <...
254,616
<p>I am wondering how I can break up my index.php homepage to multiple php pages (i.e. header.php, footer.php) and build a working index.php page using those separate php pages. I know WordPress uses this with different functions like:</p> <pre><code>GetHeader(); GetFoodter(); </code></pre> <p>But when I tried to us...
[ { "answer_id": 254622, "author": "Scott", "author_id": 6126, "author_profile": "https://Stackoverflow.com/users/6126", "pm_score": 4, "selected": true, "text": "<pre><code>include 'header.php';\n\ninclude 'footer.php';\n</code></pre>\n" }, { "answer_id": 254626, "author": "Ti...
2008/10/31
[ "https://Stackoverflow.com/questions/254616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33194/" ]
I am wondering how I can break up my index.php homepage to multiple php pages (i.e. header.php, footer.php) and build a working index.php page using those separate php pages. I know WordPress uses this with different functions like: ``` GetHeader(); GetFoodter(); ``` But when I tried to use those functions, it error...
``` include 'header.php'; include 'footer.php'; ```
254,661
<p>When I try to allocate a Texture2D the app just crashes. I've stepped through the code where the crash occurs... all I can tell is "EXC BAD ACCESS". Here is the line in the app delegate that makes it crash:</p> <pre><code>_textures[myTex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"sometex.png"]]; <...
[ { "answer_id": 254720, "author": "MrDatabase", "author_id": 22471, "author_profile": "https://Stackoverflow.com/users/22471", "pm_score": 0, "selected": false, "text": "<p>Looks like the program can't find \"sometex.png\". When I replace \"sometex.png\" with the entire path\"users/ blah ...
2008/10/31
[ "https://Stackoverflow.com/questions/254661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
When I try to allocate a Texture2D the app just crashes. I've stepped through the code where the crash occurs... all I can tell is "EXC BAD ACCESS". Here is the line in the app delegate that makes it crash: ``` _textures[myTex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"sometex.png"]]; ``` sometex.png...
Is "sometex.png" in your resources? If you right-click on the .app that Xcode creates and select "Show Package Contents", do you see it there? It sounds like it's not being bundled with your app at build time.