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
494,561
<p>What reasoning exists behind making C# case sensitive?</p> <p>I'm considering switching from VB.NET to take advantage of some language features (CCR and yield), and understanding the reasoning behind this difference may make the transition easier.</p> <p>[UPDATE] Well I took the plunge three days ago. Learning C#...
[ { "answer_id": 494567, "author": "Bhushan Bhangale", "author_id": 57423, "author_profile": "https://Stackoverflow.com/users/57423", "pm_score": 2, "selected": false, "text": "<p>Probably copied from C, C++, Java, etc. or may be kept the same on purpose so that its similar to what other l...
2009/01/30
[ "https://Stackoverflow.com/questions/494561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30576/" ]
What reasoning exists behind making C# case sensitive? I'm considering switching from VB.NET to take advantage of some language features (CCR and yield), and understanding the reasoning behind this difference may make the transition easier. [UPDATE] Well I took the plunge three days ago. Learning C# hasn't been parti...
C# is case sensistive because it takes after the C style languages which are all case sensitive. This is from memory here's an [MSDN link](http://msdn.microsoft.com/en-us/vcsharp/aa336811.aspx) which is not working for me right now I can't verify. I would also like to point out that this is a very valid use case: ```...
494,562
<p>I am using a custom UITableViewCell which has some labels, buttons and image views to be displayed. There is one label in the cell whose text is a <code>NSString</code> object and the length of string could be variable. Due to this, I cannot set a constant height to the cell in the <code>UITableView</code>'s <code>h...
[ { "answer_id": 497590, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 9, "selected": false, "text": "<p>Your <code>UITableViewDelegate</code> should implement <code>tableView:heightForRowAtIndexPath:</code></p>\n\n<p><strong...
2009/01/30
[ "https://Stackoverflow.com/questions/494562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55817/" ]
I am using a custom UITableViewCell which has some labels, buttons and image views to be displayed. There is one label in the cell whose text is a `NSString` object and the length of string could be variable. Due to this, I cannot set a constant height to the cell in the `UITableView`'s `heightForCellAtIndex` method. T...
Your `UITableViewDelegate` should implement `tableView:heightForRowAtIndexPath:` **Objective-C** ``` - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return [indexPath row] * 20; } ``` **Swift 5** ``` func tableView(_ tableView: UITableView, heightForRowAt indexP...
494,571
<p>I have a class whose object must be created on the heap. Is there any better way of doing this other than this:</p> <pre><code>class A { public: static A* createInstance(); //Allocate using new and return static void deleteInstance(A*); //Free the memory using delete private: //Constructor and destructor are...
[ { "answer_id": 494585, "author": "Uri", "author_id": 23072, "author_profile": "https://Stackoverflow.com/users/23072", "pm_score": 3, "selected": true, "text": "<p>This is pretty much the standard pattern for making the object heap-only.</p>\n\n<p>Can't really be simplified much, except ...
2009/01/30
[ "https://Stackoverflow.com/questions/494571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39742/" ]
I have a class whose object must be created on the heap. Is there any better way of doing this other than this: ``` class A { public: static A* createInstance(); //Allocate using new and return static void deleteInstance(A*); //Free the memory using delete private: //Constructor and destructor are private so th...
This is pretty much the standard pattern for making the object heap-only. Can't really be simplified much, except that you could just make the destructor private without forcing the use of a factory method for creation.
494,597
<p>I'm pretty sure this is possible, because I'm pretty sure I've seen it done. I think it is awesome, but I will gladly accept answers along the lines of "this is a terrible idea because ____".</p> <p>Say we have a basic struct.</p> <pre><code>struct vertex { float x, y, z; }; </code></pre> <p>Now, I want to im...
[ { "answer_id": 494611, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 4, "selected": false, "text": "<p>Use a union?</p>\n\n<pre><code>union vertex\n{\n struct { float x, y, z; };\n struct { float r, g, b; };...
2009/01/30
[ "https://Stackoverflow.com/questions/494597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49697/" ]
I'm pretty sure this is possible, because I'm pretty sure I've seen it done. I think it is awesome, but I will gladly accept answers along the lines of "this is a terrible idea because \_\_\_\_". Say we have a basic struct. ``` struct vertex { float x, y, z; }; ``` Now, I want to implement aliases on these vari...
What I would do is make accessors: ``` struct Vertex { float& r() { return values[0]; } float& g() { return values[1]; } float& b() { return values[2]; } float& x() { return values[0]; } float& y() { return values[1]; } float& z() { return values[2]; } float operator [] (unsigned i) cons...
494,616
<p>How do I set up an .htaccess file to redirect requests to another folder on another domain? I don't want the links to break, I just want them to go elsewhere. Say mysite.com/image.jpg would redirect to site2.com/images/image.jpg.</p>
[ { "answer_id": 494683, "author": "HappyCodeMonkey", "author_id": 15875, "author_profile": "https://Stackoverflow.com/users/15875", "pm_score": 0, "selected": false, "text": "<p>This should help:</p>\n\n<p>Redirect 301 / <a href=\"http://www.example.com/\" rel=\"nofollow noreferrer\">http...
2009/01/30
[ "https://Stackoverflow.com/questions/494616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I set up an .htaccess file to redirect requests to another folder on another domain? I don't want the links to break, I just want them to go elsewhere. Say mysite.com/image.jpg would redirect to site2.com/images/image.jpg.
In .htaccess (in Apache at least): ``` RewriteEngine On RewriteBase / RewriteRule ^images/(.*)$ http://www.yahoo.com/blah/$1 [R=302,L] ```
494,623
<p>I want code for hiding multiple child forms in MDI. whenever i click child form it must be in front.other forms will automatically hide. How can i do this? pls any one reply me.</p> <p>Thanks in advance</p>
[ { "answer_id": 494661, "author": "Sesh", "author_id": 38212, "author_profile": "https://Stackoverflow.com/users/38212", "pm_score": 0, "selected": false, "text": "<p>In Windows, there can be only form that is active at any point of time. So when user clicks on one form, if you set it to ...
2009/01/30
[ "https://Stackoverflow.com/questions/494623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want code for hiding multiple child forms in MDI. whenever i click child form it must be in front.other forms will automatically hide. How can i do this? pls any one reply me. Thanks in advance
If you watch the MdiChildActivate event, you hide all MDI children that are not active like this: ``` private void MDIMain_MdiChildActivate(Object sender, EventArgs e) { foreach(From f in this.MdiChildren) { if(this.ActiveMdiChild != f) f.Hide(); } } ```
494,629
<p>I'm building Boost (I'm using System and FileSystem) for MinGW using bjam:</p> <pre><code>bjam --toolset=gcc stage </code></pre> <p>And it builds fine, but I want to be able to statically link to it (I have to have a single file for the final product) so I tried:</p> <pre><code>bjam --link=static --toolset=gcc st...
[ { "answer_id": 494647, "author": "Fredrik Jansson", "author_id": 58237, "author_profile": "https://Stackoverflow.com/users/58237", "pm_score": 0, "selected": false, "text": "<p>I have not built this myself in MinGW but I believe your first build will output both dynamic and static librar...
2009/01/30
[ "https://Stackoverflow.com/questions/494629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366/" ]
I'm building Boost (I'm using System and FileSystem) for MinGW using bjam: ``` bjam --toolset=gcc stage ``` And it builds fine, but I want to be able to statically link to it (I have to have a single file for the final product) so I tried: ``` bjam --link=static --toolset=gcc stage ``` But I get the same output. ...
I think link is a property as opposed to an option for bjam. That means that there should be no -- before it. This is my command line for building only static libraries (visual c++ though): ``` bjam install --toolset=msvc variant=release link=static threading=multi runtime-link=static ``` Mapping that to your origi...
494,646
<pre><code>procedure DoSomething(a_1, ... a_n) p = a_1 for i = 2 to n temp = p for j = 1 to a_i p = p * temp DoSomething(10,2,2,2) </code></pre> <p>We are getting mixed results. One of us got 10^7, the other 10^27.</p> <p><strong>I Think I found my error... I keep substituting 10 for p every time, instead o...
[ { "answer_id": 494676, "author": "Charles Duffy", "author_id": 14122, "author_profile": "https://Stackoverflow.com/users/14122", "pm_score": 0, "selected": false, "text": "<p>There's a reason folks have called Python \"executable pseudocode\":</p>\n\n<pre><code>&gt;&gt;&gt; def doSomethi...
2009/01/30
[ "https://Stackoverflow.com/questions/494646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/868/" ]
``` procedure DoSomething(a_1, ... a_n) p = a_1 for i = 2 to n temp = p for j = 1 to a_i p = p * temp DoSomething(10,2,2,2) ``` We are getting mixed results. One of us got 10^7, the other 10^27. **I Think I found my error... I keep substituting 10 for p every time, instead of the new value for temp.** EDI...
It's 10^27 as shown by this bit of python code: ``` a = [10,2,2,2] p = a[0] for i in range(1,len(a)): temp = p for j in range(a[i]): p *= temp print p ``` 1,000,000,000,000,000,000,000,000,000 The problems with your code as posted are: * in your 10^7 solution, you're always multiplying by 10, not t...
494,653
<p>I want to use the TRACE() macro to get output in the debug window in <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2005" rel="noreferrer">Visual&nbsp;Studio&nbsp;2005</a> in a non-<a href="http://en.wikipedia.org/wiki/Microsoft_Foundation_Class_Library" rel="noreferrer">MFC</a> C++ proj...
[ { "answer_id": 494665, "author": "Fredrik Jansson", "author_id": 58237, "author_profile": "https://Stackoverflow.com/users/58237", "pm_score": 2, "selected": false, "text": "<p>You can try the DebugOutputString function. TRACE is only enabled in debug builds.</p>\n" }, { "answer_...
2009/01/30
[ "https://Stackoverflow.com/questions/494653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59018/" ]
I want to use the TRACE() macro to get output in the debug window in [Visual Studio 2005](http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2005) in a non-[MFC](http://en.wikipedia.org/wiki/Microsoft_Foundation_Class_Library) C++ project, but which additional header or library is needed? Is there a wa...
Build your own. trace.cpp: ``` #ifdef _DEBUG bool _trace(TCHAR *format, ...) { TCHAR buffer[1000]; va_list argptr; va_start(argptr, format); wvsprintf(buffer, format, argptr); va_end(argptr); OutputDebugString(buffer); return true; } #endif ``` trace.h: ``` #include <windows.h> #ifdef _DEBU...
494,658
<p>I wrote this code for my j2me project:</p> <pre><code>try { Image immutableThumb = Image.createImage(temp, 0, temp.length); } catch (Exception ex) { System.out.println(ex); } </code></pre> <p>Where <code>temp</code> is a byte array.</p> <p>When I tried it for localhost it works, and the image gets created...
[ { "answer_id": 494671, "author": "Stephen Denne", "author_id": 11721, "author_profile": "https://Stackoverflow.com/users/11721", "pm_score": 2, "selected": false, "text": "<p>The <a href=\"http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Image.html\" rel=\"nofoll...
2009/01/30
[ "https://Stackoverflow.com/questions/494658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I wrote this code for my j2me project: ``` try { Image immutableThumb = Image.createImage(temp, 0, temp.length); } catch (Exception ex) { System.out.println(ex); } ``` Where `temp` is a byte array. When I tried it for localhost it works, and the image gets created. But when I tried it on LAN it throws an `I...
The [docs](http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Image.html) say > > IllegalArgumentException - if imageData is incorrectly formatted or otherwise cannot be decoded > > > so I'd say you're getting a different byte array.
494,711
<p>In Perl, the <code>%</code> operator seems to assume integers. For instance:</p> <pre><code>sub foo { my $n1 = shift; my $n2 = shift; print "perl's mod=" . $n1 % $n2, "\n"; my $res = $n1 / $n2; my $t = int($res); print "my div=$t", "\n"; $res = $res - $t; $res = $res * $n2; print...
[ { "answer_id": 494736, "author": "Learning", "author_id": 18275, "author_profile": "https://Stackoverflow.com/users/18275", "pm_score": 4, "selected": true, "text": "<p>Given <code>a = qd + r</code>, there is an ambiguity when calculating the remainder for negative values of <code>d</cod...
2009/01/30
[ "https://Stackoverflow.com/questions/494711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/426/" ]
In Perl, the `%` operator seems to assume integers. For instance: ``` sub foo { my $n1 = shift; my $n2 = shift; print "perl's mod=" . $n1 % $n2, "\n"; my $res = $n1 / $n2; my $t = int($res); print "my div=$t", "\n"; $res = $res - $t; $res = $res * $n2; print "my mod=" . $res . "\n\n...
Given `a = qd + r`, there is an ambiguity when calculating the remainder for negative values of `d`. E.g.: The expression `−42 ÷ −5`, can be expressed as either as: `−42 = 9×(−5) + 3` or `−42 = 8×(−5) + (−2)`. So the remainder is then either 3 or −2. For more info: [Wikipedia:Remainder "Inequality satisfied by th...
494,720
<p>I am trying to take a person and display their current insurance along with their former insurance. I guess one could say that I'm trying to flaten my view of customers or people. I'm running into an issue where I'm getting multiple records back due to multiple records existing within my left join subqueries. I h...
[ { "answer_id": 494783, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 0, "selected": false, "text": "<p>It's difficult to understand your question so first I'll throw this out there: does changing your SELECT to SELECT ...
2009/01/30
[ "https://Stackoverflow.com/questions/494720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55747/" ]
I am trying to take a person and display their current insurance along with their former insurance. I guess one could say that I'm trying to flaten my view of customers or people. I'm running into an issue where I'm getting multiple records back due to multiple records existing within my left join subqueries. I had hop...
The pattern I normally use for this is: > > SELECT whatever > > FROM person > > LEFT JOIN subtable AS s1 > > ON s1.personid = person.personid > > > ... > > > WHERE NOT EXISTS > > ( SELECT 1 FROM subtable > > WHERE personid = person.personid > > AND orderbydate > s1.orderbydate > ) > > ...
494,779
<p>Javascript code:</p> <pre><code>function doSomething(v1,v2){ //blah; } function SomeClass(callbackFunction,callbackFuncParameters(*Array*))={ this.callback = callbackFunction; this.method = function(){ this.callback(parameters[0],parameters[1]) // *.* } } var obj = new SomeClass( doSomething, Arr...
[ { "answer_id": 494785, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 6, "selected": true, "text": "<p>You probably want to use the <a href=\"http://www.webreference.com/js/column26/apply.html\" rel=\"noreferrer\">apply ...
2009/01/30
[ "https://Stackoverflow.com/questions/494779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58743/" ]
Javascript code: ``` function doSomething(v1,v2){ //blah; } function SomeClass(callbackFunction,callbackFuncParameters(*Array*))={ this.callback = callbackFunction; this.method = function(){ this.callback(parameters[0],parameters[1]) // *.* } } var obj = new SomeClass( doSomething, Array('v1text','v...
You probably want to use the [apply method](http://www.webreference.com/js/column26/apply.html) ``` this.callback.apply(this, parameters); ``` The first parameter to apply indicates the value of "this" within the callback and can be set to any value.
494,789
<p>Can someone here tell me if there is something similar to LD_PRELOAD on recent versions of AIX? More specifically I need to intercept calls from my binary to time(), returning a constant time, for testing purposes.</p>
[ { "answer_id": 494818, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 0, "selected": false, "text": "<p>Not that I'm aware of. Closest thing we've done (with malloc/free for debugging) is to</p>\n\n<ul>\n<li>create a new ...
2009/01/30
[ "https://Stackoverflow.com/questions/494789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3414/" ]
Can someone here tell me if there is something similar to LD\_PRELOAD on recent versions of AIX? More specifically I need to intercept calls from my binary to time(), returning a constant time, for testing purposes.
AIX 5.3 introduced the `LDR_PRELOAD` (for 32-bit programs) and `LDR_PRELOAD64` (for 64-bit programs) variables. They are analoguous to LD\_PRELOAD on Linux. Both are colon-separated lists of libraries, and symbols will be pre-emptively loaded from the listed shared objects before anything else. For example, if you ha...
494,798
<p>I am a C# programmer, but I have a question about Async Workflows in F#. Supposing I have the following class in a C# class library:</p> <pre><code>class File { IAsyncResult BeginReadAll(string fileName, AsyncCallback callback, object state){} string EndReadAll(IAsyncResult result){} } </code></pre> <p>My under...
[ { "answer_id": 494818, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 0, "selected": false, "text": "<p>Not that I'm aware of. Closest thing we've done (with malloc/free for debugging) is to</p>\n\n<ul>\n<li>create a new ...
2009/01/30
[ "https://Stackoverflow.com/questions/494798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14101/" ]
I am a C# programmer, but I have a question about Async Workflows in F#. Supposing I have the following class in a C# class library: ``` class File { IAsyncResult BeginReadAll(string fileName, AsyncCallback callback, object state){} string EndReadAll(IAsyncResult result){} } ``` My understanding is that is possibl...
AIX 5.3 introduced the `LDR_PRELOAD` (for 32-bit programs) and `LDR_PRELOAD64` (for 64-bit programs) variables. They are analoguous to LD\_PRELOAD on Linux. Both are colon-separated lists of libraries, and symbols will be pre-emptively loaded from the listed shared objects before anything else. For example, if you ha...
494,803
<p>I'm trying to use Class::DBI with a simple one parent -> may chidren relationships:</p> <pre><code>Data::Company-&gt;table('Companies'); Data::Company-&gt;columns(All =&gt; qw/CompanyId Name Url/); Data::Company-&gt;has_many(offers =&gt; 'Data::Offer'=&gt;'CompanyId'); # =&gt;'CompanyId' </code></pre> <p>and</p> ...
[ { "answer_id": 495116, "author": "innaM", "author_id": 7498, "author_profile": "https://Stackoverflow.com/users/7498", "pm_score": 1, "selected": false, "text": "<p>I really haven't got much experience with Class:DBI, but I'll give this a shot anyway:</p>\n\n<ol>\n<li>The <a href=\"http:...
2009/01/30
[ "https://Stackoverflow.com/questions/494803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55111/" ]
I'm trying to use Class::DBI with a simple one parent -> may chidren relationships: ``` Data::Company->table('Companies'); Data::Company->columns(All => qw/CompanyId Name Url/); Data::Company->has_many(offers => 'Data::Offer'=>'CompanyId'); # =>'CompanyId' ``` and ``` Data::Offer->table('Offers'); Data::Offer->colu...
I agree with Manni, if your package declarations are in the same file, then you need to have the class with the `has_a()` relationship defined first. Otherwise, if they are in different source files, then the documentation states: > > Class::DBI should usually be able to > do the right things, as long as all > clas...
494,804
<p>Having the same problems as <a href="https://stackoverflow.com/questions/29382/rails-requires-rubygems-0-9-4-please-install-rubygems">this post</a>, except I don't think the solution is the same unfortunately.</p> <p>I'm getting this error message:</p> <pre><code>Rails requires RubyGems &gt;= 0.9.4. Please install...
[ { "answer_id": 494811, "author": "Abie", "author_id": 53166, "author_profile": "https://Stackoverflow.com/users/53166", "pm_score": 3, "selected": true, "text": "<p>Try <code>which ruby</code> and <code>which gem</code> from your cron job and also from the terminal. Are you accessing dif...
2009/01/30
[ "https://Stackoverflow.com/questions/494804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31092/" ]
Having the same problems as [this post](https://stackoverflow.com/questions/29382/rails-requires-rubygems-0-9-4-please-install-rubygems), except I don't think the solution is the same unfortunately. I'm getting this error message: ``` Rails requires RubyGems >= 0.9.4. Please install RubyGems ``` when I run a script...
Try `which ruby` and `which gem` from your cron job and also from the terminal. Are you accessing different binaries? You didn't mention which OS and which shell, but you may have a different `$PATH` when running headless.
494,820
<p>I've been using this pattern when I need to control how long various async operations take. I don't mean specifically for WebRequest (I know you can set the timeout property), I just used this as an example for the pattern.</p> <pre><code> var request = WebRequest.Create(someUri); WebResponse respon...
[ { "answer_id": 494852, "author": "Patrik Hägne", "author_id": 46187, "author_profile": "https://Stackoverflow.com/users/46187", "pm_score": 4, "selected": true, "text": "<p>The WaitHandles wait methods supports time out, use that. Something like:</p>\n\n<pre><code> var asyncResult = req...
2009/01/30
[ "https://Stackoverflow.com/questions/494820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2596/" ]
I've been using this pattern when I need to control how long various async operations take. I don't mean specifically for WebRequest (I know you can set the timeout property), I just used this as an example for the pattern. ``` var request = WebRequest.Create(someUri); WebResponse response = null; ...
The WaitHandles wait methods supports time out, use that. Something like: ``` var asyncResult = request.BeginGetResponse(... asyncResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(10)) ```
494,822
<p>I have a <em>Default Web Site</em> and another web application (let's call it <em>Application2</em>) inside the Default Web Site in IIS7.</p> <p>I have 2 registered domain names, let's say <em>www.example.com</em> and <em>www.example.net</em>.</p> <p>I would like to configure things that when I open <em>www.exampl...
[ { "answer_id": 494849, "author": "DavGarcia", "author_id": 40161, "author_profile": "https://Stackoverflow.com/users/40161", "pm_score": 1, "selected": false, "text": "<p>Edit... upon further investigation I found that if you can set up multiple sites and run them simultaneously. Just ne...
2009/01/30
[ "https://Stackoverflow.com/questions/494822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18631/" ]
I have a *Default Web Site* and another web application (let's call it *Application2*) inside the Default Web Site in IIS7. I have 2 registered domain names, let's say *www.example.com* and *www.example.net*. I would like to configure things that when I open *www.example.com* I get *Default Web Site*, when I open *ww...
First you need to decide if your going to use Name Based or IP Based hosting. IP-Based uses unique ip's to determine which virtual host it will serve and Name Based will actually use the host header which is sent by your client browser. So let's see two scenarios: Scenario # 1 (ONE IP TO SHARE) You have a server wi...
494,827
<p>Why can't you create a generic indexer in .NET?</p> <p>the following code throws a compiler error:</p> <pre><code>public T this&lt;T&gt;[string key] { get =&gt; /* Return generic type T. */ } </code></pre> <p>Does this mean you can't create a generic indexer for a generic member collection?</p>
[ { "answer_id": 494840, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 3, "selected": false, "text": "<p>You can; just drop the <code>&lt;T&gt;</code> part from your declaration and it will work fine. i.e.</p>\n\n<pre><co...
2009/01/30
[ "https://Stackoverflow.com/questions/494827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22769/" ]
Why can't you create a generic indexer in .NET? the following code throws a compiler error: ``` public T this<T>[string key] { get => /* Return generic type T. */ } ``` Does this mean you can't create a generic indexer for a generic member collection?
The only thing I can think of this can be used is something along these lines: ``` var settings = ConfigurationSection.AppSettings; var connectionString = settings<string>["connectionString"]; var timeout = settings<int>["timeout"]; ``` But this doesn't actually buy you anything. You've just replaced round parenthes...
494,830
<p>Does anyone know of an algorithm to find if a linked list loops on itself using only two variables to traverse the list. Say you have a linked list of objects, it doesn't matter what type of object. I have a pointer to the head of the linked list in one variable and I am only given one other variable to traverse t...
[ { "answer_id": 494835, "author": "martinus", "author_id": 48181, "author_profile": "https://Stackoverflow.com/users/48181", "pm_score": 4, "selected": false, "text": "<p>You can use the <a href=\"http://eddii.wordpress.com/2006/11/15/detecting-infinite-loop/\" rel=\"noreferrer\">Turtle a...
2009/01/30
[ "https://Stackoverflow.com/questions/494830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54822/" ]
Does anyone know of an algorithm to find if a linked list loops on itself using only two variables to traverse the list. Say you have a linked list of objects, it doesn't matter what type of object. I have a pointer to the head of the linked list in one variable and I am only given one other variable to traverse the li...
I would suggest using `Floyd's Cycle-Finding Algorithm` *aka* The `Tortoise and the Hare Algorithm`. It has O(n) complexity and I think it fits your requirements. Example code: ``` function boolean hasLoop(Node startNode){ Node slowNode = Node fastNode1 = Node fastNode2 = startNode; while (slowNode && fastNode1 =...
494,859
<p>How can i add list in a generic class? Firstly My generic Class is that:</p> <pre>[Serializable] public class ScheduleSelectedItems { private string Frequency; List FrequencyDays = new List(); private string Time; private string StartTime; private string EndTime; ...
[ { "answer_id": 494883, "author": "Charles Graham", "author_id": 7705, "author_profile": "https://Stackoverflow.com/users/7705", "pm_score": 2, "selected": false, "text": "<p>Here's what you want, I think:</p>\n\n<pre><code>List&lt;ScheduleSelectedItems&gt; list = new List&lt;ScheduleSele...
2009/01/30
[ "https://Stackoverflow.com/questions/494859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52420/" ]
How can i add list in a generic class? Firstly My generic Class is that: ``` [Serializable] public class ScheduleSelectedItems { private string Frequency; List FrequencyDays = new List(); private string Time; private string StartTime; private string EndTime; priv...
Here's what you want, I think: ``` List<ScheduleSelectedItems> list = new List<ScheduleSelectedItems>(); ```
494,860
<p>Does anyone know of a good, open source security framework for java?</p> <p>I've played with jSecurity a bit, and it seems really cool, but the documentation is so sparce I can't seem to make any progress. </p> <p>Spring security seems web-app oriented -- but I may be wrong. </p> <p>I am not opposed to writing th...
[ { "answer_id": 494895, "author": "Fortyrunner", "author_id": 16828, "author_profile": "https://Stackoverflow.com/users/16828", "pm_score": 2, "selected": false, "text": "<p>The last time I looked at Spring-Security it seemed very much web based.</p>\n\n<p>But... the Spring guys are prett...
2009/01/30
[ "https://Stackoverflow.com/questions/494860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27657/" ]
Does anyone know of a good, open source security framework for java? I've played with jSecurity a bit, and it seems really cool, but the documentation is so sparce I can't seem to make any progress. Spring security seems web-app oriented -- but I may be wrong. I am not opposed to writing this myself, but it seems ...
The last time I looked at Spring-Security it seemed very much web based. But... the Spring guys are pretty good and I suspect that they have lot of building blocks you could use from the core Spring-Security library.
494,869
<p>I'd like to be notified when a file has been changed in the file system. I have found nothing but a thread that polls the lastModified File property and clearly this solution is not optimal.</p>
[ { "answer_id": 494886, "author": "Rutesh Makhijani", "author_id": 57686, "author_profile": "https://Stackoverflow.com/users/57686", "pm_score": 6, "selected": true, "text": "<p>Since JDK 1.7, the canonical way to have an application be notified of changes to a file is using the <a href=\...
2009/01/30
[ "https://Stackoverflow.com/questions/494869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46754/" ]
I'd like to be notified when a file has been changed in the file system. I have found nothing but a thread that polls the lastModified File property and clearly this solution is not optimal.
Since JDK 1.7, the canonical way to have an application be notified of changes to a file is using the [WatchService](https://docs.oracle.com/javase/9/docs/api/java/nio/file/WatchService.html) API. The WatchService is event-driven. The [official tutorial](https://docs.oracle.com/javase/tutorial/essential/io/notification...
494,880
<p>I have a source directory eg <strong>/my/source/directory/</strong> and a destination directory eg <strong>/my/dest/directory/</strong>, which I want to mirror with some constraints.</p> <ul> <li>I want to copy files which meet certain criteria of the <strong>find</strong> command, eg <strong>-ctime -2</strong> (le...
[ { "answer_id": 494888, "author": "falstro", "author_id": 46991, "author_profile": "https://Stackoverflow.com/users/46991", "pm_score": 2, "selected": false, "text": "<p>You could try cpio using the copy-pass mode, -p. I usually use it with overwrite all (-u), create directories (-d), and...
2009/01/30
[ "https://Stackoverflow.com/questions/494880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5346/" ]
I have a source directory eg **/my/source/directory/** and a destination directory eg **/my/dest/directory/**, which I want to mirror with some constraints. * I want to copy files which meet certain criteria of the **find** command, eg **-ctime -2** (less than 2 days old) to the dest directory to mirror it * I want to...
This is remarkably similar to a (closed) question: [Bash scripting copying files without overwriting](https://stackoverflow.com/questions/363209/bash-scripting-copying-files-without-overwriting/363305#363305). The answer I gave cites the '`find | cpio`' solution mentioned in other answers (minus the time criteria, but ...
494,881
<p>It's a small thing, really: I have this function that converts dict objects to xml.</p> <p>Here's the function:</p> <pre><code>def dictToXml(d): from xml.sax.saxutils import escape def unicodify(o): if o is None: return u''; return unicode(o) lines = [] def addDict(nod...
[ { "answer_id": 494890, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Here is my short sketch for a solution:\nhave a general <code>addSomething()</code> function that dispatches based on the t...
2009/01/30
[ "https://Stackoverflow.com/questions/494881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7581/" ]
It's a small thing, really: I have this function that converts dict objects to xml. Here's the function: ``` def dictToXml(d): from xml.sax.saxutils import escape def unicodify(o): if o is None: return u''; return unicode(o) lines = [] def addDict(node, offset): f...
I noticed you have commonality in adding items. Using this commonality I would refactor adding an item to a separate function. ``` def addItem(item, name, offset): if isinstance(item, dict): lines.append(offset + u"<%s>" % name) addDict(item, offset + u" " * 4) ...
494,884
<p>I am writing an application where we will need to extend a basic entity into a number of different things (eg employee, vehicle etc). The design is as such that there is a Entity table and a second table with type specific values eg an employee will have an ID Number but a vehicle will have a registration number.</...
[ { "answer_id": 494942, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": true, "text": "<p>With LINQ-to-SQL, there are two ways inheritance can work:</p>\n\n<ul>\n<li>discriminator over a single table (not ...
2009/01/30
[ "https://Stackoverflow.com/questions/494884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60525/" ]
I am writing an application where we will need to extend a basic entity into a number of different things (eg employee, vehicle etc). The design is as such that there is a Entity table and a second table with type specific values eg an employee will have an ID Number but a vehicle will have a registration number. I ha...
With LINQ-to-SQL, there are two ways inheritance can work: * discriminator over a single table (not suitable since your data is not homogeneous) * base-class / multi-table (not that this isn't supported in the dbml - only if you write the classes manually) LINQ-to-SQL does not support multi-table inheritance (i.e. a ...
494,907
<p>This is my code:</p> <pre><code>lExpression = @"convert(" + lNewColName + ",'System.Decimal')"; if (pCurrency.ToString() != "Select") lExpression += " * convert(" + pCurrency.ToString() + ",'System.Decimal')"; mDtCases.Columns[lColName].Expression = lExpression; </code></pre> <p>Where lNewColName is the ColumnNa...
[ { "answer_id": 494963, "author": "belaz", "author_id": 59350, "author_profile": "https://Stackoverflow.com/users/59350", "pm_score": 0, "selected": false, "text": "<pre><code>System.Convert.ToDouble(IExpression)\n</code></pre>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/w2zyd...
2009/01/30
[ "https://Stackoverflow.com/questions/494907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is my code: ``` lExpression = @"convert(" + lNewColName + ",'System.Decimal')"; if (pCurrency.ToString() != "Select") lExpression += " * convert(" + pCurrency.ToString() + ",'System.Decimal')"; mDtCases.Columns[lColName].Expression = lExpression; ``` Where lNewColName is the ColumnName, pCurrency is the Curre...
The syntax for an Expression supports a number of simple functions including aggregates, but doesn't support rounding as such. However you can round the displayed value by formatting with the required number of decimals. You don't say what DataGrid you are using, but for a Web UI you can format using e.g. the BoundCol...
494,919
<p>I have a file like:</p> <pre><code>&lt;space&gt; &lt;space&gt; line1 &lt;space&gt; column 1 column 2 column 3 ... . . . &lt;space&gt; &lt;space&gt; </code></pre> <p>How to remove this extra spaces?</p> <p>I need to extract the heading which will be on <code>line1</code>. Also, I need to extract <code>c...
[ { "answer_id": 494935, "author": "Joao da Silva", "author_id": 46329, "author_profile": "https://Stackoverflow.com/users/46329", "pm_score": 3, "selected": true, "text": "<p>Start by opening the file and reading all the lines:</p>\n\n<pre><code>f = open('filename string');\nlines = f.rea...
2009/01/30
[ "https://Stackoverflow.com/questions/494919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
I have a file like: ``` <space> <space> line1 <space> column 1 column 2 column 3 ... . . . <space> <space> ``` How to remove this extra spaces? I need to extract the heading which will be on `line1`. Also, I need to extract `column 1`, `column 2`, `column 3` etc. At the end of last column content there i...
Start by opening the file and reading all the lines: ``` f = open('filename string'); lines = f.readlines() ``` Then... ``` # remove empty lines lines = [l for l in lines if len(l.strip()) > 0] header = lines[0] line = lines[1].split(' ') column1 = line[0] column2 = line[1] ... ``` Also: ``` total_lines = len(li...
494,923
<p>I'm solving problems in <a href="http://projecteuler.net/" rel="nofollow noreferrer">Project Euler</a>. Most of the problems solved by </p> <ol> <li>big numbers that exceeds ulong, </li> </ol> <blockquote> <pre><code>Ex : ulong number = 81237146123746237846293567465365862854736263874623654728568263582; </code></pr...
[ { "answer_id": 494933, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": true, "text": "<p>Well, for the third item there you really don't want to use an array, since it needs to be allocated that big as we...
2009/01/30
[ "https://Stackoverflow.com/questions/494923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55351/" ]
I'm solving problems in [Project Euler](http://projecteuler.net/). Most of the problems solved by 1. big numbers that exceeds ulong, > > > ``` > Ex : ulong number = 81237146123746237846293567465365862854736263874623654728568263582; > > ``` > > 2. very sensitive decimal numbers with significant digits over 30 ...
Well, for the third item there you really don't want to use an array, since it needs to be allocated that big as well. Let me rephrase that. By the time you can afford, and get access to, that much memory, the big-number problem will be solved! To answer your last question there, there is no way you can solve this u...
494,926
<p>I used this vba code in the ThisWorkbook module to disable the right click menu in an Excel workbook.</p> <pre><code>Private Sub Workbook_Activate() With Application.CommandBars.FindControl(ID:=847) .Visible = False End With End Sub Private Sub Workbook_Deactivate() With Application.CommandBars.Find...
[ { "answer_id": 495301, "author": "Kablam", "author_id": 42389, "author_profile": "https://Stackoverflow.com/users/42389", "pm_score": 3, "selected": true, "text": "<p>omg</p>\n\n<pre><code>Application.CommandBars(\"Ply\").Enabled = True\n</code></pre>\n\n<p>-.-<br>\nStarted googling diff...
2009/01/30
[ "https://Stackoverflow.com/questions/494926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42389/" ]
I used this vba code in the ThisWorkbook module to disable the right click menu in an Excel workbook. ``` Private Sub Workbook_Activate() With Application.CommandBars.FindControl(ID:=847) .Visible = False End With End Sub Private Sub Workbook_Deactivate() With Application.CommandBars.FindControl(ID:=84...
omg ``` Application.CommandBars("Ply").Enabled = True ``` -.- Started googling different keywords after the last edit and BAM.
494,958
<p>I really need a localized dropdown calendar. An English calendar doesn't exactly communicate excellence on a Norwegian website ;-)</p> <p>I have experimented with the <strong><a href="http://ui.jquery.com/demos/datepicker/#localization" rel="noreferrer">jQuery DatePicker</a></strong>, their website says it can be l...
[ { "answer_id": 2905411, "author": "Zilverdistel", "author_id": 2057028, "author_profile": "https://Stackoverflow.com/users/2057028", "pm_score": 6, "selected": false, "text": "<p>I figured out the demo and implemented it the following way:</p>\n\n<pre><code>$.datepicker.setDefaults(\n $...
2009/01/30
[ "https://Stackoverflow.com/questions/494958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3282/" ]
I really need a localized dropdown calendar. An English calendar doesn't exactly communicate excellence on a Norwegian website ;-) I have experimented with the **[jQuery DatePicker](http://ui.jquery.com/demos/datepicker/#localization)**, their website says it can be localized, however that doesn't seem to work. I am ...
For those that still have problems, you have to download the language file your want from here: > > <https://github.com/jquery/jquery-ui/tree/master/ui/i18n> > > > and then include it in your page like this for example(italian language): ``` <script type="text/javascript" src="/scripts/jquery.ui.datepicker-it.j...
494,965
<p>I have a bit of a problem here:</p> <pre><code>#foreach($image in $command.lessonLearned.images) Image: $image.fileName &lt;input type="submit" onclick="submitForm();setImageToRemove($image.id);setAction('removeImage');" value="REMOVE"/&gt;&lt;br/&gt; #end </code></pre> <p>$image.id inside the onclick even...
[ { "answer_id": 494998, "author": "itsadok", "author_id": 7581, "author_profile": "https://Stackoverflow.com/users/7581", "pm_score": 1, "selected": false, "text": "<p>Try replacing <code>$image.id</code> with <code>${image.id}</code></p>\n" }, { "answer_id": 505258, "author":...
2009/01/30
[ "https://Stackoverflow.com/questions/494965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59242/" ]
I have a bit of a problem here: ``` #foreach($image in $command.lessonLearned.images) Image: $image.fileName <input type="submit" onclick="submitForm();setImageToRemove($image.id);setAction('removeImage');" value="REMOVE"/><br/> #end ``` $image.id inside the onclick event is not evaluated as a velocity varia...
Are you sure that $image.id has a value? Was it $image.ID or $image.getID() that you should have typed?
494,974
<p>I am trying to limit the following SQL statement.</p> <pre><code>SELECT expense.*, transaction.* FROM expense INNER JOIN transaction ON expense_id = transaction_expense_id </code></pre> <p>What I want to do, is limit the number of 'parent' rows. IE. if I do a LIMIT 1, I would receive only one expense item, but sti...
[ { "answer_id": 494983, "author": "Ben", "author_id": 11522, "author_profile": "https://Stackoverflow.com/users/11522", "pm_score": 5, "selected": true, "text": "<p>So assuming we can exclude the user table, it could be rewritten as:</p>\n\n<pre><code>select * from expense, transaction wh...
2009/01/30
[ "https://Stackoverflow.com/questions/494974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2192/" ]
I am trying to limit the following SQL statement. ``` SELECT expense.*, transaction.* FROM expense INNER JOIN transaction ON expense_id = transaction_expense_id ``` What I want to do, is limit the number of 'parent' rows. IE. if I do a LIMIT 1, I would receive only one expense item, but still get all transactions as...
So assuming we can exclude the user table, it could be rewritten as: ``` select * from expense, transaction where expense_id = transaction_expense_id ``` Now if you want to apply a limit, you could do it like this: ``` select * from expense, transaction where expense_id = transaction_expense_id and expense_id in...
494,982
<p>I'd like to change programmaticaly the <code>tintColor</code> of a UINavigationBar and keep the gradient as in Interface Builder.</p> <p>When I change the <code>tintColor</code> in my code, the gradient disappears but when I change the <code>tintColor</code> in Interface Builder, the gradient is kept.</p> <p>Any i...
[ { "answer_id": 524859, "author": "carlos", "author_id": 29642, "author_profile": "https://Stackoverflow.com/users/29642", "pm_score": 4, "selected": false, "text": "<p>Set the barStyle to UIBarStyleBlackTranslucent\nSet the tintColor like this: </p>\n\n<pre><code>navigationBar.tintColor ...
2009/01/30
[ "https://Stackoverflow.com/questions/494982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60544/" ]
I'd like to change programmaticaly the `tintColor` of a UINavigationBar and keep the gradient as in Interface Builder. When I change the `tintColor` in my code, the gradient disappears but when I change the `tintColor` in Interface Builder, the gradient is kept. Any ideas?
Set the barStyle to UIBarStyleBlackTranslucent Set the tintColor like this: ``` navigationBar.tintColor = [UIColor colorWithRed:.7 green:.5 blue:.2 alpha:1]; ``` This will set the appropriate gradient. Use whatever combination you need.
494,985
<p>I want to use the standard resource factory provided by Tomcat 6.0, which create javax.mail.Sessions instance for me. As described in the <a href="http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html" rel="nofollow noreferrer">JNDI Resource HOW-TO tutorial</a>.</p> <p>My META-INF/context.xml looks lik...
[ { "answer_id": 501064, "author": "Olaf Kock", "author_id": 13447, "author_profile": "https://Stackoverflow.com/users/13447", "pm_score": 4, "selected": true, "text": "<p><strong>JNDI Lookup code quirks</strong></p>\n\n<p>I've seen multiple issues with not finding JNDI resources. On Websp...
2009/01/30
[ "https://Stackoverflow.com/questions/494985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
I want to use the standard resource factory provided by Tomcat 6.0, which create javax.mail.Sessions instance for me. As described in the [JNDI Resource HOW-TO tutorial](http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html). My META-INF/context.xml looks like: ``` <?xml version="1.0" encoding="UTF-8"?> ...
**JNDI Lookup code quirks** I've seen multiple issues with not finding JNDI resources. On Websphere (I know, you don't use it, but it's good to know...) you'll have problems with ``` Context envCtx = (Context) initCtx.lookup("java:comp/env"); Session session = (Session)envCtx.lookup("mail/Session"); ``` What work...
494,997
<p>I am new to XML-RPC.</p> <pre><code>#client code import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:8000/") x,y = arg1,arg2 print proxy.fun1(x,y) print proxy.fun2(x,y) </code></pre> <p>What server should do:</p> <ol> <li>load fun1</li> <li>register fun1</li> <li>return result</li> <li>unload fun1</l...
[ { "answer_id": 501064, "author": "Olaf Kock", "author_id": 13447, "author_profile": "https://Stackoverflow.com/users/13447", "pm_score": 4, "selected": true, "text": "<p><strong>JNDI Lookup code quirks</strong></p>\n\n<p>I've seen multiple issues with not finding JNDI resources. On Websp...
2009/01/30
[ "https://Stackoverflow.com/questions/494997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58737/" ]
I am new to XML-RPC. ``` #client code import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:8000/") x,y = arg1,arg2 print proxy.fun1(x,y) print proxy.fun2(x,y) ``` What server should do: 1. load fun1 2. register fun1 3. return result 4. unload fun1 and then do same with fun2. What is the best way to do...
**JNDI Lookup code quirks** I've seen multiple issues with not finding JNDI resources. On Websphere (I know, you don't use it, but it's good to know...) you'll have problems with ``` Context envCtx = (Context) initCtx.lookup("java:comp/env"); Session session = (Session)envCtx.lookup("mail/Session"); ``` What work...
495,001
<p>I put two controls in a grid column and make either the first or the second control visible. Since the width of the grid column is set to auto it will resize itself according to the width of the visible child... unless I change the width of column using a grid splitter.<br> Now the column does not resize itself to i...
[ { "answer_id": 495008, "author": "Martin Moser", "author_id": 58275, "author_profile": "https://Stackoverflow.com/users/58275", "pm_score": 1, "selected": false, "text": "<p>did you try to set the Width of the columndefinition to GridLength.Auto again, when you need to do so?</p>\n" },...
2009/01/30
[ "https://Stackoverflow.com/questions/495001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22038/" ]
I put two controls in a grid column and make either the first or the second control visible. Since the width of the grid column is set to auto it will resize itself according to the width of the visible child... unless I change the width of column using a grid splitter. Now the column does not resize itself to its c...
did you try to set the Width of the columndefinition to GridLength.Auto again, when you need to do so?
495,004
<p>I'm writing a WebPart, which means that I inherit from <code>System.Web.UI.WebControls.WebParts.WebPart</code> and I override the method <code>protected override void CreateChildControls()</code>.</p> <p>However, I'd like to make the class <code>sealed</code> if possible, but that gives two issues: Just sealing the...
[ { "answer_id": 495012, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>The fact that it says there's a <em>new</em> protected member declared in the class is slightly worrying.</p>\n\n<p>Hm...
2009/01/30
[ "https://Stackoverflow.com/questions/495004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
I'm writing a WebPart, which means that I inherit from `System.Web.UI.WebControls.WebParts.WebPart` and I override the method `protected override void CreateChildControls()`. However, I'd like to make the class `sealed` if possible, but that gives two issues: Just sealing the class gives a warning "new protected membe...
The fact that it says there's a *new* protected member declared in the class is slightly worrying. Hmm... I can't reproduce this in simple test code: ``` using System; public class Base { protected virtual void Foo() { } } public sealed class Derived : Base { protected override void Foo() { ...
495,011
<p>I have an application implemented with BackgroundWorker that periodically connects to ftp (for download and upload) using LumiSoft library. It works just fine but after a while (let's say 2 - 3 hours) the thread (backgroundworker) blocks under the Connect method (witch doesn't throw any exception). Here is the part ...
[ { "answer_id": 495014, "author": "jhornnes", "author_id": 211, "author_profile": "https://Stackoverflow.com/users/211", "pm_score": 0, "selected": false, "text": "<p>does it close the port after itself? If not, perhaps it exceeds the maximum avaiable network ports.</p>\n" }, { "a...
2009/01/30
[ "https://Stackoverflow.com/questions/495011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an application implemented with BackgroundWorker that periodically connects to ftp (for download and upload) using LumiSoft library. It works just fine but after a while (let's say 2 - 3 hours) the thread (backgroundworker) blocks under the Connect method (witch doesn't throw any exception). Here is the part of ...
You don't appear to be disposing of the FTP\_Client object unless an exception is caught? Or did you leave out some code?
495,021
<p>Quote from <a href="http://books.google.com/books?id=n9VEG2Gp5pkC&amp;pg=PA10&amp;lpg=PA10&amp;dq=%22The%20only%20portable%20way%20of%20using%20templates%20at%20the%20moment%20is%20to%20implement%20them%20in%20header%20files%20by%20using%20inline%20functions.%22&amp;source=bl&amp;ots=Ref8pl8dPX&amp;sig=t4K5gvxtBblpc...
[ { "answer_id": 495032, "author": "Anton Gogolev", "author_id": 60188, "author_profile": "https://Stackoverflow.com/users/60188", "pm_score": 5, "selected": false, "text": "<p>Although standard C++ has no such requirement, some compilers require that all function and class templates need ...
2009/01/30
[ "https://Stackoverflow.com/questions/495021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52913/" ]
Quote from [The C++ standard library: a tutorial and handbook](http://books.google.com/books?id=n9VEG2Gp5pkC&pg=PA10&lpg=PA10&dq=%22The%20only%20portable%20way%20of%20using%20templates%20at%20the%20moment%20is%20to%20implement%20them%20in%20header%20files%20by%20using%20inline%20functions.%22&source=bl&ots=Ref8pl8dPX&s...
Caveat: It is *not* necessary to put the implementation in the header file, see the alternative solution at the end of this answer. Anyway, the reason your code is failing is that, when instantiating a template, the compiler creates a new class with the given template argument. For example: ``` template<typename T> s...
495,026
<p>In my main method, I start the main form as usual:</p> <pre><code> Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); </code></pre> <p>In the main forms load thing I have the following, which will ask the user to log in an...
[ { "answer_id": 495033, "author": "Aleris", "author_id": 20417, "author_profile": "https://Stackoverflow.com/users/20417", "pm_score": 2, "selected": false, "text": "<p>The simplest would be to start the login form with Application.Run. When the login is ok and other stuff has been set ju...
2009/01/30
[ "https://Stackoverflow.com/questions/495026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39321/" ]
In my main method, I start the main form as usual: ``` Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); ``` In the main forms load thing I have the following, which will ask the user to log in and stuff. ``` usin...
Instead of: ``` Application.Run(new MainForm()); ``` try: ``` LoginDialog // the class that handles login UI login = new LoginDialog (); if (login.ShowDialog () == DialogResult.OK) { // check credentials // if credentials OK Application.Run(new MainForm()); } ``` The `ShowDialog` method is a blocking ...
495,037
<p>I have a select box with options in it. The value of the options gets the id of the item that is displayed in each option.<br> I do have an other value that should be linked on this option. Is there an easy way to do this? </p> <pre><code>&lt;select id="category" name="data[cat]"&gt; &lt;option value="12" label="0"...
[ { "answer_id": 495033, "author": "Aleris", "author_id": 20417, "author_profile": "https://Stackoverflow.com/users/20417", "pm_score": 2, "selected": false, "text": "<p>The simplest would be to start the login form with Application.Run. When the login is ok and other stuff has been set ju...
2009/01/30
[ "https://Stackoverflow.com/questions/495037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60143/" ]
I have a select box with options in it. The value of the options gets the id of the item that is displayed in each option. I do have an other value that should be linked on this option. Is there an easy way to do this? ``` <select id="category" name="data[cat]"> <option value="12" label="0">A</option> <option valu...
Instead of: ``` Application.Run(new MainForm()); ``` try: ``` LoginDialog // the class that handles login UI login = new LoginDialog (); if (login.ShowDialog () == DialogResult.OK) { // check credentials // if credentials OK Application.Run(new MainForm()); } ``` The `ShowDialog` method is a blocking ...
495,038
<p>I want to use a collection initializer for the next bit of code:</p> <pre><code>public Dictionary&lt;int, string&gt; GetNames() { Dictionary&lt;int, string&gt; names = new Dictionary&lt;int, string&gt;(); names.Add(1, "Adam"); names.Add(2, "Bart"); names.Add(3, "Charlie"); return names; } </code...
[ { "answer_id": 495049, "author": "ybo", "author_id": 60556, "author_profile": "https://Stackoverflow.com/users/60556", "pm_score": 4, "selected": false, "text": "<pre><code>return new Dictionary&lt;int, string&gt;\n{ \n { 1, \"Adam\" },\n { 2, \"Bart\" },\n ...\n</code></pre>\n" ...
2009/01/30
[ "https://Stackoverflow.com/questions/495038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57036/" ]
I want to use a collection initializer for the next bit of code: ``` public Dictionary<int, string> GetNames() { Dictionary<int, string> names = new Dictionary<int, string>(); names.Add(1, "Adam"); names.Add(2, "Bart"); names.Add(3, "Charlie"); return names; } ``` So typically it should be someth...
``` var names = new Dictionary<int, string> { { 1, "Adam" }, { 2, "Bart" }, { 3, "Charlie" } }; ```
495,042
<p>Background</p> <p>I have a component that provides certain CRM services - specificCRM. I have a specificCRMAdapter which implements my IGeneralCRM interface.</p> <p>Another component generalCRM exposes CRM functionality through IGeneralCRM and uses Spring.Net to inject the specificCRMAdapter to provide such funct...
[ { "answer_id": 495049, "author": "ybo", "author_id": 60556, "author_profile": "https://Stackoverflow.com/users/60556", "pm_score": 4, "selected": false, "text": "<pre><code>return new Dictionary&lt;int, string&gt;\n{ \n { 1, \"Adam\" },\n { 2, \"Bart\" },\n ...\n</code></pre>\n" ...
2009/01/30
[ "https://Stackoverflow.com/questions/495042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60551/" ]
Background I have a component that provides certain CRM services - specificCRM. I have a specificCRMAdapter which implements my IGeneralCRM interface. Another component generalCRM exposes CRM functionality through IGeneralCRM and uses Spring.Net to inject the specificCRMAdapter to provide such functionality. Questio...
``` var names = new Dictionary<int, string> { { 1, "Adam" }, { 2, "Bart" }, { 3, "Charlie" } }; ```
495,051
<p>I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict?</p> <pre><code>public class Car { public enum Status { Off, Starting, Moving }; Status status = S...
[ { "answer_id": 495062, "author": "Kieron", "author_id": 5791, "author_profile": "https://Stackoverflow.com/users/5791", "pm_score": 0, "selected": false, "text": "<p>I usually prefix the enums, e.g. CarStatus. I suppose it all depends on team you're working with (if they have any rules/ ...
2009/01/30
[ "https://Stackoverflow.com/questions/495051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12379/" ]
I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict? ``` public class Car { public enum Status { Off, Starting, Moving }; Status status = Status.Off; ...
I'll add my 1 euro to the discussion but it's probably not adding anything new. The obvious solution is to move Status out of being a nested Enum. Most .NET enums (except possibly some in Windows.Forms namespace) aren't nested and it makes it annoying to use for the developer consuming your API, having to prefix the c...
495,069
<p>How can I update the common control dlls to version 6 on windows 2000. I have built a MFC application using new features available in version 6 of windows common control. The default version of the dll in windows 2000 is 5.80. I need to support windows 2000, I am unable to find a way to update the common control dll...
[ { "answer_id": 495062, "author": "Kieron", "author_id": 5791, "author_profile": "https://Stackoverflow.com/users/5791", "pm_score": 0, "selected": false, "text": "<p>I usually prefix the enums, e.g. CarStatus. I suppose it all depends on team you're working with (if they have any rules/ ...
2009/01/30
[ "https://Stackoverflow.com/questions/495069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I update the common control dlls to version 6 on windows 2000. I have built a MFC application using new features available in version 6 of windows common control. The default version of the dll in windows 2000 is 5.80. I need to support windows 2000, I am unable to find a way to update the common control dll. T...
I'll add my 1 euro to the discussion but it's probably not adding anything new. The obvious solution is to move Status out of being a nested Enum. Most .NET enums (except possibly some in Windows.Forms namespace) aren't nested and it makes it annoying to use for the developer consuming your API, having to prefix the c...
495,073
<p>I've got a web service that I talk to from a PDA. In the same directory as the webservice asmx file, I have an html file that I pull a web request from in order to see if the directory is available.</p> <p>I use the following code:</p> <pre><code> /// &lt;summary&gt; /// Holds the web request for checking t...
[ { "answer_id": 495062, "author": "Kieron", "author_id": 5791, "author_profile": "https://Stackoverflow.com/users/5791", "pm_score": 0, "selected": false, "text": "<p>I usually prefix the enums, e.g. CarStatus. I suppose it all depends on team you're working with (if they have any rules/ ...
2009/01/30
[ "https://Stackoverflow.com/questions/495073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44269/" ]
I've got a web service that I talk to from a PDA. In the same directory as the webservice asmx file, I have an html file that I pull a web request from in order to see if the directory is available. I use the following code: ``` /// <summary> /// Holds the web request for checking the connectivity. /// </...
I'll add my 1 euro to the discussion but it's probably not adding anything new. The obvious solution is to move Status out of being a nested Enum. Most .NET enums (except possibly some in Windows.Forms namespace) aren't nested and it makes it annoying to use for the developer consuming your API, having to prefix the c...
495,098
<p>image this two tables:</p> <pre><code>Table: Item Columns: ItemID, Title Table: Tag Columns: TagID, ItemID, Title </code></pre> <p>Which is the best way (without changing table structure (yes, I don't mind if they are not normalized)) to retrieve a list of items with all their tags attached using less possible qu...
[ { "answer_id": 495159, "author": "andynormancx", "author_id": 46354, "author_profile": "https://Stackoverflow.com/users/46354", "pm_score": 4, "selected": true, "text": "<p>I'm guessing that the original image is stored as a JPEG.</p>\n\n<p>PNG is designed for storing things like screen ...
2009/01/30
[ "https://Stackoverflow.com/questions/495098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1139600/" ]
image this two tables: ``` Table: Item Columns: ItemID, Title Table: Tag Columns: TagID, ItemID, Title ``` Which is the best way (without changing table structure (yes, I don't mind if they are not normalized)) to retrieve a list of items with all their tags attached using less possible query (i.e. not doing 11 que...
I'm guessing that the original image is stored as a JPEG. PNG is designed for storing things like screen shots and line drawing. It is not designed for storing things like photos. It all comes down to the type of compression used, PNG uses lossless compression so that the image will be exactly the same as the origina...
495,110
<p>I have a C# app and I need to convert between 3 different units (say for example: litres, gallons, and pints). </p> <p>The app needs to know about certain volumes of liquid, say: 1 pint, 10 pints, 20 pints and 100 pints. I intend to do the calculations and hard code the values (not ideal but necessary), </p> <p>I'...
[ { "answer_id": 495117, "author": "Pablo Retyk", "author_id": 30729, "author_profile": "https://Stackoverflow.com/users/30729", "pm_score": 2, "selected": false, "text": "<p>Please take a look at <a href=\"http://msdn.microsoft.com/en-us/library/aa288461(VS.71).aspx\" rel=\"nofollow noref...
2009/01/30
[ "https://Stackoverflow.com/questions/495110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
I have a C# app and I need to convert between 3 different units (say for example: litres, gallons, and pints). The app needs to know about certain volumes of liquid, say: 1 pint, 10 pints, 20 pints and 100 pints. I intend to do the calculations and hard code the values (not ideal but necessary), I'm looking for a d...
You can store a matrix of conversion factors where * a: Is litres * b: Is pints * c: Are gallons You'd have (not accurate, but assuming there are two pints to a litre and 4 litres to a gallon) ``` a b c a 1 2 0.25 b 0.5 1 0.125 c 4 8 1 ``` Alternatively, you can decide that ...
495,114
<p>When I insert a continuous string of text in a fixed width "td", the text is not wrapping. Pls let me know why? Here are the links to the html pages.</p> <p><a href="http://shivanand.in/tmp/textstring_withspace.html" rel="nofollow noreferrer">textstring with space</a><br /><a href="http://shivanand.in/tmp/textstrin...
[ { "answer_id": 495158, "author": "dylanfm", "author_id": 38795, "author_profile": "https://Stackoverflow.com/users/38795", "pm_score": 2, "selected": false, "text": "<p>You can add soft-hyphens: <code>&amp;shy;</code>.\nPut them within the long word.</p>\n\n<p>Have a look at it with this...
2009/01/30
[ "https://Stackoverflow.com/questions/495114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34642/" ]
When I insert a continuous string of text in a fixed width "td", the text is not wrapping. Pls let me know why? Here are the links to the html pages. [textstring with space](http://shivanand.in/tmp/textstring_withspace.html) [textstring without space](http://shivanand.in/tmp/textstring_withoutspace.html)
I wonder if this might help: ``` <p style="width: 100em; word-wrap: break-word">ThisTexthasnoSpacesThisTexthasnoSpacesThisTexthasnoSpacesThisTexthasnoSpacesThisTexthasnoSpaces</p> ``` Unfortunately, that requires you to know how wide you want your column to be.
495,118
<p>I have a question about inheritance and casting in Java. I have the following two example classes and a test class, and I state my question after the classes:</p> <pre><code>public class Automobile { public int var; public Automobile () { var = 1; } public String toString () { retu...
[ { "answer_id": 495136, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "<p>I believe you can't actually override variables in Java. The subclass actually 'hides' the variable <code>var</code>.</p>\n...
2009/01/30
[ "https://Stackoverflow.com/questions/495118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42155/" ]
I have a question about inheritance and casting in Java. I have the following two example classes and a test class, and I state my question after the classes: ``` public class Automobile { public int var; public Automobile () { var = 1; } public String toString () { return "AUTOMOBILE...
I believe you can't actually override variables in Java. The subclass actually 'hides' the variable `var`. When you cast to `Automobile`, you're getting the superclass' version of the `var` variable. However, the `toString()` method is still looking at the instance's version of the `var` variable. If you removed the ...
495,124
<p>Let's say I have a controller action that deletes an item out of a user's shopping basket. This controller action is triggered by performing a POST to the url ~/delete/{id}. If I have several pages on my application that will post to this url, how do I construct the controller action to redirect back to the page t...
[ { "answer_id": 495166, "author": "Eduardo Campañó", "author_id": 12091, "author_profile": "https://Stackoverflow.com/users/12091", "pm_score": 0, "selected": false, "text": "<p>I've never tried it but you can use the Referer header to know where the post or get comes from and try to matc...
2009/01/30
[ "https://Stackoverflow.com/questions/495124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574/" ]
Let's say I have a controller action that deletes an item out of a user's shopping basket. This controller action is triggered by performing a POST to the url ~/delete/{id}. If I have several pages on my application that will post to this url, how do I construct the controller action to redirect back to the page that p...
You should provide a RedirectToUrl parameter from the posting page. Relying on referrer headers is not a good practice. Instead, do something like this: ``` public ActionResult Delete(int id, string RedirectToUrl) { // check if RedirectToUrl is null or empty and redirect accordingly } ``` On the posting view or ...
495,129
<p>i would like to scramble all a-zA-Z so a world like</p> <p>hello becomes shrxs or bhidf</p> <p>the rest should stay the same. eg. "hello world!"="ksgii fishl!"</p> <p>etc.</p>
[ { "answer_id": 495150, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 4, "selected": false, "text": "<p>It's not clear whether this is intended to be reversible, so here are two alternative answers.</p>\n\n<p>\"hello\" bec...
2009/01/30
[ "https://Stackoverflow.com/questions/495129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
i would like to scramble all a-zA-Z so a world like hello becomes shrxs or bhidf the rest should stay the same. eg. "hello world!"="ksgii fishl!" etc.
It's not clear whether this is intended to be reversible, so here are two alternative answers. "hello" becoming "shrxs" implies a scheme that goes beyond simple subsitution (a [caesar cipher](http://en.wikipedia.org/wiki/Caesar_cipher)) and perhaps something like a polyalphabetic cipher. But for a simple caesar ciphe...
495,163
<p>I am pulling a column from database which contains date.In DB it is character value.I want to print the date in formatted way. I have used following code for printing the date in formatted manner.</p> <p></p> <p>where ${Po[1]} contains date value.</p> <p>But above statement prining null value.</p> <p>Any advice<...
[ { "answer_id": 495173, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 1, "selected": false, "text": "<p>Use a JSTL format tag, of course:</p>\n\n<pre><code>&lt;fmt:date etc.&gt;\n</code></pre>\n\n<p><a href=\"http://www.jav...
2009/01/30
[ "https://Stackoverflow.com/questions/495163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am pulling a column from database which contains date.In DB it is character value.I want to print the date in formatted way. I have used following code for printing the date in formatted manner. where ${Po[1]} contains date value. But above statement prining null value. Any advice Thanks in advance Sas
Use a JSTL format tag, of course: ``` <fmt:date etc.> ``` <http://www.java2s.com/Code/Java/JSTL/JSTLFormatDate.htm> Why your value is null is another matter. `Po[1]` isn't being set properly. How does that value get entered into the page?
495,174
<p>Is it possible to determine the number of columns displayed in a Reporting Services report, and use this within the Visibility expression of a separate textbox?</p> <p>I face the following scenario:</p> <p>My client has a Reporting Services 2005 report, containing a matrix, which displays a variable number of colu...
[ { "answer_id": 501057, "author": "Dustin Brooks", "author_id": 54617, "author_profile": "https://Stackoverflow.com/users/54617", "pm_score": 4, "selected": true, "text": "<p>Would you be able to do a count on the dataset to get your column count?</p>\n\n<pre><code>Count(Fields!FieldUsedA...
2009/01/30
[ "https://Stackoverflow.com/questions/495174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2084/" ]
Is it possible to determine the number of columns displayed in a Reporting Services report, and use this within the Visibility expression of a separate textbox? I face the following scenario: My client has a Reporting Services 2005 report, containing a matrix, which displays a variable number of columns, depending on...
Would you be able to do a count on the dataset to get your column count? ``` Count(Fields!FieldUsedAsColumnGrouping.Value,"DatasetName") ``` Not sure how your data and matrix are setup, I do something similar where I have to know the number of columns so that I can draw an appropriate border line. But I think you sh...
495,189
<p>I'm running into a problem where it is possible to insert a row into a table whithout specifically setting an INT NOT NULL column (defaults to 0 which is invalid for my purposes)</p> <p>I create the table this way:</p> <pre><code>CREATE TABLE inventorycontrol ( ID INT NOT NULL UNIQUE A...
[ { "answer_id": 495200, "author": "Polo", "author_id": 60561, "author_profile": "https://Stackoverflow.com/users/60561", "pm_score": -1, "selected": false, "text": "<p>Set the values NOT NULL, if this dont work and you cant check the values by code before inserting the row you should put ...
2009/01/30
[ "https://Stackoverflow.com/questions/495189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18565/" ]
I'm running into a problem where it is possible to insert a row into a table whithout specifically setting an INT NOT NULL column (defaults to 0 which is invalid for my purposes) I create the table this way: ``` CREATE TABLE inventorycontrol ( ID INT NOT NULL UNIQUE AUTO_INCREMENT ,no...
You need to put MySQL into [**strict mode**](http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_all_tables) In your configuration file: ``` sql-mode="STRICT_ALL_TABLES" ``` EDIT: You can also set it locally (and put it back) using this query: ``` SET @mode = @@SESSION.sql_mode; SET sql_mod...
495,194
<p>I need to create a table on a web page that has two rows. The table needs to fill the entire page so I have set the height and width of the table to 100% in the CSS stylesheet and the height of the HTML and body to 100% too.</p> <p>However, I need to top row of the table to be exactly 100 pixels in height and the s...
[ { "answer_id": 495206, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 0, "selected": false, "text": "<p>Yes, you can combine all measurements. Just try it out in different browsers.</p>\n" }, { "answer_id": 495...
2009/01/30
[ "https://Stackoverflow.com/questions/495194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44938/" ]
I need to create a table on a web page that has two rows. The table needs to fill the entire page so I have set the height and width of the table to 100% in the CSS stylesheet and the height of the HTML and body to 100% too. However, I need to top row of the table to be exactly 100 pixels in height and the second row ...
Without CSS this works: ``` <html> <body> <table height="100%" width="100%" border="1"> <tr height="100"> <td>This is item text.</td> </tr> <tr> <td>This is item text 2.</td> </tr> </table> </body> </html> ``` So it is possible, I'll try it now with CSS.
495,208
<p>I was faced to a problem how to version a configuration file in XML format. The easiest way is to write XSLT updates. Every release of the application has its own XSLT update. All these update files are small enough to be managable by the IDE, especially its <em>DIFF</em> tool.</p> <p>Since the project is already b...
[ { "answer_id": 495425, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 1, "selected": false, "text": "<p>There may be other ways to do this, but you could have a <a href=\"http://maven.apache.org/pom.html\" rel=\"nofollow nore...
2009/01/30
[ "https://Stackoverflow.com/questions/495208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32090/" ]
I was faced to a problem how to version a configuration file in XML format. The easiest way is to write XSLT updates. Every release of the application has its own XSLT update. All these update files are small enough to be managable by the IDE, especially its *DIFF* tool. Since the project is already been developed as ...
Some plugins allow you to use external descriptors (for example the [maven-assembly-plugin](http://maven.apache.org/plugins/maven-assembly-plugin/examples/sharing-descriptors.html)). Unfortunately the xml-maven-plugin isn't yet one of them. One option is to copy the relevant goals from the xml-maven-plugin and shoehor...
495,212
<p>Our resources consists of dozens of fields (attributes). Some of our clients don't need all resource's properties. To save network payload we implemented a query string parameter to limit the resource properties. So for example, the next URL will return a collection of resources with all their fields:</p> <p><a hre...
[ { "answer_id": 495425, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 1, "selected": false, "text": "<p>There may be other ways to do this, but you could have a <a href=\"http://maven.apache.org/pom.html\" rel=\"nofollow nore...
2009/01/30
[ "https://Stackoverflow.com/questions/495212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52954/" ]
Our resources consists of dozens of fields (attributes). Some of our clients don't need all resource's properties. To save network payload we implemented a query string parameter to limit the resource properties. So for example, the next URL will return a collection of resources with all their fields: <http://myapp/my...
Some plugins allow you to use external descriptors (for example the [maven-assembly-plugin](http://maven.apache.org/plugins/maven-assembly-plugin/examples/sharing-descriptors.html)). Unfortunately the xml-maven-plugin isn't yet one of them. One option is to copy the relevant goals from the xml-maven-plugin and shoehor...
495,244
<p>I'd like to write a test script or program that asserts that all DLL files in a given directory are of a particular build type.</p> <p>I would use this as a sanity check at the end of a build process on an SDK to make sure that the 64-bit version hasn't somehow got some 32-bit DLL files in it and vice versa.</p> <...
[ { "answer_id": 495305, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 8, "selected": true, "text": "<h2>Gory details</h2>\n\n<p>A DLL uses the PE executable format, and it's not too tricky to read that information out of t...
2009/01/30
[ "https://Stackoverflow.com/questions/495244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5427/" ]
I'd like to write a test script or program that asserts that all DLL files in a given directory are of a particular build type. I would use this as a sanity check at the end of a build process on an SDK to make sure that the 64-bit version hasn't somehow got some 32-bit DLL files in it and vice versa. Is there an eas...
Gory details ------------ A DLL uses the PE executable format, and it's not too tricky to read that information out of the file. See this [MSDN article on the PE File Format](http://reversingproject.info/wp-content/uploads/2009/05/an_in-depth_look_into_the_win32_portable_executable_file_format_part_1.pdf) for an over...
495,245
<p>I'm working on a .net 3.5 site, standard website project.</p> <p>I've written a custom page class in the sites App_Code folder (MyPage).</p> <p>I also have a master page with a property.</p> <pre><code>public partial class MyMaster : System.Web.UI.MasterPage { ... private string pageID = ""; public strin...
[ { "answer_id": 495338, "author": "Zhaph - Ben Duguid", "author_id": 33051, "author_profile": "https://Stackoverflow.com/users/33051", "pm_score": 4, "selected": true, "text": "<p>I've tended to do the following with Web Site projects:</p>\n\n<p>In App_Code create the the following:</p>\n...
2009/01/30
[ "https://Stackoverflow.com/questions/495245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60152/" ]
I'm working on a .net 3.5 site, standard website project. I've written a custom page class in the sites App\_Code folder (MyPage). I also have a master page with a property. ``` public partial class MyMaster : System.Web.UI.MasterPage { ... private string pageID = ""; public string PageID { get ...
I've tended to do the following with Web Site projects: In App\_Code create the the following: **BaseMaster.cs** ``` using System.Web.UI; public class BaseMaster : MasterPage { public string MyString { get; set; } } ``` **BasePage.cs:** ``` using System; using System.Web.UI; public class BasePage : Page { ...
495,248
<p>Is it possible to take an existing type and create an anonymous type from it with additional properties? For Example (in VB)</p> <pre><code>Public Class Person Public Name As String Public Age As Integer End Class Dim p As New Person With {.Name = "James", .Age = 100} Dim n = New With {.ShoeSize = 10} </code>...
[ { "answer_id": 495257, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 3, "selected": true, "text": "<p>There is no syntax to do that in C#. You'll have to construct the anonymous type yourself, with all the properties....
2009/01/30
[ "https://Stackoverflow.com/questions/495248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38911/" ]
Is it possible to take an existing type and create an anonymous type from it with additional properties? For Example (in VB) ``` Public Class Person Public Name As String Public Age As Integer End Class Dim p As New Person With {.Name = "James", .Age = 100} Dim n = New With {.ShoeSize = 10} ``` What I want is ...
There is no syntax to do that in C#. You'll have to construct the anonymous type yourself, with all the properties.
495,256
<p>Im trying do this basically:</p> <pre><code> var tr = document.createElement("tr"); var td = document.createElement("td"); td.appendChild(document.createTextNode('&lt;input class="param" type="text" name="dummy" value="fred"/&gt;')); tr.appendChild(td); </code></pre> <p>but it just displays the inpu...
[ { "answer_id": 495259, "author": "Rutesh Makhijani", "author_id": 57686, "author_profile": "https://Stackoverflow.com/users/57686", "pm_score": 1, "selected": false, "text": "<p>Try using innerHtml property of element.</p>\n\n<p>That is try using <code>td.innerHtml = \"&lt;input ...../&g...
2009/01/30
[ "https://Stackoverflow.com/questions/495256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51582/" ]
Im trying do this basically: ``` var tr = document.createElement("tr"); var td = document.createElement("td"); td.appendChild(document.createTextNode('<input class="param" type="text" name="dummy" value="fred"/>')); tr.appendChild(td); ``` but it just displays the input... as normal text, how do I in...
You could either ``` td.innerHTML = '<input class="param" type="text" name="dummy" value="fred"/>'; ``` or ``` var ip = document.createElement( 'input' ); ip.className = 'param'; ip.type = 'text'; ip.name = 'dummy'; ip.value = 'fred'; td.appendChild( ip ); ``` EDIT ie won't allow the type of a form element to b...
495,262
<p>How would one go about linking (some) symbols to specific fixed addresses using GNU ld so that the binary could still be executed as normal in Linux (x86)? There will not be any accesses to those symbols, but their addresses are important.</p> <p>For example, I'd have the following structure:</p> <pre><code>struct...
[ { "answer_id": 495308, "author": "Adam Hawes", "author_id": 54415, "author_profile": "https://Stackoverflow.com/users/54415", "pm_score": 1, "selected": false, "text": "<p>I'll give you the hot tip... GNU LD can do this (assuming the system libs don't need the address you want). You jus...
2009/01/30
[ "https://Stackoverflow.com/questions/495262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20957/" ]
How would one go about linking (some) symbols to specific fixed addresses using GNU ld so that the binary could still be executed as normal in Linux (x86)? There will not be any accesses to those symbols, but their addresses are important. For example, I'd have the following structure: ``` struct FooBar { Registe...
The suggestion by litb to use `--defsym symbol=address` does work, but is a bit cumbersome when you have a few dozen such instances to map. However, `--just-symbols=symbolfile` does just the trick. It took me a while to find out the syntax of the `symbolfile`, which is ``` symbolname1 = address; symbolname2 = address;...
495,264
<p>I am working on an SWT project as part of a team. We are constantly breaking each others build environment because Eclipses .classpath file is checked into version control and we include different SWT libraries for our machines. </p> <p>Depending on who committed last, the .classpath entry can be:</p> <pre><code>&...
[ { "answer_id": 495302, "author": "basszero", "author_id": 287, "author_profile": "https://Stackoverflow.com/users/287", "pm_score": 4, "selected": true, "text": "<p>Eclipse will let you define classpath variables so you can keep the .classpath the same, but each developer would configure...
2009/01/30
[ "https://Stackoverflow.com/questions/495264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43662/" ]
I am working on an SWT project as part of a team. We are constantly breaking each others build environment because Eclipses .classpath file is checked into version control and we include different SWT libraries for our machines. Depending on who committed last, the .classpath entry can be: ``` <classpathentry kind="...
Eclipse will let you define classpath variables so you can keep the .classpath the same, but each developer would configure her Eclipse according to platform. You could at least then version the .classpath file. You will have to alter the directory structure of where you store your SWT jars to something where the jar n...
495,275
<p>If I have have a <code>WorkflowInstance</code> can I executed twice in a row?</p> <pre><code>WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(...)); instance.start(); instance.start(); </code></pre> <p>When I do this I get and exception telling me that I don't have a persistence service configured...
[ { "answer_id": 495303, "author": "Rutesh Makhijani", "author_id": 57686, "author_profile": "https://Stackoverflow.com/users/57686", "pm_score": 2, "selected": true, "text": "<p>As per the specifications of WorkflowInstance you can start the instance only once</p>\n\n<p>have a look at <a ...
2009/01/30
[ "https://Stackoverflow.com/questions/495275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54947/" ]
If I have have a `WorkflowInstance` can I executed twice in a row? ``` WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(...)); instance.start(); instance.start(); ``` When I do this I get and exception telling me that I don't have a persistence service configured. However my question is: after I exe...
As per the specifications of WorkflowInstance you can start the instance only once have a look at <http://msdn.microsoft.com/en-us/library/system.workflow.runtime.workflowinstance.start.aspx> An InvalidOperationException is thrown if the instance is already running
495,294
<p>Surely there is a better way to do this?</p> <pre><code>results = [] if not queryset is None: for obj in queryset: results.append((getattr(obj,field.attname),obj.pk)) </code></pre> <p>The problem is that sometimes queryset is None which causes an exception when I try to iterate over it. In this case, I...
[ { "answer_id": 495327, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 1, "selected": false, "text": "<p>you can use list comprehensions, but other than that I don't see what you can improve</p>\n\n<pre><code>result = []...
2009/01/30
[ "https://Stackoverflow.com/questions/495294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27478/" ]
Surely there is a better way to do this? ``` results = [] if not queryset is None: for obj in queryset: results.append((getattr(obj,field.attname),obj.pk)) ``` The problem is that sometimes queryset is None which causes an exception when I try to iterate over it. In this case, I just want result to be se...
``` results = [(getattr(obj, field.attname), obj.pk) for obj in queryset or []] ```
495,315
<p>I'm sure there's an elegant solution to the problem but I just can't get my head around it. I am trying to call a web service from within a Windows service. The web service is secured (using Windows authentication). The account that the windows service runs under does have the rights to call the web service but I ca...
[ { "answer_id": 495342, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 3, "selected": false, "text": "<p>You should be able to use something like this:</p>\n\n<pre><code>var myService = new myThing.Service();\nmyServi...
2009/01/30
[ "https://Stackoverflow.com/questions/495315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16671/" ]
I'm sure there's an elegant solution to the problem but I just can't get my head around it. I am trying to call a web service from within a Windows service. The web service is secured (using Windows authentication). The account that the windows service runs under does have the rights to call the web service but I can't...
You should be able to use something like this: ``` var myService = new myThing.Service(); myService.Credentials = System.Net.CredentialCache.DefaultCredentials; ```
495,323
<p>How would I quit all running user applications using Applescript?</p>
[ { "answer_id": 495346, "author": "Brock Woolf", "author_id": 40002, "author_profile": "https://Stackoverflow.com/users/40002", "pm_score": 5, "selected": true, "text": "<p>It's okay... I think I found my answer:</p>\n\n<pre><code>tell application \"System Events\" to set the visible of e...
2009/01/30
[ "https://Stackoverflow.com/questions/495323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40002/" ]
How would I quit all running user applications using Applescript?
It's okay... I think I found my answer: ``` tell application "System Events" to set the visible of every process to true set white_list to {"Finder"} try tell application "Finder" set process_list to the name of every process whose visible is true end tell repeat with i from 1 to (number of items...
495,345
<p>I would like to remove selected commit log entries from a linear commit tree, so that the entries do not show in the commit log.</p> <p>My commit tree looks something like:</p> <pre><code>R--A--B--C--D--E--HEAD </code></pre> <p>I would like to remove the B and C entries so that they do not show in the commit log,...
[ { "answer_id": 495352, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 9, "selected": true, "text": "<p><a href=\"http://schacon.github.com/git/git-rebase.html\" rel=\"noreferrer\">git-rebase(1)</a> does exactly that. </p>\n\n<pre...
2009/01/30
[ "https://Stackoverflow.com/questions/495345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29096/" ]
I would like to remove selected commit log entries from a linear commit tree, so that the entries do not show in the commit log. My commit tree looks something like: ``` R--A--B--C--D--E--HEAD ``` I would like to remove the B and C entries so that they do not show in the commit log, but changes from A to D should b...
[git-rebase(1)](http://schacon.github.com/git/git-rebase.html) does exactly that. ``` $ git rebase -i HEAD~5 ``` [git awsome-ness [git rebase --interactive]](http://web.archive.org/web/20100213104931/http://blog.madism.org/index.php/2007/09/09/138-git-awsome-ness-git-rebase-interactive) contains an example. 1. Don...
495,347
<p>The following example successfully binds objects with a <code>ListBox</code> to display them. However, I would like to create all the objects in one class and then from another class query them with LINQ to fill my XAML <code>ListBox</code>, what would I need to add this example:</p> <p>XAML:</p> <pre><code>&lt;Wi...
[ { "answer_id": 495368, "author": "Steve Godbold", "author_id": 454507, "author_profile": "https://Stackoverflow.com/users/454507", "pm_score": 1, "selected": false, "text": "<p>Take a look @ <a href=\"http://www.codeplex.com/bindablelinq\" rel=\"nofollow noreferrer\">http://www.codeplex....
2009/01/30
[ "https://Stackoverflow.com/questions/495347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
The following example successfully binds objects with a `ListBox` to display them. However, I would like to create all the objects in one class and then from another class query them with LINQ to fill my XAML `ListBox`, what would I need to add this example: XAML: ``` <Window x:Class="WpfApplication15.Window1" ...
*edit: added ToList call to the LINQ query* You can just assign the ItemsSource of the ListBox using LINQ in code-behind for this. Assuming you give your ListBox a name: ``` <Window x:Class="WpfApplication15.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-na...
495,348
<p>I have a set of textboxes on a form, called sm1, sm2 etc, and I want to assign them to cells A1, A2, etc. Is there a way to put this in a loop, ie:</p> <pre><code>For i = 1 to 100 Cells(i, 1).Value = ("sm" &amp; c).Value Next i </code></pre>
[ { "answer_id": 495358, "author": "Binary Worrier", "author_id": 18797, "author_profile": "https://Stackoverflow.com/users/18797", "pm_score": 3, "selected": true, "text": "<p>Not sure of VBA, but there should be \"controls\" collection on the form, you can access the elements of this by ...
2009/01/30
[ "https://Stackoverflow.com/questions/495348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59790/" ]
I have a set of textboxes on a form, called sm1, sm2 etc, and I want to assign them to cells A1, A2, etc. Is there a way to put this in a loop, ie: ``` For i = 1 to 100 Cells(i, 1).Value = ("sm" & c).Value Next i ```
Not sure of VBA, but there should be "controls" collection on the form, you can access the elements of this by the control name, like you show above. ``` cells(i,1).Value = Controls("sm"&c).Value ```
495,351
<p>I'm trying to pass a <code>ViewData</code> object from a master page to a view user control using the <code>ViewDataDictionary</code>. </p> <p>The problem is the <code>ViewDataDictionary</code> is not returning any values in the view user control whichever way I try it. </p> <p>The sample code below is using an a...
[ { "answer_id": 495417, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 4, "selected": true, "text": "<p>Have you tried:</p>\n\n<pre><code>&lt;% Html.RenderPartial(\"~/Views/Project/Projects.ascx\", ViewData); %&gt;\n</code></...
2009/01/30
[ "https://Stackoverflow.com/questions/495351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54582/" ]
I'm trying to pass a `ViewData` object from a master page to a view user control using the `ViewDataDictionary`. The problem is the `ViewDataDictionary` is not returning any values in the view user control whichever way I try it. The sample code below is using an anonymous object just for demonstration although nei...
Have you tried: ``` <% Html.RenderPartial("~/Views/Project/Projects.ascx", ViewData); %> ``` Also have you verified ViewData["Test"] is in the ViewData before you are passing it? Also note that when passing your ViewData to a Partial Control that it is important to keep the Model the same. Nick
495,380
<p>I have made a class which a form can inherit from and it handles form Location, Size and State. And it works nicely. Except for one thing: </p> <p>When you maximize the application on a different screen than your main one, the location and size (before you maximized) gets stored correctly, but when it is maximized ...
[ { "answer_id": 495396, "author": "Stu Mackellar", "author_id": 28591, "author_profile": "https://Stackoverflow.com/users/28591", "pm_score": 2, "selected": false, "text": "<p>There's no built in way to do this - you'll have to write the logic yourself. One reason for this is that you hav...
2009/01/30
[ "https://Stackoverflow.com/questions/495380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39321/" ]
I have made a class which a form can inherit from and it handles form Location, Size and State. And it works nicely. Except for one thing: When you maximize the application on a different screen than your main one, the location and size (before you maximized) gets stored correctly, but when it is maximized (according...
I found a solution to your problem by writing a little functio, that tests, if a poitn is on a connected screen. The main idea came from <http://msdn.microsoft.com/en-us/library/system.windows.forms.screen(VS.80).aspx> but some modifications were needed. ``` public static bool ThisPointIsOnOneOfTheConnectedScreens(P...
495,390
<p>I got an Java application using SQL tables that contains an ordered list of entities, ordered by an order column. I would like to add/remove things in/from the middle of the list. Now, I'm wondering if some persistence framework / orm / you-name-it could provide this kind of functionality with batch update of order...
[ { "answer_id": 495399, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 3, "selected": false, "text": "<p>My advice is to do two things:</p>\n\n<ol>\n<li>Choose very large increments between your items, say one million. This ...
2009/01/30
[ "https://Stackoverflow.com/questions/495390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28482/" ]
I got an Java application using SQL tables that contains an ordered list of entities, ordered by an order column. I would like to add/remove things in/from the middle of the list. Now, I'm wondering if some persistence framework / orm / you-name-it could provide this kind of functionality with batch update of order co...
My advice is to do two things: 1. Choose very large increments between your items, say one million. This way you can move an item at 8,000,000 to before 7,000,000 by changing just it to 6,500,000; and 2. Every now and again reorder the items as a batch job. The large increments don't eliminate the problem of doing a ...
495,392
<p>I've managed to use <a href="http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunMSCAPI" rel="noreferrer">Sun's MSCAPI provider</a> in my application. The problem I'm having now is that it always pops up a window, asking for a password, even though I've provided it in the code. This is a...
[ { "answer_id": 495495, "author": "Hes Siemelink", "author_id": 17499, "author_profile": "https://Stackoverflow.com/users/17499", "pm_score": 0, "selected": false, "text": "<p>My guess is that Windows is popping up the pop up.</p>\n\n<p>Import your key again using the Certificate Import W...
2009/01/30
[ "https://Stackoverflow.com/questions/495392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6400/" ]
I've managed to use [Sun's MSCAPI provider](http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunMSCAPI) in my application. The problem I'm having now is that it always pops up a window, asking for a password, even though I've provided it in the code. This is a problem, because I need the cr...
The MSCAPI provider does not support providing the password to CAPI: > > A compatibility mode is supported for applications that assume a password must be supplied. It permits (but ignores) a non-null password. The mode is enabled by default. [(1)](http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Platform/wind...
495,422
<p>I'm new to python, so please excuse what is probably a pretty dumb question. </p> <p>Basically, I have a single global variable, called _debug, which is used to determine whether or not the script should output debugging information. My problem is, I can't set it in a different python script than the one that uses ...
[ { "answer_id": 495444, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 3, "selected": false, "text": "<p>Names beginning with an underscore aren't imported with </p>\n\n<pre><code>from one import *\n</code></pre>\n" }...
2009/01/30
[ "https://Stackoverflow.com/questions/495422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
I'm new to python, so please excuse what is probably a pretty dumb question. Basically, I have a single global variable, called \_debug, which is used to determine whether or not the script should output debugging information. My problem is, I can't set it in a different python script than the one that uses it. I ha...
There are more problems than just the leading underscore I'm afraid. When you call `my_function()`, it still won't have your `debug` variable in its namespace, unless you import it from `two.py`. Of course, doing that means you'll end up with cyclic dependencies (`one.py -> two.py -> one.py`), and you'll get `NameErr...
495,424
<p>How to get rid of '\n' at the end of a line ?</p>
[ { "answer_id": 495428, "author": "Ionuț G. Stan", "author_id": 58808, "author_profile": "https://Stackoverflow.com/users/58808", "pm_score": 5, "selected": false, "text": "<pre><code>\"string \\n\".strip();\n</code></pre>\n\n<p>or</p>\n\n<pre><code>\"string \\n\".rstrip();\n</code></pre>...
2009/01/30
[ "https://Stackoverflow.com/questions/495424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
How to get rid of '\n' at the end of a line ?
``` "string \n".strip(); ``` or ``` "string \n".rstrip(); ```
495,426
<p>How would you design a RESTful query to support OR operand between parameters. Let's say my resource has two fields field1 &amp; field2. How would you design the URL to enable the following query: </p> <p>"Get myresources where field1=x OR field2=y"</p> <p>Designing queries in REST is pretty straight forward, but ...
[ { "answer_id": 495466, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 5, "selected": true, "text": "<p>Query params aren't by definition AND related, they're just inert params - how you handle them is up to you. For an OR ...
2009/01/30
[ "https://Stackoverflow.com/questions/495426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52954/" ]
How would you design a RESTful query to support OR operand between parameters. Let's say my resource has two fields field1 & field2. How would you design the URL to enable the following query: "Get myresources where field1=x OR field2=y" Designing queries in REST is pretty straight forward, but I have only seen quer...
Query params aren't by definition AND related, they're just inert params - how you handle them is up to you. For an OR search I'd suggest: ``` GET /myresources?field1=x&field2=y&inclusive=true ``` *If* you want to default to an AND relationship (reasonable), and any other extension you want is of course possible.
495,447
<p>I'm looking to create a generic confirmation box that can be used by multiple widgets easily, but I'm running into problems with scope and was hoping for a clearer way of doing what I'm trying to do.</p> <p>Currently I have the following - </p> <pre><code>(function() { var global = this; global.confirmati...
[ { "answer_id": 495499, "author": "jishi", "author_id": 33663, "author_profile": "https://Stackoverflow.com/users/33663", "pm_score": 0, "selected": false, "text": "<p>Try something like this:</p>\n\n<pre><code>(function() {\n\n var global = this;\n /*****************This is new****...
2009/01/30
[ "https://Stackoverflow.com/questions/495447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60598/" ]
I'm looking to create a generic confirmation box that can be used by multiple widgets easily, but I'm running into problems with scope and was hoping for a clearer way of doing what I'm trying to do. Currently I have the following - ``` (function() { var global = this; global.confirmationBox = function() { ...
You could pass jqContainer to the confirm/cancel functions. Alternately, assign jqContainer as a property of caller. Since the confirm/cancel functions are called as methods of caller, they will have access to it via `this`. But that limits you to tracking one dialog per widget.
495,452
<p>I am doing a series of window resizing using the DeferWindowPos functionality. Suppose I already opened the DeferWindowPos handle, and called DeferWindowPos a few time, and now I want to cancel everything: not call EndDeferWindowPos. I tried CloseHandle( hDWP ), but it does not work (crash). If I simply return f...
[ { "answer_id": 495499, "author": "jishi", "author_id": 33663, "author_profile": "https://Stackoverflow.com/users/33663", "pm_score": 0, "selected": false, "text": "<p>Try something like this:</p>\n\n<pre><code>(function() {\n\n var global = this;\n /*****************This is new****...
2009/01/30
[ "https://Stackoverflow.com/questions/495452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12082/" ]
I am doing a series of window resizing using the DeferWindowPos functionality. Suppose I already opened the DeferWindowPos handle, and called DeferWindowPos a few time, and now I want to cancel everything: not call EndDeferWindowPos. I tried CloseHandle( hDWP ), but it does not work (crash). If I simply return from my ...
You could pass jqContainer to the confirm/cancel functions. Alternately, assign jqContainer as a property of caller. Since the confirm/cancel functions are called as methods of caller, they will have access to it via `this`. But that limits you to tracking one dialog per widget.
495,457
<p>I am deploying my Java application with Ant. Unfortunately my test deployment on the local machine doesn't work because of Vista. The Program Files directionaries are protected and i don't want to start Ant or Eclipse as an Admin. So i had the idea to move my webapps folder to a workspace subfolder, so i can use rel...
[ { "answer_id": 495543, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 2, "selected": false, "text": "<p>The following should work in Windows:</p>\n\n<pre><code>C:/Users/maerch/Workspaces/Tomcat6.0_webapps/\n/Users/maer...
2009/01/30
[ "https://Stackoverflow.com/questions/495457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038/" ]
I am deploying my Java application with Ant. Unfortunately my test deployment on the local machine doesn't work because of Vista. The Program Files directionaries are protected and i don't want to start Ant or Eclipse as an Admin. So i had the idea to move my webapps folder to a workspace subfolder, so i can use relati...
I have very the same security issue with Vista and I resolve it by providing "Full control" access level for "Users" group on "Program Files\Apache Software Foundation\Tomcat XYZ" folder. It resolved deployment issues with tomcat for me as well as question on starting tomcat as a service. Of course you can assign perm...
495,465
<p>I tried to execute the <code>DESCRIBE</code> command via a database link, but this was the return message:</p> <pre><code>DESCRIBE &lt;table&gt;@&lt;database&gt;; ERROR: ------------------------------------ ERROR: object &lt;table&gt; does not exist 1 rows selected </code></pre> <...
[ { "answer_id": 495473, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 2, "selected": false, "text": "<p>I think DESCRIBE is a SQL*Plus feature. See <a href=\"http://www.ss64.com/ora/desc.html\" rel=\"nofollow noreferre...
2009/01/30
[ "https://Stackoverflow.com/questions/495465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32043/" ]
I tried to execute the `DESCRIBE` command via a database link, but this was the return message: ``` DESCRIBE <table>@<database>; ERROR: ------------------------------------ ERROR: object <table> does not exist 1 rows selected ``` A `SELECT` on this table works well. **Does Oracle p...
You could do something with the [all\_tab\_columns](http://download.oracle.com/docs/cd/B28359_01/server.111/b28320/statviews_2091.htm) table to get some table information. ``` select column_name, data_type from all_tab_columns where table_name = 'TABLE_NAME'; ```
495,471
<p>I'm creating a class named <code>TetraQueue</code> that inherits <code>System.Collections.Generic.Queue</code> class overriding the <code>Dequeue</code> method, here is the code:</p> <pre><code>public class TetraQueue : Queue&lt;Tetrablock&gt; { public override Tetrablock Dequeue() { return base.Dequeu...
[ { "answer_id": 495475, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 4, "selected": true, "text": "<p>Unfortunately the <code>Dequeue</code> method is not virtual so you can't override it.</p>\n" }, { "answer_i...
2009/01/30
[ "https://Stackoverflow.com/questions/495471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2605/" ]
I'm creating a class named `TetraQueue` that inherits `System.Collections.Generic.Queue` class overriding the `Dequeue` method, here is the code: ``` public class TetraQueue : Queue<Tetrablock> { public override Tetrablock Dequeue() { return base.Dequeue(); } } ``` But when I try to compile this I g...
Unfortunately the `Dequeue` method is not virtual so you can't override it.
495,478
<p>I am writing a Wordpress plugin. </p> <p>I want to perform a redirect (after creating DB records from POST data, etc...) to other ADMIN page.</p> <p>Neither header("Location: ...) nor wp_redirect() work - i get</p> <p>Warning: Cannot modify header information - headers already sent by </p> <p>which comes from ob...
[ { "answer_id": 495488, "author": "Chris Ballance", "author_id": 1551, "author_profile": "https://Stackoverflow.com/users/1551", "pm_score": 0, "selected": false, "text": "<p>You need to make sure that nothing is sent to http output before the redirect takes place. </p>\n\n<p>You can set...
2009/01/30
[ "https://Stackoverflow.com/questions/495478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6657/" ]
I am writing a Wordpress plugin. I want to perform a redirect (after creating DB records from POST data, etc...) to other ADMIN page. Neither header("Location: ...) nor wp\_redirect() work - i get Warning: Cannot modify header information - headers already sent by which comes from obvious reason. How do I proper...
On your form action, add 'noheader=true' to the action URL. This will prevent the headers for the admin area from being outputted before your redirect. For example: ``` <form name="post" action="<?php echo admin_url('admin.php?page=your-admin-page&noheader=true'); ?>" method="post" id="post"> ```
495,485
<p>Im using states in my flex form application. </p> <p>The base state is the regular form. I then have an advanced form button which calls the advanced state. Once inside the advanced state form if a user enters invalid data an error will be displayed using another error state which just adds a text field to the last...
[ { "answer_id": 495488, "author": "Chris Ballance", "author_id": 1551, "author_profile": "https://Stackoverflow.com/users/1551", "pm_score": 0, "selected": false, "text": "<p>You need to make sure that nothing is sent to http output before the redirect takes place. </p>\n\n<p>You can set...
2009/01/30
[ "https://Stackoverflow.com/questions/495485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24481/" ]
Im using states in my flex form application. The base state is the regular form. I then have an advanced form button which calls the advanced state. Once inside the advanced state form if a user enters invalid data an error will be displayed using another error state which just adds a text field to the lastChild elem...
On your form action, add 'noheader=true' to the action URL. This will prevent the headers for the admin area from being outputted before your redirect. For example: ``` <form name="post" action="<?php echo admin_url('admin.php?page=your-admin-page&noheader=true'); ?>" method="post" id="post"> ```
495,496
<p>I have this partial code:</p> <pre><code>if ($getRecords = $con-&gt;prepare("SELECT * FROM AUCTIONS WHERE ARTICLE_NO = ?")) { $getHtml = $con-&gt;prepare("SELECT ARTICLE_DESC FROM AUCTIONS WHERE ARTICLE_NO = ?"); $getHtml-&gt;bind_param("i", $pk); $getHtml-&gt;execute(); $getHtml-&gt;bind_result($ARTICLE_DESC)...
[ { "answer_id": 495488, "author": "Chris Ballance", "author_id": 1551, "author_profile": "https://Stackoverflow.com/users/1551", "pm_score": 0, "selected": false, "text": "<p>You need to make sure that nothing is sent to http output before the redirect takes place. </p>\n\n<p>You can set...
2009/01/30
[ "https://Stackoverflow.com/questions/495496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have this partial code: ``` if ($getRecords = $con->prepare("SELECT * FROM AUCTIONS WHERE ARTICLE_NO = ?")) { $getHtml = $con->prepare("SELECT ARTICLE_DESC FROM AUCTIONS WHERE ARTICLE_NO = ?"); $getHtml->bind_param("i", $pk); $getHtml->execute(); $getHtml->bind_result($ARTICLE_DESC); $getRecords->bind_param("i...
On your form action, add 'noheader=true' to the action URL. This will prevent the headers for the admin area from being outputted before your redirect. For example: ``` <form name="post" action="<?php echo admin_url('admin.php?page=your-admin-page&noheader=true'); ?>" method="post" id="post"> ```
495,502
<p>I've made soap connection to a server and the server doesn't seem to be dropping that connection, in netstat the status of the connection is listed as CLOSE WAIT.</p> <p>I'm told that the client that created the soap connection has to send a command to the server to close the connection. Can anyone tell me the corr...
[ { "answer_id": 495488, "author": "Chris Ballance", "author_id": 1551, "author_profile": "https://Stackoverflow.com/users/1551", "pm_score": 0, "selected": false, "text": "<p>You need to make sure that nothing is sent to http output before the redirect takes place. </p>\n\n<p>You can set...
2009/01/30
[ "https://Stackoverflow.com/questions/495502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36633/" ]
I've made soap connection to a server and the server doesn't seem to be dropping that connection, in netstat the status of the connection is listed as CLOSE WAIT. I'm told that the client that created the soap connection has to send a command to the server to close the connection. Can anyone tell me the correct way to...
On your form action, add 'noheader=true' to the action URL. This will prevent the headers for the admin area from being outputted before your redirect. For example: ``` <form name="post" action="<?php echo admin_url('admin.php?page=your-admin-page&noheader=true'); ?>" method="post" id="post"> ```
495,514
<p>Should I use this.</p> <pre><code>Imports System.IO Dim myStream As New Stream </code></pre> <p>or this..</p> <pre><code>Dim myStream As New System.IO.Stream </code></pre> <p>Does it make any difference to performance / memory usage?</p>
[ { "answer_id": 495520, "author": "Anton Gogolev", "author_id": 60188, "author_profile": "https://Stackoverflow.com/users/60188", "pm_score": 3, "selected": true, "text": "<p>No difference whatsoever - it's just a matter of taste and affects readability only. </p>\n\n<p>By the way, CLR is...
2009/01/30
[ "https://Stackoverflow.com/questions/495514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42446/" ]
Should I use this. ``` Imports System.IO Dim myStream As New Stream ``` or this.. ``` Dim myStream As New System.IO.Stream ``` Does it make any difference to performance / memory usage?
No difference whatsoever - it's just a matter of taste and affects readability only. By the way, CLR is not even aware of the concept of "namespaces": namespace names become prefixes to type names.
495,540
<p>How do I get past this variable initialization problem? If I only could figure out how to only initialize them only once...</p> <pre><code>* Main.cpp : main project file. /************************** Begin Header **************************/ #include "stdafx.h" //Required by Visual C ++ #include &lt;string&gt; ...
[ { "answer_id": 495563, "author": "James Ogden", "author_id": 3198, "author_profile": "https://Stackoverflow.com/users/3198", "pm_score": 2, "selected": false, "text": "<p>1) Make them static eg</p>\n\n<pre><code>static string typeArray[MAX];\n</code></pre>\n\n<p>Initialise them once, the...
2009/01/30
[ "https://Stackoverflow.com/questions/495540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60615/" ]
How do I get past this variable initialization problem? If I only could figure out how to only initialize them only once... ``` * Main.cpp : main project file. /************************** Begin Header **************************/ #include "stdafx.h" //Required by Visual C ++ #include <string> //Required to use s...
You're doing really well! The simple answer is to write static in front of your variables: ``` static int const MAX = 5; // Creat array size variable static int lowest; // The integer it will use to store the place of the lowest jar sales in the array static int highest; // The integer it will use to store the place ...
495,544
<p>I have a table for a menu system with the following structure, and some data.</p> <pre> ID, Text, ParentID, DestinationID 1, Applications, (null), (null) 2, Games, (null), (null) 3, Office, 1, (null) 4, Text Editing, 1, (null) 5, Media, (null), (null) 6, Word, 3, 1 7, Excel, 3, 2 8, Crysis, 2, 3 </pre> <p>What I n...
[ { "answer_id": 495558, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 2, "selected": false, "text": "<p>In Oracle:</p>\n\n<pre><code>SELECT m.*, level\nFROM my_table m\nSTART WITH\n Id = :startID\nCONNECT BY\n ParentID =...
2009/01/30
[ "https://Stackoverflow.com/questions/495544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6389/" ]
I have a table for a menu system with the following structure, and some data. ``` ID, Text, ParentID, DestinationID 1, Applications, (null), (null) 2, Games, (null), (null) 3, Office, 1, (null) 4, Text Editing, 1, (null) 5, Media, (null), (null) 6, Word, 3, 1 7, Excel, 3, 2 8, Crysis, 2, 3 ``` What I need is a quer...
SQL server only, but it sounds like a job for [Common Table Expressions](http://blogs.msdn.com/simonince/archive/2007/10/17/hierarchies-with-common-table-expressions.aspx).
495,552
<p>How can I probe an available TCP Port in order to programmatically configure WCF Service EndPoint ?</p>
[ { "answer_id": 495575, "author": "amazedsaint", "author_id": 45956, "author_profile": "https://Stackoverflow.com/users/45956", "pm_score": 2, "selected": false, "text": "<p>How your client will know about the endpoint, if you dynamically choose your server port? </p>\n\n<p>Anyway,</p>\n\...
2009/01/30
[ "https://Stackoverflow.com/questions/495552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50974/" ]
How can I probe an available TCP Port in order to programmatically configure WCF Service EndPoint ?
How your client will know about the endpoint, if you dynamically choose your server port? Anyway, Here is a dirty way of probing for an open port ``` for (int port = 2000; port < 65535; port++) { IPEndPoint ep = new IPEndPoint(IPAddress.Any, port); Socket ...
495,554
<p>How could I find out if a URL is available and usable to create a new site within a site collection or whether it is already in use by an other site, list or library?</p> <p>Assumed that the relative URL "/newUrl/ is not yet in use, the following code won't actually throw an exception until you try to access any of...
[ { "answer_id": 495586, "author": "Chris Ballance", "author_id": 1551, "author_profile": "https://Stackoverflow.com/users/1551", "pm_score": 3, "selected": true, "text": "<pre><code>if (web.Exists)\n</code></pre>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/microsoft.sharepoint...
2009/01/30
[ "https://Stackoverflow.com/questions/495554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19601/" ]
How could I find out if a URL is available and usable to create a new site within a site collection or whether it is already in use by an other site, list or library? Assumed that the relative URL "/newUrl/ is not yet in use, the following code won't actually throw an exception until you try to access any of the SPWeb...
``` if (web.Exists) ``` <http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.exists.aspx>
495,557
<p>I have an INI file that I want to read the line <code>DeviceName=PHJ01444-MC35</code> from group <code>[DEVICE]</code> and assign the value to a string.</p> <pre><code>[BEGIN-DO NOT CHANGE/MOVE THIS LINE] [ExecList] Exec4=PilotMobileBackup v1;Ver=&quot;1.0&quot;;NoUninst=1 Exec3=MC35 108 U 02;Ver=&quot;1.0.8&quot;;N...
[ { "answer_id": 495576, "author": "rslite", "author_id": 15682, "author_profile": "https://Stackoverflow.com/users/15682", "pm_score": 3, "selected": false, "text": "<p>You could use Windows API for this. See <a href=\"http://jachman.wordpress.com/2006/09/11/how-to-access-ini-files-in-c-n...
2009/01/30
[ "https://Stackoverflow.com/questions/495557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49971/" ]
I have an INI file that I want to read the line `DeviceName=PHJ01444-MC35` from group `[DEVICE]` and assign the value to a string. ``` [BEGIN-DO NOT CHANGE/MOVE THIS LINE] [ExecList] Exec4=PilotMobileBackup v1;Ver="1.0";NoUninst=1 Exec3=MC35 108 U 02;Ver="1.0.8";NoUninst=1 Exec2=FixMGa;Ver="1.0";Bck=1 Exec1=Clear Log ...
If you wanted the very simple but not very clean answer: ``` using System.IO; StreamReader reader = new StreamReader(filename); while(reader.ReadLine() != "[DEVICE]") { continue; } const string DeviceNameString = "DeviceName="; while(true) { string line = reader.ReadLine(); if(line.Length < DeviceNameString....
495,595
<p>I've looked at the <a href="http://docs.python.org/library/time.html" rel="nofollow noreferrer">Python Time module</a> and can't find anything that gives the integer of how many seconds since 1970 as PHP does with time().</p> <p>Am I simply missing something here or is there a common way to do this that's simply no...
[ { "answer_id": 495610, "author": "David Grant", "author_id": 40581, "author_profile": "https://Stackoverflow.com/users/40581", "pm_score": 6, "selected": true, "text": "<pre><code>import time\nprint int(time.time())\n</code></pre>\n" }, { "answer_id": 495612, "author": "Silen...
2009/01/30
[ "https://Stackoverflow.com/questions/495595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
I've looked at the [Python Time module](http://docs.python.org/library/time.html) and can't find anything that gives the integer of how many seconds since 1970 as PHP does with time(). Am I simply missing something here or is there a common way to do this that's simply not listed there?
``` import time print int(time.time()) ```
495,597
<p>I need to get a value from a textbox inside a FooterTemplate in the OnClick event of a button. My first thought was to loop through the items-property on my repeater, but as you can see in this sample, it only includes the actual databound items, not the footer-item.</p> <p>ASPX:</p> <pre><code>&lt;asp:Repeater ID...
[ { "answer_id": 495628, "author": "Ray Booysen", "author_id": 42124, "author_profile": "https://Stackoverflow.com/users/42124", "pm_score": 2, "selected": true, "text": "<p>From the <a href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.items.aspx\" rel=\"nof...
2009/01/30
[ "https://Stackoverflow.com/questions/495597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257/" ]
I need to get a value from a textbox inside a FooterTemplate in the OnClick event of a button. My first thought was to loop through the items-property on my repeater, but as you can see in this sample, it only includes the actual databound items, not the footer-item. ASPX: ``` <asp:Repeater ID="Repeater1" runat="serv...
From the [MSDN documentation](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.items.aspx), the Items is simply a set of RepeaterItems based off the DataSource that you are binding to and does not include items in the Header or FooterTemplates. If you want to reference the textbox, you can ge...
495,618
<p>I have two paths: </p> <pre><code>fred\frog </code></pre> <p>and</p> <pre><code>..\frag </code></pre> <p>I can join them together in PowerShell like this:</p> <pre><code>join-path 'fred\frog' '..\frag' </code></pre> <p>That gives me this:</p> <pre><code>fred\frog\..\frag </code></pre> <p>But I don't want tha...
[ { "answer_id": 495656, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": -1, "selected": false, "text": "<p>Well, one way would be:</p>\n\n<pre><code>Join-Path 'fred\\frog' '..\\frag'.Replace('..', '')\n</code></pre>\n\n<p>Wait,...
2009/01/30
[ "https://Stackoverflow.com/questions/495618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60620/" ]
I have two paths: ``` fred\frog ``` and ``` ..\frag ``` I can join them together in PowerShell like this: ``` join-path 'fred\frog' '..\frag' ``` That gives me this: ``` fred\frog\..\frag ``` But I don't want that. I want a normalized path without the double dots, like this: ``` fred\frag ``` How can I ...
You can use a combination of `$pwd`, `Join-Path` and `[System.IO.Path]::GetFullPath` to get a fully qualified expanded path. Since `cd` (`Set-Location`) doesn't change the process current working directory, simply passing a relative file name to a .NET API that doesn't understand PowerShell context, can have unintende...
495,629
<p>This question is very similar to <a href="https://stackoverflow.com/questions/123558/sql-server-2005-t-sql-to-temporarily-disable-a-trigger">SQL Server 2005: T-SQL to temporarily disable a trigger</a></p> <p>However I do not want to disable all triggers and not even for a batch of commands, but just for one single ...
[ { "answer_id": 495661, "author": "Justin Wignall", "author_id": 42774, "author_profile": "https://Stackoverflow.com/users/42774", "pm_score": 1, "selected": false, "text": "<p>Can you check for SUSER_SNAME() and only run when in context of the administration frontend?</p>\n" }, { ...
2009/01/30
[ "https://Stackoverflow.com/questions/495629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
This question is very similar to [SQL Server 2005: T-SQL to temporarily disable a trigger](https://stackoverflow.com/questions/123558/sql-server-2005-t-sql-to-temporarily-disable-a-trigger) However I do not want to disable all triggers and not even for a batch of commands, but just for one single INSERT. I have to de...
You can disable triggers on a table using: ``` ALTER TABLE MyTable DISABLE TRIGGER ALL ``` But that would do it for all sessions, not just your current connection.. which is obviously a very bad thing to do :-) The best way would be to alter the trigger itself so it makes the decision if it needs to run, whether th...
495,634
<p>Is it possible to use a jQuery ajax call to perform Forms Authentication with ASP.NET MVC? I've been unable to find any such examples. </p> <p>More specifically, how do I set the auth cookie on the page (without a redirect) so I can make successive authenticated ajax requests?</p>
[ { "answer_id": 495650, "author": "Christian Dalager", "author_id": 11239, "author_profile": "https://Stackoverflow.com/users/11239", "pm_score": 5, "selected": true, "text": "<p>Yes, it's possible.\nJust submit the login-form using the method <a href=\"http://weblogs.asp.net/mikebosch/ar...
2009/01/30
[ "https://Stackoverflow.com/questions/495634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is it possible to use a jQuery ajax call to perform Forms Authentication with ASP.NET MVC? I've been unable to find any such examples. More specifically, how do I set the auth cookie on the page (without a redirect) so I can make successive authenticated ajax requests?
Yes, it's possible. Just submit the login-form using the method [described here by mike bosch](http://weblogs.asp.net/mikebosch/archive/2008/02/15/asp-net-mvc-submitting-ajax-form-with-jquery.aspx) and return a json datastructure with the returnUrl if any. I have created a lightweight LoginResultDTO class that i retur...