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
278,439
<p>What's the best way to get a temp directory name in Windows? I see that I can use <code>GetTempPath</code> and <code>GetTempFileName</code> to create a temporary file, but is there any equivalent to the Linux / BSD <a href="http://linux.die.net/man/3/mkdtemp" rel="noreferrer"><code>mkdtemp</code></a> function for c...
[ { "answer_id": 278455, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": false, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/system.io.path.gettemppath.aspx\" rel=\"nofollow noreferrer\">GetTempPat...
2008/11/10
[ "https://Stackoverflow.com/questions/278439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25507/" ]
What's the best way to get a temp directory name in Windows? I see that I can use `GetTempPath` and `GetTempFileName` to create a temporary file, but is there any equivalent to the Linux / BSD [`mkdtemp`](http://linux.die.net/man/3/mkdtemp) function for creating a temporary directory?
No, there is no equivalent to mkdtemp. The best option is to use a combination of [GetTempPath](https://learn.microsoft.com/en-us/dotnet/api/system.io.path.gettemppath) and [GetRandomFileName](https://learn.microsoft.com/en-us/dotnet/api/system.io.path.getrandomfilename). You would need code similar to this: ``` publ...
278,440
<p>I need to do a modulus operation on very large integers. The biggest integer supported by my platform (edit: .NET 2.0) is a 64 bit integer, which aren't big enough for the numbers I'm working with.</p> <p>How can I do a modulus on really big integers, like 12654875632126424875387321657498462167853687516876876?</p>...
[ { "answer_id": 278448, "author": "HUAGHAGUAH", "author_id": 27233, "author_profile": "https://Stackoverflow.com/users/27233", "pm_score": 2, "selected": false, "text": "<p>Use a crypto/math library. Google for bignum.</p>\n" }, { "answer_id": 278468, "author": "Tony Arkles",...
2008/11/10
[ "https://Stackoverflow.com/questions/278440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681/" ]
I need to do a modulus operation on very large integers. The biggest integer supported by my platform (edit: .NET 2.0) is a 64 bit integer, which aren't big enough for the numbers I'm working with. How can I do a modulus on really big integers, like 12654875632126424875387321657498462167853687516876876? I have a solu...
You haven't specified where the numbers are coming from, but you might be able to make some simplifications. If the numbers are originally smaller, then consider things like: ``` (a + b) MOD n = ((a MOD n) + (b MOD n)) MOD n ``` or ``` ab MOD n = (a MOD n)(b MOD n) MOD n ```
278,466
<p>In an application I work on, any business logic error causes an exception to be thrown, and the calling code handles the exception. This pattern is used throughout the application and works well. </p> <p>I have a situation where I will be attempting to execute a number of business tasks from inside the business l...
[ { "answer_id": 278494, "author": "Cristian Libardo", "author_id": 16526, "author_profile": "https://Stackoverflow.com/users/16526", "pm_score": 0, "selected": false, "text": "<p>No super-elegant solution here but a few ideas:</p>\n\n<ul>\n<li>Pass an error-handler function as argument to...
2008/11/10
[ "https://Stackoverflow.com/questions/278466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13103/" ]
In an application I work on, any business logic error causes an exception to be thrown, and the calling code handles the exception. This pattern is used throughout the application and works well. I have a situation where I will be attempting to execute a number of business tasks from inside the business layer. The re...
The [Task Parallel Library extensions](http://msdn.microsoft.com/magazine/cc163340.aspx) for .NET (which [will become part of .NET 4.0](http://blogs.msdn.com/pfxteam/archive/2008/10/10/8994927.aspx)) follow the pattern suggested in other answers: collecting all exceptions that have been thrown into an AggregateExceptio...
278,475
<p>I'm trying to animate Visio objects with a loop, such as:</p> <pre><code>For reposition = 2 To 6 xpos = reposition ypos = reposition sh1.SetCenter xpos, ypos Sleep 1000 Next reposition </code></pre> <p>While this DOES move the object from the starting position to the ending, the intermediate ste...
[ { "answer_id": 278923, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 3, "selected": true, "text": "<p>Try a <code>DoEvents</code> statement before your sleep</p>\n" }, { "answer_id": 281240, "author": "Jon Fournier...
2008/11/10
[ "https://Stackoverflow.com/questions/278475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32848/" ]
I'm trying to animate Visio objects with a loop, such as: ``` For reposition = 2 To 6 xpos = reposition ypos = reposition sh1.SetCenter xpos, ypos Sleep 1000 Next reposition ``` While this DOES move the object from the starting position to the ending, the intermediate steps are not visible. After ...
Try a `DoEvents` statement before your sleep
278,539
<p>I have written a simple PowerShell filter that pushes the current object down the pipeline if its date is between the specified begin and end date. The objects coming down the pipeline are always in ascending date order so as soon as the date exceeds the specified end date I know my work is done and I would like to...
[ { "answer_id": 278579, "author": "Steven Murawski", "author_id": 1233, "author_profile": "https://Stackoverflow.com/users/1233", "pm_score": 2, "selected": false, "text": "<p>It is not possible to stop an upstream command from a downstream command.. it will continue to filter out objects...
2008/11/10
[ "https://Stackoverflow.com/questions/278539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30026/" ]
I have written a simple PowerShell filter that pushes the current object down the pipeline if its date is between the specified begin and end date. The objects coming down the pipeline are always in ascending date order so as soon as the date exceeds the specified end date I know my work is done and I would like to let...
It is possible to break a pipeline with anything that would otherwise break an outside loop or halt script execution altogether (like throwing an exception). The solution then is to wrap the pipeline in a loop that you can break if you need to stop the pipeline. For example, the below code will return the first item fr...
278,564
<p>After some time I wanted to update my git repo, and then something went wrong. What is the proper way out of this situation?</p> <pre><code>mblsha@siruba:~/src/psi/ $ git status iris: needs merge # On branch master # Changes to be committed: # (use "git reset HEAD &lt;file&gt;..." to unstage) # # modified: sr...
[ { "answer_id": 306308, "author": "Daniel Lucraft", "author_id": 11951, "author_profile": "https://Stackoverflow.com/users/11951", "pm_score": 4, "selected": true, "text": "<p>When it comes to git submodules, almost any problem you encounter can be solved by:</p>\n\n<pre><code>1. deleting...
2008/11/10
[ "https://Stackoverflow.com/questions/278564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8950/" ]
After some time I wanted to update my git repo, and then something went wrong. What is the proper way out of this situation? ``` mblsha@siruba:~/src/psi/ $ git status iris: needs merge # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: src/common.cpp # # Cha...
When it comes to git submodules, almost any problem you encounter can be solved by: ``` 1. deleting the submodule (rm -r iris) 2. recreating it again (git submodule update) ``` Obviously if you have made local changes to your submodule this will DELETE them PERMANENTLY, so if you have local changes make sure you hav...
278,588
<p>I'm using the XML data source feature in Reporting Services 2005 but having some issues with missing data. When there is no value for the first column in a row, it appears that the entire column is ignored by SSRS!</p> <p>The web method request is very simple:</p> <pre><code>&lt;Query&gt; &lt;Method Name="GetIs...
[ { "answer_id": 278620, "author": "DOK", "author_id": 27637, "author_profile": "https://Stackoverflow.com/users/27637", "pm_score": 0, "selected": false, "text": "<p>Is it possible to eliminate the NULLs in the XML? Replace them with an empty string? Then you won't have to wrestle with SS...
2008/11/10
[ "https://Stackoverflow.com/questions/278588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6651/" ]
I'm using the XML data source feature in Reporting Services 2005 but having some issues with missing data. When there is no value for the first column in a row, it appears that the entire column is ignored by SSRS! The web method request is very simple: ``` <Query> <Method Name="GetIssues" Namespace="http://www.m...
In the Query itself, try to define your columns explicitly, instead of letting SSRS determine them for you. In other words, where you have: ``` <ElementPath IgnoreNamespaces="true">*</ElementPath> ``` Replace the \* with something like: ``` <ElementPath IgnoreNamespaces="true">GetIssues/GetIssuesItemsResult/listit...
278,596
<p>Using Maven 2, is there a way I can list out the jar dependencies as just the file names?</p> <pre><code>mvn dependency:build-classpath </code></pre> <p>can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (o...
[ { "answer_id": 278618, "author": "Davide Gualano", "author_id": 28582, "author_profile": "https://Stackoverflow.com/users/28582", "pm_score": 2, "selected": false, "text": "<p>Maven can build the classpath in your manifest automatically: <a href=\"http://maven.apache.org/guides/mini/guid...
2008/11/10
[ "https://Stackoverflow.com/questions/278596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1113/" ]
Using Maven 2, is there a way I can list out the jar dependencies as just the file names? ``` mvn dependency:build-classpath ``` can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (or the file names that the ...
This command will generate the dependencies tree of your maven project: ``` $ mvn dependency:tree ``` I am sure that you will like the result :-)
278,604
<p>I need to implement the classic Factory Method pattern in ASP.NET to create server controls dynamically.</p> <p>The only way I've found to create .ascx controls is to use the LoadControl method of the Page/UserControl classes. I find it messy however to link my factory with a page or to pass a page parameter to the...
[ { "answer_id": 278697, "author": "Min", "author_id": 14461, "author_profile": "https://Stackoverflow.com/users/14461", "pm_score": 0, "selected": false, "text": "<p>Well after opening up reflector, the LoadControl function that is being used in Page is available in any TemplateControl.</...
2008/11/10
[ "https://Stackoverflow.com/questions/278604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22078/" ]
I need to implement the classic Factory Method pattern in ASP.NET to create server controls dynamically. The only way I've found to create .ascx controls is to use the LoadControl method of the Page/UserControl classes. I find it messy however to link my factory with a page or to pass a page parameter to the factory. ...
In the end, I decided to pass the page as a parameter to the factory. To make calls to the factory method easier, I changed the factory class from a singleton to a common class, and I passed the page to the constructor: ``` public ControlsFactory { private Page _containingPage; public ControlsFactory(Page con...
278,622
<p>I'm looking for a method to reliably extract the host name from a URL string in Ruby.</p> <p>e.g. <a href="http://www.mglenn.com/directory" rel="noreferrer">http://www.mglenn.com/directory</a> = www.mglenn.com OR <a href="http://www.mglenn.com?param=x" rel="noreferrer">http://www.mglenn.com?param=x</a> = www.mglen...
[ { "answer_id": 278673, "author": "glenatron", "author_id": 15394, "author_profile": "https://Stackoverflow.com/users/15394", "pm_score": 7, "selected": true, "text": "<p>You could try something like this:</p>\n\n<pre><code>require 'uri'\n\nmyUri = URI.parse( 'http://www.mglenn.com/direct...
2008/11/10
[ "https://Stackoverflow.com/questions/278622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9424/" ]
I'm looking for a method to reliably extract the host name from a URL string in Ruby. e.g. <http://www.mglenn.com/directory> = www.mglenn.com OR <http://www.mglenn.com?param=x> = www.mglenn.com
You could try something like this: ``` require 'uri' myUri = URI.parse( 'http://www.mglenn.com/directory' ) print myUri.host # => www.mglenn.com ```
278,627
<p>We've converted our solution from .NET 2.0 to .NET 3.5. All projects converted just fine except for the Website Project, which still doesn't understand what I mean when using 'var' and the like.</p> <p>I've looked in the property pages for the web project, and the Target Framework is set to '.NET Framework 3.5'.</p...
[ { "answer_id": 278650, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 2, "selected": false, "text": "<p>By default, a new web app in 3.5 has the following References:</p>\n\n<ul>\n<li>System System.Configuration</li>\n<li>System...
2008/11/10
[ "https://Stackoverflow.com/questions/278627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3397/" ]
We've converted our solution from .NET 2.0 to .NET 3.5. All projects converted just fine except for the Website Project, which still doesn't understand what I mean when using 'var' and the like. I've looked in the property pages for the web project, and the Target Framework is set to '.NET Framework 3.5'. Any other i...
Add the following to web.config: ``` <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerV...
278,633
<p>I must be overlooking something simple. I'm setting a variable from a query result in a MySQL stored procedure like this:</p> <pre><code>SELECT @myName := username FROM User WHERE ID=1; </code></pre> <p>So, @myName is storing the username of userid 1, which is 'Paul'. Great.</p> <p>But later in the stored procedu...
[ { "answer_id": 278681, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 3, "selected": true, "text": "<p>That's very surprising, I agree. I'm not sure how to explain it, but for what it's worth, try this instead:</p>\n\n...
2008/11/10
[ "https://Stackoverflow.com/questions/278633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26180/" ]
I must be overlooking something simple. I'm setting a variable from a query result in a MySQL stored procedure like this: ``` SELECT @myName := username FROM User WHERE ID=1; ``` So, @myName is storing the username of userid 1, which is 'Paul'. Great. But later in the stored procedure I run an update on this record...
That's very surprising, I agree. I'm not sure how to explain it, but for what it's worth, try this instead: ``` SELECT username INTO myName FROM User WHERE ID=1; ``` See <http://dev.mysql.com/doc/refman/5.0/en/select-into-statement.html> **update:** I'm trying to reproduce this problem, but I can't. I'm using MySQL...
278,668
<p>Is it possible to have an ASP.NET MVC route that uses subdomain information to determine its route? For example:</p> <ul> <li><em><strong>user1</strong>.domain.example</em> goes to one place</li> <li><em><strong>user2</strong>.domain.example</em> goes to another?</li> </ul> <p>Or, can I make it so both of these go t...
[ { "answer_id": 278689, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 2, "selected": false, "text": "<p>Yes but you have to create your own route handler. </p>\n\n<p>Typically the route is not aware of the domain because th...
2008/11/10
[ "https://Stackoverflow.com/questions/278668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19020/" ]
Is it possible to have an ASP.NET MVC route that uses subdomain information to determine its route? For example: * ***user1**.domain.example* goes to one place * ***user2**.domain.example* goes to another? Or, can I make it so both of these go to the same controller/action with a `username` parameter?
You can do it by creating a new route and adding it to the routes collection in RegisterRoutes in your global.asax. Below is a very simple example of a custom Route: ``` public class ExampleRoute : RouteBase { public override RouteData GetRouteData(HttpContextBase httpContext) { var url = httpContext....
278,674
<p>I've been tasked with the awesome job of generating a look-up table for our application culture information. The columns I need to generate data for are:</p> <ul> <li>Dot Net Code</li> <li>Version</li> <li>Culture Name</li> <li>Country Name</li> <li>Language Name</li> <li>Java Country Code</li> <li>Java Language C...
[ { "answer_id": 278875, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 3, "selected": true, "text": "<p>Java uses the 2-letter ISO country and language codes. I recommend getting rid of the \"Java Country Code\" and \"Java La...
2008/11/10
[ "https://Stackoverflow.com/questions/278674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36269/" ]
I've been tasked with the awesome job of generating a look-up table for our application culture information. The columns I need to generate data for are: * Dot Net Code * Version * Culture Name * Country Name * Language Name * Java Country Code * Java Language Code * Iso Country Code * Iso Language Code I have found ...
Java uses the 2-letter ISO country and language codes. I recommend getting rid of the "Java Country Code" and "Java Language Code" fields in your lookup table, since they would be redundant. I assume that wherever you get your ISO [country](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) and [language](http://www.loc...
278,684
<p>I am just getting started with expression trees so I hope this makes sense. I am trying to create an expression tree to represent:</p> <pre><code>t =&gt; t.SomeProperty.Contains("stringValue"); </code></pre> <p>So far I have got:</p> <pre><code> private static Expression.Lambda&lt;Func&lt;string, bool&gt;&gt; ...
[ { "answer_id": 278702, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 8, "selected": true, "text": "<p>Something like:</p>\n\n<pre><code>class Foo\n{\n public string Bar { get; set; }\n}\nstatic void Main()\n{\n ...
2008/11/10
[ "https://Stackoverflow.com/questions/278684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27805/" ]
I am just getting started with expression trees so I hope this makes sense. I am trying to create an expression tree to represent: ``` t => t.SomeProperty.Contains("stringValue"); ``` So far I have got: ``` private static Expression.Lambda<Func<string, bool>> GetContainsExpression<T>(string propertyName, string...
Something like: ``` class Foo { public string Bar { get; set; } } static void Main() { var lambda = GetExpression<Foo>("Bar", "abc"); Foo foo = new Foo { Bar = "aabca" }; bool test = lambda.Compile()(foo); } static Expression<Func<T, bool>> GetExpression<T>(string propertyName, string propertyValue) { ...
278,687
<p>If I create a recursive list of of lists:</p> <pre><code>class myList { List&lt;myList&gt; childLists; List&lt;string&gt; things; //... } List&lt;myList&gt; tempList = new List&lt;myList&gt;(); </code></pre> <p>And then later call tempList.Clear(), will it destroy all the childLists in memory, or should I ...
[ { "answer_id": 278690, "author": "Godeke", "author_id": 28006, "author_profile": "https://Stackoverflow.com/users/28006", "pm_score": 4, "selected": true, "text": "<p>If no <em>other</em> references exist to the child lists, they will be garbage collected as normal. The trick is to watch...
2008/11/10
[ "https://Stackoverflow.com/questions/278687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25538/" ]
If I create a recursive list of of lists: ``` class myList { List<myList> childLists; List<string> things; //... } List<myList> tempList = new List<myList>(); ``` And then later call tempList.Clear(), will it destroy all the childLists in memory, or should I create a recursive method to clear all the childLi...
If no *other* references exist to the child lists, they will be garbage collected as normal. The trick is to watch for any dangling references to the child items (databinding especially tends to go unnoticed once done).
278,692
<p>If I have a comma separated file like the following:</p> <pre> foo,bar,n ,a,bc,d one,two,three ,a,bc,d </pre> <p>And I want to join the <code>\n,</code> to produce this:</p> <pre> foo,bar,n,a,bc,d one,two,three,a,bc,d </pre> <p>What is the regex trick? I thought that an <code>if (/\n,/)</code> would catch this.<...
[ { "answer_id": 278720, "author": "Michael Carman", "author_id": 8233, "author_profile": "https://Stackoverflow.com/users/8233", "pm_score": 5, "selected": true, "text": "<p>You should be using <a href=\"http://search.cpan.org/perldoc?Text::CSV_XS\" rel=\"nofollow noreferrer\">Text::CSV_X...
2008/11/10
[ "https://Stackoverflow.com/questions/278692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If I have a comma separated file like the following: ``` foo,bar,n ,a,bc,d one,two,three ,a,bc,d ``` And I want to join the `\n,` to produce this: ``` foo,bar,n,a,bc,d one,two,three,a,bc,d ``` What is the regex trick? I thought that an `if (/\n,/)` would catch this. Also, will I need to do anything special for...
You should be using [Text::CSV\_XS](http://search.cpan.org/perldoc?Text::CSV_XS) instead of doing this yourself. It supports newlines embedded in records as well as Unicode files. You need to specify the right options when creating the parser, so be sure to read the documentation carefully.
278,703
<p>I know the standard way of using the <a href="https://en.wikipedia.org/wiki/Null_coalescing_operator" rel="noreferrer">null coalescing operator</a> in C# is to set default values.</p> <pre><code>string nobody = null; string somebody = &quot;Bob Saget&quot;; string anybody = &quot;&quot;; anybody = nobody ?? &quot...
[ { "answer_id": 278713, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<blockquote>\n <p>Is ?? necessary, or should you just use the ternary operator (that most are familiar with)</p>\n</...
2008/11/10
[ "https://Stackoverflow.com/questions/278703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26931/" ]
I know the standard way of using the [null coalescing operator](https://en.wikipedia.org/wiki/Null_coalescing_operator) in C# is to set default values. ``` string nobody = null; string somebody = "Bob Saget"; string anybody = ""; anybody = nobody ?? "Mr. T"; // Returns Mr. T anybody = somebody ?? "Mr. T"; // Return...
Well, first of all, it's much easier to chain than the standard ternary operator: ``` string anybody = parm1 ?? localDefault ?? globalDefault; ``` vs. ``` string anyboby = (parm1 != null) ? parm1 : ((localDefault != null) ? localDefault : globalDefault); ``` It also works well if a n...
278,709
<p>I have some user generated content I'm trying to render on my site. The rich text box editor I'm using renders font changes using <code>&lt;font /&gt;</code> tags, which are overridden by CSS on the page.</p> <p>Does anyone know if there is a way to allow rules defined using the <code>&lt;font /&gt;</code> tag to s...
[ { "answer_id": 278717, "author": "thismat", "author_id": 14045, "author_profile": "https://Stackoverflow.com/users/14045", "pm_score": 2, "selected": false, "text": "<p>I would suggest overriding the CSS with your own styles that implement the !important attribute.</p>\n\n<pre><code>div....
2008/11/10
[ "https://Stackoverflow.com/questions/278709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
I have some user generated content I'm trying to render on my site. The rich text box editor I'm using renders font changes using `<font />` tags, which are overridden by CSS on the page. Does anyone know if there is a way to allow rules defined using the `<font />` tag to show through? **UPDATE** Since changing t...
A year late, but thought I'd share nonetheless. I was frustrated by this, as well. I was using a freeware RTE JavaScript component that produced `<FONT />` tags. It wasn't convenient to replace it, as it was for a client and it was a callback to fix this CSS override problem. Unfortunately, none of the other solution...
278,719
<p>I have some code doing this :</p> <pre><code> var changes = document.getElementsByName(from); for (var c=0; c&lt;changes.length; c++) { var ch = changes[c]; var current = new String(ch.innerHTML); etc. } </code></pre> <p>This works fine in FF and Chrome but not in IE7. Presumably because getElementsByNa...
[ { "answer_id": 278741, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "<p>There are a couple of problems:</p>\n\n<ol>\n<li>IE is indeed confusing <code>id=\"\"</code> with <code>name=\"\"</code></...
2008/11/10
[ "https://Stackoverflow.com/questions/278719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36273/" ]
I have some code doing this : ``` var changes = document.getElementsByName(from); for (var c=0; c<changes.length; c++) { var ch = changes[c]; var current = new String(ch.innerHTML); etc. } ``` This works fine in FF and Chrome but not in IE7. Presumably because getElementsByName isn't working in IE. What'...
In case you don't know why this isn't working in IE, here is [the MSDN documentation on that function](http://msdn.microsoft.com/en-us/library/ms536438(VS.85).aspx): > > When you use the getElementsByName method, all elements in the document that have the specified NAME attribute or ID attribute value are returned. >...
278,732
<p>Currently have the following mapping file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernateHelpers" assembly="App_Code.NHibernateHelpers"&gt; &lt;class name="NHibernateHelpers.Fixture, App_Code" table="Fixture_List...
[ { "answer_id": 278807, "author": "Watson", "author_id": 25807, "author_profile": "https://Stackoverflow.com/users/25807", "pm_score": 0, "selected": false, "text": "<p>You may have to tweak the parameter a little, but it should work (Id matches up with the name of Fixture.Id):</p>\n\n<pr...
2008/11/10
[ "https://Stackoverflow.com/questions/278732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21940/" ]
Currently have the following mapping file: ``` <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernateHelpers" assembly="App_Code.NHibernateHelpers"> <class name="NHibernateHelpers.Fixture, App_Code" table="Fixture_Lists"> <id name="Id" column=...
Little kludgy -- but what about not converting the sp to functions, but creating new functions and using them as wrappers around the existing sp? You can add the Id to the function, and have it pass it to the stored procedure, grab the results of executing the sp, and pass them back. <http://sqlblog.com/blogs/denis_go...
278,738
<p>I have an XML schema that represents a product in a DB, and I am trying to figure out the best way to store the product image references as XML nodes. There will be a primary image, and then alternate images, each of them with sequences (display order). Would this be an appropriate format, or are there better approa...
[ { "answer_id": 278748, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": true, "text": "<p>Since XML elements have a natural order (that is, the order in which they appear in the XML file), it's probably redund...
2008/11/10
[ "https://Stackoverflow.com/questions/278738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an XML schema that represents a product in a DB, and I am trying to figure out the best way to store the product image references as XML nodes. There will be a primary image, and then alternate images, each of them with sequences (display order). Would this be an appropriate format, or are there better approache...
Since XML elements have a natural order (that is, the order in which they appear in the XML file), it's probably redundant to include the `sequence` attribute. You can still talk about the order of the elements and there is still a "first" one for the primary product image. So perhaps: ``` <images> <imageset> ...
278,761
<p>I was looking for something like Server.MapPath in the ASP.NET realm to convert the output of Assembly.GetExecutingAssembly().CodeBase into a file path with drive letter.</p> <p>The following code works for the test cases I've tried:</p> <pre> private static string ConvertUriToPath(string fileName) { fileName ...
[ { "answer_id": 278812, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 0, "selected": false, "text": "<p>Can you just use <code>Assembly.Location</code>?</p>\n" }, { "answer_id": 278840, "author": "Scott Dorm...
2008/11/10
[ "https://Stackoverflow.com/questions/278761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3475/" ]
I was looking for something like Server.MapPath in the ASP.NET realm to convert the output of Assembly.GetExecutingAssembly().CodeBase into a file path with drive letter. The following code works for the test cases I've tried: ``` private static string ConvertUriToPath(string fileName) { fileName = fileName.Repl...
Try looking at the [Uri.LocalPath](http://msdn.microsoft.com/en-us/library/system.uri.localpath.aspx) property. ``` private static string ConvertUriToPath(string fileName) { Uri uri = new Uri(fileName); return uri.LocalPath; // Some people have indicated that uri.LocalPath doesn't // always return the co...
278,768
<p>If I'm reading a text file in shared access mode and another process truncates it, what is the easiest way to detect that? (I'm excluding the obvious choice of refreshing a FileInfo object periodically to check its size) Is there some convenient way to capture an event? (Filewatcher?)</p>
[ { "answer_id": 278791, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 3, "selected": true, "text": "<p>There is, <strong>It's called <a href=\"http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx\" rel=\"n...
2008/11/10
[ "https://Stackoverflow.com/questions/278768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29021/" ]
If I'm reading a text file in shared access mode and another process truncates it, what is the easiest way to detect that? (I'm excluding the obvious choice of refreshing a FileInfo object periodically to check its size) Is there some convenient way to capture an event? (Filewatcher?)
There is, **It's called [FileSystemWatcher](http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx)**. If you are developing a windows forms application, you can drag-and-drop it from the toolbox. Here's some usage example: ``` private void myForm_Load(object sender, EventArgs e) { var fileWatc...
278,769
<p>I have an asp.net image button and I want to cancel the click event incase he fails the client side validation... how do I do that?</p>
[ { "answer_id": 278804, "author": "Aaron Fischer", "author_id": 5618, "author_profile": "https://Stackoverflow.com/users/5618", "pm_score": 1, "selected": false, "text": "<p>There is an OnClientClick event you can set this to your javascript function. If you return true it will continue t...
2008/11/10
[ "https://Stackoverflow.com/questions/278769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an asp.net image button and I want to cancel the click event incase he fails the client side validation... how do I do that?
There is an OnClientClick event you can set this to your javascript function. If you return true it will continue to the post back. If you return false the post back will not happen. ``` <asp:Button ID="NavigateAway" runat="server" OnClientClick="javascript:return PromptToNavigateOff();" OnClick="NavigateAwayButton_Cl...
278,789
<p>I have a type ahead text field, and when the user hits "Enter" I want to make an ajax call and not submit the form at the same time. My html looks like this:</p> <pre><code>&lt;input id="drug_name" class="drugs_field" type="text" size="30" onkeypress="handleKeyPress(event,this.form); return false;" name="drug[name]...
[ { "answer_id": 278803, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 2, "selected": false, "text": "<p>Trap the event and cancel it. </p>\n\n<p>It's something like trap onSubmit(event) and event.ignoreDefault(). The event ...
2008/11/10
[ "https://Stackoverflow.com/questions/278789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1486/" ]
I have a type ahead text field, and when the user hits "Enter" I want to make an ajax call and not submit the form at the same time. My html looks like this: ``` <input id="drug_name" class="drugs_field" type="text" size="30" onkeypress="handleKeyPress(event,this.form); return false;" name="drug[name]" autocomplete="o...
You should add an event handler to the form itself which calls a function to decide what to do. ``` <form onsubmit="return someFunction();"> ``` And then make sure that your someFunction() returns false on success. If it returns true the form will submit normally (which is what you are trying to prevent!). So you ca...
278,838
<p>By default when you add an image (icon, bitmap, etc.) as a resource to your project, the image's <strong>Build Action</strong> is set to <strong>None</strong>. This is done because the image is magically stored inside a .resources file.</p> <p><strong><em>I</em></strong> want the resource to be stored as an embedde...
[ { "answer_id": 278911, "author": "Todd", "author_id": 31940, "author_profile": "https://Stackoverflow.com/users/31940", "pm_score": 3, "selected": false, "text": "<p>This depends on how you want to use the image. </p>\n\n<p>If you want to localize and access specific images for a specif...
2008/11/10
[ "https://Stackoverflow.com/questions/278838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
By default when you add an image (icon, bitmap, etc.) as a resource to your project, the image's **Build Action** is set to **None**. This is done because the image is magically stored inside a .resources file. ***I*** want the resource to be stored as an embedded resource (my reasons are irrelevant, but let's just pr...
***Note: This answer is not the recommended way of handling image resources. It just addresses the particular problem as described by the question (i.e. to include an image as an embedded resourse).*** Don't add the image as a resource. I would rather do the following: * Create the image/icon and save it to a file * ...
278,856
<p>I tried using the IHttpModule and managed to convert the urls just fine, but all of my images returned path error (all going through the new url directory).</p> <p>whats the solution?</p>
[ { "answer_id": 278862, "author": "CubanX", "author_id": 27555, "author_profile": "https://Stackoverflow.com/users/27555", "pm_score": 0, "selected": false, "text": "<p>You can try using a URL rewriter such as <a href=\"http://cheeso.members.winisp.net/IIRF.aspx\" rel=\"nofollow noreferre...
2008/11/10
[ "https://Stackoverflow.com/questions/278856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I tried using the IHttpModule and managed to convert the urls just fine, but all of my images returned path error (all going through the new url directory). whats the solution?
You need to make sure that you use the "~/" path notation on your images and make sure that they are all server controls with runat='server'. Otherwise the images urls won't get rewritten. For example if you have a page that gets rewritten from: /Item/Bicycle.aspx to /Item.aspx?id=1234 Then what will happen is th...
278,858
<p>Here is my code: </p> <pre><code>ThreadStart threadStart = controller.OpenFile; Thread thread = new Thread(threadStart); thread.Start(); </code></pre> <p>In the OpenFile function, my code looks like:</p> <pre><code>System.Console.Error.WriteLine("Launching"); </code></pre> <p>The code in OpenFile doesn't get exe...
[ { "answer_id": 278877, "author": "SqlRyan", "author_id": 8114, "author_profile": "https://Stackoverflow.com/users/8114", "pm_score": 1, "selected": false, "text": "<p>Do you have the same problem if you use other threading methods (for example, Threadpool)? This would tell if it's relate...
2008/11/10
[ "https://Stackoverflow.com/questions/278858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12261/" ]
Here is my code: ``` ThreadStart threadStart = controller.OpenFile; Thread thread = new Thread(threadStart); thread.Start(); ``` In the OpenFile function, my code looks like: ``` System.Console.Error.WriteLine("Launching"); ``` The code in OpenFile doesn't get executed for 30 seconds exactly. It starts immediate...
As others pointed out - first try to produce a test program which demonstrates the behavior. If you can't, try to troubleshoot by: 1. Call the method directly, not in thread, and see how it behaves. 2. Comment out the rest of the code besides the System.Error.WriteLine line If you still see the the delay in (1), but ...
278,868
<p>I am doing the following in PHP:</p> <pre><code>exec('java -jar "/opt/flex3/lib/mxmlc.jar" +flexlib "/opt/flex3/frameworks" MyAS3App.as -default-size 360 280 -output MyAS3App.swf'); </code></pre> <p>When I run this from the command line, it runs fine and finishes in a second or two.</p> <p>When I run this command...
[ { "answer_id": 278891, "author": "mmattax", "author_id": 1638, "author_profile": "https://Stackoverflow.com/users/1638", "pm_score": 1, "selected": false, "text": "<p>Is there a reason why your using the mxmlc jar file to compile your flex application? have you tried using the executable...
2008/11/10
[ "https://Stackoverflow.com/questions/278868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20588/" ]
I am doing the following in PHP: ``` exec('java -jar "/opt/flex3/lib/mxmlc.jar" +flexlib "/opt/flex3/frameworks" MyAS3App.as -default-size 360 280 -output MyAS3App.swf'); ``` When I run this from the command line, it runs fine and finishes in a second or two. When I run this command from PHP exec, the java process ...
Turns out it was a bug specific to the PHP stack MAMP (<http://www.mamp.info/>). Turns out any invocation of the JVM following fails under MAMP, e.g.: ``` exec('java -version'); ``` The fix is to prefix the command with ``` export DYLD_LIBRARY_PATH=""; ``` Also I realized there's no reason to use that method of...
278,871
<p>I am using:</p> <pre><code>set constraints all deferred; (lots of deletes and inserts) commit; </code></pre> <p>This works as expected. If there are any broken relationships then the commit fails and an error is raised listing ONE of the FKs that it fails on.</p> <p>The user fixes the offending data and runs aga...
[ { "answer_id": 278967, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>Oracle's Error Mechanism is too primitive to return a collection of all errors that COULD occur. I mean, it's a cool though...
2008/11/10
[ "https://Stackoverflow.com/questions/278871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18138/" ]
I am using: ``` set constraints all deferred; (lots of deletes and inserts) commit; ``` This works as expected. If there are any broken relationships then the commit fails and an error is raised listing ONE of the FKs that it fails on. The user fixes the offending data and runs again. then hits another FK issue and...
First option, you can look into [DML error logging](http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#BGBEIACB). That way you leave your constraints active, then do the inserts, with the erroring rows going into error tables. You can find them there, fix them, re-insert the rows and del...
278,873
<p>you would think this would be obvious, but searching through documentation, SAP forums, Googling, etc., I've been spectacularly unsuccessful. I'm creating a file in ABAP on a solaris filesystem using the following code:</p> <pre><code>OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. </code></pre> <p>...
[ { "answer_id": 303145, "author": "tomdemuyt", "author_id": 7602, "author_profile": "https://Stackoverflow.com/users/7602", "pm_score": 2, "selected": false, "text": "<p>Go to SM69, create a logical system command, you could call it ZCHMOD.</p>\n\n<p>Map that command to <code>chmod</code>...
2008/11/10
[ "https://Stackoverflow.com/questions/278873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29003/" ]
you would think this would be obvious, but searching through documentation, SAP forums, Googling, etc., I've been spectacularly unsuccessful. I'm creating a file in ABAP on a solaris filesystem using the following code: ``` OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. ``` the resulting file is owned...
this works in 4.6B: ``` CONCATENATE 'chmod ugo=rw ' lc_filename INTO lc_chmod SEPARATED BY space. CALL 'SYSTEM' ID 'COMMAND' FIELD lc_chmod. ``` Hope this helps. Cheers, Heiko
278,882
<p>In PL/SQL, I would like to pass in a "source" schema as a parameter to a stored procedure. For instance:</p> <pre><code>BEGIN CURSOR my_cursor IS SELECT my_field FROM &lt;schema&gt;.my_table ... </code></pre> <p>I want the 'schema' value to come from an input parameter into the stored procedure. Does a...
[ { "answer_id": 278886, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>This has to be done with dynamic sql. </p>\n\n<p>Either the DBMS_SQL package or the Execute Immediate statement.</p>\n\n<p>...
2008/11/10
[ "https://Stackoverflow.com/questions/278882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20133/" ]
In PL/SQL, I would like to pass in a "source" schema as a parameter to a stored procedure. For instance: ``` BEGIN CURSOR my_cursor IS SELECT my_field FROM <schema>.my_table ... ``` I want the 'schema' value to come from an input parameter into the stored procedure. Does anyone know how I could do that? P...
In addition to what Mark Brady said, another dynamic SQL option is to use a REF CURSOR. Since your sample code includes a cursor this would be the most relevant. ``` PROCEDURE select_from_schema( the_schema VARCHAR2) IS TYPE my_cursor_type IS REF CURSOR; my_cursor my_cursor_type; BEGIN OPEN my_cursor FOR 'SELEC...
278,902
<p>I've got a bunch of properties which I am going to use read/write locks on. I can implement them either with a <code>try finally</code> or a <code>using</code> clause.</p> <p>In the <code>try finally</code> I would acquire the lock before the <code>try</code>, and release in the <code>finally</code>. In the <code>u...
[ { "answer_id": 278908, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 4, "selected": false, "text": "<p>I definitely prefer the second method. It is more concise at the point of usage, and less error prone.</p>\n\n<p>In t...
2008/11/10
[ "https://Stackoverflow.com/questions/278902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
I've got a bunch of properties which I am going to use read/write locks on. I can implement them either with a `try finally` or a `using` clause. In the `try finally` I would acquire the lock before the `try`, and release in the `finally`. In the `using` clause, I would create a class which acquires the lock in its co...
From MSDN, [using Statement (C# Reference)](http://msdn.microsoft.com/en-us/library/yh598w02.aspx) > > The using statement ensures that Dispose is called even if an exception occurs while you are calling methods on the object. You can achieve the same result by putting the object inside a try block and then calling D...
278,914
<p>The span element seems to be exactly like a div, but at the in-line level rather than at the block level. However, I can't seem to think of any beneficial logical divisions that the span element can provide. </p> <p>A single sentence, or word if not contained in a sentence, seems to be the smallest logical part. Ig...
[ { "answer_id": 278928, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 1, "selected": false, "text": "<p>If you want to apply formatting rules to part of the contents (for example a single word or sentence) of a tag. Yo...
2008/11/10
[ "https://Stackoverflow.com/questions/278914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20770/" ]
The span element seems to be exactly like a div, but at the in-line level rather than at the block level. However, I can't seem to think of any beneficial logical divisions that the span element can provide. A single sentence, or word if not contained in a sentence, seems to be the smallest logical part. Ignoring CSS...
Span can be used to add semantic meaning that falls outside the scope of HTML. This can be done by using classes which identify certain attributes. For example, if you are writing a science-fiction novel you can use span to identify made-up words, because you may want to format those differently, or because you may wan...
278,927
<p>I'm inserting an img tag into my document with the new Element constructor like this (this works just fine):</p> <pre><code>$('placeholder').insert(new Element("img", {id:'something', src:myImage})) </code></pre> <p>I would like to trigger a function when this image loads, but I can't figure out the correct syntax...
[ { "answer_id": 278987, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 0, "selected": false, "text": "<p>You might have to move the function elsewhere and call it by name</p>\n\n<pre><code>$('placeholder').insert(new Element(\...
2008/11/10
[ "https://Stackoverflow.com/questions/278927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12579/" ]
I'm inserting an img tag into my document with the new Element constructor like this (this works just fine): ``` $('placeholder').insert(new Element("img", {id:'something', src:myImage})) ``` I would like to trigger a function when this image loads, but I can't figure out the correct syntax. I'm guess it's something...
In this case, the best solution is to not use Prototype or at least not exclusively. This works: ``` var img = new Element('img',{id:'logo',alt:'Hooray!'}); img.onload = function(){ alert(this.alt); }; img.src = 'logo.jpg'; ``` The key is setting the onload directly instead of letting Prototype's wrapper do it for y...
278,932
<p>I'm building some custom tools to work against a JIRA install, and the exposed SOAP API is great, except that none of the arguments are named.</p> <p>For example, the prototype for getIssue is:</p> <pre><code>RemoteIssue getIssue (string in0, string in1); </code></pre> <p>All of the SOAP RPC methods follow this c...
[ { "answer_id": 278981, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 5, "selected": true, "text": "<p>Found the javadoc:</p>\n\n<p><a href=\"http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/index.html?...
2008/11/10
[ "https://Stackoverflow.com/questions/278932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
I'm building some custom tools to work against a JIRA install, and the exposed SOAP API is great, except that none of the arguments are named. For example, the prototype for getIssue is: ``` RemoteIssue getIssue (string in0, string in1); ``` All of the SOAP RPC methods follow this convention, so without documentati...
Found the javadoc: <http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/index.html?com/atlassian/jira/rpc/soap/JiraSoapService.html>
278,940
<p>I'm looking to vertically align text by adding <code>&lt;br /&gt;</code> tags between characters with jQuery.</p> <pre><code>&lt;div id="foo"&gt;&lt;label&gt;Vertical Text&lt;/label&gt;&lt;/div&gt; </code></pre> <p>would look like this:</p> <p>V<br /> e<br /> r<br /> t<br /> i<br /> c<br /> a<br /> l<br /> <br /...
[ { "answer_id": 278990, "author": "okoman", "author_id": 35903, "author_profile": "https://Stackoverflow.com/users/35903", "pm_score": 2, "selected": false, "text": "<p>Not tested, but it should work.</p>\n\n<pre><code>var element = $( '#foo label' );\nvar newData = '';\nvar data = elemen...
2008/11/10
[ "https://Stackoverflow.com/questions/278940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9750/" ]
I'm looking to vertically align text by adding `<br />` tags between characters with jQuery. ``` <div id="foo"><label>Vertical Text</label></div> ``` would look like this: V e r t i c a l T e x t
Let's go golfing! ``` $('#foo label').html($('#foo label').text().replace(/(.)/g,"$1<br />")); ``` Completely untested, but the pattern in the regex looks like a boob.
278,941
<p>Im having problems displaying records to my view when passing viewdata to a user control. This is only apparent for linq to sql objects where I am using table joins.</p> <p>The exception I receive is "Unable to cast object of type '&lt;>f__AnonymousType4<code>10[System.String,System.Int32,System.Nullable</code>1[S...
[ { "answer_id": 278964, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 3, "selected": true, "text": "<pre><code>foreach (table1 m in (IEnumerable)ViewData.Model)\n</code></pre>\n\n<p><code>m</code> is not of type <code>tab...
2008/11/10
[ "https://Stackoverflow.com/questions/278941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24130/" ]
Im having problems displaying records to my view when passing viewdata to a user control. This is only apparent for linq to sql objects where I am using table joins. The exception I receive is "Unable to cast object of type '<>f\_\_AnonymousType4`10[System.String,System.Int32,System.Nullable`1[System.DateTime],System....
``` foreach (table1 m in (IEnumerable)ViewData.Model) ``` `m` is not of type `table1`. It is an anonymous type (`select new { ... }` in CViewDataUC.cs). You should create a class that represents the type of the model objects you are passing from controller to view.
278,943
<p>I am trying to do this...</p> <pre><code>&lt;Image x:Name="imgGroupImage" Source="Images\unlock.png" Margin="0,0,5,0" /&gt; </code></pre> <p>But I get this error...</p> <blockquote> <p>Cannot convert string 'Images\unlock.png' in attribute 'Source' to object of type 'System.Windows.Media.ImageSource'. Cannot lo...
[ { "answer_id": 278969, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 4, "selected": true, "text": "<p>Try slashes rather than backslashes, and use an absolute path by leading with a slash:</p>\n\n<pre><code>Source=\"/Ima...
2008/11/10
[ "https://Stackoverflow.com/questions/278943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6514/" ]
I am trying to do this... ``` <Image x:Name="imgGroupImage" Source="Images\unlock.png" Margin="0,0,5,0" /> ``` But I get this error... > > Cannot convert string 'Images\unlock.png' in attribute 'Source' to object of type 'System.Windows.Media.ImageSource'. Cannot locate resource 'forms/images/unlock.png'. Error at...
Try slashes rather than backslashes, and use an absolute path by leading with a slash: ``` Source="/Images/unlock.png" ``` That generally works for me. Failing that, take a look at [Pack URIs](http://msdn.microsoft.com/en-us/library/aa970069.aspx).
278,965
<p>I use URLLoader to load data into my Flex app (mostly XML) and my buddy who is doing the same thing mostly uses HTTPService. Is there a specific or valid reason to use on over the other?</p>
[ { "answer_id": 279202, "author": "James", "author_id": 36014, "author_profile": "https://Stackoverflow.com/users/36014", "pm_score": -1, "selected": false, "text": "<p>There really is no difference between using the two. Both implementations could be considered \"correct\".</p>\n" }, ...
2008/11/10
[ "https://Stackoverflow.com/questions/278965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3435/" ]
I use URLLoader to load data into my Flex app (mostly XML) and my buddy who is doing the same thing mostly uses HTTPService. Is there a specific or valid reason to use on over the other?
HTTPService inherits AbstractInvoker which allows you to use tokens and responders which you cannot use with URLLoader. Tokens are good when you need to pass specific variables that are relevant to the request, which you want returned with the response. Other than that, using URLLoader or HttpService to load xml is th...
278,982
<p>Would the following SQL statement automatically create an index on Table1.Table1Column, or must one be explicitly created?</p> <p>Database engine is SQL Server 2000</p> <pre><code> CREATE TABLE [Table1] ( . . . CONSTRAINT [FK_Table1_Table2] FOREIGN KEY ( [Table1Column...
[ { "answer_id": 278992, "author": "jons911", "author_id": 34375, "author_profile": "https://Stackoverflow.com/users/34375", "pm_score": 7, "selected": true, "text": "<p>SQL Server will not automatically create an index on a foreign key. Also from MSDN:</p>\n\n<blockquote>\n <p>A FOREIGN...
2008/11/10
[ "https://Stackoverflow.com/questions/278982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36307/" ]
Would the following SQL statement automatically create an index on Table1.Table1Column, or must one be explicitly created? Database engine is SQL Server 2000 ``` CREATE TABLE [Table1] ( . . . CONSTRAINT [FK_Table1_Table2] FOREIGN KEY ( [Table1Column] ) REFER...
SQL Server will not automatically create an index on a foreign key. Also from MSDN: > > A FOREIGN KEY constraint does not have > to be linked only to a PRIMARY KEY > constraint in another table; it can > also be defined to reference the > columns of a UNIQUE constraint in > another table. A FOREIGN KEY > constr...
278,997
<p>More specifically, if I have:</p> <pre><code>public class TempClass : TempInterface { int TempInterface.TempProperty { get; set; } int TempInterface.TempProperty2 { get; set; } public int TempProperty { get; set; } } public inter...
[ { "answer_id": 279014, "author": "MrKurt", "author_id": 35296, "author_profile": "https://Stackoverflow.com/users/35296", "pm_score": 1, "selected": false, "text": "<p>It's overly complex. You have to reflect over the methods/properties of the Interface type, see if they exist in your c...
2008/11/10
[ "https://Stackoverflow.com/questions/278997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1946/" ]
More specifically, if I have: ``` public class TempClass : TempInterface { int TempInterface.TempProperty { get; set; } int TempInterface.TempProperty2 { get; set; } public int TempProperty { get; set; } } public interface TempInter...
I had to modify Jacob Carpenter's answer but it works nicely. nobugz's also works but Jacobs is more compact. ``` var explicitProperties = from method in typeof(TempClass).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance) where method.IsFinal && method.IsPrivate select method; ```
279,019
<p>I am working an a search page that allows users to search for houses for sale. Typical search criteria include price/zip code/# bedrooms/etc.</p> <p>I would like to allow the user to save this criteria in a database and email new homes daily.</p> <p>I could either:</p> <p>1) Serialize a "SavedSearch" object into ...
[ { "answer_id": 279025, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": -1, "selected": false, "text": "<p>If I can suggest, have a html page with search results (if it contains a moderate number of records). And, store t...
2008/11/10
[ "https://Stackoverflow.com/questions/279019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36313/" ]
I am working an a search page that allows users to search for houses for sale. Typical search criteria include price/zip code/# bedrooms/etc. I would like to allow the user to save this criteria in a database and email new homes daily. I could either: 1) Serialize a "SavedSearch" object into a string and save that t...
I assume you will need to re-run the search daily in order to find new additions to the results. Maybe it is possible to make sure that you search form specifies a get method so that the search criteria is appended to the url as a query string then save the entire querystring in the database. So if you have a search p...
279,043
<p>Let's take a very simple example:</p> <ul> <li>In my window1.xaml, i have a label control named 'lblProduct'.</li> <li>In my window1.xaml.cs, i have a public method called CalculateProduct(Int Var1, Int Var2). CalculateProduct will, as you may have guessed, calculate the product of the variables passed in.</li> </...
[ { "answer_id": 279139, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 1, "selected": false, "text": "<p><code>ObjectDataProvider</code> has an <code>ObjectInstance</code> property that you can assign your Window instanc...
2008/11/10
[ "https://Stackoverflow.com/questions/279043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36308/" ]
Let's take a very simple example: * In my window1.xaml, i have a label control named 'lblProduct'. * In my window1.xaml.cs, i have a public method called CalculateProduct(Int Var1, Int Var2). CalculateProduct will, as you may have guessed, calculate the product of the variables passed in. I'd like to simply bind the ...
Yes, there is a way. It's not pretty. You have to add an xmlns:Commands attribute to your window1.xaml tag. I ended up bastardizing some code I found in [this Code Project article](http://www.codeproject.com/KB/WPF/CentralizingWPFCommands.aspx). Is the product that you want to display in the label something that's gen...
279,065
<p>I have this as Main</p> <pre><code>int[] M ={ 10, 2, 30, 4, 50, 6, 7, 80 }; MyMath.Reverse(M); for (int i = 0; i &lt; M.Length; i++) Console.WriteLine(M[i].ToString() + ", "); </code></pre> <hr> <p>After I created the class MyMath I made the Reverse method </p> <pre><code>public int Reverse(Array M) { ...
[ { "answer_id": 279096, "author": "3Doubloons", "author_id": 25818, "author_profile": "https://Stackoverflow.com/users/25818", "pm_score": -1, "selected": false, "text": "<p>You need to pass you array as a reference. In C#, you do that by using the keyword 'ref' when declaring your parame...
2008/11/10
[ "https://Stackoverflow.com/questions/279065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have this as Main ``` int[] M ={ 10, 2, 30, 4, 50, 6, 7, 80 }; MyMath.Reverse(M); for (int i = 0; i < M.Length; i++) Console.WriteLine(M[i].ToString() + ", "); ``` --- After I created the class MyMath I made the Reverse method ``` public int Reverse(Array M) { int len = M.Length; for (int i ...
Working from your ``` public static int Reverse(Array M) { return Reverse(M); } ``` You have 2 problems. 1. Reverse(M) looks like the same function that you're in, so you're calling your new function, which calls itself, which calls itself, etc., resulting in the stack overflow. Change to `return Array.Reverse...
279,066
<p>Our company uses an app that was originally ColdFusion + Access later converted to classic ASP + MS Sql for task/time tracking called the request system. It's broken down by department, so there's one for MIS, marketing, logistics, etc. The problem comes in when (mainly managers) are using more than one at a time, w...
[ { "answer_id": 279104, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 3, "selected": true, "text": "<p>refactor the code away from the direct Session(\"whatever\") interface:</p>\n\n<ol>\n<li>create an API for session ...
2008/11/10
[ "https://Stackoverflow.com/questions/279066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1302/" ]
Our company uses an app that was originally ColdFusion + Access later converted to classic ASP + MS Sql for task/time tracking called the request system. It's broken down by department, so there's one for MIS, marketing, logistics, etc. The problem comes in when (mainly managers) are using more than one at a time, with...
refactor the code away from the direct Session("whatever") interface: 1. create an API for session access and replace all existing use of Session with it (it can be a session 'class/object' or just an include-file) 2. mangle the passed-in names for session variables with something that will make them unique per domain...
279,114
<p>I'm trying to read the contents of a text file, in this case a list of computer names (Computer1, computer2 etc,) and I thought that StreamReader would be what you would use but when I do the following:</p> <pre><code>StreamReader arrComputer = new StreamReader(FileDialog.filename)(); </code></pre> <p>I got this e...
[ { "answer_id": 279118, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 2, "selected": false, "text": "<p>try</p>\n\n<pre><code>using System.IO;\n\n\nStreamReader arrComputer = new StreamReader(FileDialog.filename);\n</c...
2008/11/10
[ "https://Stackoverflow.com/questions/279114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35760/" ]
I'm trying to read the contents of a text file, in this case a list of computer names (Computer1, computer2 etc,) and I thought that StreamReader would be what you would use but when I do the following: ``` StreamReader arrComputer = new StreamReader(FileDialog.filename)(); ``` I got this exception: ``` The type or...
You need to import the `System.IO` namespace. Put this at the top of your .cs file: ``` using System.IO; ``` Either that, or explicitly qualify the type name: ``` System.IO.StreamReader arrComputer = new System.IO.StreamReader(FileDialog.filename); ```
279,119
<p>I like to use IPython's zope profile to inspect my Plone instance, but a few annoying permissions differences come up compared to inserting a breakpoint and hitting it with the admin user.</p> <p>For example, I would like to iterate over the content objects in an unpublished testing folder. This query will return n...
[ { "answer_id": 290657, "author": "joeforker", "author_id": 36330, "author_profile": "https://Stackoverflow.com/users/36330", "pm_score": 2, "selected": true, "text": "<p>Just use catalog.search({'path':'Plone/testing'}). It performs the same query as catalog() but does not filter the res...
2008/11/10
[ "https://Stackoverflow.com/questions/279119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36330/" ]
I like to use IPython's zope profile to inspect my Plone instance, but a few annoying permissions differences come up compared to inserting a breakpoint and hitting it with the admin user. For example, I would like to iterate over the content objects in an unpublished testing folder. This query will return no results ...
Just use catalog.search({'path':'Plone/testing'}). It performs the same query as catalog() but does not filter the results based on the current user's permissions. IPython's zope profile does provide a method utils.su('username') to change the current user, but it does not recognize the admin user (defined in /acl\_us...
279,145
<p>What is the most elegant way of bubble-sorting in F#?</p> <p><strong>UPDATE</strong></p> <p>As pointed out in one of the answers, bubble sorting isn't efficient in a functional language to begin with. A humourously-cynical commenter also pointed out that bubble sorting is only appropriate when the list is small an...
[ { "answer_id": 279587, "author": "Tomas Petricek", "author_id": 33518, "author_profile": "https://Stackoverflow.com/users/33518", "pm_score": 5, "selected": true, "text": "<p>using bubble sort in a functional language isn't very efficient, because the implementation has to reverse the li...
2008/11/10
[ "https://Stackoverflow.com/questions/279145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32462/" ]
What is the most elegant way of bubble-sorting in F#? **UPDATE** As pointed out in one of the answers, bubble sorting isn't efficient in a functional language to begin with. A humourously-cynical commenter also pointed out that bubble sorting is only appropriate when the list is small and it's almost sorted anyway. ...
using bubble sort in a functional language isn't very efficient, because the implementation has to reverse the list many times (and this can't be really implemented very efficiently for immutable lists). Anyway, the example from Erlang can be rewritten to F# like this: ``` let sort l = let rec sortUtil acc rev l =...
279,154
<p>I'm looking for a reliable, implementation-independent way to clone an entire Document. The Javadocs specifically say that calling cloneNode on a Document is implementation-specific. I've tried passing the Document through a no-op Transformer, but the resulting Node has no owner Document.</p> <p>I could create a ...
[ { "answer_id": 279711, "author": "Vladimir Dyuzhev", "author_id": 1163802, "author_profile": "https://Stackoverflow.com/users/1163802", "pm_score": 2, "selected": false, "text": "<p>Still, how about the quick'n'dirty way: serialize the whole Document into XML string and then parse it bac...
2008/11/10
[ "https://Stackoverflow.com/questions/279154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25498/" ]
I'm looking for a reliable, implementation-independent way to clone an entire Document. The Javadocs specifically say that calling cloneNode on a Document is implementation-specific. I've tried passing the Document through a no-op Transformer, but the resulting Node has no owner Document. I could create a new Document...
As some of the comments point out, there are problems with serializing and re-parsing a document. In addition to memory usage, performance considerations, and normalization, there's also loss of the prolog (DTD or schema), potential loss of comments (which aren't required to be captured), and loss of what may be signif...
279,158
<p>I'm going to try to ask my question in the context of a simple example...</p> <p>Let's say I have an abstract base class Car. Car has-a basic Engine object. I have a method StartEngine() in the abstract Car class that delegates the starting of the engine to the Engine object.</p> <p>How do I allow subclasses of ...
[ { "answer_id": 279180, "author": "Chris Boran", "author_id": 25660, "author_profile": "https://Stackoverflow.com/users/25660", "pm_score": 0, "selected": false, "text": "<p>There are lots of ways it could be done. </p>\n\n<p>I would favour having a <code>setEngine()</code> method on <cod...
2008/11/10
[ "https://Stackoverflow.com/questions/279158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132931/" ]
I'm going to try to ask my question in the context of a simple example... Let's say I have an abstract base class Car. Car has-a basic Engine object. I have a method StartEngine() in the abstract Car class that delegates the starting of the engine to the Engine object. How do I allow subclasses of Car (like Ferrari) ...
The Abstract Factory pattern is precisely for this problem. Google GoF Abstract Factory {your preferred language} In the following, note how you can either use the concrete factories to produce "complete" objects (enzo, civic) or you can use them to produce "families" of related objects (CarbonFrame + TurboEngine, Wea...
279,169
<p>Is it possible to deploy a website using <code>git push</code>? I have a hunch it has something to do with using <a href="http://www.git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="noreferrer">git hooks</a> to perform a <code>git reset --hard</code> on the server side, but how would I go about accomplishing t...
[ { "answer_id": 279211, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "<p>The way I do it is I have a bare Git repository on my deployment server where I push changes. Then I log in to the dep...
2008/11/10
[ "https://Stackoverflow.com/questions/279169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/658/" ]
Is it possible to deploy a website using `git push`? I have a hunch it has something to do with using [git hooks](http://www.git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) to perform a `git reset --hard` on the server side, but how would I go about accomplishing this?
I found [this script](https://stackoverflow.com/questions/279169/deploy-php-using-git/3387030#3387030) on [this site](http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73) and it seems to work quite well. 1. Copy over your .git directory to your web server 2. On your local copy, modify your .g...
279,170
<p> I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.</p> <p>Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to...
[ { "answer_id": 279238, "author": "JW.", "author_id": 4321, "author_profile": "https://Stackoverflow.com/users/4321", "pm_score": 4, "selected": false, "text": "<p>In PHP, you'll need to either use the <a href=\"http://us2.php.net/manual/en/ref.mbstring.php\" rel=\"noreferrer\">multibyte ...
2008/11/10
[ "https://Stackoverflow.com/questions/279170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1951/" ]
I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1. Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — ...
**Data Storage**: * Specify the `utf8mb4` character set on all tables and text columns in your database. This makes MySQL physically store and retrieve values encoded natively in UTF-8. Note that MySQL will implicitly use `utf8mb4` encoding if a `utf8mb4_*` collation is specified (without any explicit character set). ...
279,173
<p>Is there anything in Visual Studio that will report memory leaks like Codeguard?</p> <p>eg:</p> <pre><code>Error 00001. 0x300010 (Thread 0x0FA4): Resource leak: The object (0xC65D84) was never deleted The object (0x00C65D84) [size: 4 bytes] was created with new | element2.cpp line 3: | #include "element2.h" | |&...
[ { "answer_id": 279188, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 3, "selected": true, "text": "<p>Built in, no. It has <code>&lt;crtdbg.h</code>>, but it's not as comprehensive as implied by your example. There a...
2008/11/10
[ "https://Stackoverflow.com/questions/279173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34799/" ]
Is there anything in Visual Studio that will report memory leaks like Codeguard? eg: ``` Error 00001. 0x300010 (Thread 0x0FA4): Resource leak: The object (0xC65D84) was never deleted The object (0x00C65D84) [size: 4 bytes] was created with new | element2.cpp line 3: | #include "element2.h" | |>CS225::Element2::Elem...
Built in, no. It has `<crtdbg.h`>, but it's not as comprehensive as implied by your example. There are various add-ons that provide this functionality. Boundschecker is a well-known and popular one.
279,190
<p>How can I extract the list of colors in the System.Drawing.Color struct into a collection or array?</p> <p>Is there a more efficient way of getting a collection of colors than using this struct as a base?</p>
[ { "answer_id": 279198, "author": "CheGueVerra", "author_id": 17787, "author_profile": "https://Stackoverflow.com/users/17787", "pm_score": 0, "selected": false, "text": "<p>In System.Drawing there is an Enum KnownColor, it specifies the known system colors.</p>\n\n<p>List&lt;>:\nList all...
2008/11/10
[ "https://Stackoverflow.com/questions/279190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583/" ]
How can I extract the list of colors in the System.Drawing.Color struct into a collection or array? Is there a more efficient way of getting a collection of colors than using this struct as a base?
So you'd do: ``` string[] colors = Enum.GetNames(typeof(System.Drawing.KnownColor)); ``` ... to get an array of all the collors. Or... You could use reflection to just get the colors. KnownColors includes items like "Menu", the color of the system menus, etc. this might not be what you desired. So, to get just the ...
279,208
<p>After two years of C#, I'm now back to VB.net because of my current job. In C#, I can do a short hand testing for null or false value on a string variable like this:</p> <pre><code>if(!String.IsNullOrEmpty(blah)) { ...code goes here } </code></pre> <p>however I'm a little confused about how to do this in VB.net...
[ { "answer_id": 279212, "author": "Ruben", "author_id": 21733, "author_profile": "https://Stackoverflow.com/users/21733", "pm_score": 3, "selected": false, "text": "<p>Yes they are the same</p>\n" }, { "answer_id": 279222, "author": "Scott Mayfield", "author_id": 33633, ...
2008/11/10
[ "https://Stackoverflow.com/questions/279208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
After two years of C#, I'm now back to VB.net because of my current job. In C#, I can do a short hand testing for null or false value on a string variable like this: ``` if(!String.IsNullOrEmpty(blah)) { ...code goes here } ``` however I'm a little confused about how to do this in VB.net. ``` if Not String.IsNul...
In the context you show, the VB `Not` keyword is indeed the equivalent of the C# `!` operator. But note that the VB `Not` keyword is actually overloaded to represent two C# equivalents: * logical negation: `!` * bitwise complement: `~` For example, the following two lines are equivalent: * C#: `useThis &= ~doNotUse;...
279,220
<p>I've written a web service using ASP.NET (in C#) and I'm attempting to write an example PHP client using NuSOAP. Where I'm tripped up on are examples of how to do this; some show <code>soapval</code> being used (and I don't quite understand the parameters - for example passing <code>false</code> as <code>string</co...
[ { "answer_id": 279407, "author": "John Lemp", "author_id": 12915, "author_profile": "https://Stackoverflow.com/users/12915", "pm_score": 4, "selected": true, "text": "<p>You have to wrap things in tons of nested arrays.</p>\n\n<pre><code>&lt;?php\nrequire_once('lib/nusoap.php');\n$client...
2008/11/10
[ "https://Stackoverflow.com/questions/279220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5645/" ]
I've written a web service using ASP.NET (in C#) and I'm attempting to write an example PHP client using NuSOAP. Where I'm tripped up on are examples of how to do this; some show `soapval` being used (and I don't quite understand the parameters - for example passing `false` as `string` types, etc.), while others are ju...
You have to wrap things in tons of nested arrays. ``` <?php require_once('lib/nusoap.php'); $client = new nusoap_client('http://localhost:3333/Service.asmx?wsdl'); $params = array( 'anId' => 3, 'action' => 'OMNOMNOMNOM', 'parameters' => array( 'Param' => array( array(...
279,221
<p>I have a VB6 picture box that gets an image from a video capture device.</p> <p>I'm trying to figure out how to then convert the picture box to a byte array.</p>
[ { "answer_id": 279231, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<p>It's been a long time since I've worked with VB6 but as far as I remember, you can just serialize the image into a...
2008/11/10
[ "https://Stackoverflow.com/questions/279221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1096640/" ]
I have a VB6 picture box that gets an image from a video capture device. I'm trying to figure out how to then convert the picture box to a byte array.
``` Private Type BITMAP bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBits As Long End Type Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As...
279,236
<p>I'm attempting to resize pngs with transparent backgrounds in PHP and the code samples I've found online don't work for me. Here's the code I'm using, advice will be much appreciated!</p> <pre><code>$this-&gt;image = imagecreatefrompng($filename); imagesavealpha($this-&gt;image, true); $newImage = imagecreatetruec...
[ { "answer_id": 279310, "author": "Dycey", "author_id": 35961, "author_profile": "https://Stackoverflow.com/users/35961", "pm_score": 7, "selected": true, "text": "<p>From what I can tell, you need to set the blending mode to <code>false</code>, and the save alpha channel flag to <code>tr...
2008/11/10
[ "https://Stackoverflow.com/questions/279236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/956/" ]
I'm attempting to resize pngs with transparent backgrounds in PHP and the code samples I've found online don't work for me. Here's the code I'm using, advice will be much appreciated! ``` $this->image = imagecreatefrompng($filename); imagesavealpha($this->image, true); $newImage = imagecreatetruecolor($width, $height...
From what I can tell, you need to set the blending mode to `false`, and the save alpha channel flag to `true` **before** you do the imagecolorallocatealpha() ``` <?php /** * https://stackoverflow.com/a/279310/470749 * * @param resource $image * @param int $newWidth * @param int $newHeight * @return resource */...
279,237
<p>How do I import a Python module given its relative path?</p> <p>For example, if <code>dirFoo</code> contains <code>Foo.py</code> and <code>dirBar</code>, and <code>dirBar</code> contains <code>Bar.py</code>, how do I import <code>Bar.py</code> into <code>Foo.py</code>?</p> <p>Here's a visual representation:</p> <...
[ { "answer_id": 279253, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 8, "selected": false, "text": "<p>Be sure that dirBar has the <code>__init__.py</code> file -- this makes a directory into a Python package.</p>\n" }, ...
2008/11/10
[ "https://Stackoverflow.com/questions/279237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1388/" ]
How do I import a Python module given its relative path? For example, if `dirFoo` contains `Foo.py` and `dirBar`, and `dirBar` contains `Bar.py`, how do I import `Bar.py` into `Foo.py`? Here's a visual representation: ``` dirFoo\ Foo.py dirBar\ Bar.py ``` `Foo` wishes to include `Bar`, but restruct...
Assuming that both your directories are real Python packages (do have the `__init__.py` file inside them), here is a safe solution for inclusion of modules relatively to the location of the script. I assume that you want to do this, because you need to include a set of modules with your script. I use this in productio...
279,240
<p>I know that CSS can be used to control the presentation of (X)HTML in modern browsers. I was under the impression that this was possible for arbitrary XML as well. (Am I mistaken?)</p> <p><strong>A concrete example</strong>: given the following XML</p> <pre><code>&lt;log&gt; &lt;entry revision="1"&gt; &lt;a...
[ { "answer_id": 279255, "author": "alex77", "author_id": 1555, "author_profile": "https://Stackoverflow.com/users/1555", "pm_score": 4, "selected": true, "text": "<p>It is indeed possible to use CSS to format an XML document.</p>\n\n<p><a href=\"http://www.w3schools.com/Xml/xml_display.as...
2008/11/10
[ "https://Stackoverflow.com/questions/279240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33412/" ]
I know that CSS can be used to control the presentation of (X)HTML in modern browsers. I was under the impression that this was possible for arbitrary XML as well. (Am I mistaken?) **A concrete example**: given the following XML ``` <log> <entry revision="1"> <author>J Random Hacker</author> <message>Some p...
It is indeed possible to use CSS to format an XML document. [W3 schools example](http://www.w3schools.com/Xml/xml_display.asp) (The W3C do recommend using xslt to do this sort of thing instead CSS though)
279,269
<p>If I have data in the following format</p> <pre><code> id subid text 1 1 Hello 1 2 World 1 3 ! 2 1 B 2 2 B 2 3 Q </code></pre> <p>And would like it in this format:</p> <pre><code> id fold 1 HelloWorld! 2 BBQ </code></p...
[ { "answer_id": 279274, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 2, "selected": false, "text": "<p>a temp table and a cursor leap to mind...</p>\n\n<p>Dear Downvoters: a temp table and a cursor have got to be at l...
2008/11/10
[ "https://Stackoverflow.com/questions/279269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8435/" ]
If I have data in the following format ``` id subid text 1 1 Hello 1 2 World 1 3 ! 2 1 B 2 2 B 2 3 Q ``` And would like it in this format: ``` id fold 1 HelloWorld! 2 BBQ ``` How could I accomplish it in T-SQL?
I would strongly suggest against that. That is the sort of thing that should be handled in your application layer. But... if you must: [Concatenating Row Values in Transact-SQL](https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/)
279,282
<p>Let's say I do something in Java like:</p> <pre> <code> RemoteResponse response = null; try { FutureTask task new FutureTask(....); executor.execute(task); response = task.get(1000, TimeUnits.MILLISECONDS); } catch( TimeoutException te ) { <b> .. should I do something special here? ... .. what hap...
[ { "answer_id": 279321, "author": "Ken Gentle", "author_id": 8709, "author_profile": "https://Stackoverflow.com/users/8709", "pm_score": 3, "selected": true, "text": "<p>Edit after the question was revised:</p>\n\n<p><code>response</code> is a reference to a <code>RemoteResponse</code> th...
2008/11/10
[ "https://Stackoverflow.com/questions/279282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3095/" ]
Let's say I do something in Java like: ``` RemoteResponse response = null; try { FutureTask task new FutureTask(....); executor.execute(task); response = task.get(1000, TimeUnits.MILLISECONDS); } catch( TimeoutException te ) { **.. should I do something special here? ... .. what happens to the return val...
Edit after the question was revised: `response` is a reference to a `RemoteResponse` that `task` is responsible for allocating. The assignment of the return value from a method won't happen if the method threw an exception, so there is no need for special handling of `response`. `task` will be unreferenced when it go...
279,293
<p>We are repurposing an application server running WebSphere 6.0.2.23. I would like to rename the various application server to better reflect its new role. </p> <p>How can you rename an application server? </p> <p>It seems like wsadmin can do it, but I'm struggling with the object hierarchy.</p>
[ { "answer_id": 2681177, "author": "ndarkduck", "author_id": 322055, "author_profile": "https://Stackoverflow.com/users/322055", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://www.ibm.com/developerworks/websphere/library/samples/SampleScripts.html\" rel=\"nofollow noreferr...
2008/11/10
[ "https://Stackoverflow.com/questions/279293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16484/" ]
We are repurposing an application server running WebSphere 6.0.2.23. I would like to rename the various application server to better reflect its new role. How can you rename an application server? It seems like wsadmin can do it, but I'm struggling with the object hierarchy.
[IBM Sample Scripts](http://www.ibm.com/developerworks/websphere/library/samples/SampleScripts.html) download: > > ConfigScripts.zip > > > from command line execute: ``` /usr/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/ws_ant.sh \ -profileName AppSrv01 \ -buildfile exportImport.xml \ -logfile rename.log \ -...
279,296
<p>Given a date how can I add a number of days to it, but exclude weekends. For example, given 11/12/2008 (Wednesday) and adding five will result in 11/19/2008 (Wednesday) rather than 11/17/2008 (Monday).</p> <p>I can think of a simple solution like looping through each day to add and checking to see if it is a weeken...
[ { "answer_id": 279316, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": -1, "selected": false, "text": "<p>Given the number of the original day in the year D and original day in the week W and the number of workdays to add N, th...
2008/11/10
[ "https://Stackoverflow.com/questions/279296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45/" ]
Given a date how can I add a number of days to it, but exclude weekends. For example, given 11/12/2008 (Wednesday) and adding five will result in 11/19/2008 (Wednesday) rather than 11/17/2008 (Monday). I can think of a simple solution like looping through each day to add and checking to see if it is a weekend, but I'd...
using Fluent DateTime <https://github.com/FluentDateTime/FluentDateTime> ``` var dateTime = DateTime.Now.AddBusinessDays(4); ```
279,306
<p>Ok. I'm having an issue with the following bit of code:</p> <pre><code>StreamReader arrComputer = new StreamReader(FileDialog.FileName); </code></pre> <p>My first question had been answered already now my second question focuses on the tail end of this code.</p> <p>I'm reading a text file <code>StreamReader</cod...
[ { "answer_id": 279314, "author": "dnord", "author_id": 3248, "author_profile": "https://Stackoverflow.com/users/3248", "pm_score": 0, "selected": false, "text": "<p>Is <code>FileDialog</code> the name of your control, or the type of the control? I'm guessing it's the type. When you dra...
2008/11/10
[ "https://Stackoverflow.com/questions/279306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35760/" ]
Ok. I'm having an issue with the following bit of code: ``` StreamReader arrComputer = new StreamReader(FileDialog.FileName); ``` My first question had been answered already now my second question focuses on the tail end of this code. I'm reading a text file `StreamReader` that the user selects with a button event ...
Looks to me like you're creating a new OpenFileDialog object in your button1\_Click method, and storing the only reference to that object in a local variable, fileDialog. Then, in your buttonRun\_Click method, it looks like you wanted to get the file name from the dialog you created in the previous method. That's not ...
279,313
<p>I'm trying to put a Message back into an MSMQ when an exception is thrown. The following code appears to work but the Message is not put back in the queue?</p> <pre><code>Message msg = null; try { MessageQueue MQueue = new MessageQueue(txtMsgQPath.Text); msg = MQueue.ReceiveById(txtQItemToRead.Text); lb...
[ { "answer_id": 279339, "author": "Gavin Miller", "author_id": 33226, "author_profile": "https://Stackoverflow.com/users/33226", "pm_score": 0, "selected": false, "text": "<p>I believe that you're looking to \"Peek\" at the message. Use: MessageQueue.Peek and if you succeed, then consume...
2008/11/10
[ "https://Stackoverflow.com/questions/279313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
I'm trying to put a Message back into an MSMQ when an exception is thrown. The following code appears to work but the Message is not put back in the queue? ``` Message msg = null; try { MessageQueue MQueue = new MessageQueue(txtMsgQPath.Text); msg = MQueue.ReceiveById(txtQItemToRead.Text); lblMsgRead.Text ...
Couple of points: The best way to do this would be using a transaction spanning both queues; that way you'll know you won't lose a message. The second part of it is to be careful about how the queues are created and how you submit messages to the second queue. In particular, MSMQ sometimes appears to "fail silently" w...
279,324
<p>Im trying to find a best practice to load usercontrols using Ajax.</p> <p>My first approach where simply using an UpdatePanel and popuplating it with LoadControl() on ajax postbacks but this would rerender other loaded usercontrols in the same UpdatePanel. Also I cannot have a predefined set of UpdatePanels since t...
[ { "answer_id": 279362, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 2, "selected": false, "text": "<p>I'm not sure, but maybe <a href=\"http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templat...
2008/11/10
[ "https://Stackoverflow.com/questions/279324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19264/" ]
Im trying to find a best practice to load usercontrols using Ajax. My first approach where simply using an UpdatePanel and popuplating it with LoadControl() on ajax postbacks but this would rerender other loaded usercontrols in the same UpdatePanel. Also I cannot have a predefined set of UpdatePanels since the number ...
Probably dozens of high-brow reasons for not doing it this way, but simply initalizing a page, adding the usercontrol, then executing and dump the resulting HTML wherever it may behoove you, is (in my simpleminded view) so mind-numbingly fast & fun that I just have to mention it... Skip the UpdatePanels, just use a La...
279,326
<p>I'm working on a simple little function to download a file from an SSL-enabled website using the WinInet functions, namely InternetOpen and InternetOpenURL. I had was initially failing the call to InternetOpenURL with a <code>ERROR_INTERNET_INVALID_CA</code> (12045) because I was using a self-signed certificate on...
[ { "answer_id": 279419, "author": "bdumitriu", "author_id": 35415, "author_profile": "https://Stackoverflow.com/users/35415", "pm_score": 0, "selected": false, "text": "<p>I see you're not checking the <code>hReq</code> you get back from <code>InternetOpen</code>. Perhaps that is the root...
2008/11/10
[ "https://Stackoverflow.com/questions/279326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm working on a simple little function to download a file from an SSL-enabled website using the WinInet functions, namely InternetOpen and InternetOpenURL. I had was initially failing the call to InternetOpenURL with a `ERROR_INTERNET_INVALID_CA` (12045) because I was using a self-signed certificate on my test server,...
I used to receive similar error. I then passed the handle returned by a HttpOpenRequest(...) to InternetQueryOption and it worked just fine. Try it out.
279,329
<p>What's the quickest way to convert a date in one format, say </p> <blockquote> <p>2008-06-01</p> </blockquote> <p>to a date in another format, say </p> <blockquote> <p>Sun 1st June 2008</p> </blockquote> <p>The important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other t...
[ { "answer_id": 279340, "author": "bdumitriu", "author_id": 35415, "author_profile": "https://Stackoverflow.com/users/35415", "pm_score": 0, "selected": false, "text": "<pre><code>date -d yyyy-mm-dd\n</code></pre>\n\n<p>If you want more control over formatting, you can also add it like th...
2008/11/10
[ "https://Stackoverflow.com/questions/279329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35961/" ]
What's the quickest way to convert a date in one format, say > > 2008-06-01 > > > to a date in another format, say > > Sun 1st June 2008 > > > The important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other things around - in a non-deterministic fashion. I'm running GN...
``` $ date -d '2005-06-30' +'%a %F' Thu 2005-06-30 ``` See `man date` for other format options. This option is available on Linux, but not on Darwin. In Darwin, you can use the following syntax instead: ``` date -j -f "%Y-%m-%d" 2006-06-30 +"%a %F" ``` The -f argument specifies the input format and the + argument...
279,359
<p>I have this Array i wrote a function MostFreq that takes an array of integers and return 2 values : the more frequent number in the array and its frequency check this code i worte what do you think ? is there a better way to do it?</p> <pre><code>static void Main() { int [] M={4,5,6,4,4,3,5,3}; int x; ...
[ { "answer_id": 279394, "author": "Nathan W", "author_id": 6335, "author_profile": "https://Stackoverflow.com/users/6335", "pm_score": 4, "selected": true, "text": "<p>LINQ it up. I know this is in VB but you should be able to convert it to C#:</p>\n\n<pre><code>Dim i = From Numbers In i...
2008/11/10
[ "https://Stackoverflow.com/questions/279359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have this Array i wrote a function MostFreq that takes an array of integers and return 2 values : the more frequent number in the array and its frequency check this code i worte what do you think ? is there a better way to do it? ``` static void Main() { int [] M={4,5,6,4,4,3,5,3}; int x; int f=MyMath.M...
LINQ it up. I know this is in VB but you should be able to convert it to C#: ``` Dim i = From Numbers In ints _ Group Numbers By Numbers Into Group _ Aggregate feq In Group Into Count() _ Select New With {.Number = Numbers, .Count = Count} ``` EDIT: Now in C# too: ``` var i = fro...
279,374
<p>I had the following line snippet of code that searches for a propery of an instance by name:</p> <pre><code>var prop = Backend.GetType().GetProperty(fieldName); </code></pre> <p>Now I want to ignore the case of fieldName, so I tried the following:</p> <pre><code>var prop = Backend.GetType().GetProperty(fieldName,...
[ { "answer_id": 279395, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "<p>You need to specify <code>BindingFlags.Public | BindingFlags.Instance</code> as well:</p>\n\n<pre><code>using System;\...
2008/11/10
[ "https://Stackoverflow.com/questions/279374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2744/" ]
I had the following line snippet of code that searches for a propery of an instance by name: ``` var prop = Backend.GetType().GetProperty(fieldName); ``` Now I want to ignore the case of fieldName, so I tried the following: ``` var prop = Backend.GetType().GetProperty(fieldName, BindingFlags.IgnoreCase); ``` ... ...
You need to specify `BindingFlags.Public | BindingFlags.Instance` as well: ``` using System; using System.Reflection; public class Test { private int foo; public int Foo { get { return foo; } } static void Main() { var prop = typeof(Test).GetProperty("foo", ...
279,391
<p>When developing JavaScript, I tend to separate JavaScript code out into different files and then run a script to concatenate the files and compress or pack the resulting file. In the end, I have one file that I need to include on my production site. </p> <p>This approach has usually worked, but I've started to run ...
[ { "answer_id": 279476, "author": "mercutio", "author_id": 1951, "author_profile": "https://Stackoverflow.com/users/1951", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>If the concatenation script I'm using is simply concatenating a directory full of files, the child class ...
2008/11/10
[ "https://Stackoverflow.com/questions/279391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22291/" ]
When developing JavaScript, I tend to separate JavaScript code out into different files and then run a script to concatenate the files and compress or pack the resulting file. In the end, I have one file that I need to include on my production site. This approach has usually worked, but I've started to run into a pro...
> > If the concatenation script I'm using is simply concatenating a directory full of files, the child class might occur in the code before the parent class. > > > Is it too simple a solution to prepend a sort order value to each filename, and sort by name before performing the operation? eg: ``` 01_parent.js 02...
279,392
<p>My SQL table looks like this:</p> <pre><code>CREATE TABLE Page ( Id int primary key, ParentId int, -- refers to Page.Id Title varchar(255), Content ntext ) </code></pre> <p>and maps to the following class in my ActiveRecord model:</p> <pre><code>[ActiveRecord] public class Page { [PrimaryKey]...
[ { "answer_id": 290886, "author": "Neil Hewitt", "author_id": 22178, "author_profile": "https://Stackoverflow.com/users/22178", "pm_score": -1, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>var rootPages = new SimpleQuery&lt;Page&gt;(@\"from Page p left join fetch p.Children ...
2008/11/10
[ "https://Stackoverflow.com/questions/279392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5017/" ]
My SQL table looks like this: ``` CREATE TABLE Page ( Id int primary key, ParentId int, -- refers to Page.Id Title varchar(255), Content ntext ) ``` and maps to the following class in my ActiveRecord model: ``` [ActiveRecord] public class Page { [PrimaryKey] public int Id { get; set; } ...
The easiest way to do this is to fetch the entire table, then filter the result. This is pretty easy, if you are using linq. ``` var AllPages = ActiveRecordMediator<Page>.FindAll(); var rootPages = AllPages.Where(p => p.Parent == null); ```
279,398
<p>I have created a reference to an IIS hosted WCF service in my ASP.NET website project on my local workstation through the "Add Service Reference" option in Visual Studio 2008. I was able to execute the service from my local workstation.</p> <p>When I move the ASP.NET web site using the "Copy Web Site" feature in V...
[ { "answer_id": 279502, "author": "Sixto Saez", "author_id": 9711, "author_profile": "https://Stackoverflow.com/users/9711", "pm_score": 1, "selected": false, "text": "<p>The problem may be due to a mismatch with the solution/project folder structure and the IIS web site folder structure....
2008/11/10
[ "https://Stackoverflow.com/questions/279398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
I have created a reference to an IIS hosted WCF service in my ASP.NET website project on my local workstation through the "Add Service Reference" option in Visual Studio 2008. I was able to execute the service from my local workstation. When I move the ASP.NET web site using the "Copy Web Site" feature in Visual Studi...
@Sixto Saez: I was able to use the following resource similar to the one you provided to generate a proxy class using the ServiceModel Metadata Utility Tool (svcutil.exe). Here is the exact command line: ``` svcutil /t:code http://<service_url> /out:<file_name>.cs /config:<file_name>.config ``` [Here](http://chakka...
279,404
<p>I know that in the original C++0x standard there was a feature called <code>export</code>.</p> <p>But I can't find a description or explanation of this feature. What is it supposed to do? Also: which compiler is supporting it?</p>
[ { "answer_id": 279411, "author": "Martin Beckett", "author_id": 10897, "author_profile": "https://Stackoverflow.com/users/10897", "pm_score": 3, "selected": false, "text": "<p>See <a href=\"https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl-export-keyword\" rel=\"n...
2008/11/10
[ "https://Stackoverflow.com/questions/279404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35744/" ]
I know that in the original C++0x standard there was a feature called `export`. But I can't find a description or explanation of this feature. What is it supposed to do? Also: which compiler is supporting it?
Although Standard C++ has no such requirement, some compilers require that all function templates need to be made available in every translation unit that it is used in. In effect, for those compilers, the bodies of template functions must be made available in a header file. To repeat: that means those compilers won't ...
279,410
<p>Given an object on a plain white background, does anybody know if OpenCV provides functionality to easily detect an object from a captured frame? </p> <p>I'm trying to locate the corner/center points of an object (rectangle). The way I'm currently doing it, is by brute force (scanning the image for the object) an...
[ { "answer_id": 279487, "author": "kenny", "author_id": 3225, "author_profile": "https://Stackoverflow.com/users/3225", "pm_score": 0, "selected": false, "text": "<p>It is usually called blob analysis in other machine vision libraries. I haven't used opencv yet.</p>\n" }, { "answe...
2008/11/10
[ "https://Stackoverflow.com/questions/279410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568/" ]
Given an object on a plain white background, does anybody know if OpenCV provides functionality to easily detect an object from a captured frame? I'm trying to locate the corner/center points of an object (rectangle). The way I'm currently doing it, is by brute force (scanning the image for the object) and not accura...
There's already an example of how to do rectangle detection in OpenCV (look in samples/squares.c), and it's quite simple, actually. Here's the rough algorithm they use: ``` 0. rectangles <- {} 1. image <- load image 2. for every channel: 2.1 image_canny <- apply canny edge detector to this channel 2.2 for threshold...
279,414
<p>Been trying to upgrade my subversion installation, but due to (what I believe) are limited rights (I'm using hosted Linux account), I'm not able to properly "./configure" and compile the source code (see posts <a href="https://stackoverflow.com/questions/189906/upgrade-subversion-143-to-152-on-debian-hosted-account"...
[ { "answer_id": 279424, "author": "Can Berk Güder", "author_id": 2119, "author_profile": "https://Stackoverflow.com/users/2119", "pm_score": 4, "selected": true, "text": "<p>You can extract the binaries from the deb package for your architecture (which you can download from <a href=\"http...
2008/11/10
[ "https://Stackoverflow.com/questions/279414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18274/" ]
Been trying to upgrade my subversion installation, but due to (what I believe) are limited rights (I'm using hosted Linux account), I'm not able to properly "./configure" and compile the source code (see posts [Post1](https://stackoverflow.com/questions/189906/upgrade-subversion-143-to-152-on-debian-hosted-account) and...
You can extract the binaries from the deb package for your architecture (which you can download from [here](http://packages.debian.org/search?keywords=subversion&exact=1)) using `dpkg-deb -x`. So for example you can do this if you're on i386: ``` wget ftp://ftp.debian.org/debian/pool/main/s/subversion/subversion_1.5...
279,415
<p>I'm working on a Rails web application, and it's currently being used by some 20 users.</p> <p>Some parts of the application are only accessible by some users, so we already have a basic authorization framework in place, which I implemented using the acts_as_authenticated plugin.</p> <p>The users' privileges depen...
[ { "answer_id": 279871, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 0, "selected": false, "text": "<p>you may need to introduce the notion of 'function points' or 'features' into your model as control-points for acce...
2008/11/10
[ "https://Stackoverflow.com/questions/279415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2119/" ]
I'm working on a Rails web application, and it's currently being used by some 20 users. Some parts of the application are only accessible by some users, so we already have a basic authorization framework in place, which I implemented using the acts\_as\_authenticated plugin. The users' privileges depend on which depa...
The basic concept of authorization, as I understand it, is a role. Role can express various things: 1. relation of a user to the system as a whole (eg. to be an admin of the system) 2. relation of a user to some kind of entities (eg. to be a moderator of comments) 3. relation of a user to some particular entity (eg. t...
279,421
<p>I have an html form that a user will fill out and print. Once printed, these forms will be faxed or mailed to a government agency, and need to look close enough like the original form published by said agency that a government bureaucrat doesn't spot that this is a reproduction. The data entered in the form is not...
[ { "answer_id": 279463, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 0, "selected": false, "text": "<p>I don't think you can make a control look like anything other than a control with CSS.</p>\n\n<p>You...
2008/11/10
[ "https://Stackoverflow.com/questions/279421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
I have an html form that a user will fill out and print. Once printed, these forms will be faxed or mailed to a government agency, and need to look close enough like the original form published by said agency that a government bureaucrat doesn't spot that this is a reproduction. The data entered in the form is not save...
Three years after this question is posted and this is almost within reach. In fact, it's completely achievable in Firefox 1+, Chrome 1+, Safari 3+ and Opera 15+ using the [~~CSS3~~](http://wiki.csswg.org/spec/css4-ui#dropped-css3-features) `appearance` property. The result is radio elements that look like checkboxes: ...
279,431
<p>I'd like to find a way to do a SQL query that will calculate the cidr (bit representation) of a subnet mask stored in the database. So for example, I've got either 255.255.255.0 or its decimal value (4294967040) stored in the database. I'd like to do a select and get back /24 representation via the query.</p> <p>...
[ { "answer_id": 282528, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": false, "text": "<p>SQL queries don't have a procedural looping construct (notwithstanding procedural language), but you can compare on...
2008/11/10
[ "https://Stackoverflow.com/questions/279431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14230/" ]
I'd like to find a way to do a SQL query that will calculate the cidr (bit representation) of a subnet mask stored in the database. So for example, I've got either 255.255.255.0 or its decimal value (4294967040) stored in the database. I'd like to do a select and get back /24 representation via the query. I've done th...
I think I have found the solution to my issue. Here is what I have done: ``` select CONCAT(INET_NTOA(ip_addr),'/',32-log2((4294967296-ip_mask))) net from subnets order by ip_addr ``` Basically I take my decmial mask and subtract it from the maximum decimal value. I then to a log2 on that value to get the logarithm...
279,444
<p>I'm pulling email address records from a table in SQL Server 2005, and want to build a single string to use as the <code>@recipients</code> list with <code>sp_send_dbmail</code>. The table has a field called EmailAddress and there are 10 records in the table.</p> <p>I'm doing this:</p> <pre><code>DECLARE @email VA...
[ { "answer_id": 279467, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": true, "text": "<p>Because for each row you concatentate the current value of <code>@email</code> with the next result in <code>EmailAd...
2008/11/10
[ "https://Stackoverflow.com/questions/279444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624/" ]
I'm pulling email address records from a table in SQL Server 2005, and want to build a single string to use as the `@recipients` list with `sp_send_dbmail`. The table has a field called EmailAddress and there are 10 records in the table. I'm doing this: ``` DECLARE @email VARCHAR(MAX) SELECT @email = ISNULL(@emai...
Because for each row you concatentate the current value of `@email` with the next result in `EmailAddress`. String concatenation is just like calling a function, in that it must evaluate the result for each row in sequence.
279,451
<p>In Visual Studio website projects (in Visual Studio 2005 or later, not web application projects where there is still a .csproj file) how is the reference information stored, and is it possible to source control it without storing compiled binaries in source control?</p> <p>If you right-click on a website project an...
[ { "answer_id": 279470, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 5, "selected": true, "text": "<p>If you reference a .dll by file name through the browse tab, there should be a .refresh file created (nested under th...
2008/11/10
[ "https://Stackoverflow.com/questions/279451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10039/" ]
In Visual Studio website projects (in Visual Studio 2005 or later, not web application projects where there is still a .csproj file) how is the reference information stored, and is it possible to source control it without storing compiled binaries in source control? If you right-click on a website project and select P...
If you reference a .dll by file name through the browse tab, there should be a .refresh file created (nested under the dll in BIN). We put those in SVN and it works great (you may have to hand edit them to use relative paths). References added from the .NET tab are added to web.config Project references are stored in...
279,469
<p>I recently wrote a webservice to be used with Silverlight which uses the ASP.net membership and roles.</p> <p>To validate the client in the service I look at the HTTPContext.Current.User (Which works when the service is called from Silverlight)</p> <p>However, I've been trying to call the same service from an asp....
[ { "answer_id": 279827, "author": "Bryant", "author_id": 10893, "author_profile": "https://Stackoverflow.com/users/10893", "pm_score": 0, "selected": false, "text": "<p>Not sure how it is working from Silverlight but not ASP.Net, but for starters here is a good <a href=\"http://nayyeri.ne...
2008/11/10
[ "https://Stackoverflow.com/questions/279469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54794/" ]
I recently wrote a webservice to be used with Silverlight which uses the ASP.net membership and roles. To validate the client in the service I look at the HTTPContext.Current.User (Which works when the service is called from Silverlight) However, I've been trying to call the same service from an asp.net postback. But...
I have solved it! Looks like by default the Silverlight application was sending all the browsers cookies to the service. One of these cookies is the ".ASPXAUTH" cookie to authenticate against the membership and roles. The asp.net application however was not sending the cookies to the service. To send the authorisatio...
279,471
<p>what is the difference in using a standard </p> <pre><code>type sl: TStringList </code></pre> <p>compared to using a generic TList</p> <pre><code>type sl: TList&lt;string&gt; </code></pre> <p>?</p> <p>As far as I can see, both behave exactly the same.</p> <p>Is it just another way of doing the same thin...
[ { "answer_id": 279488, "author": "Rob Kennedy", "author_id": 33732, "author_profile": "https://Stackoverflow.com/users/33732", "pm_score": 6, "selected": true, "text": "<ul>\n<li>TStringList is a descendant of TStrings.</li>\n<li>TStringList knows how to sort itself alphabetically.</li>\...
2008/11/10
[ "https://Stackoverflow.com/questions/279471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5015/" ]
what is the difference in using a standard ``` type sl: TStringList ``` compared to using a generic TList ``` type sl: TList<string> ``` ? As far as I can see, both behave exactly the same. Is it just another way of doing the same thing? Are there situations where one would be better than the other? T...
* TStringList is a descendant of TStrings. * TStringList knows how to sort itself alphabetically. * TStringList has an Objects property. * TStringList doesn't make your code incompatible with all previous versions of Delphi. * TStringList can be used as a published property. (A bug prevents generic classes from being p...
279,472
<p>I have a form with a lot of controls on it. How can I detect when the mouse leaves the form? I've tried wiring up a MouseLeave event for every single control and the form, but that does not work because those events fire all the time as the mouse passes over controls. Is there a way that actually works.?</p>
[ { "answer_id": 279741, "author": "Eren Aygunes", "author_id": 27980, "author_profile": "https://Stackoverflow.com/users/27980", "pm_score": 4, "selected": true, "text": "<p>You should listen:</p>\n\n<ul>\n<li>MouseLeave events of all controls of the form</li>\n<li>MouseLeave event of the...
2008/11/10
[ "https://Stackoverflow.com/questions/279472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9382/" ]
I have a form with a lot of controls on it. How can I detect when the mouse leaves the form? I've tried wiring up a MouseLeave event for every single control and the form, but that does not work because those events fire all the time as the mouse passes over controls. Is there a way that actually works.?
You should listen: * MouseLeave events of all controls of the form * MouseLeave event of the form Just link your listeners to a function that checks whether the cursor is in the forms client are or not. Try this: ``` protected override void OnControlAdded(ControlEventArgs e) { SubscribeEvents(e.Cont...
279,473
<p>currently I have the following code:</p> <pre><code>String select = qry.substring("select ".length(),qry2.indexOf(" from ")); String[] attrs = select.split(","); </code></pre> <p>which works for the most parts but fails if given the following:</p> <pre><code>qry = "select a,b,c,DATETOSTRING(date_attr_name,'mm/dd/...
[ { "answer_id": 279499, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 2, "selected": true, "text": "<pre><code>[^,]+\\([^\\)]+\\)|[^,]+,\n</code></pre>\n\n<p>Should do it nicely provided you always add a final ',' to your select...
2008/11/10
[ "https://Stackoverflow.com/questions/279473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/292/" ]
currently I have the following code: ``` String select = qry.substring("select ".length(),qry2.indexOf(" from ")); String[] attrs = select.split(","); ``` which works for the most parts but fails if given the following: ``` qry = "select a,b,c,DATETOSTRING(date_attr_name,'mm/dd/yyyy') from tbl_a"; ``` what I'm lo...
``` [^,]+\([^\)]+\)|[^,]+, ``` Should do it nicely provided you always add a final ',' to your select string: ``` a,b,c,DATETOSTRING(date_attr_name,'mm/dd/yyyy'),f,gg,dr(tt,t,),fff ``` would fail to split the last 'fff' attributes, but: ``` a,b,c,DATETOSTRING(date_attr_name,'mm/dd/yyyy'),f,gg,dr(tt,t,),fff, ``` ...
279,478
<p>Given a model</p> <pre><code>class BaseModel &lt; ActiveRecord::Base validates_presence_of :parent_id before_save :frobnicate_widgets end </code></pre> <p>and a derived model (the underlying database table has a <code>type</code> field - this is simple rails STI)</p> <pre><code>class DerivedModel &lt; BaseMod...
[ { "answer_id": 279584, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 2, "selected": false, "text": "<p>From poking around in the source (I'm currently on rails 1.2.6), the callbacks are relatively straightforward.</p>\n\...
2008/11/10
[ "https://Stackoverflow.com/questions/279478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234/" ]
Given a model ``` class BaseModel < ActiveRecord::Base validates_presence_of :parent_id before_save :frobnicate_widgets end ``` and a derived model (the underlying database table has a `type` field - this is simple rails STI) ``` class DerivedModel < BaseModel end ``` `DerivedModel` will in good OO fashion in...
I like to use the following pattern: ``` class Parent < ActiveRecord::Base validate_uniqueness_of :column_name, :if => :validate_uniqueness_of_column_name? def validate_uniqueness_of_column_name? true end end class Child < Parent def validate_uniqueness_of_column_name? false end end ``` It would b...
279,491
<p>I'm experiencing some problems with CSS and/or tables on my newly redesigned <a href="http://www.artinthepicture.com" rel="nofollow noreferrer">website</a>. Because of the well known "100% div height"-issue, I have resorted to using tables as a structural element of the website. So it looks something like this:</p> ...
[ { "answer_id": 279517, "author": "Kyle Trauberman", "author_id": 21461, "author_profile": "https://Stackoverflow.com/users/21461", "pm_score": 0, "selected": false, "text": "<p>For troubleshooting, I usually give my divs and other elements a border so I can visually see where they are lo...
2008/11/10
[ "https://Stackoverflow.com/questions/279491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm experiencing some problems with CSS and/or tables on my newly redesigned [website](http://www.artinthepicture.com). Because of the well known "100% div height"-issue, I have resorted to using tables as a structural element of the website. So it looks something like this: HTML MARKUP: ``` <div id="header">...</div...
> > Because of the well known "100% div height"-issue … > > > and which one would that be? The one solved [here](http://www.xs4all.nl/~peterned/examples/csslayout1.html)? Basically, the important part is ``` html, body { height: 100%; } ``` Tables as a workaround are a no-go here because as far as I know, t...
279,493
<p>What is the way to avoid phpunit having to call the constructor for a mock object? Otherwise I would need a mock object as constructor argument, another one for that etc. The api seems to be like this:</p> <pre><code>getMock($className, $methods = array(), array $arguments = array(), $mockClassName = '', $c...
[ { "answer_id": 332467, "author": "Glenn Moss", "author_id": 5726, "author_profile": "https://Stackoverflow.com/users/5726", "pm_score": 1, "selected": false, "text": "<p>Perhaps you need to create a stub to pass in as the constructor argument. Then you can break that chain of mock object...
2008/11/10
[ "https://Stackoverflow.com/questions/279493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
What is the way to avoid phpunit having to call the constructor for a mock object? Otherwise I would need a mock object as constructor argument, another one for that etc. The api seems to be like this: ``` getMock($className, $methods = array(), array $arguments = array(), $mockClassName = '', $callOriginalCon...
You can use `getMockBuilder` instead of just `getMock`: ``` $mock = $this->getMockBuilder('class_name') ->disableOriginalConstructor() ->getMock(); ``` See the section on ["Test Doubles"](http://phpunit.de/manual/current/en/test-doubles.html) in [PHPUnit's documentation](http://phpunit.de/manual) for details...
279,495
<p>This is a C# console application. I have a function that does something like this:</p> <pre><code>static void foo() { Application powerpointApp; Presentation presentation = null; powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); } </code></pre> <p>That's all it does....
[ { "answer_id": 279506, "author": "kenny", "author_id": 3225, "author_profile": "https://Stackoverflow.com/users/3225", "pm_score": 0, "selected": false, "text": "<p>Just guessing, but it is probably the time for PowerPoint to start up after the interop assemblies have loaded.</p>\n" },...
2008/11/10
[ "https://Stackoverflow.com/questions/279495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12261/" ]
This is a C# console application. I have a function that does something like this: ``` static void foo() { Application powerpointApp; Presentation presentation = null; powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); } ``` That's all it does. When it is called there i...
It could be the certificate revocation list - the time-out on this is 15 seconds. Is there anything in the event log? Can you check if any network connections are happening during the time-out? [I blogged some details about certificate revocation delay](http://blogs.conchango.com/anthonysteele/archive/2007/02/07/Delay...
279,507
<p>This could be the dumbest question ever asked but I think it is quite confusing for a Java newbie. </p> <ol> <li>Can somebody clarify what is meant by <em>immutable</em>? </li> <li>Why is a <code>String</code> immutable?</li> <li>What are the advantages/disadvantages of the immutable objects?</li> <li>Why should a ...
[ { "answer_id": 279513, "author": "stjohnroe", "author_id": 2985, "author_profile": "https://Stackoverflow.com/users/2985", "pm_score": 2, "selected": false, "text": "<p>Once instanciated, cannot be altered. Consider a class that an instance of might be used as the key for a hashtable or ...
2008/11/10
[ "https://Stackoverflow.com/questions/279507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33203/" ]
This could be the dumbest question ever asked but I think it is quite confusing for a Java newbie. 1. Can somebody clarify what is meant by *immutable*? 2. Why is a `String` immutable? 3. What are the advantages/disadvantages of the immutable objects? 4. Why should a mutable object such as `StringBuilder` be preferre...
Immutable means that once the constructor for an object has completed execution that instance can't be altered. This is useful as it means you can pass references to the object around, without worrying that someone else is going to change its contents. *Especially when dealing with concurrency, there are no locking is...
279,514
<p>I have a factory that returns an interface <code>FormatService</code>: </p> <pre><code>public class FormatServiceFactory { public FormatService getService() { ... } } </code></pre> <p>Is it possible to mock out this factory so that it will always return a stub implementation of <code>FormatService...
[ { "answer_id": 279594, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": true, "text": "<p>Depends. How is the factory obtained/used by the code under test? </p>\n\n<p>If it's instantiated explicitly in the method...
2008/11/10
[ "https://Stackoverflow.com/questions/279514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6340/" ]
I have a factory that returns an interface `FormatService`: ``` public class FormatServiceFactory { public FormatService getService() { ... } } ``` Is it possible to mock out this factory so that it will always return a stub implementation of `FormatService` - `FormatServiceStub` in our unit tests?
Depends. How is the factory obtained/used by the code under test? If it's instantiated explicitly in the methods you're testing, or if it's a static factory, you won't be able to mock it. If it's injected into the object under test, you can create and inject the mocked factory before executing the test. Mocking th...
279,523
<p>I have written an installation class that extends Installer and overrides afterInstall, but I'm getting a null pointer exception. How can I go about debugging my class?</p>
[ { "answer_id": 279530, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": 0, "selected": false, "text": "<p>build a VM, install Visual studio, make a copy of it (or create a differencing Virtual HDD) and run the installer under the d...
2008/11/10
[ "https://Stackoverflow.com/questions/279523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16684/" ]
I have written an installation class that extends Installer and overrides afterInstall, but I'm getting a null pointer exception. How can I go about debugging my class?
Something that is handy for hard to debug sections of code is ``` System.Diagnostics.Debugger.Break() ``` Will throw a breakpoint caught by any installed debugger (VStudio, WinDbg, Remote debugger etc...). Use it to debug really tricky areas where regular F5+Go or "Attach to Process" is difficult or impossible to p...
279,524
<p>I have a class that maintans a reference to a Hashtable and serializes/deserializes that Hashtable. After the call to SerializationInfo.GetValue, the Hashtable is not fully deserialized because the deserialization happens during the IDeserialization calback.</p> <pre><code>Hashtable hashtable = (Hashtable) info.Get...
[ { "answer_id": 287887, "author": "Brian Adams", "author_id": 32992, "author_profile": "https://Stackoverflow.com/users/32992", "pm_score": 2, "selected": false, "text": "<p>I suspect you have already googled, but I happened to across <a href=\"http://clevercoder.wordpress.com/2006/11/30/...
2008/11/10
[ "https://Stackoverflow.com/questions/279524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36373/" ]
I have a class that maintans a reference to a Hashtable and serializes/deserializes that Hashtable. After the call to SerializationInfo.GetValue, the Hashtable is not fully deserialized because the deserialization happens during the IDeserialization calback. ``` Hashtable hashtable = (Hashtable) info.GetValue("hash", ...
This is really an interesting issue. After checking the serialization code with Reflector, I think that there is no generally good soluiton if a referred class uses IDeserializationCallback. Probably you have seen, that there are two other ways as well to run some code during deserialization, the [OnDeserializing] an...
279,527
<p>I am calling a csh script that the first thing it does is starts a new group.</p> <p>I need to be able to see the standard output from the child process that is executed after the fork. I also want the parent process to 'hang' unitl the child process is finished.</p> <p>Here is the script (<code>razor_from_cgwin...
[ { "answer_id": 279839, "author": "William Gross", "author_id": 35349, "author_profile": "https://Stackoverflow.com/users/35349", "pm_score": 3, "selected": true, "text": "<p>From your module you could call HttpContext.Current.Handler and see if it is a Page. You'd probably have to do thi...
2008/11/10
[ "https://Stackoverflow.com/questions/279527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34531/" ]
I am calling a csh script that the first thing it does is starts a new group. I need to be able to see the standard output from the child process that is executed after the fork. I also want the parent process to 'hang' unitl the child process is finished. Here is the script (`razor_from_cgwin.sh`). (sort of) ``` n...
From your module you could call HttpContext.Current.Handler and see if it is a Page. You'd probably have to do this in the PostMapRequestHandler event or a later event in the life cycle. Alternatively, maybe you can check which HttpHandlerFactory is being used for the request. If it is the PageHandlerFactory, you can ...
279,534
<p>Once a programmer decides to implement <code>IXmlSerializable</code>, what are the rules and best practices for implementing it? I've heard that <code>GetSchema()</code> should return <code>null</code> and <code>ReadXml</code> should move to the next element before returning. Is this true? And what about <code>Write...
[ { "answer_id": 280077, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 8, "selected": true, "text": "<p>Yes, GetSchema() <a href=\"http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.getsch...
2008/11/10
[ "https://Stackoverflow.com/questions/279534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12971/" ]
Once a programmer decides to implement `IXmlSerializable`, what are the rules and best practices for implementing it? I've heard that `GetSchema()` should return `null` and `ReadXml` should move to the next element before returning. Is this true? And what about `WriteXml` - should it write a root element for the object...
Yes, GetSchema() [should return null](http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.getschema.aspx). > > IXmlSerializable.GetSchema Method This > method is reserved and should not be > used. When implementing the > IXmlSerializable interface, you should > return a null referenc...
279,557
<p>WPF GridSplitter makes my Grid wider than my Window!</p> <p>I've got a WPF Grid with a GridSplitter. If I resize my columns, then I can make my grid wider than my window and non-viewable.</p> <p>It starts like this: </p> <p><a href="http://img201.imageshack.us/img201/9505/onehg6.jpg" rel="nofollow noreferrer">W...
[ { "answer_id": 281317, "author": "Abe Heidebrecht", "author_id": 9268, "author_profile": "https://Stackoverflow.com/users/9268", "pm_score": 3, "selected": false, "text": "<p>Try changing your Width's to star sizes. This will cause the splitter to only resize the columns between which i...
2008/11/10
[ "https://Stackoverflow.com/questions/279557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
WPF GridSplitter makes my Grid wider than my Window! I've got a WPF Grid with a GridSplitter. If I resize my columns, then I can make my grid wider than my window and non-viewable. It starts like this: [WPF Grid http://img201.imageshack.us/img201/9505/onehg6.jpg](http://img201.imageshack.us/img201/9505/onehg6.jpg) ...
If your Window is resized so its Width is less than the sum of your columns' MinWidths, you'll see the columns cut off, but otherwise I can't reproduce your problem: ``` <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x=...
279,561
<p>What is the idiomatic Python equivalent of this C/C++ code?</p> <pre class="lang-cpp prettyprint-override"><code>void foo() { static int counter = 0; counter++; printf("counter is %d\n", counter); } </code></pre> <p>specifically, how does one implement the static member at the function level, as oppose...
[ { "answer_id": 279568, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": 4, "selected": false, "text": "<p>Use a generator function to generate an iterator.</p>\n\n<pre><code>def foo_gen():\n n = 0\n while True:\n n+...
2008/11/10
[ "https://Stackoverflow.com/questions/279561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10569/" ]
What is the idiomatic Python equivalent of this C/C++ code? ```cpp void foo() { static int counter = 0; counter++; printf("counter is %d\n", counter); } ``` specifically, how does one implement the static member at the function level, as opposed to the class level? And does placing the function into a cl...
A bit reversed, but this should work: ``` def foo(): foo.counter += 1 print "Counter is %d" % foo.counter foo.counter = 0 ``` If you want the counter initialization code at the top instead of the bottom, you can create a decorator: ``` def static_vars(**kwargs): def decorate(func): for k in kwar...