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
242,182
<p>I have a page with a "Print" link that takes the user to a printer-friendly page. The client wants a print dialog box to appear automatically when the user arrives at the print-friendly page. How can I do this with javascript?</p>
[ { "answer_id": 242190, "author": "Mark", "author_id": 26310, "author_profile": "https://Stackoverflow.com/users/26310", "pm_score": 9, "selected": true, "text": "<pre><code>window.print(); \n</code></pre>\n\n<p>unless you mean a custom looking popup.</p>\n" }, { "answer_id": 242...
2008/10/28
[ "https://Stackoverflow.com/questions/242182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
I have a page with a "Print" link that takes the user to a printer-friendly page. The client wants a print dialog box to appear automatically when the user arrives at the print-friendly page. How can I do this with javascript?
``` window.print(); ``` unless you mean a custom looking popup.
242,255
<p>If I have class names such as "left", "right", "clear" and xhtml like</p> <pre><code>&lt;a href="index.php" class="right continueLink"&gt;Continue&lt;/a&gt; </code></pre> <p>With CSS like</p> <pre><code>.right { float: right; } </code></pre> <p>I know it's not a semantic name, but it does make things much easier...
[ { "answer_id": 242259, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 1, "selected": false, "text": "<p>It might be advisable to avoid names that are the same as values in the CSS specs to avoid confusion. Especia...
2008/10/28
[ "https://Stackoverflow.com/questions/242255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31671/" ]
If I have class names such as "left", "right", "clear" and xhtml like ``` <a href="index.php" class="right continueLink">Continue</a> ``` With CSS like ``` .right { float: right; } ``` I know it's not a semantic name, but it does make things much easier sometimes. Anyway, what are your thoughts?
I don't think that's a very good idea. Now when you (or a future maintainer) go to change your website layout, you'll either have to change `.right` to `{float:left;}` (obviously a bad idea) or go through all your HTML files and change `right` to `left`. Why do you want that particular link to be floated right, and th...
242,264
<p>I am digging into LINQ--trying to understand basic models (it seems pretty cool to me). The code below is the code to perform before committing an update. </p> <pre><code> Linq01.Account acc = context.Accounts.Single( pc =&gt; pc.AccountID == AccountID ); acc.Name = textboxAccountNameRead.Text.Trim(); con...
[ { "answer_id": 242266, "author": "Aaron Powell", "author_id": 11388, "author_profile": "https://Stackoverflow.com/users/11388", "pm_score": 4, "selected": true, "text": "<p>You should use <code>SingleOrDefault</code>, if the query does not return a value you can check it against null:</p...
2008/10/28
[ "https://Stackoverflow.com/questions/242264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2536/" ]
I am digging into LINQ--trying to understand basic models (it seems pretty cool to me). The code below is the code to perform before committing an update. ``` Linq01.Account acc = context.Accounts.Single( pc => pc.AccountID == AccountID ); acc.Name = textboxAccountNameRead.Text.Trim(); context.SubmitChanges(...
You should use `SingleOrDefault`, if the query does not return a value you can check it against null: ``` var acc = context.Accounts.SingleOrDefault(pc => pc.AccountId == AccountId); if(acc != null) { acc.Name = textboxAccountNameRead.Text.Trim(); context.SubmitChanges(); } ```
242,284
<p>While surfing, I came to know that somebody has done Tower of Hanoi using vim. WOW!!!</p> <p>Can you people share what all cool things you have been doing in vim.</p> <p>Edit: Not sure about the Tower of Hanoi solution using vim being all that useful. But I think this question should be re-opened to allow people t...
[ { "answer_id": 245320, "author": "Rob Wells", "author_id": 2974, "author_profile": "https://Stackoverflow.com/users/2974", "pm_score": 2, "selected": false, "text": "<p>I was working on a system that had massive log files. We're talking 30,000 10MB logs.</p>\n\n<p>Per day!</p>\n\n<p>Dist...
2008/10/28
[ "https://Stackoverflow.com/questions/242284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29405/" ]
While surfing, I came to know that somebody has done Tower of Hanoi using vim. WOW!!! Can you people share what all cool things you have been doing in vim. Edit: Not sure about the Tower of Hanoi solution using vim being all that useful. But I think this question should be re-opened to allow people to comment on any ...
I'm using vim to syntax-color code in my [blog](http://www.spinellis.gr/blog) and [lecture notes](http://www.dmst.aueb.gr/dds/enotes.html). A single Perl line ``` system "$vimrt\\gvim.exe", qq{ -c "edit /tmp/tmpcode.$ext " -c "source $vimrt/syntax/2html.vim" -c "write! /tmp/tmpcode.html" -c "qa!"}; ``` ...
242,295
<blockquote> <p><strong>EDIT</strong>: This question duplicates <a href="https://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173">How to access the current Subversion build number?</a> (Thanks for the heads up, Charles!)</p> </blockquote> <p>Hi there,</p> <p>This question...
[ { "answer_id": 242327, "author": "Jerub", "author_id": 14648, "author_profile": "https://Stackoverflow.com/users/14648", "pm_score": 1, "selected": false, "text": "<p>I use a technique very similar to this in order to show the current subversion revision number in my shell:</p>\n\n<pre><...
2008/10/28
[ "https://Stackoverflow.com/questions/242295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19212/" ]
> > **EDIT**: This question duplicates [How to access the current Subversion build number?](https://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173) (Thanks for the heads up, Charles!) > > > Hi there, This question is similar to [Getting the subversion repository number...
There is a command called `svnversion` which comes with subversion and is meant to solve exactly that kind of problem.
242,307
<p>This is the XML I am creating in JavaScript:</p> <pre><code>&lt;root&gt; &lt;GradeValueSet&gt; &lt;GradeValueSetMaster SetId="0" SetName="wrwr" SetComments="werwrwr" mode="add"/&gt; &lt;DetailInfo&gt; &lt;ChildInfo Name="This sfsf" Weightage="24"/&gt; &lt;ChildInfo Name="45654" Weightage="67"/&gt; &lt;/Detai...
[ { "answer_id": 242309, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Sorry forgot to add the sending XML in previous post</p>\n\n<p>&lt;root&gt;\n&lt;GradeValueSet&gt;\n&lt;GradeValueSetMaster...
2008/10/28
[ "https://Stackoverflow.com/questions/242307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is the XML I am creating in JavaScript: ``` <root> <GradeValueSet> <GradeValueSetMaster SetId="0" SetName="wrwr" SetComments="werwrwr" mode="add"/> <DetailInfo> <ChildInfo Name="This sfsf" Weightage="24"/> <ChildInfo Name="45654" Weightage="67"/> </DetailInfo> </GradeValueSet> </root> ``` I am sending th...
you might want to try saving the data as plain text from the aspx page to ensure the ONLY the xml is coming through. Depending on how you are sending the data to the page, there could be extra information which is not part of the xml. Saving the data as plain text just to test this will show exactly what data you are ...
242,314
<p>Using gnuplot 4.2, is it possible to obtain the value of a specific column/row and use that value somehow?</p> <p>For example, let's say my datafile contains the following</p> <pre><code>#1 2 7 13 5 11 23 17 53 12 </code></pre> <p>For a simple plot where column 1 is the x axis and column 2 is the y axis I woul...
[ { "answer_id": 460520, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": false, "text": "<p>ad a new column full of 13, then use:</p>\n\n<p>plot 'datafile' using 1:($2/$3)</p>\n" }, { "answer_id": 1450661, ...
2008/10/28
[ "https://Stackoverflow.com/questions/242314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11688/" ]
Using gnuplot 4.2, is it possible to obtain the value of a specific column/row and use that value somehow? For example, let's say my datafile contains the following ``` #1 2 7 13 5 11 23 17 53 12 ``` For a simple plot where column 1 is the x axis and column 2 is the y axis I would:- ``` plot 'datafile' using 1:...
Using the running averages demo, I managed to achieve a plot normalized to the first value of the second column. The `base` variable is used to store the reference value, and the `first` function initializes `base` on the first row. ``` first(x) = ($0 > 0 ? base : base = x) plot file.dat u 1:(first($2), base/$2) ```...
242,320
<p>Is there a way to bind a Generic List to a multicolumn listbox, yes listbox...I know but this is what I am stuck with and can't add a grid or listview.</p> <p>Thanks</p>
[ { "answer_id": 242408, "author": "Alexander Prokofyev", "author_id": 11256, "author_profile": "https://Stackoverflow.com/users/11256", "pm_score": 3, "selected": true, "text": "<p>You could bind a list to a listbox like this:</p>\n\n<pre><code>List&lt;int&gt; list = new List&lt;int&gt; {...
2008/10/28
[ "https://Stackoverflow.com/questions/242320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
Is there a way to bind a Generic List to a multicolumn listbox, yes listbox...I know but this is what I am stuck with and can't add a grid or listview. Thanks
You could bind a list to a listbox like this: ``` List<int> list = new List<int> { 1, 2, 4, 8, 16 }; listBox1.DataSource = list; ``` As for multicolumn listbox documentation says [ListBox.MultiColumn](http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.multicolumn.aspx) only places items into as man...
242,341
<p>I'm writing a utility to export evernote notes into Outlook on a schedule. The Outlook API's need plain text, and Evernote outputs a XHTML doc version of the plain text note. What I need is to strip out all the Tags and unescape the source XHTML doc embedded in the Evernote export file.</p> <p>Basically I need to t...
[ { "answer_id": 242351, "author": "Andrew Kennan", "author_id": 22506, "author_profile": "https://Stackoverflow.com/users/22506", "pm_score": 0, "selected": false, "text": "<p>As far as I know there isn't anything to do that specific job but you might want to look at using XSLT or walking...
2008/10/28
[ "https://Stackoverflow.com/questions/242341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm writing a utility to export evernote notes into Outlook on a schedule. The Outlook API's need plain text, and Evernote outputs a XHTML doc version of the plain text note. What I need is to strip out all the Tags and unescape the source XHTML doc embedded in the Evernote export file. Basically I need to turn; ``` ...
I would use a regular expression to strip out all the HTML tags, this one is pretty basic, I am sure if you may be able to tweak it if it doesn't work as you exactly want. `Regex.Replace("<div>your html in here</div>",@"<(.|\n)*?>",string.Empty)`;
242,344
<p>I want this page to return 200 whilst still sending the redirect...</p> <pre><code>&lt;script&gt; sub page_load 'Get the parameters dim content As String content = request.querystring("text") response.redirect ("http://100.200.100.10/test1/Default.aspx?CommandParm=" + content)...
[ { "answer_id": 242358, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "<p>No way with <code>Response.Redirect()</code>. I... think. Maybe setting <code>Response.Status = \"200 OK\"</code> after...
2008/10/28
[ "https://Stackoverflow.com/questions/242344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want this page to return 200 whilst still sending the redirect... ``` <script> sub page_load 'Get the parameters dim content As String content = request.querystring("text") response.redirect ("http://100.200.100.10/test1/Default.aspx?CommandParm=" + content) end sub </scrip...
@eyelidlessness@ I agree it seems like a poor usability choice, but I'm hoping it's a workaround for a problem that can't be fixed directly. Given that, try a [META refresh](http://en.wikipedia.org/wiki/Meta_refresh), e.g., ``` <meta http-equiv="refresh" content="5;url=http://example.com/"/> ``` and embed a messag...
242,363
<p>I want create a drop shadow around the canvas component in flex. Technically speaking it will not be a shadow, as I want it to wrap around the component giving the component a floating look. I may be able to do it with glow, but can anyone drop an line or two who has already done it?</p> <p>Thanks in advance.</p>
[ { "answer_id": 242373, "author": "Mozammel", "author_id": 20165, "author_profile": "https://Stackoverflow.com/users/20165", "pm_score": 3, "selected": true, "text": "<p>I actually solved it by doing this:</p>\n\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;mx:Canvas x...
2008/10/28
[ "https://Stackoverflow.com/questions/242363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20165/" ]
I want create a drop shadow around the canvas component in flex. Technically speaking it will not be a shadow, as I want it to wrap around the component giving the component a floating look. I may be able to do it with glow, but can anyone drop an line or two who has already done it? Thanks in advance.
I actually solved it by doing this: ``` <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="780" height="100%" borderStyle="solid" borderColor="gray" creationComplete="init();" backgroundColor="white"> <mx:Script> <![CDATA[ impo...
242,383
<p>I want to autowire a bean partially - that is, I want some args to be autowired but other to be explicitly set. For example:</p> <p>public MyClient(Service svc, boolean b)</p> <p>In the case of this constructor, I would like to specify in my xml the value for b, but have svc autowired. Is that possible?</p> <p>Th...
[ { "answer_id": 242443, "author": "NR.", "author_id": 11701, "author_profile": "https://Stackoverflow.com/users/11701", "pm_score": 2, "selected": false, "text": "<p>I don't think it is possible with constructors, but with explicit setters it certainly is. Just annotate the ones you want ...
2008/10/28
[ "https://Stackoverflow.com/questions/242383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22063/" ]
I want to autowire a bean partially - that is, I want some args to be autowired but other to be explicitly set. For example: public MyClient(Service svc, boolean b) In the case of this constructor, I would like to specify in my xml the value for b, but have svc autowired. Is that possible? Thanks, Lowell
I don't think it is possible with constructors, but with explicit setters it certainly is. Just annotate the ones you want autowired with @Autowired, and set the others in your config-file Something like: ``` public MyClient() {} @Autowired public setService (Service svc) {...} public setBoolean (boolean b) {...} ...
242,391
<p>Here's the core problem: I have a .NET application that is using <a href="http://en.wikipedia.org/wiki/COM_Interop" rel="noreferrer">COM interop</a> in a separate AppDomain. The COM stuff seems to be loading assemblies back into the default domain, rather than the AppDomain from which the COM stuff is being called.<...
[ { "answer_id": 243817, "author": "Sunny Milenov", "author_id": 8220, "author_profile": "https://Stackoverflow.com/users/8220", "pm_score": 0, "selected": false, "text": "<p>Don't make your Controller MBR. Create a small proxy, which loads the Controller in the second domain and starts it...
2008/10/28
[ "https://Stackoverflow.com/questions/242391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31967/" ]
Here's the core problem: I have a .NET application that is using [COM interop](http://en.wikipedia.org/wiki/COM_Interop) in a separate AppDomain. The COM stuff seems to be loading assemblies back into the default domain, rather than the AppDomain from which the COM stuff is being called. What I want to know is: is thi...
Unfortunately, A COM component is loaded within Process Space and not within the context of an AppDomain. Thus, you will need to manually tear-down (Release and Unload) your Native DLLs (applies to both COM and P/Invoke). Simply destroying an appdomain will do you no good, but respawning the whole process shouldn't be ...
242,393
<p>I have the following classes</p> <pre><code>public interface InterfaceBase { } public class ImplementA:InterfaceBase { } public class ImplementB:InterfaceBase { } public void TestImplementType&lt;T&gt;(T obj) where T: InterfaceBase { } </code></pre> <p>How to infer what the T is whether ImplementA or ImplementB...
[ { "answer_id": 242395, "author": "Toby", "author_id": 291137, "author_profile": "https://Stackoverflow.com/users/291137", "pm_score": 3, "selected": true, "text": "<p><code>obj is ImplementA</code></p>\n" }, { "answer_id": 242396, "author": "Andrew Stapleton", "author_id"...
2008/10/28
[ "https://Stackoverflow.com/questions/242393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
I have the following classes ``` public interface InterfaceBase { } public class ImplementA:InterfaceBase { } public class ImplementB:InterfaceBase { } public void TestImplementType<T>(T obj) where T: InterfaceBase { } ``` How to infer what the T is whether ImplementA or ImplementB? I tried to use ``` typeof(T)...
`obj is ImplementA`
242,404
<p>Four 2D points in an array. I need to sort them in clockwise order. I think it can be done with just one swap operation but I have not been able to put this down formally.</p> <p><strike>Edit: The four points are a convex polygon in my case.</strike></p> <p>Edit: The four points are the vertices of a convex polygo...
[ { "answer_id": 242414, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 0, "selected": false, "text": "<p>I believe you're right that a single swap can ensure that a polygon represented by four points in the plane is convex....
2008/10/28
[ "https://Stackoverflow.com/questions/242404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45603/" ]
Four 2D points in an array. I need to sort them in clockwise order. I think it can be done with just one swap operation but I have not been able to put this down formally. Edit: The four points are a convex polygon in my case. Edit: The four points are the vertices of a convex polygon. They need not be in order.
If you want to take a more mathematical perspective, we can consider the permutations of 4 points In our case there are 4 permutations that are in clockwise order ``` A B C D B C D A C D A B D A B C ``` All other possible permutations can be converted to one of these forms with 0 or 1 swaps. (I will only consider p...
242,406
<p>So I have action_mailer_optional_tls (<a href="http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls" rel="nofollow noreferrer">http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls</a>) and this in my enviroment.rb</p> <pre><code>ActionMailer::Base.server_settings = { :tls =&g...
[ { "answer_id": 242576, "author": "Ray Lu", "author_id": 11413, "author_profile": "https://Stackoverflow.com/users/11413", "pm_score": 0, "selected": false, "text": "<p>If you want to use a different email address for the replies from the target receivers, \nyou could specify Reply-To: ot...
2008/10/28
[ "https://Stackoverflow.com/questions/242406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31975/" ]
So I have action\_mailer\_optional\_tls (<http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls>) and this in my enviroment.rb ``` ActionMailer::Base.server_settings = { :tls => true, :address => "smtp.gmail.com", :port => "587", :domain => "www.somedomain.com", :authentication => :plain, ...
I can't verify that this works right now, but you should try just modifying these settings on the fly. i.e. set the username / password from the users account right before sending an email. You could even setup a before filter on your controller to load that info. ``` before_filter :load_email_settings def load_email...
242,415
<p>I have a problem of playing FLV file which id embed in my swf when i place it on server, swf plays correctly but not FLV</p> <p>any solution will be highly appreciated.</p> <hr> <p>thanks for all replys, its works in All browesers other than IE 6 now , </p> <p>i will paste the code here for the flv to chk .</p>...
[ { "answer_id": 242429, "author": "Stu Thompson", "author_id": 2961, "author_profile": "https://Stackoverflow.com/users/2961", "pm_score": 0, "selected": false, "text": "<p><em>\"Apache 5.5\"</em>? Apache httpd only goes to 2.x, so can we assume you mean Apache Tomcat 5.5? Or??? <stron...
2008/10/28
[ "https://Stackoverflow.com/questions/242415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a problem of playing FLV file which id embed in my swf when i place it on server, swf plays correctly but not FLV any solution will be highly appreciated. --- thanks for all replys, its works in All browesers other than IE 6 now , i will paste the code here for the flv to chk . ``` var videopath:String; va...
As said before check the mime type on the server. If the FLV is playing in some browsers and not in others there is probably an issue with the Flash Player. First in all browsers go the URL where the FLV lives on the server so see if you actually access the file from a browser. Then check for each browser separately w...
242,417
<p>I have two lists that are of the same length, is it possible to loop through these two lists at once?</p> <p>I am looking for the correct syntax to do the below</p> <pre><code>foreach itemA, itemB in ListA, ListB { Console.WriteLine(itemA.ToString()+","+itemB.ToString()); } </code></pre> <p>do you think this is...
[ { "answer_id": 242420, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": false, "text": "<p>[edit]: to clarify; this is useful in the generic LINQ / <code>IEnumerable&lt;T&gt;</code> context, where you <str...
2008/10/28
[ "https://Stackoverflow.com/questions/242417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
I have two lists that are of the same length, is it possible to loop through these two lists at once? I am looking for the correct syntax to do the below ``` foreach itemA, itemB in ListA, ListB { Console.WriteLine(itemA.ToString()+","+itemB.ToString()); } ``` do you think this is possible in C#? And if it is, wh...
Modern Answer ============= LINQ now has a [built-in Zip method](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.zip), so you don't need to create your own. The resulting sequence is as long as the shortest input. Zip currently (as of .NET Core 3.0) has 2 overloads. The simpler one returns a sequen...
242,421
<p>I am trying to execute this SQL query prior to restoring a .BAK file in SQL Express. Initially, I had the file on the Desktop of my user account. I am logged in as Administrator.</p> <p>When I try to access the .BAK file on the desktop like this</p> <pre><code>RESTORE FILELISTONLY FROM DISK= 'C:\Documents and Sett...
[ { "answer_id": 242430, "author": "rwired", "author_id": 17492, "author_profile": "https://Stackoverflow.com/users/17492", "pm_score": 4, "selected": true, "text": "<p>Try granting read permission to <strong>Users</strong> or <strong>LOCAL SERVICE</strong> to the folder C:\\Documents and ...
2008/10/28
[ "https://Stackoverflow.com/questions/242421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31979/" ]
I am trying to execute this SQL query prior to restoring a .BAK file in SQL Express. Initially, I had the file on the Desktop of my user account. I am logged in as Administrator. When I try to access the .BAK file on the desktop like this ``` RESTORE FILELISTONLY FROM DISK= 'C:\Documents and Settings\Administrator\De...
Try granting read permission to **Users** or **LOCAL SERVICE** to the folder C:\Documents and Settings\Administrator\Desktop\ in your Policy Editor (right click the folder and in the Security tab click Add... then Advanced...|Find Now
242,424
<p>I know how to move a layer based on touch. But I would also like to be able to rotate the image. </p> <p>Is there any sample code that shows how to do this? Or can anyone give me some advice?</p> <p>Thanks!</p>
[ { "answer_id": 242619, "author": "Jesús A. Álvarez", "author_id": 13186, "author_profile": "https://Stackoverflow.com/users/13186", "pm_score": 1, "selected": false, "text": "<p>You would use the view's transform property.\nThere's some example code for rotating the view in the iPhone OS...
2008/10/28
[ "https://Stackoverflow.com/questions/242424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23695/" ]
I know how to move a layer based on touch. But I would also like to be able to rotate the image. Is there any sample code that shows how to do this? Or can anyone give me some advice? Thanks!
The simplest way to do this is using the layer's transform property: ``` float angle = M_PI; //rotate 180°, or 1 π radians layer.transform = CATransform3DMakeRotation(angle, 0, 0.0, 1.0); ``` The first argument to the CATransform3DMakeRotation function is the amount to rotate, in radians. The next three describe ...
242,438
<p>I've a performance related question regarding use of StringBuilder. In a very long loop I'm manipulating a <code>StringBuilder</code> and passing it to another method like this:</p> <pre><code>for (loop condition) { StringBuilder sb = new StringBuilder(); sb.append("some string"); . . . sb.append(an...
[ { "answer_id": 242442, "author": "Stu Thompson", "author_id": 2961, "author_profile": "https://Stackoverflow.com/users/2961", "pm_score": 3, "selected": false, "text": "<p>The modern JVM is really smart about stuff like this. I would not second guess it and do something hacky that is le...
2008/10/28
[ "https://Stackoverflow.com/questions/242438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27789/" ]
I've a performance related question regarding use of StringBuilder. In a very long loop I'm manipulating a `StringBuilder` and passing it to another method like this: ``` for (loop condition) { StringBuilder sb = new StringBuilder(); sb.append("some string"); . . . sb.append(anotherString); . . . ...
The second one is about 25% faster in my mini-benchmark. ``` public class ScratchPad { static String a; public static void main( String[] args ) throws Exception { long time = System.currentTimeMillis(); for( int i = 0; i < 10000000; i++ ) { StringBuilder sb = new StringBuilder();...
242,444
<p>I have a little pet web app project I'd like to show someone who doesn't have an application server themselves (and who has no clue about application servers).</p> <p>What is the easiest and quickest way for them to get my WAR file running with zero configuration, preferably something I could send along with or bun...
[ { "answer_id": 242459, "author": "tunaranch", "author_id": 27708, "author_profile": "https://Stackoverflow.com/users/27708", "pm_score": 2, "selected": false, "text": "<p>If you're using maven, there's a jetty maven plugin that can deploy your war to an embedded instance of jetty.</p>\n\...
2008/10/28
[ "https://Stackoverflow.com/questions/242444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I have a little pet web app project I'd like to show someone who doesn't have an application server themselves (and who has no clue about application servers). What is the easiest and quickest way for them to get my WAR file running with zero configuration, preferably something I could send along with or bundle with t...
You can create the slimmed down version yourself easily. <http://docs.codehaus.org/display/JETTY/Embedding+Jetty> <http://jetty.mortbay.org/xref/org/mortbay/jetty/example/LikeJettyXml.html> To run embedded Jetty you need only the following jars on the classpath: ``` * servlet-api-2.5-6.x.jar * jetty-util-6.x.jar * ...
242,468
<p>In my ASP.NET application I have a web.config file. In the web.config file I have a connection string...</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="HRDb" connectionString="xxxxx" providerName="System.Data.SqlClient" /&gt; &lt;/connectionStrings&gt; </code></pre> <p>Yet, when I retrieve this value u...
[ { "answer_id": 242481, "author": "Glenn Slaven", "author_id": 2975, "author_profile": "https://Stackoverflow.com/users/2975", "pm_score": 0, "selected": false, "text": "<p>Where was the 'old' value stored? Is it in a different config file? The config manager should only pull from the c...
2008/10/28
[ "https://Stackoverflow.com/questions/242468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22702/" ]
In my ASP.NET application I have a web.config file. In the web.config file I have a connection string... ``` <connectionStrings> <add name="HRDb" connectionString="xxxxx" providerName="System.Data.SqlClient" /> </connectionStrings> ``` Yet, when I retrieve this value using `ConfigurationManager.ConnectionStrings...
I figured out what was going wrong. So to answer my own question... ConfigurationManager only reads from web.config. My problem was that the project was configured to use an IIS web server when running the project instead of using the Visual Studio Development server. So I was in fact running an old version of my app...
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
[ { "answer_id": 242506, "author": "monkut", "author_id": 24718, "author_profile": "https://Stackoverflow.com/users/24718", "pm_score": 5, "selected": false, "text": "<p>This isn't the debugger, but probably just as useful(?)</p>\n\n<p>I know I heard Guido mention this in a speech somewher...
2008/10/28
[ "https://Stackoverflow.com/questions/242485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24530/" ]
This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered? I...
You can use [traceback.print\_exc](http://docs.python.org/library/traceback.html#traceback.print_exc) to print the exceptions traceback. Then use [sys.exc\_info](http://docs.python.org/library/sys#sys.exc_info) to extract the traceback and finally call [pdb.post\_mortem](http://docs.python.org/library/pdb#pdb.post_mort...
242,504
<p>How can I generate a report in access with the data from a recordset (instead of a query or table). I have updates to the recordset that also must be shown in the report.</p>
[ { "answer_id": 242605, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": -1, "selected": false, "text": "<p>Please explain in more detail. For example, do you wish to show what the field was and what it is now? If so, you will...
2008/10/28
[ "https://Stackoverflow.com/questions/242504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31132/" ]
How can I generate a report in access with the data from a recordset (instead of a query or table). I have updates to the recordset that also must be shown in the report.
From [Access Web](http://www.mvps.org/access/reports/rpt0014.htm) you can use the "name" property of a recordset. You resulting code would look something like this: *In the report* ``` Private Sub Report_Open(Cancel As Integer) Me.RecordSource = gMyRecordSet.Name End Sub ``` *In the calling object (module, for...
242,517
<p>I have a certain application which feeds information into an object, after comparing the new information to the old information. It goes something like</p> <pre><code>set { oldval=_value; _value=value; if (some comparison logic) raiseEvent(); } </code></pre> <p>This all happens on a background ...
[ { "answer_id": 242519, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p>You really need to give more information. All we've got here is some pseudocode. Try to come up with a <a href=\"http...
2008/10/28
[ "https://Stackoverflow.com/questions/242517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30884/" ]
I have a certain application which feeds information into an object, after comparing the new information to the old information. It goes something like ``` set { oldval=_value; _value=value; if (some comparison logic) raiseEvent(); } ``` This all happens on a background thread, in an infinite loo...
Without some meaningful code, we can only guess. In particular, if adding a MessageBox to the start of the Set doesn't appear, then it is likely that the problem is at the calling code (not this). Some thoughts, though - especially since you have multiple threads: * is there a thread race somewhere? should some of th...
242,534
<pre><code>private const int THE_ANSWER = 42; </code></pre> <p>or</p> <pre><code>private const int theAnswer = 42; </code></pre> <p>Personally I think with modern IDEs we should go with camelCase as ALL_CAPS looks strange. What do you think?</p>
[ { "answer_id": 242539, "author": "dove", "author_id": 30913, "author_profile": "https://Stackoverflow.com/users/30913", "pm_score": 4, "selected": false, "text": "<p>Leave Hungarian to the Hungarians.</p>\n\n<p>In the example I'd even leave out the definitive article and just go with </p...
2008/10/28
[ "https://Stackoverflow.com/questions/242534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6846/" ]
``` private const int THE_ANSWER = 42; ``` or ``` private const int theAnswer = 42; ``` Personally I think with modern IDEs we should go with camelCase as ALL\_CAPS looks strange. What do you think?
The recommended naming and capitalization convention is to use [**P**ascal**C**asing](https://en.wikipedia.org/wiki/Camel_case) for constants (Microsoft has a tool named [StyleCop](https://github.com/StyleCop) that documents all the preferred conventions and can check your source for compliance - though it is a little ...
242,538
<p>Basically I need to run the script with paths related to the shell script file location, how can I change the current directory to the same directory as where the script file resides?</p>
[ { "answer_id": 242550, "author": "TheMarko", "author_id": 31099, "author_profile": "https://Stackoverflow.com/users/31099", "pm_score": 10, "selected": true, "text": "<p>In Bash, you should get what you need like this:</p>\n\n<pre><code>#!/usr/bin/env bash\n\nBASEDIR=$(dirname \"$0\")\ne...
2008/10/28
[ "https://Stackoverflow.com/questions/242538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16371/" ]
Basically I need to run the script with paths related to the shell script file location, how can I change the current directory to the same directory as where the script file resides?
In Bash, you should get what you need like this: ``` #!/usr/bin/env bash BASEDIR=$(dirname "$0") echo "$BASEDIR" ```
242,565
<p>I have MainViewController calling WebViewController (From UICatalog sample application) In WebViewController I make some function setValue(){...} to set some value passed as parameter to the variable (NSString *value) from WebViewController.h but when I try from MainViewController something like WebViewController ta...
[ { "answer_id": 242638, "author": "Kendall Helmstetter Gelner", "author_id": 6330, "author_profile": "https://Stackoverflow.com/users/6330", "pm_score": 1, "selected": false, "text": "<p>If you have a property named \"value\", and use @sythesize to create a method for you, in which case y...
2008/10/28
[ "https://Stackoverflow.com/questions/242565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16066/" ]
I have MainViewController calling WebViewController (From UICatalog sample application) In WebViewController I make some function setValue(){...} to set some value passed as parameter to the variable (NSString \*value) from WebViewController.h but when I try from MainViewController something like WebViewController targ...
If you have a property named "value", and use @sythesize to create a method for you, in which case you call using that "." notation: ``` targetViewController.value = whatever; ``` Or you can call the setter outright regardless of you or the @synthesize writing the method: ``` [targetViewController setValue:whatever...
242,568
<p>By default, .NET application's configuration file is named after "exe file name".config. I'm wondering whether it is possible to have one application's configuration specified dynamically.</p> <p>For example, the built application is "foo.exe". At runtime, the config file is "foo.exe.config". Is it possible to have...
[ { "answer_id": 242591, "author": "Will Dieterich", "author_id": 31233, "author_profile": "https://Stackoverflow.com/users/31233", "pm_score": 0, "selected": false, "text": "<p>Yes you will need use ExeConfigurationFileMap</p>\n" }, { "answer_id": 242612, "author": "Ray Lu", ...
2008/10/28
[ "https://Stackoverflow.com/questions/242568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26349/" ]
By default, .NET application's configuration file is named after "exe file name".config. I'm wondering whether it is possible to have one application's configuration specified dynamically. For example, the built application is "foo.exe". At runtime, the config file is "foo.exe.config". Is it possible to have it accept...
All of the above work well if you need to replace only AppSettings section. In case you have to run with different config files (all sections) you might want to consider launching application using a host, that creates app domain for your main application and sets different config file depending on parameters you pas...
242,570
<p>I need to copy the content of a window (BitBlt) which is hidden, to another window. The problem is that once I hide the source window, the device context I got isn't painted anymore.</p>
[ { "answer_id": 242581, "author": "HS.", "author_id": 1398, "author_profile": "https://Stackoverflow.com/users/1398", "pm_score": 0, "selected": false, "text": "<p>Maybe you can trigger a redraw operation on the window with InvalidateRect?</p>\n" }, { "answer_id": 242611, "aut...
2008/10/28
[ "https://Stackoverflow.com/questions/242570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to copy the content of a window (BitBlt) which is hidden, to another window. The problem is that once I hide the source window, the device context I got isn't painted anymore.
What you need is the [PrintWindow](http://msdn.microsoft.com/en-us/library/ms535695.aspx) function that's available in Win32 API since Windows XP. If you need it to work with older versions of Windows, you can try [WM\_PRINT](http://msdn.microsoft.com/en-us/library/ms534856(VS.85).aspx), although I've never been able t...
242,572
<p>I'm trying to use a .NET assembly from VB6 via interop without placing it in the GAC and without using the /codebase argument for regasm.exe.</p> <p>From what I understand, when I run regasm.exe on a .NET class library, it creates a registry entry for each class in the class library telling the COM clients they sho...
[ { "answer_id": 242601, "author": "OJ.", "author_id": 611, "author_profile": "https://Stackoverflow.com/users/611", "pm_score": 3, "selected": true, "text": "<p>From <a href=\"http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx\" rel=\"nofollow noreferrer\">MSDN</a>:</p>\n\n<bloc...
2008/10/28
[ "https://Stackoverflow.com/questions/242572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15109/" ]
I'm trying to use a .NET assembly from VB6 via interop without placing it in the GAC and without using the /codebase argument for regasm.exe. From what I understand, when I run regasm.exe on a .NET class library, it creates a registry entry for each class in the class library telling the COM clients they should load m...
From [MSDN](http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx): > > **/Codebase** : Creates a Codebase entry in the > registry. The Codebase entry specifies > the file path for an assembly that is > not installed in the global assembly > cache. You should not specify this > option if you will subseque...
242,579
<p>I have a long URL with tons of parameters that I want to open in the default browser from Java on a Windows system using</p> <pre><code>Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+url) </code></pre> <p>For short URLs like "<a href="http://www.google.com" rel="nofollow noreferrer">http://www.g...
[ { "answer_id": 242674, "author": "David Harrison", "author_id": 2966, "author_profile": "https://Stackoverflow.com/users/2966", "pm_score": 3, "selected": true, "text": "<p>You will be running up against <a href=\"https://web.archive.org/web/20190902193246/https://boutell.com/newfaq/misc...
2008/10/28
[ "https://Stackoverflow.com/questions/242579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I have a long URL with tons of parameters that I want to open in the default browser from Java on a Windows system using ``` Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+url) ``` For short URLs like "<http://www.google.com>" this works fine. But for long URLs (say, 2000 characters), this simply ...
You will be running up against [this (archived)](https://web.archive.org/web/20190902193246/https://boutell.com/newfaq/misc/urllength.html) operating system/browser specific maximum URL length problem: For "rundll32 url.dll" (i.e. Microsoft IE) you will be limited to 2,083 characters (including http://). From where I...
242,608
<p>Is it possible to disable the browsers vertical and horizontal scrollbars using jQuery or javascript?</p>
[ { "answer_id": 242615, "author": "Ray Lu", "author_id": 11413, "author_profile": "https://Stackoverflow.com/users/11413", "pm_score": 6, "selected": false, "text": "<p>Try CSS</p>\n\n<pre><code>&lt;body style=\"overflow: hidden\"&gt;\n</code></pre>\n" }, { "answer_id": 242684, ...
2008/10/28
[ "https://Stackoverflow.com/questions/242608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17447/" ]
Is it possible to disable the browsers vertical and horizontal scrollbars using jQuery or javascript?
In case you need possibility to hide and show scrollbars dynamically you could use ``` $("body").css("overflow", "hidden"); ``` and ``` $("body").css("overflow", "auto"); ``` somewhere in your code.
242,614
<p>A classic ASP.NET app - AppSrv + MS SQL DB. Both servers are heavy-lifters 8 cores, 20 GB of RAM. When load testing, the throughput goes somewhere to 400 VirtualUsers (according to LoadRunner) with CPU being approximately 30% utilized an DB server primarily idling - response times go dramatically up, to the point of...
[ { "answer_id": 242631, "author": "Ray Lu", "author_id": 11413, "author_profile": "https://Stackoverflow.com/users/11413", "pm_score": 1, "selected": true, "text": "<p>Does the host utilize App Pool?</p>\n\n<p>Did you try increase the number to 5 to 10 in </p>\n\n<pre><code>An Application...
2008/10/28
[ "https://Stackoverflow.com/questions/242614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29573/" ]
A classic ASP.NET app - AppSrv + MS SQL DB. Both servers are heavy-lifters 8 cores, 20 GB of RAM. When load testing, the throughput goes somewhere to 400 VirtualUsers (according to LoadRunner) with CPU being approximately 30% utilized an DB server primarily idling - response times go dramatically up, to the point of un...
Does the host utilize App Pool? Did you try increase the number to 5 to 10 in ``` An Application Pool -> Performance -> Web Garden -> Max Number of worker processes ```
242,617
<p>Posting a stack overflow question on stackoverflow.com, how amusing :-)</p> <p>I'm running some recursive Ruby code and I get the: <code>"Stack level too deep (SystemStackError)"</code></p> <p>(I'm quite sure the code works, that I'm not in an infinite recursive death spiral, but that is not the point anyway)</p> ...
[ { "answer_id": 242659, "author": "Alexander Prokofyev", "author_id": 11256, "author_profile": "https://Stackoverflow.com/users/11256", "pm_score": 3, "selected": false, "text": "<p>Yukihiro Matsumoto writes <a href=\"http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/d4d5...
2008/10/28
[ "https://Stackoverflow.com/questions/242617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28625/" ]
Posting a stack overflow question on stackoverflow.com, how amusing :-) I'm running some recursive Ruby code and I get the: `"Stack level too deep (SystemStackError)"` (I'm quite sure the code works, that I'm not in an infinite recursive death spiral, but that is not the point anyway) Is there anyway to change the a...
Ruby uses the C stack so your options include using ulimit or compiling Ruby with some compiler/linker stack size flag. Tail recursion is yet to be implemented and Ruby's current support for recursion isn't so great. As cool and elegant recursion is, you might want to consider coping with the language's limitations and...
242,621
<p>I'm having trouble running a complex query against our company LDAP server. I'm using the following Perl script:</p> <pre><code>use Data::Dumper; use Net::LDAP; die "Can't connect to LDAP-Server: $@\n" unless $ldap = Net::LDAP-&gt;new( 'xLDAPx' ); foreach my $filter ( 'ou=Personal', 'ou=BAR', 'ou=Personal,o...
[ { "answer_id": 242656, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": false, "text": "<p>The reason is that you are not providing syntactically correct filter strings, but parts of a DN. I can't imagine this ...
2008/10/28
[ "https://Stackoverflow.com/questions/242621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18606/" ]
I'm having trouble running a complex query against our company LDAP server. I'm using the following Perl script: ``` use Data::Dumper; use Net::LDAP; die "Can't connect to LDAP-Server: $@\n" unless $ldap = Net::LDAP->new( 'xLDAPx' ); foreach my $filter ( 'ou=Personal', 'ou=BAR', 'ou=Personal,ou=BAR', 'ou=Person...
I think you want it to be more like `(&(ou=Personal)(ou=FOO)(o=FOO)(dc=foo)(dc=com))`. But you are not clear at all on what you want exactly, so I can't make a filter for you. Edited to add: I'm guessing this is what you want to do: `(|(ou=Personal)(ou=FOO))`
242,627
<pre><code>today1 = new Date(); today2 = Date.parse("2008-28-10"); </code></pre> <p>To compare the time (millisecond) values of these I have to do the following, because today2 is just a number.</p> <pre><code>if (today1.getTime() == today2) </code></pre> <p>Why is this?</p>
[ { "answer_id": 242632, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 2, "selected": false, "text": "<p>If I remember correctly, Date gives you a value down to the millisecond you created the Date object. So unless this ...
2008/10/28
[ "https://Stackoverflow.com/questions/242627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
``` today1 = new Date(); today2 = Date.parse("2008-28-10"); ``` To compare the time (millisecond) values of these I have to do the following, because today2 is just a number. ``` if (today1.getTime() == today2) ``` Why is this?
To answer the question in the title: Because they decided so when creating the JavaScript language. Probably because Java's `java.util.Date` parse function was doing the same thing, and they wanted to mimic its behavior to make the language feel more familiar. To answer the question in the text... Use this construct t...
242,640
<p>I wanna see if there is an approach to pack a few plugins together as a meta plugin that install everything together automatically, works like a project template.</p> <p>Why not a script? Because I want to put it in github so I don't have to worry about it when I am not with my own PC :) but of coz a script based s...
[ { "answer_id": 243330, "author": "Ricardo Acras", "author_id": 19224, "author_profile": "https://Stackoverflow.com/users/19224", "pm_score": 1, "selected": false, "text": "<p>My solution (ruby script):</p>\n\n<pre><code>plugins = %w{\n http://url_to_plugin_1\n http://url_to_plugin_2\n ...
2008/10/28
[ "https://Stackoverflow.com/questions/242640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16371/" ]
I wanna see if there is an approach to pack a few plugins together as a meta plugin that install everything together automatically, works like a project template. Why not a script? Because I want to put it in github so I don't have to worry about it when I am not with my own PC :) but of coz a script based solution is...
My solution (ruby script): ``` plugins = %w{ http://url_to_plugin_1 http://url_to_plugin_2 http://url_to_plugin_3 http://url_to_plugin_4 http://url_to_plugin_5 } plugins.each do | p | `ruby script/plugin install -x #{p}` end ``` run from project root directory
242,646
<p>How can I use vimdiff to view the differences described in a diff file?</p>
[ { "answer_id": 242680, "author": "Ken", "author_id": 20074, "author_profile": "https://Stackoverflow.com/users/20074", "pm_score": 2, "selected": false, "text": "<p>Make a copy of the original file, apply the diff and then</p>\n\n<pre><code>vimdiff original_file patched_file\n</code></pr...
2008/10/28
[ "https://Stackoverflow.com/questions/242646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14437/" ]
How can I use vimdiff to view the differences described in a diff file?
Instead of using `/usr/bin/vimdiff` command, try this: ``` $ vim file :vertical diffpatch path/to/diff ``` (`:vert diffpa` for short.) This is equivalent to calling `vimdiff` on the original file and the subsequently patched file, but `vim` calls `patch` on a temporary file for you. Edit ---- If you want `vim`'s...
242,647
<p>I have one aspx page with some controls. Also i have one DIV which is dynamically populated from AJAX call. This AJAX call return couple of controls, for example HtmlInputText1 and HtmlInputText2.</p> <p>When page is submitted, I can get values from this controls through Request.Form. If possible access to the att...
[ { "answer_id": 242692, "author": "Ray Lu", "author_id": 11413, "author_profile": "https://Stackoverflow.com/users/11413", "pm_score": 2, "selected": true, "text": "<p>The data you want the server to know can be set by the javascript within the form.\nThen You can process postback data fo...
2008/10/28
[ "https://Stackoverflow.com/questions/242647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17465/" ]
I have one aspx page with some controls. Also i have one DIV which is dynamically populated from AJAX call. This AJAX call return couple of controls, for example HtmlInputText1 and HtmlInputText2. When page is submitted, I can get values from this controls through Request.Form. If possible access to the attributes of...
The data you want the server to know can be set by the javascript within the form. Then You can process postback data for the target values manually. You can write some javascript which modify the value of the server control within browser. ``` <script language="javascript" type="text/javascript"> function changeValu...
242,665
<p>I'm trying to set up a basic test of HMAC-SHA-256 hashing but I'm having problems with the engine setup. Ideally I would like to set up only the HMAC-SHA-algorithm but so far I haven't even gotten the general case where load all the algorithms to work. Currently I'm getting segfaults on the row where I try to set th...
[ { "answer_id": 242687, "author": "Martin Kenny", "author_id": 6111, "author_profile": "https://Stackoverflow.com/users/6111", "pm_score": 0, "selected": false, "text": "<p>It looks as though nothing is allocating an engine, so the first use of <code>e</code> is segfaulting. I think you n...
2008/10/28
[ "https://Stackoverflow.com/questions/242665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30059/" ]
I'm trying to set up a basic test of HMAC-SHA-256 hashing but I'm having problems with the engine setup. Ideally I would like to set up only the HMAC-SHA-algorithm but so far I haven't even gotten the general case where load all the algorithms to work. Currently I'm getting segfaults on the row where I try to set the d...
The problem with your original suggestion is, as Martin said, that you need to initialise the ENGINE. The problem with your edited code was that you were doing ENGINE\_new, which is getting you a completely new ENGINE of your own, which you then need to provide with cipher methods, digest methods, etc. In fact, for wha...
242,695
<p>I have seen C# code that uses the <code>@</code> to tell the compiler the string has newlines in it and that it should be all in one line. Is there something like that for C/C++?</p> <p>Like if I want to put something like:</p> <p>73167176531330624919225119674426574742355349194934 969835203127745063262395783180169...
[ { "answer_id": 242702, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": false, "text": "<p>C and C++ didn't have anything like C# verbatim string literals at the time this answer was first written. The closes...
2008/10/28
[ "https://Stackoverflow.com/questions/242695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8715/" ]
I have seen C# code that uses the `@` to tell the compiler the string has newlines in it and that it should be all in one line. Is there something like that for C/C++? Like if I want to put something like: 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 8586156078...
C and C++ have automatic concatenation of adjacent quoted strings. This means that ``` const char *a = "a" "b"; ``` and ``` const char *b = "ab"; ``` will make `a` and `b` point at identical data. You can of course extend this, but it becomes troublesome when the strings contain quotes. Your example seems not to...
242,698
<p>I am trying to write a replacement regular expression to surround all words in quotes except the words AND, OR and NOT. </p> <p>I have tried the following for the match part of the expression:</p> <pre><code>(?i)(?&lt;word&gt;[a-z0-9]+)(?&lt;!and|not|or) </code></pre> <p>and </p> <pre><code>(?i)(?&lt;word&gt;[a-...
[ { "answer_id": 242716, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 5, "selected": true, "text": "<p>This is a little dirty, but it works:</p>\n\n<pre><code>(?&lt;!\\b(?:and| or|not))\\b(?!(?:and|or|not)\\b)\n</code></pre...
2008/10/28
[ "https://Stackoverflow.com/questions/242698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33/" ]
I am trying to write a replacement regular expression to surround all words in quotes except the words AND, OR and NOT. I have tried the following for the match part of the expression: ``` (?i)(?<word>[a-z0-9]+)(?<!and|not|or) ``` and ``` (?i)(?<word>[a-z0-9]+)(?!and|not|or) ``` but neither work. The replaceme...
This is a little dirty, but it works: ``` (?<!\b(?:and| or|not))\b(?!(?:and|or|not)\b) ``` In plain English, this matches any word boundary not preceded by and not followed by "and", "or", or "not". It matches whole words only, e.g. the position after the word "sand" would not be a match just because it is preceded ...
242,701
<p>Which SQL statement is faster?</p> <pre><code>SELECT TOP 2 c1.Price, c2.Price, ..... c49.Price, c50.Price FROM Table1 AS c1, Table2 AS c2, ..... Table49 AS c49, Table50 AS c50 WHERE c1.Date = c2.Date AND c2.Date = c3.Date ..... c49.Date = c50.Date ORDER BY c1.ID DESC OR SELECT TOP 2 c1.Price, c2.Price, .....
[ { "answer_id": 242706, "author": "dove", "author_id": 30913, "author_profile": "https://Stackoverflow.com/users/30913", "pm_score": 3, "selected": false, "text": "<p>WHERE would usually be better but the best way is <strong>case by case</strong> and throw this into profiler, or simpler y...
2008/10/28
[ "https://Stackoverflow.com/questions/242701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32012/" ]
Which SQL statement is faster? ``` SELECT TOP 2 c1.Price, c2.Price, ..... c49.Price, c50.Price FROM Table1 AS c1, Table2 AS c2, ..... Table49 AS c49, Table50 AS c50 WHERE c1.Date = c2.Date AND c2.Date = c3.Date ..... c49.Date = c50.Date ORDER BY c1.ID DESC OR SELECT TOP 2 c1.Price, c2.Price, ..... c49.Price,...
What is faster is not having 50 tables to start with. Joining 50 tables might be ok, but it's a highly counter-intuitive design and probably not the most maintainable solution. Can you not store your data in rows (or columns) of a single (or fewer) tables rather than 50 tables??!
242,711
<p>I think this must be simple but I can't get it right...</p> <p>I have an MxM triangular matrix, the coefficients of which are stored in a vector, row by row. For example:</p> <pre><code>M = [ m00 m01 m02 m03 ] [ m11 m12 m13 ] [ m22 m23 ] [ m33 ] </code></pre> <p>is st...
[ { "answer_id": 242919, "author": "João Augusto", "author_id": 6909, "author_profile": "https://Stackoverflow.com/users/6909", "pm_score": 0, "selected": false, "text": "<p>Took me some time to understand what you needed! :)</p>\n\n<pre><code>unsigned int row_index(int i, int m)\n{\n i...
2008/10/28
[ "https://Stackoverflow.com/questions/242711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19863/" ]
I think this must be simple but I can't get it right... I have an MxM triangular matrix, the coefficients of which are stored in a vector, row by row. For example: ``` M = [ m00 m01 m02 m03 ] [ m11 m12 m13 ] [ m22 m23 ] [ m33 ] ``` is stored as ``` coef[ m00 m01 m02 m...
Here's an algebraic (mostly) solution: ``` unsigned int row_index( unsigned int i, unsigned int M ){ double m = M; double row = (-2*m - 1 + sqrt( (4*m*(m+1) - 8*(double)i - 7) )) / -2; if( row == (double)(int) row ) row -= 1; return (unsigned int) row; } unsigned int column_index( unsigned int i, unsi...
242,718
<p>How do you split a string?</p> <p>Lets say i have a string "dog, cat, mouse,bird"</p> <p>My actual goal is to insert each of those animals into a listBox, so they would become items in a list box.</p> <p>but i think i get the idea on how to insert those items if i know how to split the string. or does anyone know...
[ { "answer_id": 242724, "author": "dove", "author_id": 30913, "author_profile": "https://Stackoverflow.com/users/30913", "pm_score": 4, "selected": true, "text": "<pre><code> string[] tokens = text.Split(',');\n\n for (int i = 0; i &lt; tokens.Length; i++)\n {\n yourList...
2008/10/28
[ "https://Stackoverflow.com/questions/242718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23491/" ]
How do you split a string? Lets say i have a string "dog, cat, mouse,bird" My actual goal is to insert each of those animals into a listBox, so they would become items in a list box. but i think i get the idea on how to insert those items if i know how to split the string. or does anyone know a better way to do this...
``` string[] tokens = text.Split(','); for (int i = 0; i < tokens.Length; i++) { yourListBox.Add(new ListItem(token[i], token[i])); } ```
242,745
<p>When I add the textBox.TextChanged to watch list I get a message saying <pre>The event 'System.Windows.Forms.Control.TextChanged' can only appear on the left hand side of += or -=</pre></p> <p>Is there any way to check what event's are called on text change?</p>
[ { "answer_id": 242757, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "<p>We use Subversion for document management at work. It works great.</p>\n\n<ul>\n<li>Don't worry about the disk space. ...
2008/10/28
[ "https://Stackoverflow.com/questions/242745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1534/" ]
When I add the textBox.TextChanged to watch list I get a message saying ``` The event 'System.Windows.Forms.Control.TextChanged' can only appear on the left hand side of += or -= ``` Is there any way to check what event's are called on text change?
We use Subversion for document management at work. It works great. * Don't worry about the disk space. Revisions are stored compressed anyway. * Checking out a project with documentation doesn't take much more time than one without. Unless your documents are absolutely huge, this shouldn't be a problem. * Training tim...
242,766
<p>Recently I've been seeing a lot of this:</p> <pre><code>&lt;a href='http://widget-site-example.com/example.html'&gt; &lt;img src='http://widget-site-example.com/ross.jpg' alt='Ross&amp;#39;s Widget' /&gt; &lt;/a&gt; </code></pre> <p>Is it valid to use single quotes in HTML? As I've highlighted above it's also ...
[ { "answer_id": 242775, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 7, "selected": true, "text": "<p>It's certainly valid to use single quotes (<a href=\"http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2\" rel=\"nore...
2008/10/28
[ "https://Stackoverflow.com/questions/242766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2025/" ]
Recently I've been seeing a lot of this: ``` <a href='http://widget-site-example.com/example.html'> <img src='http://widget-site-example.com/ross.jpg' alt='Ross&#39;s Widget' /> </a> ``` Is it valid to use single quotes in HTML? As I've highlighted above it's also problematic because you have to escape apostroph...
It's certainly valid to use single quotes ([HTML 4.01, section 3.2.2](http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2)). I haven't noticed such a trend, but perhaps there's some framework that powers web sites you've visited that happens to quote using single quotes.
242,771
<p>How can I create an Oracle stored procedure which accepts a variable number of parameter values used to feed a IN clause?</p> <p>This is what I am trying to achieve. I do not know how to declare in PLSQL for passing a variable list of primary keys of the rows I want to update.</p> <pre><code>FUNCTION EXECUTE_UPDA...
[ { "answer_id": 242776, "author": "RB.", "author_id": 15393, "author_profile": "https://Stackoverflow.com/users/15393", "pm_score": -1, "selected": false, "text": "<p>I've not done it for Oracle, but with SQL Server you can use a function to convert a CSV string into a table, which can th...
2008/10/28
[ "https://Stackoverflow.com/questions/242771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5970/" ]
How can I create an Oracle stored procedure which accepts a variable number of parameter values used to feed a IN clause? This is what I am trying to achieve. I do not know how to declare in PLSQL for passing a variable list of primary keys of the rows I want to update. ``` FUNCTION EXECUTE_UPDATE ( <parameter_list...
Using CSV is probably the simplest way, assuming you can be 100% certain that your elements won't themselves contain strings. An alternative, and probably more robust, way of doing this is to create a custom type as a table of strings. Supposing your strings were never longer than 100 characters, then you could have: ...
242,792
<p>I need to write a regular expression that finds javascript files that match </p> <pre><code>&lt;anypath&gt;&lt;slash&gt;js&lt;slash&gt;&lt;anything&gt;.js </code></pre> <p>For example, it should work for both :</p> <ul> <li>c:\mysite\js\common.js (Windows)</li> <li>/var/www/mysite/js/common.js (UNIX)</li> </ul> ...
[ { "answer_id": 242803, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 5, "selected": true, "text": "<p>Does <code>Pattern.quote(File.separator)</code> do the trick?</p>\n\n<p>EDIT: This is available as of Java 1.5 or later....
2008/10/28
[ "https://Stackoverflow.com/questions/242792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12388/" ]
I need to write a regular expression that finds javascript files that match ``` <anypath><slash>js<slash><anything>.js ``` For example, it should work for both : * c:\mysite\js\common.js (Windows) * /var/www/mysite/js/common.js (UNIX) The problem is that the file separator in Windows is not being properly escaped...
Does `Pattern.quote(File.separator)` do the trick? EDIT: This is available as of Java 1.5 or later. For 1.4, you need to simply escape the file separator char: ``` "\\" + File.separator ``` Escaping punctuation characters will not break anything, but escaping letters or numbers unconditionally will either change th...
242,812
<p>I've created a series of radio button controls in C#. <code>(radCompany, radProperty etc.)</code><br> I've set their group name to be the same (282_Type) so they function as a list of radio buttons. </p> <p>How do I retrieve the name <code>(like: ct100$m$dfgadjkfasdghasdkjfg$282_Type)</code> in c# so I can use thi...
[ { "answer_id": 242835, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>You need to reference the <a href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx\" ...
2008/10/28
[ "https://Stackoverflow.com/questions/242812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13911/" ]
I've created a series of radio button controls in C#. `(radCompany, radProperty etc.)` I've set their group name to be the same (282\_Type) so they function as a list of radio buttons. How do I retrieve the name `(like: ct100$m$dfgadjkfasdghasdkjfg$282_Type)` in c# so I can use this in a Javascript method i'm crea...
You need to reference the [ClientID](http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx) of the control; this is the id in the final html. Of course, another approach might be to use some other attribute (such as the css etc), and use [jQuery](http://jquery.com/) to find it; jQuery takes a lot...
242,813
<p><code>console.log(&quot;double&quot;);</code> vs. <code>console.log('single');</code></p> <p>I see more and more JavaScript libraries out there using single quotes when handling strings. What are the reasons to use one over the other?</p> <p>I thought they're pretty much interchangeable.</p>
[ { "answer_id": 242833, "author": "Ady", "author_id": 31395, "author_profile": "https://Stackoverflow.com/users/31395", "pm_score": 11, "selected": true, "text": "<p>The most likely reason for use of single vs. double in different libraries is programmer preference and/or API consistency....
2008/10/28
[ "https://Stackoverflow.com/questions/242813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28150/" ]
`console.log("double");` vs. `console.log('single');` I see more and more JavaScript libraries out there using single quotes when handling strings. What are the reasons to use one over the other? I thought they're pretty much interchangeable.
The most likely reason for use of single vs. double in different libraries is programmer preference and/or API consistency. Other than being consistent, use whichever best suits the string. Using the other type of quote as a literal: ``` alert('Say "Hello"'); alert("Say 'Hello'"); ``` This can get complicated: ```...
242,822
<p>Why would someone use <code>WHERE 1=1 AND &lt;conditions&gt;</code> in a SQL clause (Either SQL obtained through concatenated strings, either view definition)</p> <p>I've seen somewhere that this would be used to protect against SQL Injection, but it seems very weird.</p> <p>If there is injection <code>WHERE 1 = 1...
[ { "answer_id": 242831, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 10, "selected": true, "text": "<p>If the list of conditions is not known at compile time and is instead built at run time, you don't have to worry about...
2008/10/28
[ "https://Stackoverflow.com/questions/242822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23795/" ]
Why would someone use `WHERE 1=1 AND <conditions>` in a SQL clause (Either SQL obtained through concatenated strings, either view definition) I've seen somewhere that this would be used to protect against SQL Injection, but it seems very weird. If there is injection `WHERE 1 = 1 AND injected OR 1=1` would have the sa...
If the list of conditions is not known at compile time and is instead built at run time, you don't have to worry about whether you have one or more than one condition. You can generate them all like: ``` and <condition> ``` and concatenate them all together. With the `1=1` at the start, the initial `and` has somethi...
242,841
<p>Do you think there is a big difference in for...in and for loops? What kind of "for" do you prefer to use and why?</p> <p>Let's say we have an array of associative arrays:</p> <pre><code>var myArray = [{'key': 'value'}, {'key': 'value1'}]; </code></pre> <p>So we can iterate:</p> <pre><code>for (var i = 0; i &lt;...
[ { "answer_id": 242869, "author": "pilsetnieks", "author_id": 6615, "author_profile": "https://Stackoverflow.com/users/6615", "pm_score": 2, "selected": false, "text": "<p>With <em>for (var i in myArray)</em> you can loop over objects too, <em>i</em> will contain the key name and you can ...
2008/10/28
[ "https://Stackoverflow.com/questions/242841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17375/" ]
Do you think there is a big difference in for...in and for loops? What kind of "for" do you prefer to use and why? Let's say we have an array of associative arrays: ``` var myArray = [{'key': 'value'}, {'key': 'value1'}]; ``` So we can iterate: ``` for (var i = 0; i < myArray.length; i++) ``` And: ``` for (var ...
The choice should be based on the which idiom is best understood. An array is iterated using: ``` for (var i = 0; i < a.length; i++) //do stuff with a[i] ``` An object being used as an associative array is iterated using: ``` for (var key in o) //do stuff with o[key] ``` Unless you have earth shattering rea...
242,913
<p>We can see in a directory files ordered by Name in Windows Explorer.</p> <p>If I try the same thing in the Windows command prompt it orders by name differently - <em>correctly</em>:</p> <pre><code>dir *.jpg /ON /B cubierta.jpg pag00.jpg pag06.jpg pag08.jpg pag09.jpg pag100.jpg pag101.jpg pag102.jpg pag103.jpg pag...
[ { "answer_id": 242925, "author": "Biri", "author_id": 968, "author_profile": "https://Stackoverflow.com/users/968", "pm_score": -1, "selected": false, "text": "<p>No, there's no way to do this. Windows Explorer uses a different approach to handle this.</p>\n" }, { "answer_id": 24...
2008/10/28
[ "https://Stackoverflow.com/questions/242913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15530/" ]
We can see in a directory files ordered by Name in Windows Explorer. If I try the same thing in the Windows command prompt it orders by name differently - *correctly*: ``` dir *.jpg /ON /B cubierta.jpg pag00.jpg pag06.jpg pag08.jpg pag09.jpg pag100.jpg pag101.jpg pag102.jpg pag103.jpg pag104.jpg pag105.jpg pag106.jp...
Your best option (if possible) is to add enough leading zeros (two, in this case) to your smaller numbers so that the sort does come out as expected.
242,914
<p>Is it possible in plain JPA or JPA+Hibernate extensions to declare a composite key, where an element of the composite key is a sequence?</p> <p>This is my composite class:</p> <pre><code>@Embeddable public class IntegrationEJBPk implements Serializable { //... @ManyToOne(cascade = {}, fetch = FetchType....
[ { "answer_id": 244051, "author": "sakana", "author_id": 28921, "author_profile": "https://Stackoverflow.com/users/28921", "pm_score": 1, "selected": false, "text": "<p>Try like this:</p>\n\n<pre><code>@TableGenerator(name = \"canonicalKeys\", allocationSize = 1, initialValue = 1)\n@Gener...
2008/10/28
[ "https://Stackoverflow.com/questions/242914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22992/" ]
Is it possible in plain JPA or JPA+Hibernate extensions to declare a composite key, where an element of the composite key is a sequence? This is my composite class: ``` @Embeddable public class IntegrationEJBPk implements Serializable { //... @ManyToOne(cascade = {}, fetch = FetchType.EAGER) @JoinColumn...
I believe that this is not possible with plain JPA.
242,941
<p>I have a main canvas 'blackboard' in a panel, this canvas has itself several children, like a toolbar (tiles), a label and some skinning.</p> <p>The problem is that when I move to the rectangle tool and I start drawing rectangles if I want to change the tool when I click on an other tool such as 'circle' or 'select'...
[ { "answer_id": 242934, "author": "andy", "author_id": 32033, "author_profile": "https://Stackoverflow.com/users/32033", "pm_score": 1, "selected": false, "text": "<p>Portability... though C# isn't really know as lingua franca if you're going for portable, so this might be moot for your p...
2008/10/28
[ "https://Stackoverflow.com/questions/242941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32032/" ]
I have a main canvas 'blackboard' in a panel, this canvas has itself several children, like a toolbar (tiles), a label and some skinning. The problem is that when I move to the rectangle tool and I start drawing rectangles if I want to change the tool when I click on an other tool such as 'circle' or 'select' the butt...
Well, int64 uses 8 byte of memory storage, while int uses 4 byte... however, you pointed out most of the disadvantages already. Of course calculations performed will also be slower on many systems (a 64 bit system running in 64 bit mode can perform operations on 64 bit as fast as on 32 bit, but a 32 bit system needs to...
242,961
<p>I had a method with a lot of persistence calls that used a nHibernate session, it worked, was alright. But I needed to refactor this method, extracting a method from a content inside a loop, for multithread reasons. Then I created an class with this method. It is like a normal refactoring, but the nHibernate session...
[ { "answer_id": 242983, "author": "axk", "author_id": 578, "author_profile": "https://Stackoverflow.com/users/578", "pm_score": 5, "selected": true, "text": "<p>Sessions are <strong>not thread safe</strong> in NHibernate <strong>by design</strong>.\nSo it should be ok as long as you have ...
2008/10/28
[ "https://Stackoverflow.com/questions/242961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21668/" ]
I had a method with a lot of persistence calls that used a nHibernate session, it worked, was alright. But I needed to refactor this method, extracting a method from a content inside a loop, for multithread reasons. Then I created an class with this method. It is like a normal refactoring, but the nHibernate session in...
Sessions are **not thread safe** in NHibernate **by design**. So it should be ok as long as you have a *session used by only one thread*. I'm not sure what you're thingResolver does, but if it does some persistance calls on *the same* session you've created in the originating thread - this most probably the cause of y...
242,975
<p>I have a problem, and was hoping I could rely on some of the experience here for advice and a push in the right direction. I have an MS Access file made by propietary software. I only want to take half the columns from this table, and import into new(not yet setup)mysql database.</p> <p>I have no idea how to do thi...
[ { "answer_id": 243069, "author": "Luis Melgratti", "author_id": 17032, "author_profile": "https://Stackoverflow.com/users/17032", "pm_score": 4, "selected": true, "text": "<p>This is a bash script <strong><em>linux</em></strong> example using <a href=\"http://mdbtools.sourceforge.net/\" ...
2008/10/28
[ "https://Stackoverflow.com/questions/242975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have a problem, and was hoping I could rely on some of the experience here for advice and a push in the right direction. I have an MS Access file made by propietary software. I only want to take half the columns from this table, and import into new(not yet setup)mysql database. I have no idea how to do this or what ...
This is a bash script ***linux*** example using [mdbtools](http://mdbtools.sourceforge.net/) for automatic extraction and import from a mdb file to mysql. ``` #!/bin/bash MDBFILE="Data.mdb" OPTIONS="-H -D %y-%m-%d" mdb-export $OPTIONS $MDBFILE TableName_1 > output_1.txt mdb-export $OPTIONS $MDBFILE TableName_2 >...
243,021
<p>I have a VS2005 windows service where I have the need to use 'useUnsafeHeaderParsing' as per documentation from MSDN.</p> <p>As this is a library used within my windows service, I do not have a web.config to add httpwebrequest element and set useUnsafeHeaderParsing to true.</p> <p>How would I go about achieving th...
[ { "answer_id": 1359326, "author": "Blue Toque", "author_id": 116268, "author_profile": "https://Stackoverflow.com/users/116268", "pm_score": 0, "selected": false, "text": "<p>I'm not sure what the trouble is. </p>\n\n<p>You don't use a web.config with a windows service, you use App.confi...
2008/10/28
[ "https://Stackoverflow.com/questions/243021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a VS2005 windows service where I have the need to use 'useUnsafeHeaderParsing' as per documentation from MSDN. As this is a library used within my windows service, I do not have a web.config to add httpwebrequest element and set useUnsafeHeaderParsing to true. How would I go about achieving this in code. I tri...
You can enable unsafeHeaderParsing programmatically if you wish - here's a function I included in [Quick and Dirty Feed Parser](http://qdfeed.codeplex.com/) for turning that on - it's similar to some of the ones you linked to in your question: ``` private static bool SetUseUnsafeHeaderParsing(bool b) { Ass...
243,022
<p>I'm building an application that needs to run through an XML feed but I'm having a little trouble with getting certain elements.</p> <p>I'm using the <a href="http://twitter.com/statuses/public_timeline.rss" rel="nofollow noreferrer">Twitter feed</a> and want to run through all the <code>&lt;item&gt;</code> element...
[ { "answer_id": 1359326, "author": "Blue Toque", "author_id": 116268, "author_profile": "https://Stackoverflow.com/users/116268", "pm_score": 0, "selected": false, "text": "<p>I'm not sure what the trouble is. </p>\n\n<p>You don't use a web.config with a windows service, you use App.confi...
2008/10/28
[ "https://Stackoverflow.com/questions/243022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2025/" ]
I'm building an application that needs to run through an XML feed but I'm having a little trouble with getting certain elements. I'm using the [Twitter feed](http://twitter.com/statuses/public_timeline.rss) and want to run through all the `<item>` elements. I can connect fine and get the content from the feed but I ca...
You can enable unsafeHeaderParsing programmatically if you wish - here's a function I included in [Quick and Dirty Feed Parser](http://qdfeed.codeplex.com/) for turning that on - it's similar to some of the ones you linked to in your question: ``` private static bool SetUseUnsafeHeaderParsing(bool b) { Ass...
243,027
<p>I've got this ASP.NET drop down control that displays other textbox controls when the value is not UK (this is to help find UK addresses using postcodes). When UK is reselected I will like to hide the other controls. I've enabled view state and AutoPostBack to true. I have an <code>onSelectedIndexChanged</code> even...
[ { "answer_id": 243047, "author": "Aaron Powell", "author_id": 11388, "author_profile": "https://Stackoverflow.com/users/11388", "pm_score": 0, "selected": false, "text": "<p>How are you attaching the event? Are you using doing it code behind like:</p>\n\n<pre><code>this.dropDownList.Sele...
2008/10/28
[ "https://Stackoverflow.com/questions/243027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've got this ASP.NET drop down control that displays other textbox controls when the value is not UK (this is to help find UK addresses using postcodes). When UK is reselected I will like to hide the other controls. I've enabled view state and AutoPostBack to true. I have an `onSelectedIndexChanged` event that only ge...
Every time I've ever had something like this happen it's been because of validation controls. Do those additional textboxes have validators attached to them that could be suppressing the postback? A quick way to tell would be to set CausesValidation="false" on the dropdownlist.
243,035
<p>I have two tables, one stores the products and quantity we have bought, the other stores the sells. The current stock is therefore the sum of all the quantity columns in the bought table minus the number of rows in the sells table. How can this be expressed in MySQL. Remember that there are many different products.<...
[ { "answer_id": 243063, "author": "SquareCog", "author_id": 15962, "author_profile": "https://Stackoverflow.com/users/15962", "pm_score": 4, "selected": true, "text": "<p>Try this</p>\n\n<pre><code>\nSELECT inv_t.product_id, inventory_total-nvl(sales_total,0)\nFROM \n (SELECT product_id,...
2008/10/28
[ "https://Stackoverflow.com/questions/243035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1585/" ]
I have two tables, one stores the products and quantity we have bought, the other stores the sells. The current stock is therefore the sum of all the quantity columns in the bought table minus the number of rows in the sells table. How can this be expressed in MySQL. Remember that there are many different products. **...
Try this ``` SELECT inv_t.product_id, inventory_total-nvl(sales_total,0) FROM (SELECT product_id, sum(quantity) as inventory_total FROM inventory GROUP BY product_id) inv_t LEFT OUTER JOIN (SELECT product_id, count(*) AS sales_total FROM sales GROUP BY product_id) sale_t ON (inv_t.product_id = sa...
243,045
<p>What does Java do with long variables while performing addition?</p> <p>Wrong version 1:</p> <pre><code>Vector speeds = ... //whatever, speeds.size() returns 2 long estimated = 1l; long time = speeds.size() + estimated; // time = 21; string concatenation?? </code></pre> <p>Wrong version 2:</p> <pre><code>Vector ...
[ { "answer_id": 243054, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>I suspect you're not seeing what you think you're seeing. Java doesn't do this.</p>\n\n<p>Please try to provide a <a h...
2008/10/28
[ "https://Stackoverflow.com/questions/243045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32043/" ]
What does Java do with long variables while performing addition? Wrong version 1: ``` Vector speeds = ... //whatever, speeds.size() returns 2 long estimated = 1l; long time = speeds.size() + estimated; // time = 21; string concatenation?? ``` Wrong version 2: ``` Vector speeds = ... //whatever, speeds.size() retur...
I suspect you're not seeing what you think you're seeing. Java doesn't do this. Please try to provide a [short but complete program](http://pobox.com/~skeet/csharp/complete.html) which demonstrates this. Here's a short but complete program which demonstrates correct behaviour, but with your "wrong" code (i.e. a counte...
243,057
<p>I'm using a Response.Redirect to redirect users to another server to download a file, and the other server is checking the header to ensure it came from the correct server... however it seems Response.Redirect strips the headers from the Response.</p> <p>Does anybody know how i can add the headers back? I've tried...
[ { "answer_id": 243073, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 1, "selected": false, "text": "<p>I don't think it's possible. What you are sending back to the client is a Location header that tells the client to ...
2008/10/28
[ "https://Stackoverflow.com/questions/243057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21969/" ]
I'm using a Response.Redirect to redirect users to another server to download a file, and the other server is checking the header to ensure it came from the correct server... however it seems Response.Redirect strips the headers from the Response. Does anybody know how i can add the headers back? I've tried: ``` Resp...
There is an HTML hack available. ``` <form action="http://url.goes.here" id="test" method="GET"></form> <script type="text/javascript"> document.getElementById("test").submit(); </script> ``` If you need to trigger that from a code behind, that can be done too: ```cs Response.Write( @"<form action='http://url.goe...
243,060
<p>Emacs does not recognize my correct Python path. I think it is a general problem with Emacs not recognizing my environment variables. I have GNU Emacs 22.1.1 (i386-apple-darwin8.9.1, Carbon Version 1.6.0) of 2007-06-17 installed.</p> <p>I have set <code>PYTHONPATH</code> in my <code>~/.bashrc</code>. Maybe I should...
[ { "answer_id": 243239, "author": "Chris Conway", "author_id": 1412, "author_profile": "https://Stackoverflow.com/users/1412", "pm_score": 6, "selected": true, "text": "<p><code>.bashrc</code> only gets read when a shell starts; it won't affect Carbon Emacs. Instead, use <code>setenv</cod...
2008/10/28
[ "https://Stackoverflow.com/questions/243060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2007483/" ]
Emacs does not recognize my correct Python path. I think it is a general problem with Emacs not recognizing my environment variables. I have GNU Emacs 22.1.1 (i386-apple-darwin8.9.1, Carbon Version 1.6.0) of 2007-06-17 installed. I have set `PYTHONPATH` in my `~/.bashrc`. Maybe I should set it somewhere else?
`.bashrc` only gets read when a shell starts; it won't affect Carbon Emacs. Instead, use `setenv` in your `.emacs`: ``` (setenv "PYTHONPATH" "PATH_STRING_HERE") ``` You can set `PYTHONPATH` for the entire Mac OS session, by adding it to `~/.MacOSX/environment.plist` (more [here](http://developer.apple.com/documentat...
243,068
<p>How can I create EPS files in C#? Are there any opensource libraries available or do I have to resort to <a href="http://www.adobe.com/devnet/postscript/pdfs/5002.EPSF_Spec.pdf" rel="noreferrer">the spec</a> and do it by hand?</p>
[ { "answer_id": 243239, "author": "Chris Conway", "author_id": 1412, "author_profile": "https://Stackoverflow.com/users/1412", "pm_score": 6, "selected": true, "text": "<p><code>.bashrc</code> only gets read when a shell starts; it won't affect Carbon Emacs. Instead, use <code>setenv</cod...
2008/10/28
[ "https://Stackoverflow.com/questions/243068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25571/" ]
How can I create EPS files in C#? Are there any opensource libraries available or do I have to resort to [the spec](http://www.adobe.com/devnet/postscript/pdfs/5002.EPSF_Spec.pdf) and do it by hand?
`.bashrc` only gets read when a shell starts; it won't affect Carbon Emacs. Instead, use `setenv` in your `.emacs`: ``` (setenv "PYTHONPATH" "PATH_STRING_HERE") ``` You can set `PYTHONPATH` for the entire Mac OS session, by adding it to `~/.MacOSX/environment.plist` (more [here](http://developer.apple.com/documentat...
243,072
<p>When a user logs in to my site I want a css styled button to appear (this could be anything really, i.e. some special news text item etc), how can you do this via masterpages in asp.net? Or is there some other way you do this?</p>
[ { "answer_id": 243075, "author": "Steve Horn", "author_id": 10589, "author_profile": "https://Stackoverflow.com/users/10589", "pm_score": 1, "selected": false, "text": "<p>This MSDN article describes how you can find and manipulate master page content from a content page. </p>\n\n<p><a ...
2008/10/28
[ "https://Stackoverflow.com/questions/243072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5175/" ]
When a user logs in to my site I want a css styled button to appear (this could be anything really, i.e. some special news text item etc), how can you do this via masterpages in asp.net? Or is there some other way you do this?
You haven't provided a whole lot of information about your setup simon, but assuming you're using a .NET Membership Provider, then you can use a login view to have a section of your page render differently for logged in Vs. not ``` <asp:LoginView> <AnonymousTemplate> Nothing Displayed <...
243,082
<p>Let's say I have a <strong>Base</strong> class and several <strong>Derived</strong> classes. Is there any way to cast an object to one of the derived classes without the need to write something like this :</p> <pre><code> string typename = typeid(*object).name(); if(typename == "Derived1") { Derived1 *d1 = stati...
[ { "answer_id": 243105, "author": "moogs", "author_id": 26374, "author_profile": "https://Stackoverflow.com/users/26374", "pm_score": 2, "selected": false, "text": "<p>usually, this is a sign of a bad design. Why do you need to do this? It might be possible to redesign so that this is not...
2008/10/28
[ "https://Stackoverflow.com/questions/243082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31610/" ]
Let's say I have a **Base** class and several **Derived** classes. Is there any way to cast an object to one of the derived classes without the need to write something like this : ``` string typename = typeid(*object).name(); if(typename == "Derived1") { Derived1 *d1 = static_cast< Derived1*>(object); } else if(ty...
Don't. Read up on polymorphism. Almost every "dynamic cast" situation is an example of polymorphism struggling to be implemented. Whatever decision you're making in the dynamic cast has already been made. Just delegate the real work to the subclasses. You left out the most important part of your example. The usefu...
243,083
<p>What is a strongly typed dataset? (.net)</p>
[ { "answer_id": 243093, "author": "Rik", "author_id": 5409, "author_profile": "https://Stackoverflow.com/users/5409", "pm_score": 2, "selected": false, "text": "<p>Short answer: A dataset which is guaranteed (by the compiler) to hold a specific type.</p>\n" }, { "answer_id": 24309...
2008/10/28
[ "https://Stackoverflow.com/questions/243083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
What is a strongly typed dataset? (.net)
A strongly typed dataset is one that has specific types for the tables and their columns. You can say ``` EmployeeDataset ds = ... EmployeeRow row = ds.Employees.Rows[0]; row.Name = "Joe"; ``` instead of: ``` DataSet ds = ... DataRow row = ds.Tables["Employees"].Rows[0]; row["Name"] = "Joe"; ``` This helps becau...
243,097
<p>I have a unit test where I have statically defined a quite large byte array (over 8000 bytes) as the byte data of a file I don't want to read every time I run my unit test.</p> <pre><code>private static final byte[] FILE_DATA = new byte[] { 12,-2,123,................ } </code></pre> <p>This compiles fine within Ec...
[ { "answer_id": 243114, "author": "Shimi Bandiel", "author_id": 15100, "author_profile": "https://Stackoverflow.com/users/15100", "pm_score": 6, "selected": true, "text": "<p>Methods in Java are restricted to 64k in the byte code. Static initializations are done in a single method (see <a...
2008/10/28
[ "https://Stackoverflow.com/questions/243097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I have a unit test where I have statically defined a quite large byte array (over 8000 bytes) as the byte data of a file I don't want to read every time I run my unit test. ``` private static final byte[] FILE_DATA = new byte[] { 12,-2,123,................ } ``` This compiles fine within Eclipse, but when compiling ...
Methods in Java are restricted to 64k in the byte code. Static initializations are done in a single method (see [link](http://www.mail-archive.com/help-bison@gnu.org/msg01990.html)) You may try to load the array data from a file.
243,124
<p>Here is the problem: we have lots of Javascripts and lots of CSS files, which we'd rather be serving minified. Minification is easy: set up the YUI Compressor, run an Ant task, and it spits out minified files, which we save beside the originals.</p> <p>So we end up with the following directory structure somewhere i...
[ { "answer_id": 243135, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 0, "selected": false, "text": "<p>Is it possible to change your build scripts? If so, you can configure them to minify the files and give them the same fi...
2008/10/28
[ "https://Stackoverflow.com/questions/243124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6573/" ]
Here is the problem: we have lots of Javascripts and lots of CSS files, which we'd rather be serving minified. Minification is easy: set up the YUI Compressor, run an Ant task, and it spits out minified files, which we save beside the originals. So we end up with the following directory structure somewhere inside our ...
Here is the configuration that finally worked: /js/.htaccess: ``` RewriteEngine On RewriteBase /js RewriteCond %{REQUEST_URI} ^/js/((.+)\.js)$ RewriteCond %{DOCUMENT_ROOT}/js/min/%2-min.js -f RewriteRule ^(.+)$ min/%2-min.js [L] ``` Same for **css** directory.
243,152
<p>The thing is I've been using the <a href="http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx" rel="noreferrer">lock statement</a> to protect a critical part of my code, but now, I realize I could allow concurrent execution of that critical code is some conditions are met.<br> Is there a way to condition the lock?...
[ { "answer_id": 243168, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 4, "selected": true, "text": "<pre><code>Action doThatThing = someMethod;\n\nif (condition)\n{\n lock(thatThing)\n {\n doThatThing();\n }\n}\nelse\n{\...
2008/10/28
[ "https://Stackoverflow.com/questions/243152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23893/" ]
The thing is I've been using the [lock statement](http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx) to protect a critical part of my code, but now, I realize I could allow concurrent execution of that critical code is some conditions are met. Is there a way to condition the lock?
``` Action doThatThing = someMethod; if (condition) { lock(thatThing) { doThatThing(); } } else { doThatThing(); } ```
243,173
<p>I'm having an issue with a USB project using <code>LIB-USB</code>. The USB device is based on a PIC18F4550 and has a single control endpoint. The PC front-end is written in MSVC and uses Lib-Usb 1.12.</p> <p>On the PC end, the program begins by setting the configuration, claiming the interface, then sending (and re...
[ { "answer_id": 243748, "author": "Ilya", "author_id": 6807, "author_profile": "https://Stackoverflow.com/users/6807", "pm_score": 1, "selected": false, "text": "<p>It's very advisable to have USB bus analyzer <a href=\"http://www.lecroy.com/tm/products/ProtocolAnalyzers/usb.asp?menuid=67...
2008/10/28
[ "https://Stackoverflow.com/questions/243173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm having an issue with a USB project using `LIB-USB`. The USB device is based on a PIC18F4550 and has a single control endpoint. The PC front-end is written in MSVC and uses Lib-Usb 1.12. On the PC end, the program begins by setting the configuration, claiming the interface, then sending (and receiving) control mess...
**It Now Works!!** Of course, I now feel "smart like a bag of hammers" Had I read section 18 thoroughly I would have noticed the line about adding a 220nF capacitor between Vusb and ground. Added a 470nF cap between pin18 and ground and that was all it took .... reliable transfers now. Just another case of `"I forgo...
243,193
<p>I have a set of tables that are used to track bills. These tables are loaded from an SSIS process that runs weekly.</p> <p>I am in the process of creating a second set of tables to track adjustments to the bills that are made via the web. Some of our clients hand key their bills and all of those entries need to be ...
[ { "answer_id": 243312, "author": "HLGEM", "author_id": 9034, "author_profile": "https://Stackoverflow.com/users/9034", "pm_score": 1, "selected": false, "text": "<p>I personally would have the SSIS-fed tables in one database (set to simple recovery mode) and the other tables in a separat...
2008/10/28
[ "https://Stackoverflow.com/questions/243193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11780/" ]
I have a set of tables that are used to track bills. These tables are loaded from an SSIS process that runs weekly. I am in the process of creating a second set of tables to track adjustments to the bills that are made via the web. Some of our clients hand key their bills and all of those entries need to be backed up ...
I ended up using a DDL trigger to make a copy of changes from one table to the other. The only problem is that if a table or column name contains part of a reserved word - ARCH for VARCHAR - it will cause problems with the modification script. Thanks, once again, to [Brent Ozar](https://stackoverflow.com/users/26837/b...
243,200
<p>I'm looking to improve my PHP coding and am wondering what PHP-specific techniques other programmers use to improve productivity or workaround PHP limitations.</p> <p>Some examples:</p> <ol> <li><p>Class naming convention to handle namespaces: <code>Part1_Part2_ClassName</code> maps to file <code>Part1/Part2/Class...
[ { "answer_id": 243254, "author": "changelog", "author_id": 5646, "author_profile": "https://Stackoverflow.com/users/5646", "pm_score": 3, "selected": false, "text": "<p>My experience with PHP has taught me a few things. To name a few:</p>\n\n<ul>\n<li>Always output errors. These are the ...
2008/10/28
[ "https://Stackoverflow.com/questions/243200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4890/" ]
I'm looking to improve my PHP coding and am wondering what PHP-specific techniques other programmers use to improve productivity or workaround PHP limitations. Some examples: 1. Class naming convention to handle namespaces: `Part1_Part2_ClassName` maps to file `Part1/Part2/ClassName.php` 2. `if ( count($arrayName) ) ...
Ultimately, you'll get the most out of PHP first by learning generally good programming practices, before focusing on anything PHP-specific. Having said that... --- Apply liberally for fun and profit: ----------------------------------- 1. Iterators in foreach loops. There's almost never a wrong time. 2. Design arou...
243,206
<p>I'm trying to integrate against a SOAP web service, running on Apache Axis. The WSDL specifies a namespace with a URI, that looks like:</p> <pre><code>&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:stns="java:dk.tdc.serviceproviderweb.datatypes" elementFormDefault="qualified" attributeFor...
[ { "answer_id": 245179, "author": "Dave DiFranco", "author_id": 30547, "author_profile": "https://Stackoverflow.com/users/30547", "pm_score": 1, "selected": true, "text": "<p>Your snippet is the beginning of an XML schema that defines the contents of the \"java:dk.tdc.serviceproviderweb.d...
2008/10/28
[ "https://Stackoverflow.com/questions/243206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18180/" ]
I'm trying to integrate against a SOAP web service, running on Apache Axis. The WSDL specifies a namespace with a URI, that looks like: ``` <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:stns="java:dk.tdc.serviceproviderweb.datatypes" elementFormDefault="qualified" attributeFormDefault="qualifi...
Your snippet is the beginning of an XML schema that defines the contents of the "java:dk.tdc.serviceproviderweb.datatypes" namespace. (The targetNamespace attribute indicates this). So it shouldn't matter if you're handling this with java or PHP on the client side, as long as the rest of this schema is valid.
243,217
<p>I keep it in single line, if it's short. Lately I've been using this style for longer or nested ternary operator expressions. A contrived example:</p> <pre><code>$value = ( $a == $b ) ? 'true value # 1' : ( $a == $c ) ? 'true value # 2' : 'false value'; </cod...
[ { "answer_id": 243226, "author": "Tim", "author_id": 10755, "author_profile": "https://Stackoverflow.com/users/10755", "pm_score": 1, "selected": false, "text": "<p>I don't use it. It always smelled to me like trying to save space and typing in source code with the expectation that smal...
2008/10/28
[ "https://Stackoverflow.com/questions/243217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1897/" ]
I keep it in single line, if it's short. Lately I've been using this style for longer or nested ternary operator expressions. A contrived example: ``` $value = ( $a == $b ) ? 'true value # 1' : ( $a == $c ) ? 'true value # 2' : 'false value'; ``` Personally wh...
The ternary operator is generally to be avoided, but this form can be quite readable: ``` result = (foo == bar) ? result1 : (foo == baz) ? result2 : (foo == qux) ? result3 : (foo == quux) ? result4 : fail_result; ``` This way, the condition and the re...
243,232
<p>Inside my page, I have the following:</p> <pre><code>&lt;aspe:UpdatePanel runat="server" ID="updatePanel"&gt; &lt;ContentTemplate&gt; &lt;local:KeywordSelector runat="server" ID="ksKeywords" /&gt; &lt;/ContentTemplate&gt; &lt;/aspe:UpdatePanel&gt; </code></pre> <p>The <code>KeywordSelector</code> c...
[ { "answer_id": 243493, "author": "Omer van Kloeten", "author_id": 4979, "author_profile": "https://Stackoverflow.com/users/4979", "pm_score": 6, "selected": true, "text": "<p>Well, I've found the problem(s):</p>\n\n<ol>\n<li><p><em>User Controls</em>, as opposed to <em>Custom Controls</e...
2008/10/28
[ "https://Stackoverflow.com/questions/243232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4979/" ]
Inside my page, I have the following: ``` <aspe:UpdatePanel runat="server" ID="updatePanel"> <ContentTemplate> <local:KeywordSelector runat="server" ID="ksKeywords" /> </ContentTemplate> </aspe:UpdatePanel> ``` The `KeywordSelector` control is a control I define in the same assembly and `local` is ma...
Well, I've found the problem(s): 1. *User Controls*, as opposed to *Custom Controls* must be registered one-by-one in the *web.config* file. Do this: `<add tagPrefix="local" tagName="KeywordSelector" src="~/KeywordSelector.ascx" />` instead of: `<add tagPrefix="local" namespace="Keywords" assembly="Keywords" />` 2....
243,242
<p>I had the following piece of code (simplified for this question):</p> <pre><code>struct StyleInfo { int width; int height; }; typedef int (StyleInfo::*StyleInfoMember); void AddStyleInfoMembers(std::vector&lt;StyleInfoMember&gt;&amp; members) { members.push_back(&amp;StyleInfo::width); members.pus...
[ { "answer_id": 243396, "author": "Steve Jessop", "author_id": 13005, "author_profile": "https://Stackoverflow.com/users/13005", "pm_score": 1, "selected": false, "text": "<p>Is it definitely possible? I honestly don't know, never having played much with pointer-to-member.</p>\n\n<p>Suppo...
2008/10/28
[ "https://Stackoverflow.com/questions/243242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455874/" ]
I had the following piece of code (simplified for this question): ``` struct StyleInfo { int width; int height; }; typedef int (StyleInfo::*StyleInfoMember); void AddStyleInfoMembers(std::vector<StyleInfoMember>& members) { members.push_back(&StyleInfo::width); members.push_back(&StyleInfo::height); ...
Remember a pointer to a member is just used like a member. ``` Obj x; int y = (x.*)ptrMem; ``` But like normal members you can not access members of subclasses using the member access mechanism. So what you need to do is access it like you would access a member of the object (in your case via the size member). ...
243,266
<p>Core Animation allows for custom animations by implementing the actionForKey method in your CALayer based class:</p> <pre><code>- (id&lt;CAAction&gt;)actionForKey:(NSString *)key { // Custom animations return [super actionForKey:key]; } </code></pre> <p>I can then create an animation and return it for the ...
[ { "answer_id": 245089, "author": "Colin Barrett", "author_id": 23106, "author_profile": "https://Stackoverflow.com/users/23106", "pm_score": 0, "selected": false, "text": "<p>Have you verified that your method is being called with <code>key</code> as <code>@\"onOrderOut\"</code> and that...
2008/10/28
[ "https://Stackoverflow.com/questions/243266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9454/" ]
Core Animation allows for custom animations by implementing the actionForKey method in your CALayer based class: ``` - (id<CAAction>)actionForKey:(NSString *)key { // Custom animations return [super actionForKey:key]; } ``` I can then create an animation and return it for the `onOrderIn` action (i.e. when th...
Quoting John Harper on [quartz-dev mailing list](http://lists.apple.com/archives/quartz-dev/2008/Nov/msg00039.html): > > There's a fundamental problem with > returning any animation for the > onOrderOut key—by the time the > animation should be running, the layer > is no longer in the tree, so it has no > effect. So ...
243,267
<p>I'm looking for an efficient way of searching through a dataset to see if an item exists. I have an arraylist of ~6000 items and I need to determine which of those doesn't exist in the dataset by comparing each item within the arraylist with data in a particular column of the dataset.</p> <p>I attempted to loop th...
[ { "answer_id": 243297, "author": "Brian Boatright", "author_id": 3747, "author_profile": "https://Stackoverflow.com/users/3747", "pm_score": 2, "selected": false, "text": "<p>Try switching your array list to Generics. From what I understand they are much faster than an array list.</p>\n\...
2008/10/28
[ "https://Stackoverflow.com/questions/243267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32059/" ]
I'm looking for an efficient way of searching through a dataset to see if an item exists. I have an arraylist of ~6000 items and I need to determine which of those doesn't exist in the dataset by comparing each item within the arraylist with data in a particular column of the dataset. I attempted to loop through each ...
Try switching your array list to Generics. From what I understand they are much faster than an array list. Here is a previous SO on [Generics vs Array List](https://stackoverflow.com/questions/94884/generics-vs-array-lists)
243,269
<p>Windows Mobile pops up a "busy wheel" - a rotating colour disk - when things are happening . I can't find in the documentation how this is done - can someone point me in the right direction?</p> <p>We have a situation where we need to prompt the user to say we're doing stuff for a while, but we don't know how long...
[ { "answer_id": 243282, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 2, "selected": false, "text": "<p>I'm just guessing here, but I'd imagine it is <a href=\"http://msdn.microsoft.com/en-us/library/wc7bzytb%28VS.80%29.aspx\...
2008/10/28
[ "https://Stackoverflow.com/questions/243269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21755/" ]
Windows Mobile pops up a "busy wheel" - a rotating colour disk - when things are happening . I can't find in the documentation how this is done - can someone point me in the right direction? We have a situation where we need to prompt the user to say we're doing stuff for a while, but we don't know how long it will ta...
Use [SetCursor](http://msdn.microsoft.com/en-us/library/ms940016.aspx)/[LoadCursor](http://msdn.microsoft.com/en-us/library/aa453410.aspx)/[ShowCursor](http://msdn.microsoft.com/en-us/library/aa453730.aspx) APIs, like this: ``` SetCursor(LoadCursor(NULL, IDC_WAIT)); // my code ShowCursor(FALSE); ```
243,277
<p>My SQL is rusty -- I have a simple requirement to calculate the sum of the greater of two column values:</p> <pre><code>CREATE TABLE [dbo].[Test] ( column1 int NOT NULL, column2 int NOT NULL ); insert into Test (column1, column2) values (2,3) insert into Test (column1, column2) values (6,3) insert into Te...
[ { "answer_id": 243292, "author": "StingyJack", "author_id": 16391, "author_profile": "https://Stackoverflow.com/users/16391", "pm_score": 1, "selected": false, "text": "<p>Try this... Its not the best performing option, but should work. </p>\n\n<pre><code>SELECT\n 'LargerValue' = CASE \...
2008/10/28
[ "https://Stackoverflow.com/questions/243277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18482/" ]
My SQL is rusty -- I have a simple requirement to calculate the sum of the greater of two column values: ``` CREATE TABLE [dbo].[Test] ( column1 int NOT NULL, column2 int NOT NULL ); insert into Test (column1, column2) values (2,3) insert into Test (column1, column2) values (6,3) insert into Test (column1, c...
Try this: ``` SELECT SUM(CASE WHEN column1 > column2 THEN column1 ELSE column2 END) FROM test ```
243,351
<p>Is it ever OK to use <code>Environment.TickCount</code>to calculate time spans?</p> <pre><code>int start = Environment.TickCount; // Do stuff int duration = Environment.TickCount - start; Console.WriteLine("That took " + duration " ms"); </code></pre> <p>Because <code>TickCount</code> is signed and will rollover a...
[ { "answer_id": 243357, "author": "Grzenio", "author_id": 5363, "author_profile": "https://Stackoverflow.com/users/5363", "pm_score": 7, "selected": true, "text": "<p>Use Stopwatch class. There is a decent example on msdn: <a href=\"http://msdn.microsoft.com/en-us/library/system.diagnosti...
2008/10/28
[ "https://Stackoverflow.com/questions/243351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27414/" ]
Is it ever OK to use `Environment.TickCount`to calculate time spans? ``` int start = Environment.TickCount; // Do stuff int duration = Environment.TickCount - start; Console.WriteLine("That took " + duration " ms"); ``` Because `TickCount` is signed and will rollover after 25 days (it takes 50 days to hit all 32 bit...
Use Stopwatch class. There is a decent example on msdn: <http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx> ``` Stopwatch stopWatch = Stopwatch.StartNew(); Thread.Sleep(10000); stopWatch.Stop(); // Get the elapsed time as a TimeSpan value. TimeSpan ts = stopWatch.Elapsed; `...
243,355
<p>Is there a way to quickly list which sites are on which IP address in IIS 7? </p> <p>If I remember correctly you could sort a view of domains by IP in IIS 6 which was a big help to me in seeing which IPs I had available.</p>
[ { "answer_id": 243370, "author": "Kieron", "author_id": 5791, "author_profile": "https://Stackoverflow.com/users/5791", "pm_score": 2, "selected": false, "text": "<p>You can try this script:</p>\n\n<pre><code>MachineName = \"localhost\"\nIIsObjectPath = \"IIS://\" &amp; MachineName &amp;...
2008/10/28
[ "https://Stackoverflow.com/questions/243355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34548/" ]
Is there a way to quickly list which sites are on which IP address in IIS 7? If I remember correctly you could sort a view of domains by IP in IIS 6 which was a big help to me in seeing which IPs I had available.
Take a look at [APPCMD](http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/#HowToUse) . For example, to list all sites on the machine, use this command-line: ``` %systemroot%\system32\inetsrv\APPCMD list sites ```
243,363
<p>Can someone explain the structure of a Pid in Erlang?</p> <p>Pids looks like this: <code>&lt;A.B.C&gt;</code>, e.g. <code>&lt;0.30.0&gt;</code> , but I would like to know what is the meaning of these three &quot;bits&quot;: <code>A</code>, <code>B</code> and <code>C</code>.</p> <p><code>A</code> seems to be always <...
[ { "answer_id": 243519, "author": "Ruben", "author_id": 26919, "author_profile": "https://Stackoverflow.com/users/26919", "pm_score": 2, "selected": false, "text": "<p>The PID refers to a process and a node table. So you can only send a message directly to a PID if it is known in the nod...
2008/10/28
[ "https://Stackoverflow.com/questions/243363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15539/" ]
Can someone explain the structure of a Pid in Erlang? Pids looks like this: `<A.B.C>`, e.g. `<0.30.0>` , but I would like to know what is the meaning of these three "bits": `A`, `B` and `C`. `A` seems to be always `0` on a local node, but this value changes when the Pid's owner is located on another node. Is it poss...
Printed process ids < A.B.C > are composed of [6](http://github.com/mfoemmel/erlang-otp/blob/R13B/erts/emulator/beam/erl_term.h#L502): * A, the node number (0 is the local node, an arbitrary number for a remote node) * B, the first 15 bits of the process number (an index into the process table) [7](http://github.com/m...
243,365
<p>I was just reading this <a href="https://stackoverflow.com/questions/243082/c-casting-programmatically-can-it-be-done">thread</a> and it occurred to me that there is one seemingly-valid use of that pattern the OP is asking about. I know I've used it before to implement dynamic creation of objects. As far as I know...
[ { "answer_id": 243401, "author": "Mr Fooz", "author_id": 25050, "author_profile": "https://Stackoverflow.com/users/25050", "pm_score": 2, "selected": false, "text": "<p>What you're describing here is termed the <a href=\"http://en.wikipedia.org/wiki/Factory_method_pattern\" rel=\"nofollo...
2008/10/28
[ "https://Stackoverflow.com/questions/243365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10861/" ]
I was just reading this [thread](https://stackoverflow.com/questions/243082/c-casting-programmatically-can-it-be-done) and it occurred to me that there is one seemingly-valid use of that pattern the OP is asking about. I know I've used it before to implement dynamic creation of objects. As far as I know, there is no be...
I think what you are asking is how to keep the object creation code with the objects themselves. This is usually what I do. It assumes that there is some key that gives you a type (int tag, string, etc). I make a class that has a map of key to factory functions, and a registration function that takes a key and factory...
243,368
<p>How do I programmatically reset the Excel <code>Find and Replace</code> dialog box parameters to defaults ("Find what", "Replace with", "Within", "Search", "Look in", "Match case", "Match entire cell contents")?</p> <p>I am using <code>Application.FindFormat.Clear</code> and <code>Application.ReplaceFormat.Clear</c...
[ { "answer_id": 245276, "author": "Lance Roberts", "author_id": 13295, "author_profile": "https://Stackoverflow.com/users/13295", "pm_score": 1, "selected": false, "text": "<p>You can use the following command to open the \"Replace\" dialog with fields filled: </p>\n\n<p><strong>Applicat...
2008/10/28
[ "https://Stackoverflow.com/questions/243368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I programmatically reset the Excel `Find and Replace` dialog box parameters to defaults ("Find what", "Replace with", "Within", "Search", "Look in", "Match case", "Match entire cell contents")? I am using `Application.FindFormat.Clear` and `Application.ReplaceFormat.Clear` to reset find and replace cell formats...
You can use this macro to reset find & replace. Unfortunately, you have to call them both as there are one or two arguments unique to each, so if you want to reset everything, you're stuck. There is no 'reset', so the only way I have found is to execute a fake find & replace using the default parameters. ``` Sub Reset...
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
[ { "answer_id": 243393, "author": "mspmsp", "author_id": 21724, "author_profile": "https://Stackoverflow.com/users/21724", "pm_score": 0, "selected": false, "text": "<p>img's use GET. You'll have to come up with another mechanism. How about calling the same functionality in image.py and...
2008/10/28
[ "https://Stackoverflow.com/questions/243375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27478/" ]
I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code: ``` <img src="image.py?text=xxxxxxxxxxxxxx"> ``` The problem is that I expect in the future the "text" field will get very long and the URL will become too large. From Goo...
Store the text somewhere (e.g. a database) and then pass through the primary key.
243,383
<p>I was reading about parsers and parser generators and found this statement in wikipedia's LR parsing -page:</p> <blockquote> <p>Many programming languages can be parsed using some variation of an LR parser. One notable exception is C++.</p> </blockquote> <p>Why is it so? What particular property of C++ causes it...
[ { "answer_id": 243447, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 8, "selected": true, "text": "<p>There is an interesting thread on <a href=\"http://lambda-the-ultimate.org/\" rel=\"noreferrer\">Lambda the Ultimate</a...
2008/10/28
[ "https://Stackoverflow.com/questions/243383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21711/" ]
I was reading about parsers and parser generators and found this statement in wikipedia's LR parsing -page: > > Many programming languages can be parsed using some variation of an LR parser. One notable exception is C++. > > > Why is it so? What particular property of C++ causes it to be impossible to parse with ...
There is an interesting thread on [Lambda the Ultimate](http://lambda-the-ultimate.org/) that discusses the [LALR grammar for C++](http://lambda-the-ultimate.org/node/2158#comment-27800). It includes a link to a [PhD thesis](http://www.computing.surrey.ac.uk/research/dsrg/fog/FogThesis.pdf) that includes a discussion...
243,388
<p>I <del>understand (I think) the basic idea behind RESTful-ness. Use HTTP methods semantically - GET gets, PUT puts, DELETE deletes, etc... Right?</del> thought I understood the idea behind REST, but I think I'm confusing that with the details of an HTTP implementation. What is the driving idea behind rest, why is ...
[ { "answer_id": 243437, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 3, "selected": false, "text": "<p>REST is an architecture where resources are defined and addressed. </p>\n\n<p>To understand REST best, you should ...
2008/10/28
[ "https://Stackoverflow.com/questions/243388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/96/" ]
I ~~understand (I think) the basic idea behind RESTful-ness. Use HTTP methods semantically - GET gets, PUT puts, DELETE deletes, etc... Right?~~ thought I understood the idea behind REST, but I think I'm confusing that with the details of an HTTP implementation. What is the driving idea behind rest, why is this becomin...
This is what REST might look like: ``` POST /user fname=John&lname=Doe&age=25 ``` The server responds: ``` 201 Created Location: /user/123 ``` In the future, you can then retrieve the user information: ``` GET /user/123 ``` The server responds (assuming an XML response): ``` 200 OK <user><fname>John</fname><l...
243,409
<p>I need to set the fetch mode on my hibernate mappings to be eager in some cases, and lazy in others. I have my default (set through the hbm file) as lazy="true". How do I override this setting in code? MyClass has a set defined of type MyClass2 for which I want to set the FetchMode to EAGER.</p> <p>Currently, I hav...
[ { "answer_id": 243488, "author": "Mat Mannion", "author_id": 6282, "author_profile": "https://Stackoverflow.com/users/6282", "pm_score": 4, "selected": true, "text": "<p>You could try something like this: (code off the top of my head)</p>\n\n<pre><code>Criteria crit = session.createCrite...
2008/10/28
[ "https://Stackoverflow.com/questions/243409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23249/" ]
I need to set the fetch mode on my hibernate mappings to be eager in some cases, and lazy in others. I have my default (set through the hbm file) as lazy="true". How do I override this setting in code? MyClass has a set defined of type MyClass2 for which I want to set the FetchMode to EAGER. Currently, I have somethin...
You could try something like this: (code off the top of my head) ``` Criteria crit = session.createCriteria(MyClass.class); crit.add(Restrictions.eq("id", myClassId)); crit.setFetchMode("myProperty", FetchMode.EAGER); MyClass myThingy = (MyClass)crit.uniqueResult(); ``` I believe that FetchMode.JOIN or FetchMode.SEL...
243,417
<p>How do you pass "this" to the constructor for ObjectDataProvider in XAML.</p> <p>Lets say my presenter class is:</p> <pre><code>public class ApplicationPresenter(IView view){} </code></pre> <p>and that my UserControl implements IView.</p> <p>What do I pass to the ConstructorParameters in the code below so that t...
[ { "answer_id": 243429, "author": "Joachim Kerschbaumer", "author_id": 20227, "author_profile": "https://Stackoverflow.com/users/20227", "pm_score": 0, "selected": false, "text": "<p>i don't know if it works, but you could give your user control a name , e.g.</p>\n\n<pre><code>x:Name=\"my...
2008/10/28
[ "https://Stackoverflow.com/questions/243417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30046/" ]
How do you pass "this" to the constructor for ObjectDataProvider in XAML. Lets say my presenter class is: ``` public class ApplicationPresenter(IView view){} ``` and that my UserControl implements IView. What do I pass to the ConstructorParameters in the code below so that the UserControl can create the Applicatio...
I'm just starting with Wpf and was under the misapprehension that I should be trying to do everything in XAML. I've just watched a few videos from [WindowsClient.net](http://windowsclient.net/) which are starting to clear some things up. But boy is this a complex technology!!!
243,464
<p>I was mapping a relation using something like the following </p> <pre><code>&lt;map name="Foo" cascade="all-delete-orphan" lazy="false"&gt; &lt;key column="FooId"/&gt; &lt;index column="FooType" type="Domain.Enum.FooType, Domain"/&gt; &lt;element column ="FooStatus" type="Domain.Enum.FooStatus, Domain"/&gt; &...
[ { "answer_id": 247036, "author": "Nikelman", "author_id": 32388, "author_profile": "https://Stackoverflow.com/users/32388", "pm_score": 0, "selected": false, "text": "<p>Forget to add </p>\n\n<pre><code>namespace Domain \n{\npublic virtual IDictionary&lt;FooType, FooStatus&gt; MyFoo { se...
2008/10/28
[ "https://Stackoverflow.com/questions/243464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I was mapping a relation using something like the following ``` <map name="Foo" cascade="all-delete-orphan" lazy="false"> <key column="FooId"/> <index column="FooType" type="Domain.Enum.FooType, Domain"/> <element column ="FooStatus" type="Domain.Enum.FooStatus, Domain"/> </map> ``` The class is like this ``...
ANSWER From Fluent NHibernate Google group were I asked the same question The short answer is no, you cannot do this with the fluent interface at the moment. My initial implementation of AsMap() was rather naive and does not support your scenario. I will raise it as an issue and get back to you once a fix is in pla...
243,489
<p>I am doing an Financial Winforms application and am having some trouble with the controls.</p> <p>My customer needs to insert decimal values all over the place (Prices, Discounts etc) and I'd like to avoid some of the repeating validation.</p> <p>So I immediately tried the MaskedTextBox that would fit my needs (wi...
[ { "answer_id": 243502, "author": "Nick", "author_id": 1490, "author_profile": "https://Stackoverflow.com/users/1490", "pm_score": 3, "selected": false, "text": "<p>You will need a custom control. Just trap the Validating event on the control and check if the string input can be parsed a...
2008/10/28
[ "https://Stackoverflow.com/questions/243489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21699/" ]
I am doing an Financial Winforms application and am having some trouble with the controls. My customer needs to insert decimal values all over the place (Prices, Discounts etc) and I'd like to avoid some of the repeating validation. So I immediately tried the MaskedTextBox that would fit my needs (with a Mask like "€...
This two overriden methods did it for me (disclaimer: this code is not in production yet. You may need to modify) ``` protected override void OnKeyPress(KeyPressEventArgs e) { if (!char.IsNumber(e.KeyChar) & (Keys)e.KeyChar != Keys.Back & e.KeyChar != '.') { e.Handled =...
243,494
<p>I have some legacy code that uses VBA to parse a word document and build some XML output; </p> <p>Needless to say it runs like a dog but I was interested in profiling it to see where it's breaking down and maybe if there are some options to make it faster.</p> <p>I don't want to try anything until I can start meas...
[ { "answer_id": 243545, "author": "Svante Svenson", "author_id": 19707, "author_profile": "https://Stackoverflow.com/users/19707", "pm_score": 0, "selected": false, "text": "<p>Insert a bunch of</p>\n\n<pre><code>Debug.Print \"before/after foo\", Now\n</code></pre>\n\n<p>before and after ...
2008/10/28
[ "https://Stackoverflow.com/questions/243494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24525/" ]
I have some legacy code that uses VBA to parse a word document and build some XML output; Needless to say it runs like a dog but I was interested in profiling it to see where it's breaking down and maybe if there are some options to make it faster. I don't want to try anything until I can start measuring my results ...
Using a class and #if would make that "adding code to each method" a little easier... ***Profiler* Class Module:**: ``` #If PROFILE = 1 Then Private m_locationName As String Private Sub Class_Initialize() m_locationName = "unknown" End Sub Public Sub Start(locationName As String) m_locationName = locationNa...
243,510
<p>Does anyone know what is wrong with this query?</p> <pre><code> SELECT DISTINCT c.CN as ClaimNumber, a.ItemDate as BillReceivedDate, c.DTN as DocTrackNumber FROM ItemData a, ItemDataPage b, KeyGroupData c WHERE a.ItemTypeNum in (112, 113, 116, 172, 189) AND a....
[ { "answer_id": 243520, "author": "Chris Conway", "author_id": 2849, "author_profile": "https://Stackoverflow.com/users/2849", "pm_score": 2, "selected": false, "text": "<p>Nevermind, executing in SQL Plus gave me a more informative answer. The DateStored needs to be in the select stateme...
2008/10/28
[ "https://Stackoverflow.com/questions/243510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2849/" ]
Does anyone know what is wrong with this query? ``` SELECT DISTINCT c.CN as ClaimNumber, a.ItemDate as BillReceivedDate, c.DTN as DocTrackNumber FROM ItemData a, ItemDataPage b, KeyGroupData c WHERE a.ItemTypeNum in (112, 113, 116, 172, 189) AND a.ItemNum = b.It...
You will need to modify the query as such: ``` SELECT DISTINCT c.CN as ClaimNumber, a.ItemDate as BillReceivedDate, c.DTN as DocTrackNumber, a.DateStored FROM ItemData a, ItemDataPage b, KeyGroupData c WHERE a.ItemTypeNum in (112, 113, 116, 172, 189) AND a.ItemNu...
243,567
<p>The database type is PostGres 8.3.</p> <p>If I wrote: </p> <pre><code>SELECT field1, field2, field3, count(*) FROM table1 GROUP BY field1, field2, field3 having count(*) &gt; 1; </code></pre> <p>I have some rows that have a count over 1. How can I take out the duplicate (I do still want 1 row for each of them in...
[ { "answer_id": 243627, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 0, "selected": false, "text": "<p>One possible answer is:</p>\n\n<pre><code>CREATE &lt;temporary table&gt; (&lt;correct structure for table bein...
2008/10/28
[ "https://Stackoverflow.com/questions/243567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
The database type is PostGres 8.3. If I wrote: ``` SELECT field1, field2, field3, count(*) FROM table1 GROUP BY field1, field2, field3 having count(*) > 1; ``` I have some rows that have a count over 1. How can I take out the duplicate (I do still want 1 row for each of them instead of +1 row... I do not want to ...
This is one of many reasons that all tables should have a primary key (not necessarily an ID number or IDENTITY, but a combination of one or more columns that uniquely identifies a row and which has its uniqueness enforced in the database). Your best bet is something like this: ``` SELECT field1, field2, field3, coun...