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
420,732
<p>In my profiler reports I'm increasingly seeing the results of mock-based testing with dependency injection. Many of the dependencies were static, but because we want to test methods in isolation they are changed to instance members, like the following example:</p> <pre><code>class ShortLivedThing { IDependency1...
[ { "answer_id": 420763, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 4, "selected": true, "text": "<p>It seems to me like you need to leverage the features a proper dependency injection framework can give you. Do not us...
2009/01/07
[ "https://Stackoverflow.com/questions/420732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1324220/" ]
In my profiler reports I'm increasingly seeing the results of mock-based testing with dependency injection. Many of the dependencies were static, but because we want to test methods in isolation they are changed to instance members, like the following example: ``` class ShortLivedThing { IDependency1 dep1; IDepe...
It seems to me like you need to leverage the features a proper dependency injection framework can give you. Do not use different construction logic for testing/production. With spring, singleton injections are only performed at container startup. Prototype injections are done every time. The full wiring is also done e...
420,733
<p>I'm thinking about using asking sphinx to index many fields (in the hundreds), many of which will be null. My question is how much having many null fields will affect performance?</p> <p>This situation arises not from having incredibly denormalized data, but from requirements on the search interface and what can be...
[ { "answer_id": 420763, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 4, "selected": true, "text": "<p>It seems to me like you need to leverage the features a proper dependency injection framework can give you. Do not us...
2009/01/07
[ "https://Stackoverflow.com/questions/420733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6705/" ]
I'm thinking about using asking sphinx to index many fields (in the hundreds), many of which will be null. My question is how much having many null fields will affect performance? This situation arises not from having incredibly denormalized data, but from requirements on the search interface and what can be searched....
It seems to me like you need to leverage the features a proper dependency injection framework can give you. Do not use different construction logic for testing/production. With spring, singleton injections are only performed at container startup. Prototype injections are done every time. The full wiring is also done e...
420,741
<p>I'm looking at creating a basic ORM (purely for fun), and was wondering, is there a way to return the list of tables in a database and also the fields for every table?</p> <p>Using this, I want to be able to loop through the result set (in C#) and then say for each table in the result set, do this (e.g. use reflect...
[ { "answer_id": 420752, "author": "ZombieSheep", "author_id": 377, "author_profile": "https://Stackoverflow.com/users/377", "pm_score": 5, "selected": false, "text": "<p>Tables ::</p>\n\n<pre><code>SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'\n</code></pre>\n\n<p>...
2009/01/07
[ "https://Stackoverflow.com/questions/420741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
I'm looking at creating a basic ORM (purely for fun), and was wondering, is there a way to return the list of tables in a database and also the fields for every table? Using this, I want to be able to loop through the result set (in C#) and then say for each table in the result set, do this (e.g. use reflection to mak...
Is this what you are looking for: **Using OBJECT CATALOG VIEWS** ``` SELECT T.name AS Table_Name , C.name AS Column_Name , P.name AS Data_Type , C.max_length AS Size , CAST(P.precision AS VARCHAR) + '/' + CAST(P.scale AS VARCHAR) AS Precision_Scale FROM sys.objects AS T JOIN sys....
420,746
<p>I am trying to clean up some email addresses in sql server. I can see examples of the problematic emails, and they look like this:</p> <pre><code>abc123 @xyz.com </code></pre> <p>However, when I try to run a query to find folks like these, say with:</p> <pre><code>NOT CHARINDEX(' ',LTRIM(RTRIM([Email_Address])))...
[ { "answer_id": 420756, "author": "BlackWasp", "author_id": 21862, "author_profile": "https://Stackoverflow.com/users/21862", "pm_score": 4, "selected": true, "text": "<p>Is it definitely a space in there or could it be some other non-printing character?</p>\n" }, { "answer_id": 4...
2009/01/07
[ "https://Stackoverflow.com/questions/420746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4943/" ]
I am trying to clean up some email addresses in sql server. I can see examples of the problematic emails, and they look like this: ``` abc123 @xyz.com ``` However, when I try to run a query to find folks like these, say with: ``` NOT CHARINDEX(' ',LTRIM(RTRIM([Email_Address]))) = 0 ``` or ``` Email_Address like ...
Is it definitely a space in there or could it be some other non-printing character?
420,749
<p>I'd like to have the full history of a large text field edited by users, stored using Django.</p> <p>I've seen the projects:</p> <ul> <li><a href="http://code.google.com/p/fullhistory/" rel="nofollow noreferrer">Django Full History (Google Code)</a></li> <li><a href="http://code.google.com/p/django-modelhistory/" ...
[ { "answer_id": 421400, "author": "Jeff Bauer", "author_id": 41759, "author_profile": "https://Stackoverflow.com/users/41759", "pm_score": 1, "selected": false, "text": "<p>For managing the diffs, you would probably want to investigate Python's <a href=\"http://docs.python.org/library/dif...
2009/01/07
[ "https://Stackoverflow.com/questions/420749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19212/" ]
I'd like to have the full history of a large text field edited by users, stored using Django. I've seen the projects: * [Django Full History (Google Code)](http://code.google.com/p/fullhistory/) * [Django ModelHistory](http://code.google.com/p/django-modelhistory/), and * [Django FullHistory](http://code.djangoprojec...
**The storage issue:** I think you should only store the diffs of two consecutive valid versions of the document. As you point out, the problem becomes getting a valid version when concurrent edits take place. **The concurrency issue:** 1. Could you avoid them all together like [Jeff suggests](https://stackoverflow.c...
420,770
<p>I'm going to be brief because I'm short on time, so I apologize if this isn't as detailed as I'd like it to be.</p> <p>I have some code:</p> <pre><code>print("&lt;a href='#'&gt;Some text&lt;sup&gt;&amp;reg;&lt;/sup&gt; some more text&lt;/a&gt;"); </code></pre> <p>In FF, this works like I would like, the link as a...
[ { "answer_id": 420812, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 4, "selected": true, "text": "<p>The <code>&lt;sup&gt;</code> tag isn't great for things like trademark and reg symbols.</p>\n\n<p>I p...
2009/01/07
[ "https://Stackoverflow.com/questions/420770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32641/" ]
I'm going to be brief because I'm short on time, so I apologize if this isn't as detailed as I'd like it to be. I have some code: ``` print("<a href='#'>Some text<sup>&reg;</sup> some more text</a>"); ``` In FF, this works like I would like, the link as a whole is underlined. However in IE, the link is underlined e...
The `<sup>` tag isn't great for things like trademark and reg symbols. I prefer doing it with css: ``` <span style='font-size:75%;vertical-align:super;text-decoration:none'>&reg</span> ``` If you can set up a .reg class: ``` .reg { font-size:75%; vertical-align:super; text-decoration:none } ``` For: ...
420,774
<p>When <code>foreach</code>ing through a generic list I often want to do something different for the first element in the list:</p> <pre><code>List&lt;object&gt; objs = new List&lt;object&gt; { new Object(), new Object(), new Object(), new Object() }; foreach (object o in objs) { if (o == objs.Fi...
[ { "answer_id": 420786, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": true, "text": "<p>Well, you could code it using explicit iteration:</p>\n\n<pre><code>using(var iter = ints.GetEnumerator()) {\n if(...
2009/01/07
[ "https://Stackoverflow.com/questions/420774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39709/" ]
When `foreach`ing through a generic list I often want to do something different for the first element in the list: ``` List<object> objs = new List<object> { new Object(), new Object(), new Object(), new Object() }; foreach (object o in objs) { if (o == objs.First()) { System.Diagnosti...
Well, you could code it using explicit iteration: ``` using(var iter = ints.GetEnumerator()) { if(iter.MoveNext()) { // do "first" with iter.Current while(iter.MoveNext()) { // do something with the rest of the data with iter.Current } } } ``` The bool flag option (with `foreach`) is proba...
420,791
<p>Just got a review comment that my static import of the method was not a good idea. The static import was of a method from a DA class, which has mostly static methods. So in middle of the business logic I had a da activity that apparently seemed to belong to the current class:</p> <pre><code>import static some.packag...
[ { "answer_id": 420810, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 2, "selected": false, "text": "<p>Static imports are the only “new” feature of Java that I have never used and don’t intend to ever use, due to the problem...
2009/01/07
[ "https://Stackoverflow.com/questions/420791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18573/" ]
Just got a review comment that my static import of the method was not a good idea. The static import was of a method from a DA class, which has mostly static methods. So in middle of the business logic I had a da activity that apparently seemed to belong to the current class: ``` import static some.package.DA.*; class...
This is from Sun's guide when they released the feature (emphasis in original): > > So when should you use static import? **Very sparingly!** Only use it when you'd otherwise be tempted to declare local copies of constants, or to abuse inheritance (the Constant Interface Antipattern). ... If you overuse the static im...
420,792
<p>I'm considering moving my code (around 30K LOC) from CPython to Jython, so that I could have better integration with my java code. </p> <p>Is there a checklist or a guide I should look at, to help my with the migration? Does anyone have experience with doing something similar?</p> <p>From reading the <a href="http...
[ { "answer_id": 421125, "author": "Ali Afshar", "author_id": 28380, "author_profile": "https://Stackoverflow.com/users/28380", "pm_score": 3, "selected": false, "text": "<p>So far, I have noticed two further issues:</p>\n\n<ul>\n<li>String interning 'a' is 'a' is not guaranteed (and it is...
2009/01/07
[ "https://Stackoverflow.com/questions/420792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7581/" ]
I'm considering moving my code (around 30K LOC) from CPython to Jython, so that I could have better integration with my java code. Is there a checklist or a guide I should look at, to help my with the migration? Does anyone have experience with doing something similar? From reading the [Jython site](http://jython.so...
I'm starting this as a wiki collected from the other answers and my experience. Feel free to edit and add stuff, but please try to stick to practical advice rather than a list of broken things. Here's an [old list of differences](http://jython.sourceforge.net/archive/21/docs/differences.html) from the Jython site. Res...
420,800
<pre><code> Checkbox[,] checkArray = new Checkbox[2, 3]{{checkbox24,checkboxPref1,null}, {checkbox23,checkboxPref2,null}}; </code></pre> <p>I am getting error . How do I initialize it? </p>
[ { "answer_id": 420824, "author": "AnthonyLambert", "author_id": 31762, "author_profile": "https://Stackoverflow.com/users/31762", "pm_score": 0, "selected": false, "text": "<p>int[,] myArray;\nmyArray = new int[,] {{1,2}, {3,4}, {5,6}, {7,8}};</p>\n\n<p>Does for me....</p>\n\n<p>Tony</p>...
2009/01/07
[ "https://Stackoverflow.com/questions/420800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42564/" ]
``` Checkbox[,] checkArray = new Checkbox[2, 3]{{checkbox24,checkboxPref1,null}, {checkbox23,checkboxPref2,null}}; ``` I am getting error . How do I initialize it?
OK, I think I see what's happening here. You're trying to initialize an array at a class level using this syntax, and one of the checkboxes is also a class level variable? Am I correct? You can't do that. You can only use static variables at that point. You need to move the init code into the constructor. At the clas...
420,813
<p>Can I create a private instance method that can be called by a class method?</p> <pre><code>class Foo def initialize(n) @n = n end private # or protected? def plus(n) @n += n end end class Foo def Foo.bar(my_instance, n) my_instance.plus(n) end end a = Foo.new(5) a.plus(3) # This should ...
[ { "answer_id": 420837, "author": "Samuel", "author_id": 32465, "author_profile": "https://Stackoverflow.com/users/32465", "pm_score": 5, "selected": true, "text": "<p>Using private or protected really don't do that much in Ruby. You can call send on any object and use any method it has.<...
2009/01/07
[ "https://Stackoverflow.com/questions/420813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4812/" ]
Can I create a private instance method that can be called by a class method? ``` class Foo def initialize(n) @n = n end private # or protected? def plus(n) @n += n end end class Foo def Foo.bar(my_instance, n) my_instance.plus(n) end end a = Foo.new(5) a.plus(3) # This should not be allowed...
Using private or protected really don't do that much in Ruby. You can call send on any object and use any method it has. ``` class Foo def Foo.bar(my_instance, n) my_instance.send(:plus, n) end end ```
420,825
<p>I was reading about threading and about locking. It is common practise that you can't (well should not) lock a value type.</p> <p>So the question is, what is the recommended way of locking a value type? I know there's a few ways to go about doing one thing but I haven't seen an example. Although there was a good th...
[ { "answer_id": 420836, "author": "Jon B", "author_id": 27414, "author_profile": "https://Stackoverflow.com/users/27414", "pm_score": 6, "selected": true, "text": "<p>Use another object for the lock.</p>\n\n<pre><code>int valueType;\nobject valueTypeLock = new object();\n\nvoid Foo()\n{\n...
2009/01/07
[ "https://Stackoverflow.com/questions/420825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
I was reading about threading and about locking. It is common practise that you can't (well should not) lock a value type. So the question is, what is the recommended way of locking a value type? I know there's a few ways to go about doing one thing but I haven't seen an example. Although there was a good thread on MS...
Use another object for the lock. ``` int valueType; object valueTypeLock = new object(); void Foo() { lock (valueTypeLock) { valueType = 0; } } ```
420,832
<p>I want to strengthen a pattern to match only numbers which pass an additional validation function.</p> <pre><code>let (|IsValid|_|) n = ... let (|Nil|One|Two|) (l : int list) = match l with | a :: b :: t -&gt; Two(a + b) | a :: t -&gt; One(a) | _ -&gt; Nil </code></pre> <p>The 'One...
[ { "answer_id": 420836, "author": "Jon B", "author_id": 27414, "author_profile": "https://Stackoverflow.com/users/27414", "pm_score": 6, "selected": true, "text": "<p>Use another object for the lock.</p>\n\n<pre><code>int valueType;\nobject valueTypeLock = new object();\n\nvoid Foo()\n{\n...
2009/01/07
[ "https://Stackoverflow.com/questions/420832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40759/" ]
I want to strengthen a pattern to match only numbers which pass an additional validation function. ``` let (|IsValid|_|) n = ... let (|Nil|One|Two|) (l : int list) = match l with | a :: b :: t -> Two(a + b) | a :: t -> One(a) | _ -> Nil ``` The 'One' case is easy: ``` | IsValid(...
Use another object for the lock. ``` int valueType; object valueTypeLock = new object(); void Foo() { lock (valueTypeLock) { valueType = 0; } } ```
420,838
<p>I am trying to install the "libxml" Gem (<a href="http://libxml.rubyforge.org/install.xml" rel="nofollow noreferrer">http://libxml.rubyforge.org/install.xml</a>) and it says that libxml requires a few other libraries to be installed in order to build and function properly:</p> <pre><code> * libm (math routine...
[ { "answer_id": 420836, "author": "Jon B", "author_id": 27414, "author_profile": "https://Stackoverflow.com/users/27414", "pm_score": 6, "selected": true, "text": "<p>Use another object for the lock.</p>\n\n<pre><code>int valueType;\nobject valueTypeLock = new object();\n\nvoid Foo()\n{\n...
2009/01/07
[ "https://Stackoverflow.com/questions/420838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51338/" ]
I am trying to install the "libxml" Gem (<http://libxml.rubyforge.org/install.xml>) and it says that libxml requires a few other libraries to be installed in order to build and function properly: ``` * libm (math routines: very standard) * libz (zlib) * libiconv * libxml2 ``` I installed RubyGems b...
Use another object for the lock. ``` int valueType; object valueTypeLock = new object(); void Foo() { lock (valueTypeLock) { valueType = 0; } } ```
420,843
<p>I'm having some trouble understanding the purpose of a salt to a password. It's my understanding that the primary use is to hamper a rainbow table attack. However, the methods I've seen to implement this don't seem to really make the problem harder.</p> <p>I've seen many tutorials suggesting that the salt be used...
[ { "answer_id": 420865, "author": "Carl Seleborg", "author_id": 2095, "author_profile": "https://Stackoverflow.com/users/2095", "pm_score": 6, "selected": false, "text": "<p>The idea with the salt is to make it much harder to guess with brute-force than a normal character-based password. ...
2009/01/07
[ "https://Stackoverflow.com/questions/420843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42897/" ]
I'm having some trouble understanding the purpose of a salt to a password. It's my understanding that the primary use is to hamper a rainbow table attack. However, the methods I've seen to implement this don't seem to really make the problem harder. I've seen many tutorials suggesting that the salt be used as the foll...
A public salt will **not** make dictionary attacks harder when cracking a single password. As you've pointed out, the attacker has access to both the hashed password and the salt, so when running the dictionary attack, she can simply use the known salt when attempting to crack the password. A public salt does two thin...
420,852
<p>Is there an easy way to read an application's already embedded manifest file?</p> <p>I was thinking along the lines of an alternate data stream?</p>
[ { "answer_id": 420992, "author": "jeffm", "author_id": 1544, "author_profile": "https://Stackoverflow.com/users/1544", "pm_score": 4, "selected": false, "text": "<p>There's a manifest viewer tool available <a href=\"http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.as...
2009/01/07
[ "https://Stackoverflow.com/questions/420852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
Is there an easy way to read an application's already embedded manifest file? I was thinking along the lines of an alternate data stream?
Windows manifest files are Win32 resources. In other words, they're embedded towards the end of the EXE or DLL. You can use LoadLibraryEx, FindResource, LoadResource and LockResource to load the embedded resource. Here's a simple example that extracts its own manifest... ``` BOOL CALLBACK EnumResourceNameCallback(HMO...
420,856
<p>I'm trying to load a div into a page based on a change in the drop down. I either want to show a div which has state/zip or province/postal_code, (each is a file) but I am getting a "406 Not Acceptable [<a href="http://localhost/profiles/residency]" rel="nofollow noreferrer">http://localhost/profiles/residency]</a>"...
[ { "answer_id": 420916, "author": "roryf", "author_id": 270, "author_profile": "https://Stackoverflow.com/users/270", "pm_score": 2, "selected": false, "text": "<p>A <code>406 Not Acceptable</code> response means the <code>Content-Type</code> of the data to be returned is not of a type sp...
2009/01/07
[ "https://Stackoverflow.com/questions/420856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to load a div into a page based on a change in the drop down. I either want to show a div which has state/zip or province/postal\_code, (each is a file) but I am getting a "406 Not Acceptable [<http://localhost/profiles/residency]>" Here is my JQuery code: ``` $(function(){ $("#profile_country").change...
A `406 Not Acceptable` response means the `Content-Type` of the data to be returned is not of a type specific in the `Accept` header. I suggest you use [Firebug](http://www.getfirebug.com) to diagnose further. More information from the W3C [HTTP/1.1 Status Code Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-...
420,863
<p>I have a problem with an application which uses the same stored procedure over and over again to populate people information in dropdown lists. The problem is that sometimes people aren't there anymore as the data changes. I have two views I can use to select from, but I want to dynamically change which view is bein...
[ { "answer_id": 420885, "author": "Rockcoder", "author_id": 5290, "author_profile": "https://Stackoverflow.com/users/5290", "pm_score": 3, "selected": true, "text": "<p>If you use only two views and you know their names, you could just pass a bit parameter to a procedure.</p>\n\n<pre><cod...
2009/01/07
[ "https://Stackoverflow.com/questions/420863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48478/" ]
I have a problem with an application which uses the same stored procedure over and over again to populate people information in dropdown lists. The problem is that sometimes people aren't there anymore as the data changes. I have two views I can use to select from, but I want to dynamically change which view is being u...
If you use only two views and you know their names, you could just pass a bit parameter to a procedure. ``` @useFirstView bit IF @useFirstView = 1 -- select from firstView ELSE -- select from secondView ```
420,864
<p>What is the best way to ensure that the proper RJS is being generated in a Controller action?</p> <p>For example, I want to ensure that a div is highlighted as such:</p> <pre><code>def new render :update do |page| page.visual_effect :highlight, :some_div end end </code></pre> <p><strong>Rant:</strong> Thi...
[ { "answer_id": 420885, "author": "Rockcoder", "author_id": 5290, "author_profile": "https://Stackoverflow.com/users/5290", "pm_score": 3, "selected": true, "text": "<p>If you use only two views and you know their names, you could just pass a bit parameter to a procedure.</p>\n\n<pre><cod...
2009/01/07
[ "https://Stackoverflow.com/questions/420864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52283/" ]
What is the best way to ensure that the proper RJS is being generated in a Controller action? For example, I want to ensure that a div is highlighted as such: ``` def new render :update do |page| page.visual_effect :highlight, :some_div end end ``` **Rant:** This is quickly becoming one of the reasons I gro...
If you use only two views and you know their names, you could just pass a bit parameter to a procedure. ``` @useFirstView bit IF @useFirstView = 1 -- select from firstView ELSE -- select from secondView ```
420,867
<p>The snippet says it all :-)</p> <pre><code>UTF8Encoding enc = new UTF8Encoding(true/*include Byte Order Mark*/); byte[] data = enc.GetBytes("a"); // data has length 1. // I expected the BOM to be included. What's up? </code></pre>
[ { "answer_id": 420894, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "<p>You wouldn't want it to be used for <em>every</em> call to GetBytes, otherwise you'd have no way of (say) writing a fi...
2009/01/07
[ "https://Stackoverflow.com/questions/420867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82/" ]
The snippet says it all :-) ``` UTF8Encoding enc = new UTF8Encoding(true/*include Byte Order Mark*/); byte[] data = enc.GetBytes("a"); // data has length 1. // I expected the BOM to be included. What's up? ```
You wouldn't want it to be used for *every* call to GetBytes, otherwise you'd have no way of (say) writing a file a line at a time. By exposing it with [GetPreamble](http://msdn.microsoft.com/en-us/library/system.text.encoding.getpreamble.aspx), callers can insert the preamble just at the appropriate point (i.e. at th...
420,891
<p>If I registered several components with Windsor.</p> <p>IAnimal provides BigAnimal IPerson provides SmellyPerson IWhale provides BlueWhale</p> <p>etc.. pretty standard component registeration</p> <p>all the above types implement IMustBeIntercepted, how do I tell the container add an interceptor to all types that ...
[ { "answer_id": 470774, "author": "Mikael Sundberg", "author_id": 4422, "author_profile": "https://Stackoverflow.com/users/4422", "pm_score": 3, "selected": false, "text": "<p>Simply create an interface like this:</p>\n\n<pre><code>public interface IMustBeIntercepted {}\n</code></pre>\n\n...
2009/01/07
[ "https://Stackoverflow.com/questions/420891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If I registered several components with Windsor. IAnimal provides BigAnimal IPerson provides SmellyPerson IWhale provides BlueWhale etc.. pretty standard component registeration all the above types implement IMustBeIntercepted, how do I tell the container add an interceptor to all types that implement IMustBeImpleme...
Simply create an interface like this: ``` public interface IMustBeIntercepted {} ``` and a facility like this: ``` public class InterceptionFacility : AbstractFacility { protected override void Init() { Kernel.ComponentRegistered += new Castle.MicroKernel.ComponentDataDelegate(Kernel_ComponentRegistered...
420,895
<p>I'm working on creating a call back function for an ASP.NET cache item removal event.</p> <p>The documentation says I should call a method on an object or calls I know will exist (will be in scope), such as a static method, but it said I need to ensure the static is thread safe.</p> <p>Part 1: What are some exampl...
[ { "answer_id": 420914, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": false, "text": "<p>No, addOne is thread-safe here - it only uses local variables. Here's an example which <em>wouldn't</em> be thread-sa...
2009/01/07
[ "https://Stackoverflow.com/questions/420895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33264/" ]
I'm working on creating a call back function for an ASP.NET cache item removal event. The documentation says I should call a method on an object or calls I know will exist (will be in scope), such as a static method, but it said I need to ensure the static is thread safe. Part 1: What are some examples of things I co...
That *addOne* function is indeed thread safe because it doesn't access any data that could be accessed by another thread. Local variables cannot be shared among threads because each thread gets its own stack. You do have to make sure, however, that the function parameters are value types and not reference types. ``` s...
420,948
<p>I recently started working at a company with an enormous "enterprisey" application. At my last job, I designed the database, but here we have a whole Database Architecture department that I'm not part of.</p> <p>One of the stranger things in their database is that they have a bunch of views which, instead of havin...
[ { "answer_id": 420967, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 1, "selected": false, "text": "<p>Personally, I'm guessing that it would be a pretty strange occurance. And from what you are saying two methods...
2009/01/07
[ "https://Stackoverflow.com/questions/420948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333/" ]
I recently started working at a company with an enormous "enterprisey" application. At my last job, I designed the database, but here we have a whole Database Architecture department that I'm not part of. One of the stranger things in their database is that they have a bunch of views which, instead of having the user ...
Do I understand this correctly? There is a view like this: ``` SELECT * FROM some_table, tmp_parm_rang WHERE some_table.date_column BETWEEN tmp_parm_rang.start_date AND tmp_parm_rang.end_date; ``` Then in some frontend a user inputs a date range, and the application does the following: 1. Deletes all existing ro...
420,964
<p>I want to do the following query:</p> <pre><code>UPDATE `users` SET balance = (balance - 10) WHERE id=1 </code></pre> <p>But if the balance will become a negative number I want an error to be returned. Any ideas on if this is possible?</p>
[ { "answer_id": 420988, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 3, "selected": false, "text": "<p>If you do</p>\n\n<pre><code>UPDATE `users` SET balance = (balance - 10) WHERE id=1 and balance &gt;=10\n</code></pre>\...
2009/01/07
[ "https://Stackoverflow.com/questions/420964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to do the following query: ``` UPDATE `users` SET balance = (balance - 10) WHERE id=1 ``` But if the balance will become a negative number I want an error to be returned. Any ideas on if this is possible?
If you do ``` UPDATE `users` SET balance = (balance - 10) WHERE id=1 and balance >=10 ``` You should be able to detect that a row was not modified. Note that while another answer suggests using an unsigned int column, this may not work: Create a test table ``` create table foo(val int unsigned default '0'); inse...
420,976
<p>I have several tables that center around an organization table that simply holds a unique ID value. Each Organization can then be at a particular location and have a particular name. The tricky part is that the organizations support location and name changes with a specified effective date of each change. For this e...
[ { "answer_id": 420988, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 3, "selected": false, "text": "<p>If you do</p>\n\n<pre><code>UPDATE `users` SET balance = (balance - 10) WHERE id=1 and balance &gt;=10\n</code></pre>\...
2009/01/07
[ "https://Stackoverflow.com/questions/420976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31672/" ]
I have several tables that center around an organization table that simply holds a unique ID value. Each Organization can then be at a particular location and have a particular name. The tricky part is that the organizations support location and name changes with a specified effective date of each change. For this exam...
If you do ``` UPDATE `users` SET balance = (balance - 10) WHERE id=1 and balance >=10 ``` You should be able to detect that a row was not modified. Note that while another answer suggests using an unsigned int column, this may not work: Create a test table ``` create table foo(val int unsigned default '0'); inse...
421,002
<p>I have an SQL Server 2005 table named 'EventTable' defined as such:</p> <p>EventID, EventTypeCode, EventStatusCode, EventDate</p> <p>Currently the table has a clustered index on the primary key 'EventID', there are no other indexes currently</p> <p>EventTypeCode and EventStatusCode columns are CHAR(3) (examples a...
[ { "answer_id": 421014, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 0, "selected": false, "text": "<p>I would put an index on each of the foreign keys (I generally index most foreign keys), and then probably one on the da...
2009/01/07
[ "https://Stackoverflow.com/questions/421002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52212/" ]
I have an SQL Server 2005 table named 'EventTable' defined as such: EventID, EventTypeCode, EventStatusCode, EventDate Currently the table has a clustered index on the primary key 'EventID', there are no other indexes currently EventTypeCode and EventStatusCode columns are CHAR(3) (examples are 'NEW', 'SEN', 'SAL') ...
Strategy 1, provide indexes that can be used for filtering. Table lookups will fetch the remaining data. This almost doubles the use of space and quadruples write IO cost. ``` on EventTable(EventDate) on EventTable(EventTypeCode) on EventTable(EventStatusCode) ``` Strategy 2, provide covering indexes that can be use...
421,013
<p>What is best practice to create dynamic sidebar or other non content layout places with zend framework. At this moment I created controller witch i called WidgetsController. In this controller i defined some actions with 'sidebar' response segment for my sidebar and in IndexController i call them with $this->view->a...
[ { "answer_id": 421043, "author": "Ali", "author_id": 49153, "author_profile": "https://Stackoverflow.com/users/49153", "pm_score": -1, "selected": false, "text": "<p>We'd like some more details, i.e what sort of content is shown in the sidebars, how you show them (i.e using a <code>&lt;u...
2009/01/07
[ "https://Stackoverflow.com/questions/421013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43182/" ]
What is best practice to create dynamic sidebar or other non content layout places with zend framework. At this moment I created controller witch i called WidgetsController. In this controller i defined some actions with 'sidebar' response segment for my sidebar and in IndexController i call them with $this->view->acti...
You question doesn't provide many details. Generally, I'd say load the sidebar as view template, via the render/partial methods of the view. So from inside a view: ``` //$data is dynamic data you want to pass to the sidebar echo $this -> partial('/path/to/sidebar.phtml',array('menuitems' => $data)); ``` And then sid...
421,031
<p>Hi This is either a very specific or very generic quetion - I'm not sure, and I'm new to the Zend framework / oo generally. Please be patient if this is a stupid Q...</p> <p>Anyway, I want to create a model which does something like:</p> <pre><code>Read all the itmes from a table 'gifts' into a row set for each ...
[ { "answer_id": 421092, "author": "Brian Fisher", "author_id": 43816, "author_profile": "https://Stackoverflow.com/users/43816", "pm_score": 1, "selected": false, "text": "<p>I would recommend creating a function in your gifts model class that returns what you want. It would probably loo...
2009/01/07
[ "https://Stackoverflow.com/questions/421031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52494/" ]
Hi This is either a very specific or very generic quetion - I'm not sure, and I'm new to the Zend framework / oo generally. Please be patient if this is a stupid Q... Anyway, I want to create a model which does something like: ``` Read all the itmes from a table 'gifts' into a row set for each row in the table, read...
I assume second tables is something like "gift\_order" or something. In this case you need to specify tables relationships beetween "gift" and and "gift\_order" via foreign keys and describe it in table class. ``` It will look like this class GiftOrder extends Zend_Db_Table_Abstract { /** Table name */...
421,040
<p>I have a very simple HTML page (validates as XHTML 1.0 Strict):</p> <pre><code>&lt;div class="news-result"&gt; &lt;h2&gt;&lt;a href="#"&gt;Title&lt;/a&gt;&lt;/h2&gt;&lt;span class="date"&gt;(1-1-2009)&lt;/span&gt; &lt;p&gt;Some text...&lt;/p&gt; &lt;/div&gt; </code></pre> <p>with the following CSS:</p> <p...
[ { "answer_id": 421150, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 2, "selected": false, "text": "<p>I'm seeing the extra whitespace in IE6, 7 and 8B2.</p>\n\n<p>It appears that IE has a non-zero top-margin applied to...
2009/01/07
[ "https://Stackoverflow.com/questions/421040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4174/" ]
I have a very simple HTML page (validates as XHTML 1.0 Strict): ``` <div class="news-result"> <h2><a href="#">Title</a></h2><span class="date">(1-1-2009)</span> <p>Some text...</p> </div> ``` with the following CSS: ``` .news-result { overflow: hidden; padding: 30px 0 20px; } .news-result h2 { ...
I'm seeing the extra whitespace in IE6, 7 and 8B2. It appears that IE has a non-zero top-margin applied to the `<p>` tag. I was able to remove the whitespace in IE by making the following change: ``` .news-result p { margin-top: 0; padding: 3px 0 0 0; clear: left; } ``` The change did not seem to have ...
421,049
<p>If I have a few UNION Statements as a contrived example:</p> <pre><code>SELECT * FROM xxx WHERE z = 1 UNION SELECT * FROM xxx WHERE z = 2 UNION SELECT * FROM xxx WHERE z = 3 </code></pre> <p><strong>What is the default <code>order by</code> behaviour?</strong></p> <p>The test data I'm seeing essentially does not...
[ { "answer_id": 421076, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 7, "selected": true, "text": "<p>There is no default order.</p>\n\n<p>Without an <strong>Order By</strong> clause the order returned is undefined. That means...
2009/01/07
[ "https://Stackoverflow.com/questions/421049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42124/" ]
If I have a few UNION Statements as a contrived example: ``` SELECT * FROM xxx WHERE z = 1 UNION SELECT * FROM xxx WHERE z = 2 UNION SELECT * FROM xxx WHERE z = 3 ``` **What is the default `order by` behaviour?** The test data I'm seeing essentially does not return the data in the order that is specified above. I....
There is no default order. Without an **Order By** clause the order returned is undefined. That means SQL Server can bring them back in any order it likes. EDIT: Based on what I have seen, without an Order By, the order that the results come back in depends on the query plan. So if there is an index that it is using,...
421,107
<p>I have a code base where many of the classes I implement derive from classes that are provided by other divisions of my company. Working with these other devisions often have the working relationship as though they are third party middle ware vendors.</p> <p>I'm trying to write test code without modifying these bas...
[ { "answer_id": 421135, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>You might want to consider <a href=\"http://code.google.com/p/googlemock/\" rel=\"nofollow noreferrer\">mocking</a> ...
2009/01/07
[ "https://Stackoverflow.com/questions/421107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8908/" ]
I have a code base where many of the classes I implement derive from classes that are provided by other divisions of my company. Working with these other devisions often have the working relationship as though they are third party middle ware vendors. I'm trying to write test code without modifying these base classes....
[Mock objects](http://en.wikipedia.org/wiki/Mock_object) are suitable for this kind of task. They allow you to simulate the existence of other components without needing them to be present. You simply define the expected input and output in your tests. [Google](http://code.google.com/p/googlemock/) have a good mocking...
421,119
<p>I have a weird design situation that I've never encountered before... If I were using Objective-C, I would solve it with categories, but I have to use C# 2.0.</p> <p>First, some background. I have two abstraction layers in this class library. The bottom layer implements a plug-in architecture for components that sc...
[ { "answer_id": 421135, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>You might want to consider <a href=\"http://code.google.com/p/googlemock/\" rel=\"nofollow noreferrer\">mocking</a> ...
2009/01/07
[ "https://Stackoverflow.com/questions/421119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3121/" ]
I have a weird design situation that I've never encountered before... If I were using Objective-C, I would solve it with categories, but I have to use C# 2.0. First, some background. I have two abstraction layers in this class library. The bottom layer implements a plug-in architecture for components that scan content...
[Mock objects](http://en.wikipedia.org/wiki/Mock_object) are suitable for this kind of task. They allow you to simulate the existence of other components without needing them to be present. You simply define the expected input and output in your tests. [Google](http://code.google.com/p/googlemock/) have a good mocking...
421,137
<p>In .NET 1.x, you could use the <a href="http://msdn.microsoft.com/en-us/library/system.security.permissions.strongnameidentitypermissionattribute.aspx" rel="nofollow noreferrer">StrongNameIdentityPermissionAttribute</a> on your assembly to ensure that only code signed by you could access your assembly. According to ...
[ { "answer_id": 421188, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "<p>See this article:<br />\n<a href=\"http://blogs.msdn.com/ericlippert/archive/2008/10/06/preventing-third-party-deri...
2009/01/07
[ "https://Stackoverflow.com/questions/421137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30827/" ]
In .NET 1.x, you could use the [StrongNameIdentityPermissionAttribute](http://msdn.microsoft.com/en-us/library/system.security.permissions.strongnameidentitypermissionattribute.aspx) on your assembly to ensure that only code signed by you could access your assembly. According to the MSDN documentation, > > In the .N...
As per Eric's suggestion, I solved it by checking the key myself. In the code I want to protect, I add the following call, ``` EnsureAssemblyIsSignedByMyCompany( Assembly.GetCallingAssembly() ); ``` Then the implementation of that method is ``` /// <summary> /// Ensures that the given assembly is signed by My C...
421,139
<p>I am working in C to implement pseudo-code that says:</p> <pre><code>delay = ROUND(64*(floatDelay - intDelay)) where intDelay = (int) floatDelay </code></pre> <p>The floatDelay will always be positive. Is there an advantage to using the round function from math.h:</p> <pre><code>#inlcude &lt;math.h&gt; delay=(int...
[ { "answer_id": 421167, "author": "Calyth", "author_id": 45144, "author_profile": "https://Stackoverflow.com/users/45144", "pm_score": 2, "selected": false, "text": "<p>There isn't any advantages that I know of, other than the fact that the cast to int may not be immediately obvious to ot...
2009/01/07
[ "https://Stackoverflow.com/questions/421139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48064/" ]
I am working in C to implement pseudo-code that says: ``` delay = ROUND(64*(floatDelay - intDelay)) where intDelay = (int) floatDelay ``` The floatDelay will always be positive. Is there an advantage to using the round function from math.h: ``` #inlcude <math.h> delay=(int) round(64*(floatDelay-intDelay)); ``` or...
You should always use the appropriate math libs when dealing with floating point numbers. A float may be only a very close approximation of the actual value, and that can cause weirdness. For instance, 5f might be approximated to 4.9999999... and if you try to cast directly to int it will be truncated to 4. To see w...
421,154
<p>In my script:</p> <pre><code>Function getDescript (strname, uname) Set MyUser = GetObject ("LDAP://cn=" &amp; uname &amp; ",ou=" &amp; strname &amp; ",DC=tms-1,DC=net") getDescript = myUser.Get("msExchOmaAdminWirelessEnable") End Function uname = "Bob Gardner" strname = "bgConsultants" WScript.Echo "wirele...
[ { "answer_id": 421172, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 0, "selected": false, "text": "<p>If I understood your question correctly, you want to use different views based on the parameters passed to the controller. ...
2009/01/07
[ "https://Stackoverflow.com/questions/421154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
In my script: ``` Function getDescript (strname, uname) Set MyUser = GetObject ("LDAP://cn=" & uname & ",ou=" & strname & ",DC=tms-1,DC=net") getDescript = myUser.Get("msExchOmaAdminWirelessEnable") End Function uname = "Bob Gardner" strname = "bgConsultants" WScript.Echo "wireless enable: " & getDescript(str...
Your controller shouldn't know or care about this, other than which View to send the data to. The View can render in any format imaginable. I've got views that emit RSS (XML), etc. In the controller, either send it to the default view or explicitly identify the target view.
421,155
<p>If I want to loop over a Dictionary(Key, Value)... why cant I add a new key-value pair in the loop?</p> <pre><code>Dictionary&lt;string, string&gt; persons = new Dictionary&lt;string, string&gt;(); persons.Add("roger", "12"); persons.Add("mary", "13"); foreach (KeyValuePair&lt;string,string&gt; person in persons)...
[ { "answer_id": 421160, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 0, "selected": false, "text": "<p>That's just... odd. You're trying to add the same person again for each person already in the dictionary.</p>\n\n<...
2009/01/07
[ "https://Stackoverflow.com/questions/421155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50069/" ]
If I want to loop over a Dictionary(Key, Value)... why cant I add a new key-value pair in the loop? ``` Dictionary<string, string> persons = new Dictionary<string, string>(); persons.Add("roger", "12"); persons.Add("mary", "13"); foreach (KeyValuePair<string,string> person in persons) { Console.WriteLine("Name: " +...
If you want to do this you should get a copy of the Dictionary Object (can be done in many ways) then enumerate it, add what you want to the original. Simply you can't add new items while enumerating an Dictionary.
421,174
<p>I'm using Jeff Atwood's <a href="http://www.codinghorror.com/blog/archives/000656.html" rel="nofollow noreferrer">Last Configuration Section Handler You'll Ever Need</a>, but it only seems to work for the default app.config file. If I wanted to separate certain settings into another file, the deserializing doesn't ...
[ { "answer_id": 421216, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 4, "selected": true, "text": "<p>yes, just replace the section in the default config file with an xml element of the same name that has a config...
2009/01/07
[ "https://Stackoverflow.com/questions/421174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52513/" ]
I'm using Jeff Atwood's [Last Configuration Section Handler You'll Ever Need](http://www.codinghorror.com/blog/archives/000656.html), but it only seems to work for the default app.config file. If I wanted to separate certain settings into another file, the deserializing doesn't work, since ConfigurationManager.GetSecti...
yes, just replace the section in the default config file with an xml element of the same name that has a configSource="" attribute that points to another file... ... In yr App.config or web.config... ``` <configSections> <section name="Connections" type="BPA.AMP.Configuration.XmlConfigurator, BPA.AM...
421,199
<p>I have a DataTable which is bound to a GridView. I also have a button that when clicked exports the DataTable to an Excel file. However, the following error is occuring:</p> <p>ErrMsg = "Thread was being aborted."</p> <p>Here is part of the code where the error is being thrown:</p> <pre><code>private static voi...
[ { "answer_id": 421207, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 4, "selected": true, "text": "<p>The ThreadAbortException is thrown from the following line:</p>\n\n<pre><code>HttpContext.Current.Response.End();...
2009/01/07
[ "https://Stackoverflow.com/questions/421199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
I have a DataTable which is bound to a GridView. I also have a button that when clicked exports the DataTable to an Excel file. However, the following error is occuring: ErrMsg = "Thread was being aborted." Here is part of the code where the error is being thrown: ``` private static void Export_with_XSLT_Web(DataSet...
The ThreadAbortException is thrown from the following line: ``` HttpContext.Current.Response.End(); ``` Here's more [details](http://support.microsoft.com/kb/312629) and a workaround.
421,206
<p>I have a Python script that calls an executable program with various arguments (in this example, it is 'sqlpubwiz.exe' which is the "Microsoft SQL Server Database Publishing Wizard"):</p> <pre><code>import os sqlpubwiz = r'"C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz.exe"' server = 'myLocal...
[ { "answer_id": 421228, "author": "Carlos Rendon", "author_id": 43851, "author_profile": "https://Stackoverflow.com/users/43851", "pm_score": 4, "selected": true, "text": "<pre><code>import subprocess\np=subprocess.Popen(args, stdout=subprocess.PIPE)\nprint p.communicate()[0]\n</code></pr...
2009/01/07
[ "https://Stackoverflow.com/questions/421206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
I have a Python script that calls an executable program with various arguments (in this example, it is 'sqlpubwiz.exe' which is the "Microsoft SQL Server Database Publishing Wizard"): ``` import os sqlpubwiz = r'"C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz.exe"' server = 'myLocalServer' databa...
``` import subprocess p=subprocess.Popen(args, stdout=subprocess.PIPE) print p.communicate()[0] ``` It would look pretty much the same. But the path should not be r'"whatever the path is"'. Because that gives me an error. You want "the path with escaped backslashes" or r'the path without escaping'. Also args should ...
421,223
<p>This may seem like a weird question, but I would like to know how I can run a function in a .dll from a memory 'signature'. I don't understand much about how it actually works, but I needed it badly. Its a way of running unexported functions from within a .dll, if you know the memory signature and adress of it. For ...
[ { "answer_id": 430523, "author": "mabbit", "author_id": 47311, "author_profile": "https://Stackoverflow.com/users/47311", "pm_score": 2, "selected": false, "text": "<p>If you can already run them using C++ then you can try using SWIG to generate python wrappers for the C++ code you've wr...
2009/01/07
[ "https://Stackoverflow.com/questions/421223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42584/" ]
This may seem like a weird question, but I would like to know how I can run a function in a .dll from a memory 'signature'. I don't understand much about how it actually works, but I needed it badly. Its a way of running unexported functions from within a .dll, if you know the memory signature and adress of it. For exa...
If you can already run them using C++ then you can try using SWIG to generate python wrappers for the C++ code you've written making it callable from python. <http://www.swig.org/> Some caveats that I've found using SWIG: Swig looks up types based on a string value. For example an integer type in Python (int) will l...
421,225
<p>I'm try to install the SQLite gem on a Fedora 9 Linux box with Ruby 1.8.6, Rails 2.2.2, gem 1.3, and sqlite-3.5.9. Here's the command I'm running and its results:</p> <pre><code>sudo gem install sqlite3-ruby Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Fa...
[ { "answer_id": 421267, "author": "barneytron", "author_id": 48988, "author_profile": "https://Stackoverflow.com/users/48988", "pm_score": 1, "selected": false, "text": "<p>Do you have all the source code required to build sqlite3-ruby? Gem is trying to compile some C code and cannot fin...
2009/01/07
[ "https://Stackoverflow.com/questions/421225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27515/" ]
I'm try to install the SQLite gem on a Fedora 9 Linux box with Ruby 1.8.6, Rails 2.2.2, gem 1.3, and sqlite-3.5.9. Here's the command I'm running and its results: ``` sudo gem install sqlite3-ruby Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build ...
The SQLite RubyGem isn't actually a *Ruby*Gem, it's a "*C*Gem", IOW it's written in C. This means it has to be compiled and linked to the Ruby interpreter when you install it and in order to do *that* it needs the C header files for the Ruby interpreter. If you compile Ruby yourself, those header files will be install...
421,231
<p>I am using <a href="http://docs.jquery.com/UI/Resizable/resizable#options" rel="nofollow noreferrer"><code>jQuery-ui Resizable</code></a> - and i want to use a knob instead of the borders (my knob is a button in the bottom right). </p> <p>I see that in options I have a <code>KnobHandles</code>, that I have to set t...
[ { "answer_id": 421272, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 1, "selected": false, "text": "<p>I don't know of a way to automatically run a search-and-replace on each column, however the problem of multiple...
2009/01/07
[ "https://Stackoverflow.com/questions/421231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52016/" ]
I am using [`jQuery-ui Resizable`](http://docs.jquery.com/UI/Resizable/resizable#options) - and i want to use a knob instead of the borders (my knob is a button in the bottom right). I see that in options I have a `KnobHandles`, that I have to set to `true`. Where do I set my handle? I tried to set it in the handle...
Let's try and tackle each of these separately: If the set of replacements is the same for every column in every table that you need to do this on (or there are only a couple patterns), consider creating a user-defined function that takes a varchar and returns a varchar that just calls `replace(replace(@input,'search1'...
421,232
<p>I have three arrays.</p> <ul> <li>@array1 containing filenames</li> <li>@array2 containing filenames</li> <li>@unique which I want to contain the unique items </li> </ul> <p>I use the following code to compare the two arrays and output a third array that contains the unique filenames.</p> <pre><code>@test{@array1...
[ { "answer_id": 421244, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 3, "selected": false, "text": "<pre><code>@test{ map { lc } @array1 } = ();\n@new_ones = grep { !exists $test{lc $_} } @array2;\n</code></pre>\n\...
2009/01/07
[ "https://Stackoverflow.com/questions/421232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have three arrays. * @array1 containing filenames * @array2 containing filenames * @unique which I want to contain the unique items I use the following code to compare the two arrays and output a third array that contains the unique filenames. ``` @test{@array1} = (); @unqiue = grep {!exists $test{$_}} @array2; `...
``` @test{ map { lc } @array1 } = (); @new_ones = grep { !exists $test{lc $_} } @array2; ``` If you want to add the list of `@new_ones` to those already in `@array1`, thereby producing a list of all unique items seen so far: ``` push @array1, @new_ones; ```
421,251
<p>I have to login into a https web page and download a file using Java. I know all the URLs beforehand:</p> <pre><code>baseURL = // a https URL; urlMap = new HashMap&lt;String, URL&gt;(); urlMap.put("login", new URL(baseURL, "exec.asp?login=username&amp;pass=XPTO")); urlMap.put("logout", new URL(baseURL, "exec.asp?ex...
[ { "answer_id": 421274, "author": "Mark Davidson", "author_id": 50866, "author_profile": "https://Stackoverflow.com/users/50866", "pm_score": 2, "selected": false, "text": "<p>I'd say have a look at Java CURL <a href=\"http://sourceforge.net/projects/javacurl\" rel=\"nofollow noreferrer\"...
2009/01/07
[ "https://Stackoverflow.com/questions/421251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46726/" ]
I have to login into a https web page and download a file using Java. I know all the URLs beforehand: ``` baseURL = // a https URL; urlMap = new HashMap<String, URL>(); urlMap.put("login", new URL(baseURL, "exec.asp?login=username&pass=XPTO")); urlMap.put("logout", new URL(baseURL, "exec.asp?exec.asp?page=999")); urlM...
I agree with Alnitak that the problem is likely storing and returning cookies. Another good option I have used is [HttpClient](http://hc.apache.org/httpclient-3.x/) from Jakarta Commons. It's worth noting, as an aside, that if this is a server you control, you should be aware that sending the username and password as...
421,258
<p>One of the most challenging thing I have felt while working on (complex) web application is the organizing the CSS.Here are the different approaches we have tried on multiple projects.</p> <p><strong>1: Have a different stylesheet for every web page/module.</strong></p> <p>Obviously we were very new to web apps th...
[ { "answer_id": 421342, "author": "allesklar", "author_id": 19893, "author_profile": "https://Stackoverflow.com/users/19893", "pm_score": 1, "selected": false, "text": "<p>You want to take advantage of cascading nature of CSS and the ways rules are inherited. </p>\n\n<p>Code first the mos...
2009/01/07
[ "https://Stackoverflow.com/questions/421258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38997/" ]
One of the most challenging thing I have felt while working on (complex) web application is the organizing the CSS.Here are the different approaches we have tried on multiple projects. **1: Have a different stylesheet for every web page/module.** Obviously we were very new to web apps then, and this approach resulted...
I've found myself in similar situations. First off, make sure that you're using CSS effectively. If you don't feel like you're an absolute pro at using CSS, take some time to study up and you'll significantly reduce redundancy and end up with a stylesheet that's easier to work with. In most cases, there isn't much of...
421,275
<p>While developing a new query at work I wrote it and profiled it in SQL Query Analyzer. The query was performing really good without any table scans but when I encapsulated it within a stored procedure the performance was horrible. When I looked at the execution plan I could see that SQL Server picked a different pla...
[ { "answer_id": 421288, "author": "Eric Z Beard", "author_id": 1219, "author_profile": "https://Stackoverflow.com/users/1219", "pm_score": 5, "selected": true, "text": "<p>This generally has something to do with parameter sniffing. It can be very frustrating to deal with. Sometimes it c...
2009/01/07
[ "https://Stackoverflow.com/questions/421275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2114/" ]
While developing a new query at work I wrote it and profiled it in SQL Query Analyzer. The query was performing really good without any table scans but when I encapsulated it within a stored procedure the performance was horrible. When I looked at the execution plan I could see that SQL Server picked a different plan t...
This generally has something to do with parameter sniffing. It can be very frustrating to deal with. Sometimes it can be solved by recompiling the stored procedure, and sometimes you can even use a duplicate variable inside the stored procedure like this: ``` alter procedure p_myproc (@p1 int) as declare @p1_copy int;...
421,280
<p>I need to find the caller of a method. Is it possible using stacktrace or reflection?</p>
[ { "answer_id": 421318, "author": "Bill K", "author_id": 12943, "author_profile": "https://Stackoverflow.com/users/12943", "pm_score": 3, "selected": false, "text": "<p>I've done this before. You can just create a new exception and grab the stack trace on it without throwing it, then exa...
2009/01/07
[ "https://Stackoverflow.com/questions/421280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51402/" ]
I need to find the caller of a method. Is it possible using stacktrace or reflection?
``` StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace() ``` According to the Javadocs: > > The last element of the array represents the bottom of the stack, which is the least recent method invocation in the sequence. > > > A `StackTraceElement` has `getClassName()`, `getFileName()`...
421,282
<p>I compiled 2 different binaries on the same GNU/Linux server using g++ version 4.2.3.</p> <p>The first one uses:</p> <pre><code>GLIBC_2.0 GLIBC_2.2 GLIBC_2.1 GLIBCXX_3.4 GLIBC_2.1.3 </code></pre> <p>The second one uses:</p> <pre><code>GLIBC_2.0 GLIBC_2.2 GLIBC_2.1 GLIBCXX_3.4.9 GLIBCXX_3.4 GLIBC_2.1.3 </code></p...
[ { "answer_id": 421435, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 0, "selected": false, "text": "<p>Well the first question is how did you generate the above list.<br>\nOne would assume that the compiler is determin...
2009/01/07
[ "https://Stackoverflow.com/questions/421282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6605/" ]
I compiled 2 different binaries on the same GNU/Linux server using g++ version 4.2.3. The first one uses: ``` GLIBC_2.0 GLIBC_2.2 GLIBC_2.1 GLIBCXX_3.4 GLIBC_2.1.3 ``` The second one uses: ``` GLIBC_2.0 GLIBC_2.2 GLIBC_2.1 GLIBCXX_3.4.9 GLIBCXX_3.4 GLIBC_2.1.3 ``` Why the second binary uses GLIBCXX\_3.4.9 that i...
To find out which of the listed GLIBCXX\_3.4.9 symbol(s) your binary actually depends on, do this: ``` readelf -s ./a.out | grep 'GLIBCXX_3\.4\.9' | c++filt ``` Once you know which symbols to look for, you can trace back to the object which needs them: ``` nm -A *.o | grep _ZN<whatever> ``` Finally, to tie this b...
421,283
<p>I need to crawl and store locally for future analysis the contents of a finite list of websites. I basically want to slurp in all pages and follow all internal links to get the entire publicly available site.</p> <p>Are there existing free libraries to get me there? I've seen Chilkat, but it's for pay. I'm just ...
[ { "answer_id": 421302, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 0, "selected": false, "text": "<p>Do you really need a library? I strongly recommend <a href=\"http://crawler.archive.org\" rel=\"nofollow noreferr...
2009/01/07
[ "https://Stackoverflow.com/questions/421283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52522/" ]
I need to crawl and store locally for future analysis the contents of a finite list of websites. I basically want to slurp in all pages and follow all internal links to get the entire publicly available site. Are there existing free libraries to get me there? I've seen Chilkat, but it's for pay. I'm just looking for b...
Use [Scrapy](http://scrapy.org/). It is a twisted-based web crawler framework. Still under heavy development but it works already. Has many goodies: * Built-in support for parsing HTML, XML, CSV, and Javascript * A media pipeline for scraping items with images (or any other media) and download the image files as well...
421,326
<p>Sorry I couldn't be more descriptive with the title, I will elaborate fully below:</p> <p>I have a web application that I want to implement some AJAX functionality into. Currently, it is running ASP.NET 3.5 with VB.NET codebehind. My current "problem" is I want to dynamically be able to populate a DIV when a user...
[ { "answer_id": 421377, "author": "Shawn", "author_id": 26, "author_profile": "https://Stackoverflow.com/users/26", "pm_score": 0, "selected": false, "text": "<p>I think just using <code>HttpUtility.HtmlEncode</code> may solve your problem. I'm not sure I follow completely though : \\</p>...
2009/01/07
[ "https://Stackoverflow.com/questions/421326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
Sorry I couldn't be more descriptive with the title, I will elaborate fully below: I have a web application that I want to implement some AJAX functionality into. Currently, it is running ASP.NET 3.5 with VB.NET codebehind. My current "problem" is I want to dynamically be able to populate a DIV when a user clicks an i...
First of all, if you're pulling the questions from the db on page load you most likely have all the answers too, so just keep going with your current approach by jamming the answers into the page as your code sample is doing. Unless your FAQ list has thousands and thousands of questions, doing it the "AJAX way" by hitt...
421,329
<p>I have a DB table with the following structure: </p> <pre><code>Id int (identity) Company string Cluster string BU string Department string SalesPoint string </code></pre> <p><strong>The following LINQ query:</strong><br /></p> <pre><code>var chEntities = from a in dataContext...
[ { "answer_id": 421366, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<p>I think this is your problem:</p>\n\n<pre><code>(a.Company == (parent.BU == null ? a.BU : parent.BU)) &amp;&amp;\n(a...
2009/01/07
[ "https://Stackoverflow.com/questions/421329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21586/" ]
I have a DB table with the following structure: ``` Id int (identity) Company string Cluster string BU string Department string SalesPoint string ``` **The following LINQ query:** ``` var chEntities = from a in dataContext.CompanyHierarchies l...
I think this is your problem: ``` (a.Company == (parent.BU == null ? a.BU : parent.BU)) && (a.Company == (parent.Department == null ? a.Department : parent.Department)) && (a.Company == (parent.SalesPoint == null ? a.SalesPoint : parent.SalesPoint)) ``` Shouldn't it be: ``` (a.BU == (parent.BU == null ? a.BU : pare...
421,339
<p>I have a List, it has Foo objects, and each Foo has a start date, and an end date. I want to insert a new Foo object, which has its own start and end date.</p> <p>I want the elements in the list to update their start and end dates accordingly, when the new Foo object is inserted, and for the new Foo object to find ...
[ { "answer_id": 421410, "author": "borq", "author_id": 42541, "author_profile": "https://Stackoverflow.com/users/42541", "pm_score": 2, "selected": false, "text": "<p>To find the insertion point you could use the <a href=\"http://en.wikipedia.org/wiki/Interpolation_search\" rel=\"nofollow...
2009/01/07
[ "https://Stackoverflow.com/questions/421339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13143/" ]
I have a List, it has Foo objects, and each Foo has a start date, and an end date. I want to insert a new Foo object, which has its own start and end date. I want the elements in the list to update their start and end dates accordingly, when the new Foo object is inserted, and for the new Foo object to find its correc...
Your new Foo object needs to traverse the list and find where it needs to be inserted. But be careful, since there are a bunch of edge cases that can mess up your list. Your logic should work in the following situations: ``` 1) The new interval fits into an existing interval -- do nothing 2) The new interval beg...
421,356
<p>I'm having problems with SVG files loading in a .NET 2.0 WebBrowser control. If I create a new WinForms application project, drag a WebBrowser control and a button onto the Form1.cs design surface, and add a line to the button's on-click handler to set the Url property of the WebBrowser control to an SVG file, I ge...
[ { "answer_id": 421978, "author": "Robert C. Barth", "author_id": 9209, "author_profile": "https://Stackoverflow.com/users/9209", "pm_score": 1, "selected": false, "text": "<p>Response.Write often doesn't work inside of UpdatePanels. Assuming you're just running some javascript in the onc...
2009/01/07
[ "https://Stackoverflow.com/questions/421356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm having problems with SVG files loading in a .NET 2.0 WebBrowser control. If I create a new WinForms application project, drag a WebBrowser control and a button onto the Form1.cs design surface, and add a line to the button's on-click handler to set the Url property of the WebBrowser control to an SVG file, I get tw...
I had a similar problem in a GridView, but solved it by uing an Image inside a LinkButton. <http://netpl.blogspot.com/2008/01/imagebutton-in-templatefield-does-not.html> for more information.
421,381
<p>I've built a form with Netbeans's visual editor. When I press one of the buttons it should do the following :</p> <ul> <li>set it to disabled</li> <li>perform a task that takes some time</li> <li>when the task finishes the button will be enabled again</li> </ul> <p>However, the following happens:</p> <ul> <li>the...
[ { "answer_id": 421403, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 3, "selected": false, "text": "<p>When you do things in a button callback, you are essentially stalling the gui painting thread - not just for the but...
2009/01/07
[ "https://Stackoverflow.com/questions/421381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31610/" ]
I've built a form with Netbeans's visual editor. When I press one of the buttons it should do the following : * set it to disabled * perform a task that takes some time * when the task finishes the button will be enabled again However, the following happens: * the button remains in a pressed state until the task fin...
When you do work in a button callback, you are stalling the GUI painting thread until it completes. What you need to do is spawn a thread to do the long running task, and then have that thread use `SwingUtilities.invokeLater()` to update the UI when it completes. Not using `invokeLater` is not thread safe, and is gene...
421,382
<p>I'm developing an Access 2003 Database that uses a MS SQLServer backend.</p> <p>I'm trying to do Form Validation and am experiencing some problems.</p> <ol> <li>ValidationRule for each field seems to be ignored</li> <li>I can't figure out what event I should override to enforce validation without having the databa...
[ { "answer_id": 421403, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 3, "selected": false, "text": "<p>When you do things in a button callback, you are essentially stalling the gui painting thread - not just for the but...
2009/01/07
[ "https://Stackoverflow.com/questions/421382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
I'm developing an Access 2003 Database that uses a MS SQLServer backend. I'm trying to do Form Validation and am experiencing some problems. 1. ValidationRule for each field seems to be ignored 2. I can't figure out what event I should override to enforce validation without having the database do it. (I'm not against...
When you do work in a button callback, you are stalling the GUI painting thread until it completes. What you need to do is spawn a thread to do the long running task, and then have that thread use `SwingUtilities.invokeLater()` to update the UI when it completes. Not using `invokeLater` is not thread safe, and is gene...
421,389
<p>I created a custom autocomplete control, when the user press a key it queries the database server (using Remoting) on another thread. When the user types very fast, the program must cancel the previously executing request/thread. </p> <p>I previously implemented it as AsyncCallback first, but i find it cumbersome...
[ { "answer_id": 421433, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>You might want to have a look at <a href=\"http://birrell.org/andrew/papers/ThreadsCSharp.pdf\" rel=\"nofollow noreferrer\"...
2009/01/07
[ "https://Stackoverflow.com/questions/421389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11432/" ]
I created a custom autocomplete control, when the user press a key it queries the database server (using Remoting) on another thread. When the user types very fast, the program must cancel the previously executing request/thread. I previously implemented it as AsyncCallback first, but i find it cumbersome, too many h...
No, it **is not** safe. `Thread.Abort()` is sketchy enough at the best of times, but in this case your control has no (heh) control over what's being done in the delegate callback. You don't know what state the rest of the app will be left in, and may well find yourself in a world of hurt when the time comes to call th...
421,391
<p>Basically like using the out keyword. But the problem is with the out keyword, you still have to declare a variable outside the method call, like:</p> <pre><code>double result; Double.TryParse ( "76", out result ); </code></pre> <p>where as I want something like:</p> <pre><code>Double.TryParse ( "76", out result ...
[ { "answer_id": 421399, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 2, "selected": false, "text": "<p>No, you have to declare the variable first because you are passing it to the method, the only difference is that y...
2009/01/07
[ "https://Stackoverflow.com/questions/421391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51816/" ]
Basically like using the out keyword. But the problem is with the out keyword, you still have to declare a variable outside the method call, like: ``` double result; Double.TryParse ( "76", out result ); ``` where as I want something like: ``` Double.TryParse ( "76", out result ); ``` and there I get a new variab...
You can use [C# tuples](http://rabdullin.com/journal/2008/9/30/using-tuples-in-c-functions-and-dictionaries.html) to **compose multiple variables into one**.
421,422
<p>I'm wondering if it's possible to get a handle on running instances of a given class. The particular issue that triggered this was an application that doesn't exit nicely because of a number of running threads. </p> <p>Yes, I know you can daemonize the theads, and they won't then hold up the application exit. But i...
[ { "answer_id": 421454, "author": "Mark", "author_id": 50262, "author_profile": "https://Stackoverflow.com/users/50262", "pm_score": 1, "selected": false, "text": "<p>I use <a href=\"https://visualvm.dev.java.net/\" rel=\"nofollow noreferrer\">Visual VM</a> to monitor the JVM. Has lots o...
2009/01/07
[ "https://Stackoverflow.com/questions/421422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19479/" ]
I'm wondering if it's possible to get a handle on running instances of a given class. The particular issue that triggered this was an application that doesn't exit nicely because of a number of running threads. Yes, I know you can daemonize the theads, and they won't then hold up the application exit. But it did get ...
You can indeed get a stack trace of all running Threads dumped to the stdout by using `kill -QUIT <pid>` on a \*NIX like OS, or by running the application in a Windows console and pressing `Ctrl-Pause` (as another poster notes.) However, it seems like you're asking for programmatic ways to do it. So, assuming what you...
421,458
<p>I'm looking at implementing some form of anonymous user system in Rails. I need to let people do things (creating records, looking at what they've created, etc), without actually creating an account. Once they create an account, everything persists without risk of losing it by clearing cookies or something.</p> <p>...
[ { "answer_id": 421471, "author": "frankodwyer", "author_id": 42404, "author_profile": "https://Stackoverflow.com/users/42404", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>Assuming the session persists for some\n reasonable period of time, and the\n session cookie does...
2009/01/07
[ "https://Stackoverflow.com/questions/421458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/722/" ]
I'm looking at implementing some form of anonymous user system in Rails. I need to let people do things (creating records, looking at what they've created, etc), without actually creating an account. Once they create an account, everything persists without risk of losing it by clearing cookies or something. Right now,...
The only real security issue is going to be if these anonymous users can perform critical operations. Your system means that anyone with the specific cookie will gain access to the site. Not necessarily a big deal, but it really depends on the type of information your users are providing. I have done something simi...
421,467
<p>recently I have been encountering problems with exposing events from .NET to COM.</p> <p>I have been successful with this example (conceptually taken from <a href="http://blogs.msdn.com/andreww/archive/2008/10/13/exposing-events-from-managed-add-in-objects.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/andre...
[ { "answer_id": 421493, "author": "wisequark", "author_id": 33159, "author_profile": "https://Stackoverflow.com/users/33159", "pm_score": 2, "selected": false, "text": "<p>I've found it convenient to use an integer to represent the number of cents and then divide by 100 for presentation. ...
2009/01/07
[ "https://Stackoverflow.com/questions/421467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15497/" ]
recently I have been encountering problems with exposing events from .NET to COM. I have been successful with this example (conceptually taken from <http://blogs.msdn.com/andreww/archive/2008/10/13/exposing-events-from-managed-add-in-objects.aspx>): // The delegate type for our custom event. ``` [ComVisible(false)] ...
Marcus Zarra has a pretty clear stance on this: ["If you are dealing with currency at all, then you should be using NSDecimalNumber."](http://www.cimgf.com/2008/04/23/cocoa-tutorial-dont-be-lazy-with-nsdecimalnumber-like-me/) His article inspired me to look into NSDecimalNumber, and I've been very impressed with it. IE...
421,486
<p>I'm trying to add a class to the selected radio input and then remove that class when another radio of the same type is selected</p> <p>The radio buttons have the class 'radio_button' but i can't get the class to change with the below code.</p> <pre><code> jQuery(".radio_button").livequery('click',function() { ...
[ { "answer_id": 421647, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 1, "selected": false, "text": "<ul>\n<li>Give each radio button a unique ID</li>\n<li>Pass the ID on the click</li>\n<li>Remove the \"...
2009/01/07
[ "https://Stackoverflow.com/questions/421486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48973/" ]
I'm trying to add a class to the selected radio input and then remove that class when another radio of the same type is selected The radio buttons have the class 'radio\_button' but i can't get the class to change with the below code. ``` jQuery(".radio_button").livequery('click',function() { $('input.rad...
Tre problem is caused by one extra space in your selectors. Instead of: ``` $('input.radio_button :radio') ``` you wanted to write: ``` $('input.radio_button:radio') ```
421,494
<p>Could some one give an idea about how to convert an excel file into a CLOB in oracle through JDBC. I would like to know how to covert excel file into a String using API available as part of JDK and the conversion from string to clob should be straight forward. Thanks in advance. If a similar question was already rai...
[ { "answer_id": 421647, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 1, "selected": false, "text": "<ul>\n<li>Give each radio button a unique ID</li>\n<li>Pass the ID on the click</li>\n<li>Remove the \"...
2009/01/07
[ "https://Stackoverflow.com/questions/421494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52542/" ]
Could some one give an idea about how to convert an excel file into a CLOB in oracle through JDBC. I would like to know how to covert excel file into a String using API available as part of JDK and the conversion from string to clob should be straight forward. Thanks in advance. If a similar question was already raised...
Tre problem is caused by one extra space in your selectors. Instead of: ``` $('input.radio_button :radio') ``` you wanted to write: ``` $('input.radio_button:radio') ```
421,509
<p>Basically this code below returns the right information, but I need to add the quantities together to bring back one record. Is there any way of doing this?</p> <pre><code>select category.category_name, (equipment.total_stock-equipment.stock_out) AS Current_Stock, equipment.stock_out from EQUIPMENT, CATEGORY WHERE ...
[ { "answer_id": 421517, "author": "DonOctavioDelFlores", "author_id": 22694, "author_profile": "https://Stackoverflow.com/users/22694", "pm_score": 1, "selected": false, "text": "<p>1 - Sum() and Group By will do the trick</p>\n\n<p>2 - Post your questions only once, in one post, its easy...
2009/01/07
[ "https://Stackoverflow.com/questions/421509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Basically this code below returns the right information, but I need to add the quantities together to bring back one record. Is there any way of doing this? ``` select category.category_name, (equipment.total_stock-equipment.stock_out) AS Current_Stock, equipment.stock_out from EQUIPMENT, CATEGORY WHERE EQUIPMENT.CAT...
You want to use the SUM function and a GROUP BY clause. ``` select category.category_name, SUM((equipment.total_stock-equipment.stock_out)) AS Current_Stock, SUM(equipment.stock_out) as stock_out from EQUIPMENT, CATEGORY WHERE EQUIPMENT.CATEGORY_ID = CATEGORY.CATEGORY_ID and category.category_name = 'Power Tools' GRO...
421,516
<p>I have a windows service written in C# that acts as a proxy for a bunch of network devices to the back end database. For testing and also to add a simulation layer to test the back end I would like to have a GUI for the test operator to be able run the simulation. Also for a striped down version to send out as a dem...
[ { "answer_id": 421528, "author": "Abtin Forouzandeh", "author_id": 52515, "author_profile": "https://Stackoverflow.com/users/52515", "pm_score": 2, "selected": false, "text": "<p>Create a new winforms app the references the assembly of your service.</p>\n" }, { "answer_id": 42153...
2009/01/07
[ "https://Stackoverflow.com/questions/421516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32958/" ]
I have a windows service written in C# that acts as a proxy for a bunch of network devices to the back end database. For testing and also to add a simulation layer to test the back end I would like to have a GUI for the test operator to be able run the simulation. Also for a striped down version to send out as a demo. ...
You basically have two choices. Either expose an API on the service which you can then call from the UI app OR enable the service to run either as a winforms app or a service. The first option is pretty easy - use remoting or WCF to expose the API. The second option can be achieved by moving the "guts" of your app in...
421,518
<p>I have to copy tables from an Oracle database to a db2 v7 one, and in order to do this (avoiding millions of drops and creates) I'd like to know if db2 has a feature like Oracle to enable / disable constraints temporarily without dropping them.</p> <p>Thanks in advance, Mauro.</p>
[ { "answer_id": 421590, "author": "Chris Allwein", "author_id": 50255, "author_profile": "https://Stackoverflow.com/users/50255", "pm_score": 1, "selected": false, "text": "<p>I'm not sure if this works in version 7, but you can try the following:</p>\n\n<pre><code>set integrity for table...
2009/01/07
[ "https://Stackoverflow.com/questions/421518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52017/" ]
I have to copy tables from an Oracle database to a db2 v7 one, and in order to do this (avoiding millions of drops and creates) I'd like to know if db2 has a feature like Oracle to enable / disable constraints temporarily without dropping them. Thanks in advance, Mauro.
You can do: ``` ALTER TABLE <table-name> ALTER FOREIGN KEY <constraint-name> NOT ENFORCED ``` and then to re-enable: ``` ALTER TABLE <table-name> ALTER FOREIGN KEY <constraint-name> ENFORCED ``` <http://publib.boulder.ibm.com/infocenter/mptoolic/v1r0/index.jsp?topic=/com.ibm.db2tools.ama.doc.ug/amacric0.htm>
421,530
<p>In C/C++, if a multi-byte wide character (wchar_t) value is transmitted from a big-endian system to a little-endian system (or vice-versa), will it come out the same value on the other side? Or will the bytes need to be swapped?</p>
[ { "answer_id": 421552, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 0, "selected": false, "text": "<p>Yes, you need to perform endian conversion. Define carefully your serialization format, i.e. the byte order of d...
2009/01/07
[ "https://Stackoverflow.com/questions/421530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17035/" ]
In C/C++, if a multi-byte wide character (wchar\_t) value is transmitted from a big-endian system to a little-endian system (or vice-versa), will it come out the same value on the other side? Or will the bytes need to be swapped?
Yes you will need to swap them. The bytes will be retrieved from the transport in the same order they were put in. Just at the other end the ordering of these bytes has a different meaning. So you need to convert them to the correct endian-ness (is that a word?). The tried and true method is to convert to network b...
421,547
<p>Imagine that I will make an async call in .NET, i.e. HttpWebRequest.BeginGetResponse, and the HttpWebRequest object isn't referenced at a broader scope. Will the Garbage Collector destroy it and cause problems?</p> <p>Example code:</p> <pre><code>using System; using System.Net; public class AsyncHttpWebRequest { ...
[ { "answer_id": 421584, "author": "Drew Noakes", "author_id": 24874, "author_profile": "https://Stackoverflow.com/users/24874", "pm_score": 5, "selected": true, "text": "<p>An object is considered alive and non-eligible for garbage collection if any live thread contains a reference to it,...
2009/01/07
[ "https://Stackoverflow.com/questions/421547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
Imagine that I will make an async call in .NET, i.e. HttpWebRequest.BeginGetResponse, and the HttpWebRequest object isn't referenced at a broader scope. Will the Garbage Collector destroy it and cause problems? Example code: ``` using System; using System.Net; public class AsyncHttpWebRequest { void Main() {...
An object is considered alive and non-eligible for garbage collection if any live thread contains a reference to it, or if it's referenced statically (directly or indirectly in both cases). In both examples the async API keeps a reference to your request (within the thread pool where async IO operations are lodged) an...
421,553
<p>I have seen some guidance which recommends that you secure a database by layering all data access through stored procedures.</p> <p>I know that for SQL Server, you can secure tables, and even columns against CRUD operations. </p> <p>For example: </p> <pre><code> --// Logged in as 'sa' USE AdventureWorks; GRANT...
[ { "answer_id": 421591, "author": "Thomas Jones-Low", "author_id": 23030, "author_profile": "https://Stackoverflow.com/users/23030", "pm_score": 2, "selected": false, "text": "<p>Stored procedures provide additional security by allowing users to perform CRUD operations (insert, update, de...
2009/01/07
[ "https://Stackoverflow.com/questions/421553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24970/" ]
I have seen some guidance which recommends that you secure a database by layering all data access through stored procedures. I know that for SQL Server, you can secure tables, and even columns against CRUD operations. For example: ``` --// Logged in as 'sa' USE AdventureWorks; GRANT SELECT ON Person.Address(Add...
Because by limiting all access to those stored procs you have established a defined interface to the database, through which all access must occur... Since you will have DENY'd Direct select, insert, update, and delete operations against the tables and views, noone can directly write sql of their own design that does w...
421,561
<p>I just found this in some old code, and I'm not sure what it means. </p> <pre><code>Dim sTemp As String * 1 </code></pre> <p>What is the * 1 at the end?</p> <p>Thanks!</p>
[ { "answer_id": 421565, "author": "Mike Hofer", "author_id": 47580, "author_profile": "https://Stackoverflow.com/users/47580", "pm_score": 4, "selected": true, "text": "<p>It means that the variable is a string of exactly one character in length.</p>\n\n<p>Essentially, a fixed-length stri...
2009/01/07
[ "https://Stackoverflow.com/questions/421561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13348/" ]
I just found this in some old code, and I'm not sure what it means. ``` Dim sTemp As String * 1 ``` What is the \* 1 at the end? Thanks!
It means that the variable is a string of exactly one character in length. Essentially, a fixed-length string.
421,570
<p>The boss wants the master page's menu to look nicer. I generated my gradient file with one of the tools available on the net, no problem there..</p> <p>I tried to make a CSS class for each menu item but when I use the background-image directive and the style builder, I get a line like:</p> <pre><code>background-i...
[ { "answer_id": 421589, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<p>The url in your CSS needs to be an absolute (or relative) url and not use the tilde mapping as it is not a server-si...
2009/01/07
[ "https://Stackoverflow.com/questions/421570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15891/" ]
The boss wants the master page's menu to look nicer. I generated my gradient file with one of the tools available on the net, no problem there.. I tried to make a CSS class for each menu item but when I use the background-image directive and the style builder, I get a line like: ``` background-image: url('file:///C:/...
You're almost there... try this: ``` .menuStyle { background-image: url('/images/BG.gif'); /* Putting a slash in front means its relative to the root. No slash would be relative to the current directory. */ background-repeat: repeat-x; /* assuming you have a vertical gradient. */ } ``` Hope that helps.
421,573
<p>Suppose I have a <code>std::vector</code> (let's call it <code>myVec</code>) of size <code>N</code>. What's the simplest way to construct a new vector consisting of a copy of elements X through Y, where 0 &lt;= X &lt;= Y &lt;= N-1? For example, <code>myVec [100000]</code> through <code>myVec [100999]</code> in a v...
[ { "answer_id": 421607, "author": "Yuval F", "author_id": 1702, "author_profile": "https://Stackoverflow.com/users/1702", "pm_score": 2, "selected": false, "text": "<p>You can use <a href=\"http://www.cplusplus.com/reference/algorithm/copy.html\" rel=\"nofollow noreferrer\">STL copy</a> w...
2009/01/07
[ "https://Stackoverflow.com/questions/421573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17035/" ]
Suppose I have a `std::vector` (let's call it `myVec`) of size `N`. What's the simplest way to construct a new vector consisting of a copy of elements X through Y, where 0 <= X <= Y <= N-1? For example, `myVec [100000]` through `myVec [100999]` in a vector of size `150000`. If this cannot be done efficiently with a ve...
``` vector<T>::const_iterator first = myVec.begin() + 100000; vector<T>::const_iterator last = myVec.begin() + 101000; vector<T> newVec(first, last); ``` It's an O(N) operation to construct the new vector, but there isn't really a better way.
421,581
<p>If I have a user control defined:</p> <pre><code>public partial class MainFooter : UserControl { public System.Windows.Media.Color BkColor; } </code></pre> <p>and it's xaml:</p> <pre><code>&lt;UserControl x:Class="Test.MainFooter"&gt; &lt;Grid x:Name="LayoutRoot"&gt; &lt;Rectangle x:Name="rctBotto...
[ { "answer_id": 421626, "author": "Rob", "author_id": 18505, "author_profile": "https://Stackoverflow.com/users/18505", "pm_score": 0, "selected": false, "text": "<p>Take a look at this blog post: <a href=\"http://www.thejoyofcode.com/Workaround_for_missing_ElementName_in_Silverlight_2_0_...
2009/01/07
[ "https://Stackoverflow.com/questions/421581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
If I have a user control defined: ``` public partial class MainFooter : UserControl { public System.Windows.Media.Color BkColor; } ``` and it's xaml: ``` <UserControl x:Class="Test.MainFooter"> <Grid x:Name="LayoutRoot"> <Rectangle x:Name="rctBottom_Background2" HorizontalAlignmen...
Often when I've seen this question posed the answer is 'you have to do it in code', which sounded to me like 'Silverlight binding doesn't support this' - so you have to do it '*completely manually*' by setting the property by hand. But thats not the case : **Silverlight binding does support this - its just Silverligh...
421,604
<p>what's the best way to remove a row (QTreeWidgetItem) from a QTreeWidget?</p> <p>The QTreeWidget content has been set by:</p> <pre><code>myQTreeWidget-&gt;insertTopLevelItems(0, items); // items = QList&lt;QTreeWidgetItem*&gt; </code></pre> <p>then I remove an item from my QList "items" and I try to clear/reset t...
[ { "answer_id": 421692, "author": "Soviut", "author_id": 46914, "author_profile": "https://Stackoverflow.com/users/46914", "pm_score": 1, "selected": false, "text": "<p>From what <a href=\"http://docs.huihoo.com/pyqt/pyqt4/html/qtreewidget.html#takeTopLevelItem\" rel=\"nofollow noreferrer...
2009/01/07
[ "https://Stackoverflow.com/questions/421604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39339/" ]
what's the best way to remove a row (QTreeWidgetItem) from a QTreeWidget? The QTreeWidget content has been set by: ``` myQTreeWidget->insertTopLevelItems(0, items); // items = QList<QTreeWidgetItem*> ``` then I remove an item from my QList "items" and I try to clear/reset the QTreeWidget ``` packList->clear(); ...
Your problem is that calling `packList->clear()` deletes the tree widget items contained by the tree. (See the documentation about `QTreeWidget::clear()`, which includes a note about the items being removed from the tree before deleting.) You'll either need to find a way to remove the items, or not maintain a list of t...
421,616
<p>For the hope-to-have-an-answer-in-30-seconds part of this question, I'm specifically looking for C#</p> <p>But in the general case, what's the best way to strip punctuation in any language?</p> <p><strong>I should add:</strong> Ideally, the solutions won't require you to enumerate all the possible punctuation mark...
[ { "answer_id": 421629, "author": "TheTXI", "author_id": 22164, "author_profile": "https://Stackoverflow.com/users/22164", "pm_score": 2, "selected": false, "text": "<p>The most braindead simple way of doing it would be using string.replace</p>\n\n<p>The other way I would imagine is a reg...
2009/01/07
[ "https://Stackoverflow.com/questions/421616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8435/" ]
For the hope-to-have-an-answer-in-30-seconds part of this question, I'm specifically looking for C# But in the general case, what's the best way to strip punctuation in any language? **I should add:** Ideally, the solutions won't require you to enumerate all the possible punctuation marks. Related: [Strip Punctuati...
``` new string(myCharCollection.Where(c => !char.IsPunctuation(c)).ToArray()); ```
421,618
<p>I'm attempting to code a script that outputs each user and their group on their own line like so:</p> <pre><code>user1 group1 user2 group1 user3 group2 ... user10 group6 </code></pre> <p>etc. </p> <p>I'm writing up a script in python for this but was wondering how SO might do this.</p> <p>p.s. Take a wh...
[ { "answer_id": 421651, "author": "d0k", "author_id": 52109, "author_profile": "https://Stackoverflow.com/users/52109", "pm_score": 4, "selected": false, "text": "<p>the <code>grp</code> module is your friend. Look at <code>grp.getgrall()</code> to get a list of all groups and their membe...
2009/01/07
[ "https://Stackoverflow.com/questions/421618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39061/" ]
I'm attempting to code a script that outputs each user and their group on their own line like so: ``` user1 group1 user2 group1 user3 group2 ... user10 group6 ``` etc. I'm writing up a script in python for this but was wondering how SO might do this. p.s. Take a whack at it in any language but I'd prefer ...
For \*nix, you have the [pwd](http://docs.python.org/2/library/pwd.html) and [grp](http://docs.python.org/2/library/grp.html) modules. You iterate through `pwd.getpwall()` to get all users. You look up their group names with `grp.getgrgid(gid)`. ``` import pwd, grp for p in pwd.getpwall(): print p[0], grp.getgrgid...
421,619
<p>I have this sample text, which is retrieved from the class name on an html element:</p> <pre><code>rich-message err-test1 erroractive rich-message err-test2 erroractive rich-message erroractive err-test1 err-test2 rich-message erroractive </code></pre> <p>I am trying to match the "test1"/"test2" data in each of th...
[ { "answer_id": 421650, "author": "Lucas Jones", "author_id": 41981, "author_profile": "https://Stackoverflow.com/users/41981", "pm_score": 0, "selected": false, "text": "<p>You could try 'err-([^ \\n\\r]*)' - but are you sure that it is the regex that is the problem? Are you using the wh...
2009/01/07
[ "https://Stackoverflow.com/questions/421619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/68788/" ]
I have this sample text, which is retrieved from the class name on an html element: ``` rich-message err-test1 erroractive rich-message err-test2 erroractive rich-message erroractive err-test1 err-test2 rich-message erroractive ``` I am trying to match the "test1"/"test2" data in each of these examples. I am current...
From what I am reading, your code already works. **`Regex.exec()` returns an array of results on success.** The first element in the array (index 0) returns the entire string, after which all `()` enclosed elements are pushed into this array. ``` var string = 'rich-message err-test1 erroractive'; var regex = new Reg...
421,630
<p>Yo!</p> <p>I'm trying to copy a few chars from a char[] to a char*. I just want the chars from index 6 to (message length - 9).</p> <p>Maybe the code example will explain my problem more:</p> <pre><code>char buffer[512] = "GET /testfile.htm HTTP/1.0"; char* filename; // I want *filename to hold only "/testfile.ht...
[ { "answer_id": 421653, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 4, "selected": true, "text": "<p>I assume you meant...</p>\n\n<pre><code>strncpy(filename, buffer+5, msgLen-9);\n</code></pre>\n\n<p>The problem is you haven...
2009/01/07
[ "https://Stackoverflow.com/questions/421630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52355/" ]
Yo! I'm trying to copy a few chars from a char[] to a char\*. I just want the chars from index 6 to (message length - 9). Maybe the code example will explain my problem more: ``` char buffer[512] = "GET /testfile.htm HTTP/1.0"; char* filename; // I want *filename to hold only "/testfile.htm" msgLen = recv(connectin...
I assume you meant... ``` strncpy(filename, buffer+5, msgLen-9); ``` The problem is you haven't allocated any memory to hold the characters you're copying. "filename" is a pointer, but it doesn't point at anything. Either just declare ``` char filename[512]; ``` or malloc some memory for the new name (and don't ...
421,660
<p>(vb.net/c#/etc)</p> <p>I am having trouble figuring out how to do a bit of deserialization magic. Currently the standard deserialization works fine, including the enums, but <em>now</em> I want to convert an attribute into a class. Oh! what was I <em>thinking</em>!</p> <p>My xml looks a bit like this:</p> <pre>...
[ { "answer_id": 421738, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": true, "text": "<p>This is not supported in a declarative way. You will have to implement IXmlSerializable on the parent class (the one ...
2009/01/07
[ "https://Stackoverflow.com/questions/421660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15127/" ]
(vb.net/c#/etc) I am having trouble figuring out how to do a bit of deserialization magic. Currently the standard deserialization works fine, including the enums, but *now* I want to convert an attribute into a class. Oh! what was I *thinking*! My xml looks a bit like this: ``` .... <review user="..." version="2.2">...
This is not supported in a declarative way. You will have to implement IXmlSerializable on the parent class (the one that is serialized to an element) and perform the conversion between the string and the MyValue type manually.
421,720
<p>I am not a big fan of datasets so I use POCO to return data. I have achieved paging and sorting using custom methods that I create for a POCO type that work on page size and give me a set of the complete POCO collection at a time, I use methods that check for name of the DataItem clicked and sort order to do that so...
[ { "answer_id": 421737, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 0, "selected": false, "text": "<p>I created an Entity base class. My DAOs derive from it and have properties corresponding to the table columns (for...
2009/01/07
[ "https://Stackoverflow.com/questions/421720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37494/" ]
I am not a big fan of datasets so I use POCO to return data. I have achieved paging and sorting using custom methods that I create for a POCO type that work on page size and give me a set of the complete POCO collection at a time, I use methods that check for name of the DataItem clicked and sort order to do that sort....
I agree with the base class idea as this will save all the duplicate code. One thing I did that takes a step in this direction is to create a class to handle the sorting of any generic list (for DTO/POCO). This allowed me to sort a list in my presenter or code-behind with only 1 line of code. Typically for SortExpress...
421,739
<p>Let's say I have DatabaseA with TableA, which has these fields: Id, Name.</p> <p>In another database, DatabaseB, I have TableA which has these fields: DatabaseId, Id, Name.</p> <p>Is it possible to setup a replication publication that will send:</p> <p>DatabaseA.dbid, DatabaseA.TableA.Id, DatabaseA.TableA.Name</...
[ { "answer_id": 421737, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 0, "selected": false, "text": "<p>I created an Entity base class. My DAOs derive from it and have properties corresponding to the table columns (for...
2009/01/07
[ "https://Stackoverflow.com/questions/421739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34720/" ]
Let's say I have DatabaseA with TableA, which has these fields: Id, Name. In another database, DatabaseB, I have TableA which has these fields: DatabaseId, Id, Name. Is it possible to setup a replication publication that will send: DatabaseA.dbid, DatabaseA.TableA.Id, DatabaseA.TableA.Name to DatabaseB.TableA? Edi...
I agree with the base class idea as this will save all the duplicate code. One thing I did that takes a step in this direction is to create a class to handle the sorting of any generic list (for DTO/POCO). This allowed me to sort a list in my presenter or code-behind with only 1 line of code. Typically for SortExpress...
421,751
<p>I figure one way to do a count is like this:</p> <pre><code>foo = db.GqlQuery("SELECT * FROM bar WHERE baz = 'baz') my_count = foo.count() </code></pre> <p>What I don't like is my count will be limited to 1000 max and my query will probably be slow. Anyone out there with a workaround? I have one in mind, but it ...
[ { "answer_id": 422267, "author": "orip", "author_id": 37020, "author_profile": "https://Stackoverflow.com/users/37020", "pm_score": 0, "selected": false, "text": "<p>I haven't tried it, and this is an utter resource hog, but perhaps iterating with <code>.fetch()</code> and specifying the...
2009/01/07
[ "https://Stackoverflow.com/questions/421751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48988/" ]
I figure one way to do a count is like this: ``` foo = db.GqlQuery("SELECT * FROM bar WHERE baz = 'baz') my_count = foo.count() ``` What I don't like is my count will be limited to 1000 max and my query will probably be slow. Anyone out there with a workaround? I have one in mind, but it doesn't feel clean. If only ...
+1 to Jehiah's response. Official and blessed method on getting object counters on GAE is to build [sharded counter](http://code.google.com/appengine/articles/sharding_counters.html). Despite heavily sounding name, this is pretty straightforward.
421,757
<p>I have this regular expression: </p> <pre><code>^\$?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$ </code></pre> <p>however it is failing when i have an amount such as this: <code>41022095.6</code></p> <p>anything I am missing?</p>
[ { "answer_id": 421765, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": true, "text": "<p>Your regular expression expects either no decimal point, or a decimal point followed by <em>two</em> decimal digits. It...
2009/01/07
[ "https://Stackoverflow.com/questions/421757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41685/" ]
I have this regular expression: ``` ^\$?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$ ``` however it is failing when i have an amount such as this: `41022095.6` anything I am missing?
Your regular expression expects either no decimal point, or a decimal point followed by *two* decimal digits. It depends on what you want, but you could make your regex match your suggested input by doing this: ``` ^\$?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{1,2})?$ ``` I changed the `{2}` near the end to `{1,2}` to allow on...
421,763
<pre><code> &lt;{if $ishtml == true}&gt;&lt;font face="Verdana, Arial, Helvetica" size="2"&gt;&lt;{$contentshtml}&gt; &lt;BR&gt;&lt;BR&gt; &lt;{if $settings[t_enhistory] == 1}&gt; &lt;fieldset style="margin-bottom: 6px; color: #333333;FONT: 11px Verdana, Tahoma;PADDING:3px;"&gt; &lt;legend&gt;&lt;{$language[tickethi...
[ { "answer_id": 421781, "author": "zvrba", "author_id": 2583, "author_profile": "https://Stackoverflow.com/users/2583", "pm_score": 2, "selected": false, "text": "<p>Looks like some php or perl templating engine such as Mason.</p>\n" }, { "answer_id": 421784, "author": "Michae...
2009/01/07
[ "https://Stackoverflow.com/questions/421763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18309/" ]
``` <{if $ishtml == true}><font face="Verdana, Arial, Helvetica" size="2"><{$contentshtml}> <BR><BR> <{if $settings[t_enhistory] == 1}> <fieldset style="margin-bottom: 6px; color: #333333;FONT: 11px Verdana, Tahoma;PADDING:3px;"> <legend><{$language[tickethistory]}></legend> <{foreach key=key value=post from=$postl...
I'd guess it's from a [Smarty](http://www.smarty.net/crashcourse.php) template for PHP.
421,772
<p>What I'd like to do is to include settings from a file into my current interactive bash shell like this:</p> <p>$ . /path/to/some/dir/.settings</p> <p>The problem is that the .settings script also needs to use the "." operator to include other files like this:</p> <p>. .extra_settings</p> <p>How do I reference t...
[ { "answer_id": 421859, "author": "Gary", "author_id": 52563, "author_profile": "https://Stackoverflow.com/users/52563", "pm_score": 0, "selected": false, "text": "<p>I tried messing with variants of $(dirname $0) but it fails when the .settings file is included with \".\". If I were exe...
2009/01/07
[ "https://Stackoverflow.com/questions/421772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52563/" ]
What I'd like to do is to include settings from a file into my current interactive bash shell like this: $ . /path/to/some/dir/.settings The problem is that the .settings script also needs to use the "." operator to include other files like this: . .extra\_settings How do I reference the relative path for .extra\_s...
I believe `$(dirname "$BASH_SOURCE")` will do what you want, as long as the file you are sourcing is **not** a symlink. If the file you are sourcing may be a symlink, you can do something like the following to get the true directory: ``` PRG="$BASH_SOURCE" progname=`basename "$BASH_SOURCE"` while [ -h "$PRG" ] ; do ...
421,773
<p>I have a Repeater which displays a list of items (in a grid-like/table view). When a user clicks an item, I display an UpdatePanel under this item with additional information relevant to the item (similar to Accordion control). I know how to populate the elements of the UpdatePanel in code-behind (I pass the ID of t...
[ { "answer_id": 421859, "author": "Gary", "author_id": 52563, "author_profile": "https://Stackoverflow.com/users/52563", "pm_score": 0, "selected": false, "text": "<p>I tried messing with variants of $(dirname $0) but it fails when the .settings file is included with \".\". If I were exe...
2009/01/07
[ "https://Stackoverflow.com/questions/421773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52545/" ]
I have a Repeater which displays a list of items (in a grid-like/table view). When a user clicks an item, I display an UpdatePanel under this item with additional information relevant to the item (similar to Accordion control). I know how to populate the elements of the UpdatePanel in code-behind (I pass the ID of the ...
I believe `$(dirname "$BASH_SOURCE")` will do what you want, as long as the file you are sourcing is **not** a symlink. If the file you are sourcing may be a symlink, you can do something like the following to get the true directory: ``` PRG="$BASH_SOURCE" progname=`basename "$BASH_SOURCE"` while [ -h "$PRG" ] ; do ...
421,778
<p>My default document is in subfolder not in root how can i make it default in asp.net 2.0 website.</p> <p>Tried iis7 default document setting to '/pages/default.aspx' '~/pages/default.aspx' but it didn't work.</p>
[ { "answer_id": 421820, "author": "Greg Hurlman", "author_id": 35, "author_profile": "https://Stackoverflow.com/users/35", "pm_score": 2, "selected": false, "text": "<p>Default documents are a subfolder-specific thing - what you're trying to do won't (directly) work. Set up a default.htm ...
2009/01/07
[ "https://Stackoverflow.com/questions/421778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48695/" ]
My default document is in subfolder not in root how can i make it default in asp.net 2.0 website. Tried iis7 default document setting to '/pages/default.aspx' '~/pages/default.aspx' but it didn't work.
Default document is not the same as start page. Default document means if I requested `mysite.com/somefolder` and didn't specify a file, which file should IIS display. If you want to use a specific page as your home page, create a Default.aspx file and write this in it's codebehind class: ``` public override void Pro...
421,782
<p>I have to take over and improve/finish some code that transforms Java objects from a third party library into internal objects. Currently this is done through a big if-else statement along the lines of:</p> <pre><code>if (obj instanceOf X) { //code to initialize internal object } else if (obj instanceOf Y) { ...
[ { "answer_id": 421803, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 4, "selected": true, "text": "<p>Create an interface like this</p>\n\n<pre><code>public interface Converter&lt;S,T&gt; {\n public T convert(S sour...
2009/01/07
[ "https://Stackoverflow.com/questions/421782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52558/" ]
I have to take over and improve/finish some code that transforms Java objects from a third party library into internal objects. Currently this is done through a big if-else statement along the lines of: ``` if (obj instanceOf X) { //code to initialize internal object } else if (obj instanceOf Y) { //code to in...
Create an interface like this ``` public interface Converter<S,T> { public T convert(S source); } ``` and implement it for each object of X,Y,Z. Then put all known converters into a Map and get happy!
421,789
<p>I want to create an ASP:ImageMap with a dynamic number of hot spots. I tried the code below, but it complains about having a repeater nested inside an image map. Any ideas on how to do this?</p> <pre><code> &lt;asp:ImageMap ID="imgMap" runat="server" ImageUrl="~/circles.png" HotSpotMode="PostB...
[ { "answer_id": 421803, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 4, "selected": true, "text": "<p>Create an interface like this</p>\n\n<pre><code>public interface Converter&lt;S,T&gt; {\n public T convert(S sour...
2009/01/07
[ "https://Stackoverflow.com/questions/421789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17715/" ]
I want to create an ASP:ImageMap with a dynamic number of hot spots. I tried the code below, but it complains about having a repeater nested inside an image map. Any ideas on how to do this? ``` <asp:ImageMap ID="imgMap" runat="server" ImageUrl="~/circles.png" HotSpotMode="PostBack"> <asp...
Create an interface like this ``` public interface Converter<S,T> { public T convert(S source); } ``` and implement it for each object of X,Y,Z. Then put all known converters into a Map and get happy!
421,797
<p>I saw this tip in another question and was wondering if someone could explain to me how on earth this works? </p> <pre><code>try { return x; } finally { x = null; } </code></pre> <p>I mean, does the <code>finally</code> clause really execute <em>after</em> the <code>return</code> statement? How thread-unsafe is th...
[ { "answer_id": 421810, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 5, "selected": false, "text": "<p>The finally clause executes after the return statement but before actually returning from the function. It has lit...
2009/01/07
[ "https://Stackoverflow.com/questions/421797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9476/" ]
I saw this tip in another question and was wondering if someone could explain to me how on earth this works? ``` try { return x; } finally { x = null; } ``` I mean, does the `finally` clause really execute *after* the `return` statement? How thread-unsafe is this code? Can you think of any additional hackery that c...
No - at the IL level you can't return from inside an exception-handled block. It essentially stores it in a variable and returns afterwards i.e. similar to: ``` int tmp; try { tmp = ... } finally { ... } return tmp; ``` for example (using reflector): ``` static int Test() { try { return SomeNumber(...
421,833
<p>As most should know <code>close()</code> also closes any streams uses.</p> <p>This allows the follow code:</p> <pre><code>BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(...))); ... br.close(); </code></pre> <p>This is nice, since we don't need a reference to <code>FileInputStream...
[ { "answer_id": 421844, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 1, "selected": false, "text": "<p>Yes.</p>\n\n<p>Locks depend on a file descriptor. When there is no file descriptor representing a file in a process, there ...
2009/01/07
[ "https://Stackoverflow.com/questions/421833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21838/" ]
As most should know `close()` also closes any streams uses. This allows the follow code: ``` BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(...))); ... br.close(); ``` This is nice, since we don't need a reference to `FileInputStream` and remember to close it. But does it also wor...
According to the [JavaDoc](http://java.sun.com/javase/6/docs/api/java/nio/channels/FileLock.html): > > It remains valid until the lock is > released by invoking the release > method, by closing the channel that > was used to acquire it, or by the > termination of the Java virtual > machine, whichever comes first...
421,847
<p>Is there any FREE "build-in" way to capitalize the "keywords" in the SQL 2005/2008 management studio when you write a sql query?</p> <p>i.e</p> <pre><code>truncate table x </code></pre> <p>should be automatically changed to:</p> <pre><code>TRUNCATE TABLE x </code></pre>
[ { "answer_id": 421853, "author": "flesh", "author_id": 27805, "author_profile": "https://Stackoverflow.com/users/27805", "pm_score": 2, "selected": false, "text": "<p>There is no built in 'intellisense' in SQL Server 2005 (there is in 2008) but Redgate do an add-in for exactly this and m...
2009/01/07
[ "https://Stackoverflow.com/questions/421847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1683839/" ]
Is there any FREE "build-in" way to capitalize the "keywords" in the SQL 2005/2008 management studio when you write a sql query? i.e ``` truncate table x ``` should be automatically changed to: ``` TRUNCATE TABLE x ```
the intellisense in the 2008 management studio will do this as well as long as you are connected to a SQL 2008 database. You can change the case you prefer to upper or lower under Tools / Options / Text Editor / Transact-SQL / IntelliSense
421,851
<p>I have a subclass with an over-ridden method that I know always returns a particular subtype of the return type declared in the base class. If I write the code this way, it won't compile. Since that probably doesn't make sense, let me give a code example:</p> <pre><code>class BaseReturnType { } class DerivedRetur...
[ { "answer_id": 421868, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "<p>Unfortunately no, covariant return types aren't supported in C# for method overriding. (Ditto contravariant parameter ...
2009/01/07
[ "https://Stackoverflow.com/questions/421851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44743/" ]
I have a subclass with an over-ridden method that I know always returns a particular subtype of the return type declared in the base class. If I write the code this way, it won't compile. Since that probably doesn't make sense, let me give a code example: ``` class BaseReturnType { } class DerivedReturnType : BaseRetu...
Unfortunately no, covariant return types aren't supported in C# for method overriding. (Ditto contravariant parameter types.) If you're implementing an interface you can implement it explicitly with the "weak" version and also provide a public version with the stronger contract. For simple overriding of a parent class...
421,873
<p>In my matlab m-file I am using some logic (string concat) to build variables like this:</p> <pre><code>c = 'CalcPrediction(1,10)' </code></pre> <p>That means I have a string that is a function and some parameters. How can I do that function call?</p> <p>Trying run(c) results in:</p> <pre><code>&gt;&gt; run(c) ??...
[ { "answer_id": 422021, "author": "ONODEVO", "author_id": 40440, "author_profile": "https://Stackoverflow.com/users/40440", "pm_score": -1, "selected": false, "text": "<p>You want to use <a href=\"http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techd...
2009/01/07
[ "https://Stackoverflow.com/questions/421873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52570/" ]
In my matlab m-file I am using some logic (string concat) to build variables like this: ``` c = 'CalcPrediction(1,10)' ``` That means I have a string that is a function and some parameters. How can I do that function call? Trying run(c) results in: ``` >> run(c) ??? Error using ==> run at 71 CalcPrediction(1,10) n...
The command you are looking for is `eval()` instead of `run()`
421,874
<p>In one of the Stackoverflow podcasts, I remember Jeff Atwood saying that there was a configuration option in SQL Server 2008 which cuts down on locking, and was kind of an alternative to using "with (nolock)" in all your queries. Does anybody know how to enable the feature he was talking about, possibly even Jeff h...
[ { "answer_id": 421932, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 3, "selected": true, "text": "<p>Jeff was talking about snapshot isolation</p>\n\n<p>here is the command</p>\n\n<pre><code>ALTER DATABASE MyDatabase\nSET A...
2009/01/07
[ "https://Stackoverflow.com/questions/421874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1862/" ]
In one of the Stackoverflow podcasts, I remember Jeff Atwood saying that there was a configuration option in SQL Server 2008 which cuts down on locking, and was kind of an alternative to using "with (nolock)" in all your queries. Does anybody know how to enable the feature he was talking about, possibly even Jeff himse...
Jeff was talking about snapshot isolation here is the command ``` ALTER DATABASE MyDatabase SET ALLOW_SNAPSHOT_ISOLATION ON ALTER DATABASE MyDatabase SET READ_COMMITTED_SNAPSHOT ON ```
421,878
<p>I have been running an UPDATE on a table containing 250 million rows with 3 index'; this UPDATE uses another table containing 30 million rows. It has been running for about 36 hours now. I am wondering if their is a way to find out how close it is to being done for if it plans to take a million days to do its thing,...
[ { "answer_id": 429260, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 4, "selected": true, "text": "<p>Did you read the PostgreSQL documentation for \"<a href=\"http://www.postgresql.org/docs/8.3/static/using-explain.ht...
2009/01/07
[ "https://Stackoverflow.com/questions/421878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49985/" ]
I have been running an UPDATE on a table containing 250 million rows with 3 index'; this UPDATE uses another table containing 30 million rows. It has been running for about 36 hours now. I am wondering if their is a way to find out how close it is to being done for if it plans to take a million days to do its thing, I ...
Did you read the PostgreSQL documentation for "[Using EXPLAIN](http://www.postgresql.org/docs/8.3/static/using-explain.html)", to interpret the output you're showing? I'm not a regular PostgreSQL user, but I just read that doc, and then compared to the `EXPLAIN` output you're showing. Your `UPDATE` query seems to be u...
421,891
<p>What's the proper way to create a hyperlink in Spring+JSP? There must be a better way than just coding in the <code>&lt;a href="..."&gt;</code> tag. Take for example a page that displays people. The URL is <code>people.htm</code>. The corresponding controller gets people from the database and performs optional colum...
[ { "answer_id": 421920, "author": "Ole", "author_id": 49540, "author_profile": "https://Stackoverflow.com/users/49540", "pm_score": 2, "selected": false, "text": "<p>I haven't seen this kind of functionality in pure spring (although grails offers things like that).</p>\n\n<p>For your spec...
2009/01/07
[ "https://Stackoverflow.com/questions/421891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24396/" ]
What's the proper way to create a hyperlink in Spring+JSP? There must be a better way than just coding in the `<a href="...">` tag. Take for example a page that displays people. The URL is `people.htm`. The corresponding controller gets people from the database and performs optional column sorting. The JSP might look l...
The only thing that comes to mind is the JSTL standard tag `<c:url>`. [For example](http://www.sitepoint.com/article/java-standard-tag-library/3/): ``` <c:url var="thisURL" value="homer.jsp"> <c:param name="iq" value="${homer.iq}"/> <c:param name="checkAgainst" value="marge simpson"/> </c:url> <a href="<c:out valu...
421,944
<p>I'll create a EML file with an attachment using JavaMail. </p> <p>I created a simple EML file successfully, but adding an attachment don't work properly. I'm going to add a PDF file. My EML file will be created successfully. If I open the generated EML file with Outlook I'll find not my PDF file as attachment but I...
[ { "answer_id": 421935, "author": "Joe Phillips", "author_id": 20471, "author_profile": "https://Stackoverflow.com/users/20471", "pm_score": 0, "selected": false, "text": "<p>I'm not sure I entirely understand your question but I'll do my best to give you a basic answer.</p>\n\n<p>Cross S...
2009/01/07
[ "https://Stackoverflow.com/questions/421944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42659/" ]
I'll create a EML file with an attachment using JavaMail. I created a simple EML file successfully, but adding an attachment don't work properly. I'm going to add a PDF file. My EML file will be created successfully. If I open the generated EML file with Outlook I'll find not my PDF file as attachment but I'll find t...
This sounds like you need a moderation system in place for user generated content, not a technical solution. Obviously you can check the referrer field, content scrub and attempt to filter the profane, but enumerating badness *never* works. (It can be an acceptable "first pass", but humans are infinitely resourceful in...
421,949
<p>I'm looking for a better way to do the following query. I have a table that looks like this:</p> <pre><code>game_id | home_team_id | away_team_id 1 | 100 | 200 2 | 200 | 300 3 | 200 | 400 4 | 300 | 100 5 | 100 | 400 </code></pre> <p>And I ...
[ { "answer_id": 422019, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": false, "text": "<p>If you want the distinct list of teams, you have to select from the game table twice, unioning the home and the away ...
2009/01/07
[ "https://Stackoverflow.com/questions/421949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28002/" ]
I'm looking for a better way to do the following query. I have a table that looks like this: ``` game_id | home_team_id | away_team_id 1 | 100 | 200 2 | 200 | 300 3 | 200 | 400 4 | 300 | 100 5 | 100 | 400 ``` And I want to write a query that ...
It's cleaner if you have another table team with team\_id and team\_name. ``` SELECT team_id, team_name, sum(team_id = home_team_id) as home_games, sum(team_id = away_team_id) as away_games FROM game, team GROUP BY team_id ``` What's going on: the no WHERE clause causes a Cartesian Product between the...
421,953
<p>I have a gridview that contains one to many rows (like most do) - each with an input textbox. Each row has a requiredfieldvalidator against that textbox. When the form is submitted the gridview is validated it is entirely possible that more than one row has an empty textbox. This results in repeating validation mess...
[ { "answer_id": 422925, "author": "BlackMael", "author_id": 19377, "author_profile": "https://Stackoverflow.com/users/19377", "pm_score": 0, "selected": false, "text": "<p>I would suggest not using a Validator Summary.</p>\n\n<p>Change the Text property or inner content of the validators ...
2009/01/07
[ "https://Stackoverflow.com/questions/421953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47036/" ]
I have a gridview that contains one to many rows (like most do) - each with an input textbox. Each row has a requiredfieldvalidator against that textbox. When the form is submitted the gridview is validated it is entirely possible that more than one row has an empty textbox. This results in repeating validation message...
This is a solution that uses a CustomValidator and requires a few organizational changes. This requires a postback since CustomValidator validation is performed on the server-side. **Here's the setup:** 1. For each of your existing RequiredFieldValidators that display the "Please provide text for 'Name' field" messag...
421,968
<p>I need to create a transparent blurred background. Lets suppose I have a border with a white blurry transparent background. Everything that is behind the border is blurred.</p> <p>I'm trying to avoid dependencies; I'm currently using .NET 3.0, and want it to run with XP too.</p> <p>Mockup image:</p> <p><img src="...
[ { "answer_id": 421986, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 2, "selected": false, "text": "<p>I would imagine you will need use an Effect for this, applied to a background rectangle or grid.</p>\n\n<p>There...
2009/01/07
[ "https://Stackoverflow.com/questions/421968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1013/" ]
I need to create a transparent blurred background. Lets suppose I have a border with a white blurry transparent background. Everything that is behind the border is blurred. I'm trying to avoid dependencies; I'm currently using .NET 3.0, and want it to run with XP too. Mockup image: ![Mockup Image](https://i.stack.im...
A VisualBrush can be used to get close to what you want, but has some limitations. As long as you only need the glass effect within the window (and not be an effect over other windows) and that the placement of the glass effect border is controlled tightly then you could you something like this:- ``` <Grid> <Bo...