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
520,696
<p>I'm trying to follow a tutorial for a C++ interface in the Mac OS X API (Audio Queue Services), but in a Cocoa (well, actually just Foundation) application (well, actually just a 'tool'). It has a struct that looks like this:</p> <pre><code>static const int kNumberBuffers = 3; // 1 stru...
[ { "answer_id": 520772, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 2, "selected": false, "text": "<p><b>Edit:</b> <a href=\"https://stackoverflow.com/users/30461/peter-hosey\">Peter Hosey</a> has pointed out that an arra...
2009/02/06
[ "https://Stackoverflow.com/questions/520696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31897/" ]
I'm trying to follow a tutorial for a C++ interface in the Mac OS X API (Audio Queue Services), but in a Cocoa (well, actually just Foundation) application (well, actually just a 'tool'). It has a struct that looks like this: ``` static const int kNumberBuffers = 3; // 1 struct AQPlayerSta...
**Edit:** [Peter Hosey](https://stackoverflow.com/users/30461/peter-hosey) has pointed out that an array in C is *not* the same thing as a pointer. (see [this document](http://djmnet.org/lore/arrays-are-not-pointers.txt) for details). That would explain the error you are seeing, and would make the code that I posted wr...
520,710
<p>I have a very simply problem where I need a div to expand to fit its contents unless the height reaches a certain size, when I want the div to scroll vertically instead. As a test, I created a page containing:</p> <pre><code>&lt;div style="width:300px;max-height:25px;background-color:green;overflow:auto;"&gt; 1...
[ { "answer_id": 520717, "author": "TJ L", "author_id": 12605, "author_profile": "https://Stackoverflow.com/users/12605", "pm_score": 3, "selected": false, "text": "<p>Here's the cross-browser way to set min-height:</p>\n\n<pre><code>min-height: 400px;\nheight:auto !important;\nheight:400p...
2009/02/06
[ "https://Stackoverflow.com/questions/520710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44938/" ]
I have a very simply problem where I need a div to expand to fit its contents unless the height reaches a certain size, when I want the div to scroll vertically instead. As a test, I created a page containing: ``` <div style="width:300px;max-height:25px;background-color:green;overflow:auto;"> 1<br /> 2<br /> ...
The problem is your browser. Maybe you could wrap this div in another div that has the fixed height of 25px. Of course this wouldn't be exactly the same as max-height. [An article about a solution.](http://perishablepress.com/press/2007/01/16/maximum-and-minimum-height-and-width-in-internet-explorer/) **Edit:** [Acco...
520,716
<p>i <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.close.aspx" rel="noreferrer">Dispose</a> an SqlConnection object, but of of course <a href="http://www.ondotnet.com/pub/a/dotnet/2004/02/09/connpool.html" rel="noreferrer">it isn't really closed</a>. i need closed connection to no...
[ { "answer_id": 524264, "author": "gbn", "author_id": 27535, "author_profile": "https://Stackoverflow.com/users/27535", "pm_score": 0, "selected": false, "text": "<p>Reading the comment, you want to restore it.</p>\n\n<p>OK, take it off-line.</p>\n\n<p>Restore is not something that an app...
2009/02/06
[ "https://Stackoverflow.com/questions/520716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
i [Dispose](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.close.aspx) an SqlConnection object, but of of course [it isn't really closed](http://www.ondotnet.com/pub/a/dotnet/2004/02/09/connpool.html). i need closed connection to not hold locks on database objects. How can i prevent closed ...
You can place the database in single user mode in order to restore it. IIRC, something like this... ``` ALTER DATABASE TheDatabaseToRestore SET SINGLE_USER WITH ROLLBACK IMMEDIATE; RESTORE DATABASE TheDatabaseToRestore FROM DISK =N'Z:\Path\To\Backup\BackupFile'; ALTER DATABASE TheDatabaseToRestore SET MULTI_USER; `...
520,722
<p>Is there a way to keep StreamReader from doing any buffering?</p> <p>I'm trying to handle output from a Process that may be either binary or text. The output will look like an HTTP Response, e.g.</p> <pre><code>Content-type: application/whatever Another-header: value text or binary data here </code></pre> <p>Wha...
[ { "answer_id": 521227, "author": "Stuart Childs", "author_id": 63030, "author_profile": "https://Stackoverflow.com/users/63030", "pm_score": 0, "selected": false, "text": "<p>Well, you can use <a href=\"http://msdn.microsoft.com/en-us/library/system.io.stream.seek.aspx\" rel=\"nofollow n...
2009/02/06
[ "https://Stackoverflow.com/questions/520722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29691/" ]
Is there a way to keep StreamReader from doing any buffering? I'm trying to handle output from a Process that may be either binary or text. The output will look like an HTTP Response, e.g. ``` Content-type: application/whatever Another-header: value text or binary data here ``` What I want to do is to parse the he...
This answer is late and possibly no longer relevant to you but it may come in handy for someone else who stumbles across this problem. My problem involved [PPM files](http://en.wikipedia.org/wiki/Netpbm_format), which have a similar format of: * ASCII text in the beginning * Binary bytes for the rest of the file The...
520,735
<p>Can you use </p> <pre><code>int blah = Convert.ToInt32(cmd.ExecuteScalar()); </code></pre> <p>When the sproc's last statement does:</p> <pre><code>RETURN @value </code></pre> <p>I can only get it to work if it does:</p> <p>SELECT @value</p> <p>Also, this gives me a object null exception:</p> <pre><code>int bl...
[ { "answer_id": 520751, "author": "DCNYAM", "author_id": 30419, "author_profile": "https://Stackoverflow.com/users/30419", "pm_score": 4, "selected": true, "text": "<p>No, you cannot. The ExecuteScalar() method is designed to return as single value that is returned in a result set. Basi...
2009/02/06
[ "https://Stackoverflow.com/questions/520735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
Can you use ``` int blah = Convert.ToInt32(cmd.ExecuteScalar()); ``` When the sproc's last statement does: ``` RETURN @value ``` I can only get it to work if it does: SELECT @value Also, this gives me a object null exception: ``` int blah = (int)cmd.ExecuteScalar(); ``` isn't convert.toint32 and (int) the s...
No, you cannot. The ExecuteScalar() method is designed to return as single value that is returned in a result set. Basically, the value in the first column of the first row returned. To get the return value, you need to add a parameter to your SQLCommand object. Use the name "@RETURN\_VALUE" and specify a parameter di...
520,742
<p>I would like to prepend some text to multiple files in bash, I've found this post that deals with prepend: <a href="https://stackoverflow.com/questions/54365/prepend-to-a-file-one-liner-shell" title="prepend to a file one liner shell?">prepend to a file one liner shell?</a></p> <p>And I can find all the files I nee...
[ { "answer_id": 520766, "author": "mitchnull", "author_id": 18645, "author_profile": "https://Stackoverflow.com/users/18645", "pm_score": -1, "selected": false, "text": "<pre><code>find . -name \"somename.txt\" | while read a; do prepend_stuff_to \"$a\" ; done\n</code></pre>\n\n<p>or</p>\...
2009/02/06
[ "https://Stackoverflow.com/questions/520742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6432/" ]
I would like to prepend some text to multiple files in bash, I've found this post that deals with prepend: [prepend to a file one liner shell?](https://stackoverflow.com/questions/54365/prepend-to-a-file-one-liner-shell "prepend to a file one liner shell?") And I can find all the files I need to process using find: `...
You've got several options. Easiest is probably sed: ``` find ./ -name somename.txt -exec sed -e '1i\ My new text here' {} \; ``` It'll be faster if you add '2q' to tell it you're done after prepanding the text, and if will happen in place in the file with the -i flag: ``` find ./ -name somename.txt -exec sed -i .b...
520,757
<p>I have a similar problem as this <a href="https://stackoverflow.com/questions/209224/-net-consuming-web-service-identical-types-in-two-different-services">question</a>. I have multiple web services that I am consuming with WCF, which all share types. The services themselves are written in Java and I do not have acce...
[ { "answer_id": 704556, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>First - are they <strong>exactly</strong> the same? In particular, the SOAP namespaces must match (in addition to e...
2009/02/06
[ "https://Stackoverflow.com/questions/520757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/736/" ]
I have a similar problem as this [question](https://stackoverflow.com/questions/209224/-net-consuming-web-service-identical-types-in-two-different-services). I have multiple web services that I am consuming with WCF, which all share types. The services themselves are written in Java and I do not have access to them. Th...
First - are they **exactly** the same? In particular, the SOAP namespaces must match (in addition to everything else). If they don't, then they are different (incompatible) types; you will have to use 2 different references (in different C# namespaces to avoid conflicts), and shift data between the two types. If the t...
520,776
<p>I am just beginning to learn SQL and have stumbled at the first hurdle, I am unable to create a table. Below is the code example. The error I am receiving when running the statement, references line 7 stating there is an issue with a 'relational operator'. The purpose of <strong>line 7</strong> is to check that the ...
[ { "answer_id": 520787, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 1, "selected": false, "text": "<p>Check your parenthesis.</p>\n\n<pre><code>DATE NOT NULL CHECK(((SYSDATE - birthDate) /365 ) &gt;= 18)\n</code></pr...
2009/02/06
[ "https://Stackoverflow.com/questions/520776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50057/" ]
I am just beginning to learn SQL and have stumbled at the first hurdle, I am unable to create a table. Below is the code example. The error I am receiving when running the statement, references line 7 stating there is an issue with a 'relational operator'. The purpose of **line 7** is to check that the age of the perso...
You cannot define a CHECK constraint that references a function like SYSDATE. The Oracle documentation has a discussion on the [restrictions on CHECK constraints](http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_constraints.htm#sthref684)
520,778
<p>Let's say you're running an UPDATE statement on a table, but the information you're putting into this base table is from some other auxiliary table. Normally, you would JOIN the data and not expect the rows in the UPDATE statement's FROM clause to multiply, maintaining that one new row maps to one old row in the bas...
[ { "answer_id": 520847, "author": "HLGEM", "author_id": 9034, "author_profile": "https://Stackoverflow.com/users/9034", "pm_score": 3, "selected": false, "text": "<p>Actually if I understand the question correctly it is updating the field multiple times, it is just that since there is onl...
2009/02/06
[ "https://Stackoverflow.com/questions/520778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40725/" ]
Let's say you're running an UPDATE statement on a table, but the information you're putting into this base table is from some other auxiliary table. Normally, you would JOIN the data and not expect the rows in the UPDATE statement's FROM clause to multiply, maintaining that one new row maps to one old row in the base t...
[From BOL on UPDATE](http://msdn.microsoft.com/en-us/library/ms177523(SQL.90).aspx) > > **Using UPDATE with the FROM Clause** > > > The results of an UPDATE statement are > undefined if the statement includes a > FROM clause that is not specified in > such a way that only one value is > available for each colum...
520,788
<p>Can I return more than one item in a select? For instance I have a List of Fixtures (think football (or soccer for the yanks) fixtures). Each fixture contains a home and away team and a home and away score. I want to get all the teams that drew. I want to use something like</p> <pre><code>IEnumerable&lt;Team&gt;...
[ { "answer_id": 520806, "author": "Anton Gogolev", "author_id": 60188, "author_profile": "https://Stackoverflow.com/users/60188", "pm_score": 5, "selected": false, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx\" rel=\"noreferrer\">101 LINQ Samples</a>, namely...
2009/02/06
[ "https://Stackoverflow.com/questions/520788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47339/" ]
Can I return more than one item in a select? For instance I have a List of Fixtures (think football (or soccer for the yanks) fixtures). Each fixture contains a home and away team and a home and away score. I want to get all the teams that drew. I want to use something like ``` IEnumerable<Team> drew = from fixture in...
I think you're looking for the Union method as follows: ``` IEnumerable<Team> drew = (from fixture in fixtures where fixture.Played && (fixture.HomeScore == fixture.AwayScore) select fixture.HomeTeam) .Union(from fixture in fixture...
520,793
<h2>Definitions</h2> <p>In ASP.NET MVC, there are two ways to do model binding in an action. Let's call these the "Bind arguments way" and the "UpdateModel way." Both of them do almost exactly the same thing, and they do it in almost exactly the same way:</p> <pre><code> public ActionResult UpdateWithBindArguments...
[ { "answer_id": 520856, "author": "Peter Morris", "author_id": 61311, "author_profile": "https://Stackoverflow.com/users/61311", "pm_score": 0, "selected": false, "text": "<p>I'd be inclined to write it like so</p>\n\n<pre><code>public ActionResult Update(int id, string name)\n{\n Person...
2009/02/06
[ "https://Stackoverflow.com/questions/520793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7714/" ]
Definitions ----------- In ASP.NET MVC, there are two ways to do model binding in an action. Let's call these the "Bind arguments way" and the "UpdateModel way." Both of them do almost exactly the same thing, and they do it in almost exactly the same way: ``` public ActionResult UpdateWithBindArguments(Foo model)...
In terms of testing, it seems to me that passing in the object directly to the action method is more natural. There's no need to populate the ValueProviderDictionary. The reason the other approach is needed is that you might need to control the instantiation of the object you're binding. The DefaultModelBinder simply ...
520,810
<p>Anyone know if R has quote-like operators like Perl's <code>qw()</code> for generating character vectors? </p>
[ { "answer_id": 1214471, "author": "hadley", "author_id": 16632, "author_profile": "https://Stackoverflow.com/users/16632", "pm_score": 6, "selected": true, "text": "<p>No, but you can write it yourself:</p>\n\n<pre><code>q &lt;- function(...) {\n sapply(match.call()[-1], deparse)\n}\n</...
2009/02/06
[ "https://Stackoverflow.com/questions/520810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63372/" ]
Anyone know if R has quote-like operators like Perl's `qw()` for generating character vectors?
No, but you can write it yourself: ``` q <- function(...) { sapply(match.call()[-1], deparse) } ``` And just to show it works: ``` > q(a, b, c) [1] "a" "b" "c" ```
520,812
<p>I want to write an application that detects when a page is loaded in the browser, then I should be able to insert content on top of the loaded web page? Anybody with an idea on how to do that?</p> <p>Please note that I should be able to do this in any browser (Firefox/IE).</p> <p>What language should I use to help...
[ { "answer_id": 520821, "author": "Romain Linsolas", "author_id": 26457, "author_profile": "https://Stackoverflow.com/users/26457", "pm_score": 2, "selected": false, "text": "<p>In Javascript, you have the <a href=\"http://www.w3schools.com/jsref/jsref_onload.asp\" rel=\"nofollow noreferr...
2009/02/06
[ "https://Stackoverflow.com/questions/520812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to write an application that detects when a page is loaded in the browser, then I should be able to insert content on top of the loaded web page? Anybody with an idea on how to do that? Please note that I should be able to do this in any browser (Firefox/IE). What language should I use to help me do this? How...
You would use javascript to do this. If you don't know how to use javascript, I would recommend reading through [some](http://www.w3schools.com/js/default.asp) [tutorials](https://developer.mozilla.org/en/A_re-introduction_to_JavaScript) [first](http://eloquentjavascript.net/contents.html). After you have a basic unde...
520,816
<p>Is there a chart of existing Blackberry platform vs. OS vs. Model versions? </p> <p>Something like:</p> <pre><code>Blackberry Storm, platforms: x.x.x - y.y.y, OS versions: x.x.x-y.y.y Blackberry Bold, platforms: x.x.x - y.y.y, OS versions: x.x.x-y.y.y Blackberry Curve, platforms: x.x.x - y.y.y, OS versions: x.x.x...
[ { "answer_id": 521027, "author": "Andy Mikula", "author_id": 58114, "author_profile": "https://Stackoverflow.com/users/58114", "pm_score": 3, "selected": true, "text": "<p>The blackberry forum is probably the best place to look - see the post here: <a href=\"http://www.blackberryforums.c...
2009/02/06
[ "https://Stackoverflow.com/questions/520816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36084/" ]
Is there a chart of existing Blackberry platform vs. OS vs. Model versions? Something like: ``` Blackberry Storm, platforms: x.x.x - y.y.y, OS versions: x.x.x-y.y.y Blackberry Bold, platforms: x.x.x - y.y.y, OS versions: x.x.x-y.y.y Blackberry Curve, platforms: x.x.x - y.y.y, OS versions: x.x.x-y.y.y ``` e.t.c
The blackberry forum is probably the best place to look - see the post here: <http://www.blackberryforums.com/rim-software/58404-latest-operating-system-available-each-blackberry-device.html>, which may not be the latest of its kind. Best of luck!
520,818
<p>I'm trying to teach myself Ruby's Treetop grammar generator. I am finding that not only is the documentation woefully sparse for the "best" one out there, but that it doesn't seem to work as intuitively as I'd hoped.</p> <p>On a high level, I'd really love a better tutorial than the on-site docs or the video, if t...
[ { "answer_id": 532916, "author": "Geo", "author_id": 31610, "author_profile": "https://Stackoverflow.com/users/31610", "pm_score": 4, "selected": true, "text": "<p>Sadly, Treetop's documentation sucks. A lot. And the examples on the website aren't helpful. I found that dzone has a pretty...
2009/02/06
[ "https://Stackoverflow.com/questions/520818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54650/" ]
I'm trying to teach myself Ruby's Treetop grammar generator. I am finding that not only is the documentation woefully sparse for the "best" one out there, but that it doesn't seem to work as intuitively as I'd hoped. On a high level, I'd really love a better tutorial than the on-site docs or the video, if there is one...
Sadly, Treetop's documentation sucks. A lot. And the examples on the website aren't helpful. I found that dzone has a pretty large collection of treetop grammars : [Treetop grammars](http://snippets.dzone.com/tag/Treetop)
520,863
<p>I'd like to use my Action in asp.net mvc, as template engine, that results in form of string, that I could send in email.</p> <p>Pseudo-Code:</p> <pre><code>public ActionResult Register() { SendEmail(View().ToString()); return new EmptyResult(); } </code></pre>
[ { "answer_id": 521130, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 1, "selected": false, "text": "<p>You cannot see the view itself inside of the controller. The way to do what you ask would be to write a custom Actio...
2009/02/06
[ "https://Stackoverflow.com/questions/520863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40789/" ]
I'd like to use my Action in asp.net mvc, as template engine, that results in form of string, that I could send in email. Pseudo-Code: ``` public ActionResult Register() { SendEmail(View().ToString()); return new EmptyResult(); } ```
First, you'll still probably want to return a view from your action, so returning an EmptyResult isn't the best; but you'll figure that out when you're dealing with the page flow in your registration process. I'm assuming that you wish to create an HTML email using a View you have already created. That means you wish ...
520,865
<p>I'm trying to install MySQLdb for python on Cygwin. Unfortunately, when I run <code>python setup.py build</code>, I get the following error:</p> <pre><code>$ python setup.py build /bin/sh: /usr/local/bin/mysql_config: No such file or directory Traceback (most recent call last): File "setup.py", line 16, in &lt;mo...
[ { "answer_id": 521081, "author": "Yoni Samlan", "author_id": 59058, "author_profile": "https://Stackoverflow.com/users/59058", "pm_score": 3, "selected": true, "text": "<p>You'll need mysql-devel, if it's available for cygwin, or you'll need to build mysql from source.</p>\n\n<p>Your bes...
2009/02/06
[ "https://Stackoverflow.com/questions/520865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
I'm trying to install MySQLdb for python on Cygwin. Unfortunately, when I run `python setup.py build`, I get the following error: ``` $ python setup.py build /bin/sh: /usr/local/bin/mysql_config: No such file or directory Traceback (most recent call last): File "setup.py", line 16, in <module> metadata, options ...
You'll need mysql-devel, if it's available for cygwin, or you'll need to build mysql from source. Your best bet is probably to just compile the MySQL client yourself in order to get the necessary headers to compile MySQLdb. See [this note](http://cpansearch.perl.org/src/CAPTTOFU/DBD-mysql-3.0000/INSTALL.html#windows_c...
520,869
<p>I'm trying to do pagination with Hibernate using <code>setFirstResult()</code> and <code>setMaxResults()</code> but I'm not getting the expected results when setting the first result to 0.</p> <p>When doing the following: </p> <pre><code>Query query = session.createQuery(queryString); query.setFirstResult(0); ...
[ { "answer_id": 521872, "author": "Bernardo", "author_id": 40847, "author_profile": "https://Stackoverflow.com/users/40847", "pm_score": 5, "selected": true, "text": "<p>Apparently adding <code>setFetchSize()</code> does the trick. So something like this now works perfectly: </p>\n\n<pre...
2009/02/06
[ "https://Stackoverflow.com/questions/520869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40847/" ]
I'm trying to do pagination with Hibernate using `setFirstResult()` and `setMaxResults()` but I'm not getting the expected results when setting the first result to 0. When doing the following: ``` Query query = session.createQuery(queryString); query.setFirstResult(0); query.setMaxResults(30); List list = quer...
Apparently adding `setFetchSize()` does the trick. So something like this now works perfectly: ``` query.setFirstResult(0); query.setMaxResults(30); query.setFetchSize(30); List list = query.list(); //list.size() now returns... wait for it... 30 ```
520,877
<p>In TFS, I want to see how many files I modified for a day/week/etc.</p> <p>Is this possible?</p>
[ { "answer_id": 521872, "author": "Bernardo", "author_id": 40847, "author_profile": "https://Stackoverflow.com/users/40847", "pm_score": 5, "selected": true, "text": "<p>Apparently adding <code>setFetchSize()</code> does the trick. So something like this now works perfectly: </p>\n\n<pre...
2009/02/06
[ "https://Stackoverflow.com/questions/520877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
In TFS, I want to see how many files I modified for a day/week/etc. Is this possible?
Apparently adding `setFetchSize()` does the trick. So something like this now works perfectly: ``` query.setFirstResult(0); query.setMaxResults(30); query.setFetchSize(30); List list = query.list(); //list.size() now returns... wait for it... 30 ```
520,881
<p>hey guys, my last problem ^^ say i have a string which contains html, like</p> <pre><code>html = '&lt;td class="p11_666699"&gt;&lt;strong&gt;100&lt;/strong&gt;&lt;/td&gt;' </code></pre> <p>and a list like</p> <pre><code>numbers = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 1...
[ { "answer_id": 520923, "author": "Eli Bendersky", "author_id": 8206, "author_profile": "https://Stackoverflow.com/users/8206", "pm_score": 1, "selected": false, "text": "<p>Are you looking for a way to join a list of numbers into a string? This will work:</p>\n\n<pre><code>' '.join(map(s...
2009/02/06
[ "https://Stackoverflow.com/questions/520881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
hey guys, my last problem ^^ say i have a string which contains html, like ``` html = '<td class="p11_666699"><strong>100</strong></td>' ``` and a list like ``` numbers = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, ...
I think you either want this: ``` numbers = [100, 101, 102, 103] output = "<td>" + ", ".join(map(str, numbers)) + "</td>" ``` or ``` output = "" for number in numbers: output += "<td>" + str(number) + "</td>" ```
520,893
<p>I have a class called Cal and it's .cpp and .h counterpart</p> <p>Headerfile has</p> <pre><code>class Cal { private: int wa[2][2]; public: void do_cal(); }; </code></pre> <p>.cpp file has</p> <pre><code>#include "Cal.h" void Cal::do_cal() { print(wa) // where print just itterates and ...
[ { "answer_id": 520917, "author": "Perchik", "author_id": 60989, "author_profile": "https://Stackoverflow.com/users/60989", "pm_score": 3, "selected": false, "text": "<p>You cannot initialize array elements in a class declaration. I recently tried to find a way to do just that. From what ...
2009/02/06
[ "https://Stackoverflow.com/questions/520893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62570/" ]
I have a class called Cal and it's .cpp and .h counterpart Headerfile has ``` class Cal { private: int wa[2][2]; public: void do_cal(); }; ``` .cpp file has ``` #include "Cal.h" void Cal::do_cal() { print(wa) // where print just itterates and prints the elements in wa } ``` My questio...
If it can be static, you can initialize it in your .cpp file. Add the static keyword in the class declaration: ``` class Cal { private: static int wa[2][2]; public: void do_cal(); }; ``` and at file scope in the .cpp file add: ``` #include "Cal.h" int Cal::wa[2][2] = { {5,2}, {7,9} }; void ...
520,895
<p>I'm afraid that this is a very silly question, but I must be missing something.</p> <p>Why might one want to use <a href="https://learn.microsoft.com/en-us/dotnet/api/system.string.copy" rel="noreferrer">String.Copy(string)</a>?</p> <p>The documentation says the method</p> <blockquote> <p>Creates a new instance...
[ { "answer_id": 520932, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 4, "selected": false, "text": "<p><code>String.Copy</code> returns a new <code>String</code> and does not yield the same results as </p>\n\n<pre><cod...
2009/02/06
[ "https://Stackoverflow.com/questions/520895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1199/" ]
I'm afraid that this is a very silly question, but I must be missing something. Why might one want to use [String.Copy(string)](https://learn.microsoft.com/en-us/dotnet/api/system.string.copy)? The documentation says the method > > Creates a new instance of String with > the same value as a specified String. > > ...
With `String.Copy` you are actually allocating new memory and copying the characters from one string to another; you get a completely new instance as opposed to having both variables being the same instance. This may matter if you use the string with unmanaged code which deals with the memory locations directly and can...
520,902
<h2>It's a long one! ;-)</h2> <p>There are a lot of copy pasted text in this question which makes it look complicated. And to be honest, it's a lot of information! However to an experienced person a lot of it might be unnecessary and easy to skim over.</p> <p>In its essence I'm only wondering why my basic <strong>Hib...
[ { "answer_id": 523941, "author": "Jack Leow", "author_id": 31506, "author_profile": "https://Stackoverflow.com/users/31506", "pm_score": 2, "selected": false, "text": "<p>I'd explicitly specify javassist in your project as a dependency and seee if that works.</p>\n\n<p>As to why it's lis...
2009/02/06
[ "https://Stackoverflow.com/questions/520902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It's a long one! ;-) -------------------- There are a lot of copy pasted text in this question which makes it look complicated. And to be honest, it's a lot of information! However to an experienced person a lot of it might be unnecessary and easy to skim over. In its essence I'm only wondering why my basic **Hiberna...
I had to add **,optional** to my Ivy.xml to also get the optional configuration, which was necessary for all dependencies to be retrieved and for the project run correctly. ``` dependency org="org.hibernate" name="hibernate-core" rev="3.3.1.GA" conf="runtime->runtime,optional"/> ```
520,905
<p>I'm working with a set of data from SQL Server that I'd like to get into a group of Excel files. This task needs to be automated to run on a monthly basis. The data looks like</p> <pre><code>Site ID FirstName LastName ------ ------- --------- --------- North 111 Jim Smith North 112 ...
[ { "answer_id": 520983, "author": "K Richard", "author_id": 16771, "author_profile": "https://Stackoverflow.com/users/16771", "pm_score": 1, "selected": false, "text": "<p>I think SSIS is a good tool to use, and you have a couple of options.</p>\n\n<p>Basically, you can use the multicast ...
2009/02/06
[ "https://Stackoverflow.com/questions/520905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18891/" ]
I'm working with a set of data from SQL Server that I'd like to get into a group of Excel files. This task needs to be automated to run on a monthly basis. The data looks like ``` Site ID FirstName LastName ------ ------- --------- --------- North 111 Jim Smith North 112 Tim Jo...
You have probably found an answer to your question by now. This is for other users who might stumble upon this question. Following example shows how this can be achieved dynamically for any number of Sites that might be present. The example was created using `SSIS 2008 R2` with `SQL Server 2008 R2` database. **Step-by...
520,908
<p>I have a UserControlParent that dynamically loads UserControlChild.</p> <p>In the UserControlChild, I store a value using the ViewState object by doing a </p> <pre><code>ViewState["count"] = myCount; </code></pre> <p>On Postbacks, the ViewState returns a null. Is this because the UserControlChild is being loaded ...
[ { "answer_id": 520954, "author": "Aaron Digulla", "author_id": 34088, "author_profile": "https://Stackoverflow.com/users/34088", "pm_score": 3, "selected": false, "text": "<p>You have two ways, the fast and the memory conservative way. But first, you need to know what characters are in t...
2009/02/06
[ "https://Stackoverflow.com/questions/520908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a UserControlParent that dynamically loads UserControlChild. In the UserControlChild, I store a value using the ViewState object by doing a ``` ViewState["count"] = myCount; ``` On Postbacks, the ViewState returns a null. Is this because the UserControlChild is being loaded dynamically? If it helps, the Use...
Strings and bytes are two completely different things, so wanting to split a String into bytes is as meaningless as wanting to split a painting into verses. What is it that you actually want to do? To convert between strings and bytes, you need to specify an encoding that can encode all the characters in the String. ...
520,910
<p>I have an issue with my application when Windows shuts down - my app isn't exiting nicely, resulting in the End Task window being displayed. How can I use the debugger to see what's going on? </p> <p>Is there a way to send the Windows shutdown message(s) to my application so it thinks Windows is shutting down, so I...
[ { "answer_id": 520940, "author": "Jon Tackabury", "author_id": 343, "author_profile": "https://Stackoverflow.com/users/343", "pm_score": 3, "selected": false, "text": "<p>I believe when Windows is shutting down it sends a \"WM_QueryEndSession\" to all applications. To simulate a Windows ...
2009/02/06
[ "https://Stackoverflow.com/questions/520910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8479/" ]
I have an issue with my application when Windows shuts down - my app isn't exiting nicely, resulting in the End Task window being displayed. How can I use the debugger to see what's going on? Is there a way to send the Windows shutdown message(s) to my application so it thinks Windows is shutting down, so I can see e...
There is a tool named Restart Manager (rmtool.exe) in the Microsoft's Logo Testing Tools for Windows, which can be used to send shutdown and restart messages to a process. Logo testing tools can be downloaded here: <http://download.microsoft.com/download/d/2/5/d2522ce4-a441-459d-8302-be8f3321823c/LogoToolsv1.0.msi> T...
520,914
<p>I edit data in a <code>DataTable</code> which is bound to a <code>DataGridView</code>. When a new column is created in the <code>DataTable</code> a new column is generated in the view.</p> <p>Ordinarily I would set the view column properties in a <code>DataGridView_ColumnAdded</code> event, however the default for ...
[ { "answer_id": 521037, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "<p>Interesting - I've done a lot with <code>DataGridView</code> and I haven't seen this. Perhaps the pragmatic option...
2009/02/06
[ "https://Stackoverflow.com/questions/520914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199/" ]
I edit data in a `DataTable` which is bound to a `DataGridView`. When a new column is created in the `DataTable` a new column is generated in the view. Ordinarily I would set the view column properties in a `DataGridView_ColumnAdded` event, however the default for the columns at present is to add a view column with `S...
OK, time to hack it: To demonstrate, here's a little app: ``` public partial class Form1 : Form { DataTable table = new DataTable(); public Form1() { InitializeComponent(); this.dataGridView1.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect; ...
520,922
<p>I have understanding how heap and garbage collector works: garbage collection happens in generations, memory allocation happens sequentially, during garbage collection free/unused space compacted by shifting data and forming continues block, etc. </p> <p>Is there any headers for allocated memory chunks are present ...
[ { "answer_id": 521056, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": -1, "selected": false, "text": "<p>I don't know about Java but for the CLR there is a 1 native word overhead per <em>reference</em> type allocated. On ...
2009/02/06
[ "https://Stackoverflow.com/questions/520922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62672/" ]
I have understanding how heap and garbage collector works: garbage collection happens in generations, memory allocation happens sequentially, during garbage collection free/unused space compacted by shifting data and forming continues block, etc. Is there any headers for allocated memory chunks are present and how bi...
I believe the header size is two words - one for the type reference and one for the sync block and other flags. The padding is (I believe) just enough to round the total size up to a whole number of words. For instance, a reference type with just an "int" in takes 12 bytes on x86, as demonstrated here: ``` using Syst...
520,963
<p>I'm prototyping a Python app with the <a href="http://docs.python.org/library/cmd.html" rel="noreferrer">cmd</a> module.</p> <p>Some messages to the user will be quite long and I'd like to paginate them. The first 10 (or a configurable number) lines of the message would appear, and pressing the SPACE bar would disp...
[ { "answer_id": 521054, "author": "Yoni Samlan", "author_id": 59058, "author_profile": "https://Stackoverflow.com/users/59058", "pm_score": 2, "selected": false, "text": "<p>The simple thing would just be to pipe your script through \"less\" or a similar command at runtime.</p>\n\n<p>Here...
2009/02/06
[ "https://Stackoverflow.com/questions/520963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26416/" ]
I'm prototyping a Python app with the [cmd](http://docs.python.org/library/cmd.html) module. Some messages to the user will be quite long and I'd like to paginate them. The first 10 (or a configurable number) lines of the message would appear, and pressing the SPACE bar would display the next page, until the end of th...
The simple thing would just be to pipe your script through "less" or a similar command at runtime. Here's a simple method that does approximately what you want, though: ``` def print_and_wait(some_long_message): lines = some_long_message.split('\n') i=0 while i < len(lines): print '\n'.join(lines[...
520,967
<p>I backed up a database:</p> <pre><code>BACKUP DATABASE MyDatabase TO DISK = 'MyDatabase.bak' WITH INIT --overwrite existing </code></pre> <p>And then tried to restore it:</p> <pre><code>RESTORE DATABASE MyDatabase FROM DISK = 'MyDatabase.bak' WITH REPLACE --force restore over specified database </code></pre...
[ { "answer_id": 521039, "author": "John Sansom", "author_id": 60308, "author_profile": "https://Stackoverflow.com/users/60308", "pm_score": 10, "selected": true, "text": "<p>You need to use the <code>WITH RECOVERY</code> option, with your database <code>RESTORE</code> command, to bring yo...
2009/02/06
[ "https://Stackoverflow.com/questions/520967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
I backed up a database: ``` BACKUP DATABASE MyDatabase TO DISK = 'MyDatabase.bak' WITH INIT --overwrite existing ``` And then tried to restore it: ``` RESTORE DATABASE MyDatabase FROM DISK = 'MyDatabase.bak' WITH REPLACE --force restore over specified database ``` And now the database is stuck in the restor...
You need to use the `WITH RECOVERY` option, with your database `RESTORE` command, to bring your database online as part of the restore process. This is of course only if you do not intend to restore any transaction log backups, i.e. you only wish to restore a database backup and then be able to access the database. Y...
520,987
<p>I'm using ASP.NET and C# and am exporting a very large results set to Excel. While my export code is running I would like to show a "loading" animated gif so the users will know their request is processing. I've been trying to do this with multithreading, but I am not very familiar with it. Can anyone guide me in...
[ { "answer_id": 521028, "author": "Brian Bolton", "author_id": 38613, "author_profile": "https://Stackoverflow.com/users/38613", "pm_score": 0, "selected": false, "text": "<p>I've run into this same problem with generating reports. A simple solution would be to run the report at night an...
2009/02/06
[ "https://Stackoverflow.com/questions/520987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47895/" ]
I'm using ASP.NET and C# and am exporting a very large results set to Excel. While my export code is running I would like to show a "loading" animated gif so the users will know their request is processing. I've been trying to do this with multithreading, but I am not very familiar with it. Can anyone guide me in the r...
Are you trying to do multi-threading on the server? What I'd recommend is in your client side javascript turn on a please wait message before posting to the server. Then on the client side when your done posting you turn the message off. Without knowing more about your actual setup I can't help much further, but last...
521,017
<p>given this html code:</p> <pre><code>&lt;td&gt;&lt;img class='del' id='4' src='images/delete.gif'&gt;&lt;/td&gt; </code></pre> <p>I am in trouble understanding how to complete the following code:</p> <pre><code>$(document).ready( function(){ setup(); } ); function set...
[ { "answer_id": 521042, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 1, "selected": false, "text": "<pre><code>$(document).ready( function(){ \n setup(); \n});\n\nfunction setup() { \n $(\"#deleteForm\").hide(); \n ...
2009/02/06
[ "https://Stackoverflow.com/questions/521017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47506/" ]
given this html code: ``` <td><img class='del' id='4' src='images/delete.gif'></td> ``` I am in trouble understanding how to complete the following code: ``` $(document).ready( function(){ setup(); } ); function setup(){ $("#deleteForm").hide(); $("img.del").bin...
Just re-formatting bendewey's answer: ``` jQuery(function($) { $("#deleteForm").hide(); $("img.del").click(function() { $("#deleteForm").show(); $(this).attr('id'); // this is the image Id }) }); ```
521,019
<p>I need to have a .htaccess rewrite rule redirect to a script in the root of a subdirectory, but only for any files/directories in that sub directory...</p> <pre><code>/ /subdir/ /index.php /somedir/ /anotherdir/ </code></pre> <p>For the structure above, I want anyone browsing to /subdir to go to /subdir/i...
[ { "answer_id": 521042, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 1, "selected": false, "text": "<pre><code>$(document).ready( function(){ \n setup(); \n});\n\nfunction setup() { \n $(\"#deleteForm\").hide(); \n ...
2009/02/06
[ "https://Stackoverflow.com/questions/521019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62434/" ]
I need to have a .htaccess rewrite rule redirect to a script in the root of a subdirectory, but only for any files/directories in that sub directory... ``` / /subdir/ /index.php /somedir/ /anotherdir/ ``` For the structure above, I want anyone browsing to /subdir to go to /subdir/index.php, and anyone going...
Just re-formatting bendewey's answer: ``` jQuery(function($) { $("#deleteForm").hide(); $("img.del").click(function() { $("#deleteForm").show(); $(this).attr('id'); // this is the image Id }) }); ```
521,021
<p>I'm reading Silverlight 2 Unleashed, published in October 2008 and it has examples in it with a root canvas tag:</p> <pre><code>&lt;Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="Red" Width="500" Height="300"&gt; &lt...
[ { "answer_id": 522423, "author": "Randolpho", "author_id": 12716, "author_profile": "https://Stackoverflow.com/users/12716", "pm_score": 0, "selected": false, "text": "<p>I think the book probably did things wrong. Books tend to do that, actually. </p>\n\n<p>Typically, your user control ...
2009/02/06
[ "https://Stackoverflow.com/questions/521021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
I'm reading Silverlight 2 Unleashed, published in October 2008 and it has examples in it with a root canvas tag: ``` <Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="Red" Width="500" Height="300"> <Ellipse Width="400"......
Taken out of context, using a Canvas as the root in a XAML document might seem weird. However, in the book, this is used when we demonstrate the very first XAML samples in an online tool named SilverlightPad. In that case, there is no Code-Behind, only XAML, thus you do not need to change anything in a class file (sinc...
521,055
<p>I am attempting to select a distinct list where duplicates are created over several fields. For example, </p> <pre><code>SELECT tablename.field1Date, tablename.field2Number, tablename.field3Text FROM tablename; </code></pre> <p>Would select duplicating records over the date, number and text fields...
[ { "answer_id": 521066, "author": "BIBD", "author_id": 685, "author_profile": "https://Stackoverflow.com/users/685", "pm_score": 5, "selected": true, "text": "<p>Yes, basically it has to sort the results and then re-processed to eliminate the duplicates. This cull could also be being done...
2009/02/06
[ "https://Stackoverflow.com/questions/521055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3155/" ]
I am attempting to select a distinct list where duplicates are created over several fields. For example, ``` SELECT tablename.field1Date, tablename.field2Number, tablename.field3Text FROM tablename; ``` Would select duplicating records over the date, number and text fields respectively. Now, when ...
Yes, basically it has to sort the results and then re-processed to eliminate the duplicates. This cull could also be being done during the sort, but we can only speculate as to how exactly the code works in the background. You could try and improve the performance by creating an index composed of all three (3) fields.
521,062
<p>I've got a create action that is attempting to create a Rating and a Programme in one go:</p> <pre><code> def create @rating = current_user.ratings.create(params[:rating]) @rating.create_programme(params[:programme]) redirect_to ratings_path end </code></pre> <p>In this code, a rating belongs to bot...
[ { "answer_id": 521157, "author": "Alex Wayne", "author_id": 62076, "author_profile": "https://Stackoverflow.com/users/62076", "pm_score": 0, "selected": false, "text": "<p>Your code looks right. Try this. Immediately after hitting this create action go into you script/console and see w...
2009/02/06
[ "https://Stackoverflow.com/questions/521062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52092/" ]
I've got a create action that is attempting to create a Rating and a Programme in one go: ``` def create @rating = current_user.ratings.create(params[:rating]) @rating.create_programme(params[:programme]) redirect_to ratings_path end ``` In this code, a rating belongs to both a user and a programme a...
In response to your question to help make the code cleaner: ``` def create @rating = Rating.new(params[:rating]) @rating.user = curent_user @rating.programme = Programme.find_or_create_by_title(params[:programme]) @rating.save redirect_to ratings_path end ``` First of all you call find\_or\_create fo...
521,078
<p>Does anyone know how to convert these string hex values back into DateTime values?</p> <p>Property my_DateProperty (System.String) = 0x01c9874e|0x98f28800</p> <pre><code>//l_item is SPListItem Hashtable l_properties = l_item.Properties; if (l_properties != null) { object l_value = null; foreach (...
[ { "answer_id": 526349, "author": "Nat", "author_id": 13813, "author_profile": "https://Stackoverflow.com/users/13813", "pm_score": 0, "selected": false, "text": "<p>Could be you that the datetime is being converted into an \"invariant\" date by the ToString. <a href=\"http://weblogs.asp....
2009/02/06
[ "https://Stackoverflow.com/questions/521078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48924/" ]
Does anyone know how to convert these string hex values back into DateTime values? Property my\_DateProperty (System.String) = 0x01c9874e|0x98f28800 ``` //l_item is SPListItem Hashtable l_properties = l_item.Properties; if (l_properties != null) { object l_value = null; foreach (string l_key in l_pr...
I discovered recently that this seems to occur only on Office 2007 documents (for other file types, the value is a standard string format for a date). The answer is that the hexadecimal value represents the number of ticks since the 1/1/1600. Here is a conversion that worked for me: Dim dateVal as DateTime = New DateT...
521,079
<p>I saw a code snippet the other day that converts a Boolean value to the corresponding "Yes"/"No" value:</p> <pre><code>CDbl(True).ToString("Yes;Yes;No") </code></pre> <p>The code works fine but I'm curious how it works and I haven't been able to find the answer in the <a href="http://msdn.microsoft.com/en-us/libra...
[ { "answer_id": 521108, "author": "tanathos", "author_id": 51295, "author_profile": "https://Stackoverflow.com/users/51295", "pm_score": 3, "selected": false, "text": "<p>Take a look <a href=\"http://msdn.microsoft.com/en-us/library/system.iformattable.aspx\" rel=\"noreferrer\">here</a> a...
2009/02/06
[ "https://Stackoverflow.com/questions/521079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50225/" ]
I saw a code snippet the other day that converts a Boolean value to the corresponding "Yes"/"No" value: ``` CDbl(True).ToString("Yes;Yes;No") ``` The code works fine but I'm curious how it works and I haven't been able to find the answer in the [MSDN documentation for ToString()](http://msdn.microsoft.com/en-us/libr...
It's treating it as a [Custom Numeric Format String](http://msdn.microsoft.com/en-us/library/0c899ak8.aspx). Specifically, see the part about section separators in the linked page: > > The ';' character is used to separate sections for positive, negative, and zero numbers in the format string. If there are two sectio...
521,082
<p>I have a situation in which I have several related/cascaded tables. Lets say all 1-to-many relationships cascading down table1, table2, table3, table4, etc. What I have are default rows in the tables. They start with 1 record in table1 and have 1 or more related records in other tables.</p> <p>What I am looking ...
[ { "answer_id": 521215, "author": "Welbog", "author_id": 52443, "author_profile": "https://Stackoverflow.com/users/52443", "pm_score": 1, "selected": false, "text": "<p>We had to do this for some functionality in one our projects recently.</p>\n\n<p>We ended up doing it using a recursive ...
2009/02/06
[ "https://Stackoverflow.com/questions/521082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a situation in which I have several related/cascaded tables. Lets say all 1-to-many relationships cascading down table1, table2, table3, table4, etc. What I have are default rows in the tables. They start with 1 record in table1 and have 1 or more related records in other tables. What I am looking for is an eas...
We had to do this for some functionality in one our projects recently. We ended up doing it using a recursive stored procedure. Each call needed two pieces of information: * The name of the table where the records are being duplicated * The primary key of the parent table of the table being duplicated So if you had ...
521,083
<p>I'm changing an old routine that used to take an integer parameter so that it now takes a const reference to an object. I was hoping that the compiler would tell me where the function is called from (because the parameter type is wrong), but the object has a constructor that takes an integer, so rather than failing,...
[ { "answer_id": 521092, "author": "Paolo Tedesco", "author_id": 15622, "author_profile": "https://Stackoverflow.com/users/15622", "pm_score": 5, "selected": true, "text": "<p>Use the <code>explicit</code> keyword in the thing constructor.</p>\n\n<pre><code>class thing {\npublic:\n expl...
2009/02/06
[ "https://Stackoverflow.com/questions/521083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1821/" ]
I'm changing an old routine that used to take an integer parameter so that it now takes a const reference to an object. I was hoping that the compiler would tell me where the function is called from (because the parameter type is wrong), but the object has a constructor that takes an integer, so rather than failing, th...
Use the `explicit` keyword in the thing constructor. ``` class thing { public: explicit thing( int x ) { printf( "Creating a thing(%d)\n", x ); } }; ``` This will prevent the compiler from implicitly calling the thing constructor when it finds an integer.
521,089
<p>Greetings!</p> <p>I have a simple navigation menu consisting of an asp:DropDownList and an asp:Button. Users select an item from the dropdown and click the button to go to the new URL. I'd like to be able to able to support when users hit the ENTER key when a dropdown list item is selected so that it replicates t...
[ { "answer_id": 521104, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 4, "selected": true, "text": "<p>have your tried wrapping your controls in a panel with the default button? I know it works for textboxes</p>\n\n<pre><...
2009/02/06
[ "https://Stackoverflow.com/questions/521089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27870/" ]
Greetings! I have a simple navigation menu consisting of an asp:DropDownList and an asp:Button. Users select an item from the dropdown and click the button to go to the new URL. I'd like to be able to able to support when users hit the ENTER key when a dropdown list item is selected so that it replicates the behavior ...
have your tried wrapping your controls in a panel with the default button? I know it works for textboxes ``` <asp:Panel runat="server" id="searchPanel" DefaultButton="btnGoButton"> <asp:DropDownList ID="ddlMenu" runat="server" /> <asp:Button ID="btnGoButton" runat="server" onclick="GoButton_Click"/> </asp:Pane...
521,101
<p>I'm trying to understand what the Java <em>java.security.Signature</em> class does. If I compute an SHA1 message digest, and then encrypt that digest using RSA, I get a different result to asking the <em>Signature</em> class to sign the same thing:</p> <pre><code>// Generate new key KeyPair keyPair = KeyPairGenerat...
[ { "answer_id": 521112, "author": "Leonidas", "author_id": 57510, "author_profile": "https://Stackoverflow.com/users/57510", "pm_score": 2, "selected": false, "text": "<p>Erm, after understanding your question: are you sure that the signature-method only creates a SHA1 and encrypts it? GP...
2009/02/06
[ "https://Stackoverflow.com/questions/521101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37416/" ]
I'm trying to understand what the Java *java.security.Signature* class does. If I compute an SHA1 message digest, and then encrypt that digest using RSA, I get a different result to asking the *Signature* class to sign the same thing: ``` // Generate new key KeyPair keyPair = KeyPairGenerator.getInstance("RSA").genera...
OK, I've worked out what's going on. Leonidas is right, it's not just the hash that gets encrypted (in the case of the Cipher class method), it's the ID of the hash algorithm concatenated with the digest: ``` DigestInfo ::= SEQUENCE { digestAlgorithm AlgorithmIdentifier, digest OCTET STRING } ``` Whi...
521,103
<p>I've never used nested functions, but have seen references to them in several languages (as well as nested classes, which I assume are related).</p> <ul> <li>What is a nested function?</li> <li>Why?!?</li> <li>What can you do with a nested function that you cannot do any other way?</li> <li>What can you do with a n...
[ { "answer_id": 521134, "author": "wiwulo", "author_id": 238591, "author_profile": "https://Stackoverflow.com/users/238591", "pm_score": 1, "selected": false, "text": "<p>(C#) :\nI use that to simplify the Object Browser view, and to structure my classes better.\nAs class Wheel nested in ...
2009/02/06
[ "https://Stackoverflow.com/questions/521103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2915/" ]
I've never used nested functions, but have seen references to them in several languages (as well as nested classes, which I assume are related). * What is a nested function? * Why?!? * What can you do with a nested function that you cannot do any other way? * What can you do with a nested function this is difficult or...
One popular use of nested functions is [closures](http://en.wikipedia.org/wiki/Closure_(computer_science)). In a [lexically scoped](http://en.wikipedia.org/wiki/Scope_(programming)#Static_scoping_.28also_known_as_lexical_scoping.29) language with first-class functions it's possible to use functions to store data. A sim...
521,107
<p>I have the following HandleUnknownAction set on my base controller class:</p> <pre><code>protected override void HandleUnknownAction(string action) { Response.Redirect("/"); } </code></pre> <p>How can I unit test that? Another point, is that way to handle the unknown action correct? Seems that calling Redirect...
[ { "answer_id": 529934, "author": "Dala", "author_id": 11547, "author_profile": "https://Stackoverflow.com/users/11547", "pm_score": 3, "selected": true, "text": "<p>I don't think there's a need to test that HandleUnknownAction is invoked when a controller is missing an action. We trust t...
2009/02/06
[ "https://Stackoverflow.com/questions/521107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18623/" ]
I have the following HandleUnknownAction set on my base controller class: ``` protected override void HandleUnknownAction(string action) { Response.Redirect("/"); } ``` How can I unit test that? Another point, is that way to handle the unknown action correct? Seems that calling RedirectToAction() would be more c...
I don't think there's a need to test that HandleUnknownAction is invoked when a controller is missing an action. We trust the framework to handle that. So we can test the implementation by calling HandleUnknownAction directly with the mocking framework [Moq](http://code.google.com/p/moq/). Should also be possible with ...
521,111
<p>How do I write a Python class that handles calls on undefined methods by first, getting the output of a function of the same name from a given module, and then, doing something further with that output?</p> <p>For example, given add(x, y), doublerInstance.add(1, 1) should return 4.</p> <p>I know _ _ getattr _ _() ...
[ { "answer_id": 521194, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "https://Stackoverflow.com/users/3978", "pm_score": 2, "selected": false, "text": "<p><code>__getattr__</code> has to return the function - not the result from calling it:</p>\n\n<pre><code>class Doub...
2009/02/06
[ "https://Stackoverflow.com/questions/521111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63401/" ]
How do I write a Python class that handles calls on undefined methods by first, getting the output of a function of the same name from a given module, and then, doing something further with that output? For example, given add(x, y), doublerInstance.add(1, 1) should return 4. I know \_ \_ getattr \_ \_() intercepts ca...
When you call `doublerInstance.add(1, 2)`, you're getting an attribute `add` from it, and then you're *calling* it. But inside your getattr, you're returning a value. You have to return a function. Anyway, for this particular case to work, you need this: ``` def __getattr__(self, attrname) : fnc = getattr(self.so...
521,118
<p>I am looking at using Ruby on Rails for a storefront that has to make use of existing data, but I can create my own database schema if I need to. A lot of the fields in the existing data are char(1) emulating a boolean field (i.e. Y/N) for, I believe, cross-platform portability. Since the data is prone to change, ...
[ { "answer_id": 521151, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": -1, "selected": false, "text": "<p>Can't you just wrap it in your database engine with a view or stored procedure to produce a consistent interface to ...
2009/02/06
[ "https://Stackoverflow.com/questions/521118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40667/" ]
I am looking at using Ruby on Rails for a storefront that has to make use of existing data, but I can create my own database schema if I need to. A lot of the fields in the existing data are char(1) emulating a boolean field (i.e. Y/N) for, I believe, cross-platform portability. Since the data is prone to change, I don...
As far as I know, what you describe is not possible with `ActiveRecord` out-of-the-box. However, if you have a lot of columns like this you could look at doing a little bit of meta-programming to provide a declarative way to add the relevant accessor logic. Something like :- ``` class Product < ActiveRecord::Base ...
521,120
<p>I saw that there is a <strong>virtual()</strong> function in PHP that will call a CGI script, but is that the best way? Can I pass any parameters to that scripts as well?</p> <p>I saw some examples using <strong><code>file_get_contents()</code></strong> or <strong>include()</strong> and passing in the URL of a CGI...
[ { "answer_id": 521273, "author": "Ryan Graham", "author_id": 62525, "author_profile": "https://Stackoverflow.com/users/62525", "pm_score": 3, "selected": true, "text": "<p>Use <strong>exec()</strong> if you can call it locally. If it needs to be invoked as a CGI (as in the script is desi...
2009/02/06
[ "https://Stackoverflow.com/questions/521120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57698/" ]
I saw that there is a **virtual()** function in PHP that will call a CGI script, but is that the best way? Can I pass any parameters to that scripts as well? I saw some examples using **`file_get_contents()`** or **include()** and passing in the URL of a CGI script, but that feels like a hack.
Use **exec()** if you can call it locally. If it needs to be invoked as a CGI (as in the script is designed to only work within a CGI environment), then you'll need to call it via **include()** or **file\_get\_contents()**. **virtual()** will flush your buffers and append the output of the sub-request. You can pass pa...
521,133
<p>When you create a new MFC application, the wizard creates the following block of code in almost every CPP file:</p> <pre><code>#ifdef _DEBUG #define new DEBUG_NEW #endif </code></pre> <p>and sometimes it also adds this:</p> <pre><code>#undef THIS_FILE static char THIS_FILE[] = __FILE__; </code></pre> <p>I would ...
[ { "answer_id": 521192, "author": "Mark Ransom", "author_id": 5987, "author_profile": "https://Stackoverflow.com/users/5987", "pm_score": 4, "selected": true, "text": "<p>It is perfectly safe to delete this. It's a debugging aid; leaving it in will generate better details in the warnings...
2009/02/06
[ "https://Stackoverflow.com/questions/521133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61697/" ]
When you create a new MFC application, the wizard creates the following block of code in almost every CPP file: ``` #ifdef _DEBUG #define new DEBUG_NEW #endif ``` and sometimes it also adds this: ``` #undef THIS_FILE static char THIS_FILE[] = __FILE__; ``` I would like to remove this code from my CPP files if it ...
It is perfectly safe to delete this. It's a debugging aid; leaving it in will generate better details in the warnings in the output window of any memory leaks you have when the program exits. If you delete it, you still get the memory leak report, but just without any details about where in your source code they occurr...
521,136
<p>Basically I'm a bit stuck,</p> <p>I've been following the <a href="http://framework.zend.com/docs/quickstart" rel="nofollow noreferrer">quick start</a> on Zend site, and wish to make a dynamic navigation to the framework, I've got layout.phtml with <code>$this-&gt;render('navigation.phtml);</code> this has static l...
[ { "answer_id": 521192, "author": "Mark Ransom", "author_id": 5987, "author_profile": "https://Stackoverflow.com/users/5987", "pm_score": 4, "selected": true, "text": "<p>It is perfectly safe to delete this. It's a debugging aid; leaving it in will generate better details in the warnings...
2009/02/06
[ "https://Stackoverflow.com/questions/521136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Basically I'm a bit stuck, I've been following the [quick start](http://framework.zend.com/docs/quickstart) on Zend site, and wish to make a dynamic navigation to the framework, I've got layout.phtml with `$this->render('navigation.phtml);` this has static links, but I wish to make them pull from a database table coul...
It is perfectly safe to delete this. It's a debugging aid; leaving it in will generate better details in the warnings in the output window of any memory leaks you have when the program exits. If you delete it, you still get the memory leak report, but just without any details about where in your source code they occurr...
521,147
<p>I've got a window that I handle WM_NCLBUTTONUP messages, in order to handle clicks on custom buttons in the caption bar. This works great when the window is maximised, but when it's not, the WM_NCLBUTTONUP message never arrives! I do get a WM_NCLBUTTONDOWN message though. Strangely WM_NCLBUTTONUP does arrive if I cl...
[ { "answer_id": 521218, "author": "Franci Penov", "author_id": 17028, "author_profile": "https://Stackoverflow.com/users/17028", "pm_score": 2, "selected": false, "text": "<p>A wild guess - some code is capturing the mouse, probably to facilitate the window move when you grab the title. T...
2009/02/06
[ "https://Stackoverflow.com/questions/521147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/986/" ]
I've got a window that I handle WM\_NCLBUTTONUP messages, in order to handle clicks on custom buttons in the caption bar. This works great when the window is maximised, but when it's not, the WM\_NCLBUTTONUP message never arrives! I do get a WM\_NCLBUTTONDOWN message though. Strangely WM\_NCLBUTTONUP does arrive if I c...
I've had this same problem. The issue is indeed that a left button click on the window caption starts a drag, and thus mouse capture, which prevents WM\_NCLBUTTONUP from arriving. The solution is to override WM\_NCHITTEST: ``` LRESULT CALLBACK WndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { switch (...
521,171
<p>I like how Java has a Map where you can define the types of each entry in the map, for example <code>&lt;String, Integer&gt;</code>. </p> <p>What I'm looking for is a type of collection where each element in the collection is a pair of values. Each value in the pair can have its own type (like the String and Integ...
[ { "answer_id": 521205, "author": "Dan Dyer", "author_id": 5171, "author_profile": "https://Stackoverflow.com/users/5171", "pm_score": 3, "selected": false, "text": "<p>You could write a generic Pair&lt;A, B&gt; class and use this in an array or list. Yes, you have to write a class, but ...
2009/02/06
[ "https://Stackoverflow.com/questions/521171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60006/" ]
I like how Java has a Map where you can define the types of each entry in the map, for example `<String, Integer>`. What I'm looking for is a type of collection where each element in the collection is a pair of values. Each value in the pair can have its own type (like the String and Integer example above), which is ...
The Pair class is one of those "gimme" generics examples that is easy enough to write on your own. For example, off the top of my head: ``` public class Pair<L,R> { private final L left; private final R right; public Pair(L left, R right) { assert left != null; assert right != null; this.left = le...
521,186
<p>I want to very SMTP connectivity from an AS400 in a VM to a mailserver on port 25</p> <p>The native telnet command on the as400 does not seem to support a port specification.</p> <p>Any ideas how to telnet from as400 to port 25 on my mailserver?</p> <p>I can ping the mailserver from the as400</p> <p>I can telnet...
[ { "answer_id": 521211, "author": "Jeroen Huinink", "author_id": 59086, "author_profile": "https://Stackoverflow.com/users/59086", "pm_score": 3, "selected": false, "text": "<p>I just tried this on an i5/OS V5R4:</p>\n\n<pre><code>TELNET RMTSYS(hostname) ASCOPRMOD(*VT100) PORT(25)\n</code...
2009/02/06
[ "https://Stackoverflow.com/questions/521186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to very SMTP connectivity from an AS400 in a VM to a mailserver on port 25 The native telnet command on the as400 does not seem to support a port specification. Any ideas how to telnet from as400 to port 25 on my mailserver? I can ping the mailserver from the as400 I can telnet in from other boxes (non as400...
I just tried this on an i5/OS V5R4: ``` TELNET RMTSYS(hostname) ASCOPRMOD(*VT100) PORT(25) ``` I also found [an IBM manual about telnet support in V5R2](http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzaiw/rzaiw.pdf) that suggests you can also specify a port in older versions.
521,199
<p>I would like to assign a mnemonic to a <code>JMenu</code> using resource bundles (or the <code>ResourceMap</code>). So for example, the code without resource file would be...</p> <pre><code>JMenu fileMenu = new JMenu(); fileMenu.setText("File"); // this would be read from a resource file fileMenu.setMnemonic('F')...
[ { "answer_id": 521698, "author": "John Gardner", "author_id": 13687, "author_profile": "https://Stackoverflow.com/users/13687", "pm_score": 0, "selected": false, "text": "<p>You could do it in a similar way, and treat \"FileMenu\" as a (fake) action?</p>\n" }, { "answer_id": 5218...
2009/02/06
[ "https://Stackoverflow.com/questions/521199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3898/" ]
I would like to assign a mnemonic to a `JMenu` using resource bundles (or the `ResourceMap`). So for example, the code without resource file would be... ``` JMenu fileMenu = new JMenu(); fileMenu.setText("File"); // this would be read from a resource file fileMenu.setMnemonic('F'); // but the docs say this is obsol...
Java's [javax.swing.KeyStroke](http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/KeyStroke.html) class bridges the gap: ``` JMenu fileMenu = new JMenu(); String mnemonic = // string from localization fileMenu.setMnemonic(KeyStroke.getKeyStroke(mnemonic).getKeyCode()); ``` Accelerators are not supported for `JMenu`s...
521,204
<p>I'm writing a PowerShell script to manipulate some Windows Installer XML (WiX). I'm using the new XML APIs in .NET 3.5 to do this, as I find it an easier API to work with than the DOM. The following script fragment is flatly refusing to work:</p> <pre><code>[System.Reflection.Assembly]::LoadWithPartialName("Syst...
[ { "answer_id": 521653, "author": "James Pogran", "author_id": 1083, "author_profile": "https://Stackoverflow.com/users/1083", "pm_score": 1, "selected": false, "text": "<p>I know you said you prefered not to work with the DOM, but is there any reason why this doesn't work for you?</p>\n\...
2009/02/06
[ "https://Stackoverflow.com/questions/521204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5296/" ]
I'm writing a PowerShell script to manipulate some Windows Installer XML (WiX). I'm using the new XML APIs in .NET 3.5 to do this, as I find it an easier API to work with than the DOM. The following script fragment is flatly refusing to work: ``` [System.Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq") | O...
This problem intrigued me, so I did some searching around. After a lot of messing around in PowerShell and searching the web I found your solution. Credit goes to Jamie Thomson for the actual code. <http://dougfinke.com/blog/index.php/2007/08/07/using-xmllinq-in-powershell/> The missing piece is to handle the namesp...
521,220
<p>Ok I'm trying to use the Win32 Crypto API in C++ to decrypt a string encrypted in C# (.NET 2) with the RijndaelManaged Class. But I'm having no luck at all i get jibberish or a bad data Win32 error code. All my keys, IV and salt match, I've looked in the watch for both test apps. I've spent all say looking at it ...
[ { "answer_id": 521237, "author": "Niyaz", "author_id": 184, "author_profile": "https://Stackoverflow.com/users/184", "pm_score": 0, "selected": false, "text": "<p>I see that you are using CBC chaining mode to encrypt the plain text.</p>\n\n<p>Are you sure you are using the same chaining ...
2009/02/06
[ "https://Stackoverflow.com/questions/521220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Ok I'm trying to use the Win32 Crypto API in C++ to decrypt a string encrypted in C# (.NET 2) with the RijndaelManaged Class. But I'm having no luck at all i get jibberish or a bad data Win32 error code. All my keys, IV and salt match, I've looked in the watch for both test apps. I've spent all say looking at it and I'...
Ok my fault, I didn't include the Struct def for the keyblob in the C++ and it turns out you need a contigous block of data for the key with the header but I was using the MSDN example that had a pointer to the key data. Which is wrong!
521,226
<p>In my bash script I need to change current dir to user's home directory. </p> <p>if I want to change to user's <em>foo</em> home dir, from the command line I can do:</p> <pre><code>cd ~foo </code></pre> <p>Which works fine, however when I do the same from the <em>script</em> it tells me:</p> <pre><code>./bar.sh:...
[ { "answer_id": 521233, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 3, "selected": false, "text": "<p>Change it to:</p>\n\n<pre><code>cd $HOME\n</code></pre>\n\n<p>Actually, I'm not sure why <code>cd ~whatever</code> ...
2009/02/06
[ "https://Stackoverflow.com/questions/521226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26592/" ]
In my bash script I need to change current dir to user's home directory. if I want to change to user's *foo* home dir, from the command line I can do: ``` cd ~foo ``` Which works fine, however when I do the same from the *script* it tells me: ``` ./bar.sh: line 4: cd: ~foo: No such file or directory ``` Seams l...
What about ``` cd $(getent passwd foo | cut -d: -f6) ``` and ``` USER=foo eval cd ~$USER ``` works, too (foo is the username)
521,242
<p>I need to validate an input on a form. I'm expecting the input to be a number between 1 to 19 digits. The input can also start with zeros. However, I want to validate that they are not all zeros. I've got a regex that will ensure that the input is numeric and between 1 and 19 numbers.</p> <pre><code>^\d[1,19]$ </co...
[ { "answer_id": 521256, "author": "chaos", "author_id": 47529, "author_profile": "https://Stackoverflow.com/users/47529", "pm_score": 5, "selected": true, "text": "<p><code>^(?!0+$)\\d{1,19}$</code></p>\n" }, { "answer_id": 521288, "author": "codelogic", "author_id": 43427...
2009/02/06
[ "https://Stackoverflow.com/questions/521242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9809/" ]
I need to validate an input on a form. I'm expecting the input to be a number between 1 to 19 digits. The input can also start with zeros. However, I want to validate that they are not all zeros. I've got a regex that will ensure that the input is numeric and between 1 and 19 numbers. ``` ^\d[1,19]$ ``` But I can't ...
`^(?!0+$)\d{1,19}$`
521,254
<p>I'm using NSUserDefaults for a Settings Application. This is a pristine copy and I have not at all added anything to the filesystem for this particular setting. I expect it to be nil, but on the contrary..</p> <p>If I do something like the following: </p> <pre><code>NSUserDefaults *defaults = [NSUserDefaults stand...
[ { "answer_id": 521347, "author": "Alex Wayne", "author_id": 62076, "author_profile": "https://Stackoverflow.com/users/62076", "pm_score": 4, "selected": true, "text": "<p>valueForKey: is kind of a complex method in all the places it searches. I find it more reliable to use the getters f...
2009/02/06
[ "https://Stackoverflow.com/questions/521254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
I'm using NSUserDefaults for a Settings Application. This is a pristine copy and I have not at all added anything to the filesystem for this particular setting. I expect it to be nil, but on the contrary.. If I do something like the following: ``` NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ...
valueForKey: is kind of a complex method in all the places it searches. I find it more reliable to use the getters for specific datatypes when dealing with defaults. ``` if ([defaults boolForKey:kIdentifierKey]) [self doSomething]; ``` Or you could use objectForKey: which should return nil as you expect. In fact, yo...
521,261
<p>I want to remove square brackets from an SQL string, but only where there is no whitespace inside them.</p> <p>E.g. "SELECT [intId], [The Description]" should return "SELECT intId, [The Description]".</p> <p>I can get the square brackets without spaces inside with the regular expression:</p> <pre><code>\[[^\s]*\]...
[ { "answer_id": 521277, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 4, "selected": true, "text": "<pre><code>sql = Regex.Replace(sql, \"\\\\[([^\\\\s]*)\\\\]\", \"$1\");\n</code></pre>\n" }, { "answer_id": 521...
2009/02/06
[ "https://Stackoverflow.com/questions/521261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63416/" ]
I want to remove square brackets from an SQL string, but only where there is no whitespace inside them. E.g. "SELECT [intId], [The Description]" should return "SELECT intId, [The Description]". I can get the square brackets without spaces inside with the regular expression: ``` \[[^\s]*\] ``` How can the square br...
``` sql = Regex.Replace(sql, "\\[([^\\s]*)\\]", "$1"); ```
521,269
<p>I get data imported from an Oracle database and use Excel to create some reports from that. Recently one of our data entry folks has started beginning her entries with "+". Excel than evaluates that and adds = then displays the dreaded ?name# error. The error is error 2029.</p> <p>I tried using </p> <pre><code>...
[ { "answer_id": 521341, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 2, "selected": false, "text": "<p>Excel has it's own replace function:</p>\n\n<pre><code>ActiveSheet.Cells.Replace What:=\"=+\", Replacement:=\"\", LookAt:=x...
2009/02/06
[ "https://Stackoverflow.com/questions/521269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32790/" ]
I get data imported from an Oracle database and use Excel to create some reports from that. Recently one of our data entry folks has started beginning her entries with "+". Excel than evaluates that and adds = then displays the dreaded ?name# error. The error is error 2029. I tried using ``` If IsError(C.Value) Then...
If you have the data in a text/CSV file then you can try: `Data > Import External Data > Import Data` This launches a wizard which lets you specify specific columns as text and that causes symbols like +, - etc not to be parsed by Excel In VBA this can be done through the `Worksheet("foo").QueryTables.Add` method. The...
521,270
<p>I would like to run a search with MSSQL Full text engine where given the following user input: "Hollywood square"</p> <p>I want the results to have both Hollywood and square[s] in them.</p> <p>I can create a method on the web server (C#, ASP.NET) to dynamically produce a sql statement like this:</p> <pre><code>SE...
[ { "answer_id": 521341, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 2, "selected": false, "text": "<p>Excel has it's own replace function:</p>\n\n<pre><code>ActiveSheet.Cells.Replace What:=\"=+\", Replacement:=\"\", LookAt:=x...
2009/02/06
[ "https://Stackoverflow.com/questions/521270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42697/" ]
I would like to run a search with MSSQL Full text engine where given the following user input: "Hollywood square" I want the results to have both Hollywood and square[s] in them. I can create a method on the web server (C#, ASP.NET) to dynamically produce a sql statement like this: ``` SELECT TITLE FROM MOVIES WHERE...
If you have the data in a text/CSV file then you can try: `Data > Import External Data > Import Data` This launches a wizard which lets you specify specific columns as text and that causes symbols like +, - etc not to be parsed by Excel In VBA this can be done through the `Worksheet("foo").QueryTables.Add` method. The...
521,274
<p>I am interested and would like to learn more about java , how to write into existing excel sheets / manipulating the existing data. I was wondering if you could give me an idea on how to edit an existing excel file and save it using the jxl api / Apache POI or perhaps give me a sample program on how to edit some dat...
[ { "answer_id": 521386, "author": "Zabbala", "author_id": 54789, "author_profile": "https://Stackoverflow.com/users/54789", "pm_score": 5, "selected": false, "text": "<p>The tutorials <a href=\"http://poi.apache.org/spreadsheet/quick-guide.html\" rel=\"noreferrer\">here</a> are very helpf...
2009/02/06
[ "https://Stackoverflow.com/questions/521274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am interested and would like to learn more about java , how to write into existing excel sheets / manipulating the existing data. I was wondering if you could give me an idea on how to edit an existing excel file and save it using the jxl api / Apache POI or perhaps give me a sample program on how to edit some data i...
The tutorials [here](http://poi.apache.org/spreadsheet/quick-guide.html) are very helpful and well-written. They use an external JAR developed by the Apache POI project. Here's an simple example of editing one cell: ``` InputStream inp = new FileInputStream("wb.xls"); Workbook wb = WorkbookFactory.create(inp);...
521,278
<p>My requirement is to read some set of columns from a table. The source table has many - around 20-30 numeric columns and I would like to read only a set of those columns from the source table and keep appending the values of those columns to the destination table. My DB is on Oracle and the programming language is ...
[ { "answer_id": 521383, "author": "Schwern", "author_id": 14660, "author_profile": "https://Stackoverflow.com/users/14660", "pm_score": 1, "selected": false, "text": "<p>The problem seems a little vague, and frankly a little odd. The fact that there's hundreds of columns in a single tabl...
2009/02/06
[ "https://Stackoverflow.com/questions/521278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61395/" ]
My requirement is to read some set of columns from a table. The source table has many - around 20-30 numeric columns and I would like to read only a set of those columns from the source table and keep appending the values of those columns to the destination table. My DB is on Oracle and the programming language is JDB...
Shamik, okay, you're loading an OLAP database with OLTP data. What's the acceptable latency? Does your OLAP need today's data before people come in to the office tomorrow morning, or is it closer to real time. Saying the Inserts are "frequent" doesn't mean anything. Some of us are used to thousands of txns/sec - to o...
521,281
<p>I am working on modifying a control on a existing site. All controls from the site inherit form a base class. I have a requirement to hide several links on the master page so I wrote this method on my control:</p> <pre><code>private void HideCartLink (bool visible) { Control control1 = Page.Master.FindControl( ...
[ { "answer_id": 521297, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 3, "selected": true, "text": "<p>If I'm honest, I'd be more inclined to turn this upside-down. I'd have something that <em>added</em> the buttons/...
2009/02/06
[ "https://Stackoverflow.com/questions/521281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46780/" ]
I am working on modifying a control on a existing site. All controls from the site inherit form a base class. I have a requirement to hide several links on the master page so I wrote this method on my control: ``` private void HideCartLink (bool visible) { Control control1 = Page.Master.FindControl( "link1" ); con...
If I'm honest, I'd be more inclined to turn this upside-down. I'd have something that *added* the buttons/links as necessary, based on the criteria of the page. This would then give you something more like a toolbar, and in fact you could make it configurable (or based on user privileges) which buttons/links appear on ...
521,291
<p>I extended the <code>jQuery</code> effects called <code>slideRightShow()</code> and <code>slideLeftHide()</code> with a couple functions that work similarly to <code>slideUp()</code> and <code>slideDown()</code> as seen below. However, I would also like to implement <code>slideLeftShow()</code> and <code>slideRight...
[ { "answer_id": 521468, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 9, "selected": true, "text": "<p>This feature is included as part of jquery ui <a href=\"http://docs.jquery.com/UI/Effects/Slide\" rel=\"noreferrer\">ht...
2009/02/06
[ "https://Stackoverflow.com/questions/521291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30133/" ]
I extended the `jQuery` effects called `slideRightShow()` and `slideLeftHide()` with a couple functions that work similarly to `slideUp()` and `slideDown()` as seen below. However, I would also like to implement `slideLeftShow()` and `slideRightHide()`. I know there are substantial libraries that offer this type of t...
This feature is included as part of jquery ui <http://docs.jquery.com/UI/Effects/Slide> if you want to extend it with your own names you can use this. ``` jQuery.fn.extend({ slideRightShow: function() { return this.each(function() { $(this).show('slide', {direction: 'right'}, 1000); }); }, slideL...
521,294
<p>What does this JavaScript do exactly?</p> <pre><code>parent.kill = 1; </code></pre> <p>This is used in a project I'm working on to do some sort of session expiration but I've never seen it before. It's loaded in an <code>iframe</code> so I'm assuming that it is targeting the DOM <code>document.window</code>.</p>
[ { "answer_id": 521318, "author": "mmcglynn", "author_id": 4241, "author_profile": "https://Stackoverflow.com/users/4241", "pm_score": 0, "selected": false, "text": "<p>I don't think that's part of the language - maybe part of a library?</p>\n" }, { "answer_id": 521397, "autho...
2009/02/06
[ "https://Stackoverflow.com/questions/521294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6406/" ]
What does this JavaScript do exactly? ``` parent.kill = 1; ``` This is used in a project I'm working on to do some sort of session expiration but I've never seen it before. It's loaded in an `iframe` so I'm assuming that it is targeting the DOM `document.window`.
The child iframe is setting the variable `kill` in the `parent` `window`'s global scope. What the `parent` does with that variable cannot be determined from just that line of javascript.
521,298
<p>When should you use struct and not class in C#? My conceptual model is that structs are used in times when the item is <em>merely a collection of value types</em>. A way to logically hold them all together into a cohesive whole.</p> <p>I came across these rules <a href="https://web.archive.org/web/20110829190107/h...
[ { "answer_id": 521309, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 7, "selected": false, "text": "<p>Use a struct when you want value semantics as opposed to reference semantics.</p>\n<p>If you need reference semantics...
2009/02/06
[ "https://Stackoverflow.com/questions/521298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47630/" ]
When should you use struct and not class in C#? My conceptual model is that structs are used in times when the item is *merely a collection of value types*. A way to logically hold them all together into a cohesive whole. I came across these rules [here](https://web.archive.org/web/20110829190107/http://www.johnnycant...
The source referenced by the OP has some credibility ...but what about Microsoft - what is the stance on struct usage? I sought some extra [learning from Microsoft](http://msdn.microsoft.com/en-us/library/ms229017.aspx), and here is what I found: > > **Consider defining a structure instead of a class if instances of...
521,310
<p>I am using ASP.NET C#.</p> <p>How do I implement URL re-writing procedure that is similar to StackOverflow.com?</p> <pre><code>http://stackoverflow.com/questions/358630/how-to-search-date-in-sql </code></pre> <p>Also, what is the meaning of values such as "358630" in the URL? Is this the question ID (the basis fo...
[ { "answer_id": 521333, "author": "Franci Penov", "author_id": 17028, "author_profile": "https://Stackoverflow.com/users/17028", "pm_score": 5, "selected": true, "text": "<p>SO is using <a href=\"http://asp.net/mvc\" rel=\"nofollow noreferrer\">ASP.NET MVC</a>. You really need to read in ...
2009/02/06
[ "https://Stackoverflow.com/questions/521310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45261/" ]
I am using ASP.NET C#. How do I implement URL re-writing procedure that is similar to StackOverflow.com? ``` http://stackoverflow.com/questions/358630/how-to-search-date-in-sql ``` Also, what is the meaning of values such as "358630" in the URL? Is this the question ID (the basis for which they use to fetch the dat...
SO is using [ASP.NET MVC](http://asp.net/mvc). You really need to read in details how MVC URL rewriting works, but the gist of it is that the 'questions' part in the URL is the name of the Controller class (which roughly corresponds to the 'showdetails' in your URL) and the number is a ID parameter for the default acti...
521,321
<p><strong>&lt;edit></strong> Thanks to everyone who has answered so far. The zip and os.path.join are really helpful. Any suggestions on ways to list the counter in front, without doing something like this:</p> <pre><code>zip(range(len(files)), files, directories) </code></pre> <p><strong>&lt;/edit></strong></p> <p...
[ { "answer_id": 521345, "author": "Ryan", "author_id": 17917, "author_profile": "https://Stackoverflow.com/users/17917", "pm_score": 3, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>directories = ['directory_0', 'directory_1', 'directory_2']\nfiles = ['file_a', 'file_b', 'fil...
2009/02/06
[ "https://Stackoverflow.com/questions/521321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**<edit>** Thanks to everyone who has answered so far. The zip and os.path.join are really helpful. Any suggestions on ways to list the counter in front, without doing something like this: ``` zip(range(len(files)), files, directories) ``` **</edit>** Hi, I'm in the process of learning Python, but I come from a ba...
``` import os.path for dir, file in zip(directories, files): print(os.path.join(dir, file)) # for directories, files ``` you can have it as a list comprehension as well, creating list of string with print going after that] with counter: ``` for i, (dir, file) in enumerate(zip(directories, f...
521,334
<p>How do I set the initial value of a databound drop down list in ASP.NET? </p> <p>For instance, I want the values, but the first value to display should be -- Select One ---, with a null value.</p>
[ { "answer_id": 521357, "author": "Element", "author_id": 50970, "author_profile": "https://Stackoverflow.com/users/50970", "pm_score": 0, "selected": false, "text": "<p>Add an item and set its \"Selected\" property to true, you will probably want to set \"appenddatabounditems\" property ...
2009/02/06
[ "https://Stackoverflow.com/questions/521334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4241/" ]
How do I set the initial value of a databound drop down list in ASP.NET? For instance, I want the values, but the first value to display should be -- Select One ---, with a null value.
I think what you want to do is this: ``` <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true"> <asp:ListItem Text="--Select One--" Value="" /> </asp:DropDownList> ``` Make sure the 'AppendDataBoundItems' is set to *true* or else you will clear the '--Select One--' list item when you...
521,338
<p>The app was working fine but now a few weeks later when the new version begun testing, it crashes. Tried it on five of the workstations, it crashes only on two of them. And the only common about them I can find is that those two have Windows installed with English language.</p> <p>Its a DirectX 8.1 application, wri...
[ { "answer_id": 521389, "author": "arul", "author_id": 15409, "author_profile": "https://Stackoverflow.com/users/15409", "pm_score": 1, "selected": false, "text": "<p>Make sure you don't compare string messages when checking for errors. I've seen errors like this in a code that was search...
2009/02/06
[ "https://Stackoverflow.com/questions/521338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56763/" ]
The app was working fine but now a few weeks later when the new version begun testing, it crashes. Tried it on five of the workstations, it crashes only on two of them. And the only common about them I can find is that those two have Windows installed with English language. Its a DirectX 8.1 application, written in C+...
Problem solved. And as a note to others having the same problem, I found the answer in this [question](https://stackoverflow.com/questions/265481/application-has-failed-to-start-application-configuration-is-incorrect-vc). We installed the VS2005 CRT alright, but not the SP1 one. **Edit**: Although, I still have no ide...
521,366
<p>I want to create a extremely simple bash script, <code>my_copy.sh</code>, that reads arbitrary number of input files, a destination directory, and finally asks for confirmation if you want to copy the files. </p> <p>Example usage: <code>./my_copy.sh</code></p> <pre><code> Type in the file names to copy: file1 fil...
[ { "answer_id": 521399, "author": "Matt K", "author_id": 25844, "author_profile": "https://Stackoverflow.com/users/25844", "pm_score": 1, "selected": false, "text": "<p>Your second question is quite difficult. The shell will attempt to interpret * and replace it with all items in the curr...
2009/02/06
[ "https://Stackoverflow.com/questions/521366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to create a extremely simple bash script, `my_copy.sh`, that reads arbitrary number of input files, a destination directory, and finally asks for confirmation if you want to copy the files. Example usage: `./my_copy.sh` ``` Type in the file names to copy: file1 file2 Anna Kurt Arne Type in the directory to...
Unless the \* is escaped or quoted when calling your script, the shell will expand it before you script gets it. > > ./my\_copy '\*' > > > or > > ./my\_copy \\* > > > It looks like you're trying to add a simple confirmation wrapper around 'cp'. Or are you trying to make it interactively prompt the user?
521,382
<p>I want to delete every "_svn" in every folder and subfolder...</p> <p>For example</p> <pre> c:\ proyect1 _svn images _svn banner _svn buttons _svn </pre> <p>Then I run something like </p> <pre><code>rm-recurse c:\proyect1 _svn </code></pre> <p>And I should get:</p> <pre> c...
[ { "answer_id": 521391, "author": "BlackTigerX", "author_id": 8411, "author_profile": "https://Stackoverflow.com/users/8411", "pm_score": 4, "selected": false, "text": "<pre><code>for /f \"usebackq\" %d in (`\"dir _svn /ad/b/s\"`) do rd /s/q \"%d\"\n</code></pre>\n\n<p><a href=\"http://eb...
2009/02/06
[ "https://Stackoverflow.com/questions/521382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47633/" ]
I want to delete every "\_svn" in every folder and subfolder... For example ``` c:\ proyect1 _svn images _svn banner _svn buttons _svn ``` Then I run something like ``` rm-recurse c:\proyect1 _svn ``` And I should get: ``` c:\ proyect1 images banner buttons...
Similar to BlackTigerX's "for", I was going to suggest `for /d /r . %d in (_svn) do @if exist "%d" rd /s/q "%d"`
521,401
<p>I am currently in a try catch finding if a property has been set properly to the bool value that it should be like this...</p> <pre><code>public void RunBusinessRule(MyCustomType customType) { try { if (customType.CustomBoolProperty == true) { DoSomething(); } else ...
[ { "answer_id": 521412, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": true, "text": "<pre><code>ArgumentException\nInvalidOperationException\nFormatException\n</code></pre>\n\n<p>The passed in argument wasn't goo...
2009/02/06
[ "https://Stackoverflow.com/questions/521401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62039/" ]
I am currently in a try catch finding if a property has been set properly to the bool value that it should be like this... ``` public void RunBusinessRule(MyCustomType customType) { try { if (customType.CustomBoolProperty == true) { DoSomething(); } else { ...
``` ArgumentException InvalidOperationException FormatException ``` The passed in argument wasn't good.
521,407
<h2><strong>object is to class as enum is to ...?</strong></h2> <p><br><br> I'm using C# but I'd like the answer for Java as well, if there is one.</p> <p>Thank you, as always.</p>
[ { "answer_id": 521409, "author": "Dana the Sane", "author_id": 2567, "author_profile": "https://Stackoverflow.com/users/2567", "pm_score": 2, "selected": false, "text": "<p>In Java, Enum is now a type of class, so you can have an enum object.</p>\n" }, { "answer_id": 521440, ...
2009/02/06
[ "https://Stackoverflow.com/questions/521407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41662/" ]
**object is to class as enum is to ...?** ----------------------------------------- I'm using C# but I'd like the answer for Java as well, if there is one. Thank you, as always.
It doesn't matter whether we're discussing C# or Java, the sentence cannot be completed the way you expect it to, because of the following fundamental flaw in it: both enum and class are *types*, whereas an object is a particular *instance* of a type. In C#, an enum is a value type that restricts an underlying numeric...
521,408
<p>I am using this method to try find a match, in an example:</p> <pre><code>Regex.Match("A2-TS-OIL", "TS-OIL", RegexOptions.IgnoreCase).Success; </code></pre> <p>I got a true result. I am confused. I think this should return false since there is no special characters in the pattern. If I use <code>".+TS-OIL"</code>,...
[ { "answer_id": 521445, "author": "codybartfast", "author_id": 53252, "author_profile": "https://Stackoverflow.com/users/53252", "pm_score": 4, "selected": false, "text": "<p>A regex match doesn't have to start at begining of the input. You might want:</p>\n\n<pre><code>^TS-OIL\n</code><...
2009/02/06
[ "https://Stackoverflow.com/questions/521408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62776/" ]
I am using this method to try find a match, in an example: ``` Regex.Match("A2-TS-OIL", "TS-OIL", RegexOptions.IgnoreCase).Success; ``` I got a true result. I am confused. I think this should return false since there is no special characters in the pattern. If I use `".+TS-OIL"`, true should be returned (`.` for any...
A regex match doesn't have to start at begining of the input. You might want: ``` ^TS-OIL ``` if you want to only match at the start. Or: ``` ^TS-OIL$ ``` to prevent it matching TS-OIL-123. `^` matches the start of the input, $ matches the end. I believe there are some place where the `^` and `$` get added aut...
521,418
<p>I am trying to download the content of a secure (uses https) webpage using php and curl libraries.</p> <p>However, reading failed and I get error 60: "SSL certificate problem, verify that the CA cert is OK."</p> <p>also "Details: SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"</p> <p>So...pretty self expla...
[ { "answer_id": 521460, "author": "Ryan Graham", "author_id": 62525, "author_profile": "https://Stackoverflow.com/users/62525", "pm_score": 7, "selected": true, "text": "<p>It sounds like you might be misinterpreting the error. It looks to me like the site you're connecting to is self-sig...
2009/02/06
[ "https://Stackoverflow.com/questions/521418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62031/" ]
I am trying to download the content of a secure (uses https) webpage using php and curl libraries. However, reading failed and I get error 60: "SSL certificate problem, verify that the CA cert is OK." also "Details: SSL3\_GET\_SERVER\_CERTIFICATE:certificate verify failed" So...pretty self explanatory error msg's. ...
It sounds like you might be misinterpreting the error. It looks to me like the site you're connecting to is self-signed or some other common problem. Just like the usual browser warning, you're easiest work around is to disable the checks. You'll need to set `CURLOPT_SSL_VERIFYPEER` and `CURLOPT_SSL_VERIFYHOST` to `FA...
521,454
<p>When creating a new xml file, how does one go about structuring the file correctly or the best possible way. By structure, which may not be the best word in this case, I mean how does one choose between making something an element or an attribute of an element. For example, if I create a Person.xml file which conta...
[ { "answer_id": 521480, "author": "Richard Ev", "author_id": 39709, "author_profile": "https://Stackoverflow.com/users/39709", "pm_score": 2, "selected": false, "text": "<p>It's pretty much a subjective thing.</p>\n" }, { "answer_id": 521482, "author": "George Stocker", "a...
2009/02/06
[ "https://Stackoverflow.com/questions/521454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
When creating a new xml file, how does one go about structuring the file correctly or the best possible way. By structure, which may not be the best word in this case, I mean how does one choose between making something an element or an attribute of an element. For example, if I create a Person.xml file which contains ...
XML files should (not to start a holy war) be structured as follows: If it's data, or something that can be changed, then it should be like this: ``` <Person> <FirstName>John</FirstName> <LastName>Smith</LastName> <Age>23</Age> </Person> ``` If it's an attribute of the thing `Person` then it should be like th...
521,490
<p>The naïve <code>FOO = empty_clob()</code> complains about incompatible types. I tried Googling, but (once again) had little success searching for help with Oracle. Thanks.</p>
[ { "answer_id": 521565, "author": "Igor Zelaya", "author_id": 22769, "author_profile": "https://Stackoverflow.com/users/22769", "pm_score": 2, "selected": false, "text": "<p>something like this should work for initialization:</p>\n\n<pre><code>DECLARE\n dummy clob;\n dummy2 clob;\nBE...
2009/02/06
[ "https://Stackoverflow.com/questions/521490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4203/" ]
The naïve `FOO = empty_clob()` complains about incompatible types. I tried Googling, but (once again) had little success searching for help with Oracle. Thanks.
If you are trying to do the comparison in PL/SQL, you can just test equality as Igor's solution does ``` SQL> ed Wrote file afiedt.buf 1 DECLARE 2 dummy clob; 3 BEGIN 4 dummy := empty_clob(); 5 IF dummy = empty_clob() THEN 6 dbms_output.put_line( 'Dummy is empty' ); 7 ...
521,493
<p>I have a 2D bitmap-like array of let's say 500*500 values. I'm trying to create a linear gradient on the array, so the resulting bitmap would look something like this (in grayscale): <a href="https://i.stack.imgur.com/Zdn9Q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zdn9Q.jpg" alt="Example gr...
[ { "answer_id": 521538, "author": "David Z", "author_id": 56541, "author_profile": "https://Stackoverflow.com/users/56541", "pm_score": 4, "selected": false, "text": "<p>This is really a math question, so it might be debatable whether it really \"belongs\" on Stack Overflow, but anyway: y...
2009/02/06
[ "https://Stackoverflow.com/questions/521493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38256/" ]
I have a 2D bitmap-like array of let's say 500\*500 values. I'm trying to create a linear gradient on the array, so the resulting bitmap would look something like this (in grayscale): [![Example gradient](https://i.stack.imgur.com/Zdn9Q.jpg)](https://i.stack.imgur.com/Zdn9Q.jpg) (source: [showandtell-graphics.com](h...
In your example image, it looks like you have a radial gradient. Here's my impromtu math explanation for the steps you'll need. Sorry for the math, the other answers are better in terms of implementation. 1. Define a linear function (like y = x + 1) with the domain (i.e. x) being from the colour you want to start with...
521,502
<p>I want to avoid calling a lot of <code>isinstance()</code> functions, so I'm looking for a way to get the concrete class name for an instance variable as a string.</p> <p>Any ideas?</p>
[ { "answer_id": 521510, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 9, "selected": true, "text": "<pre><code> instance.__class__.__name__\n</code></pre>\n\n<p>example:</p>\n\n<pre><code>&gt;&gt;&gt; class A():\n pa...
2009/02/06
[ "https://Stackoverflow.com/questions/521502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7305/" ]
I want to avoid calling a lot of `isinstance()` functions, so I'm looking for a way to get the concrete class name for an instance variable as a string. Any ideas?
``` instance.__class__.__name__ ``` example: ``` >>> class A(): pass >>> a = A() >>> a.__class__.__name__ 'A' ```
521,505
<p>I am trying to understand lambdas and I get the idea but how do I define multiple conditions for a Point2 [x,y] comparison, so something like:</p> <pre><code>if x1 &lt; x2: -1 if x1 == x2: 0 if x1 &gt; x2: 1 </code></pre>
[ { "answer_id": 521517, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>EDIT: Updated to be real Python according to <a href=\"http://www.python.org/dev/peps/pep-0308/\" rel=\"nofollow nore...
2009/02/06
[ "https://Stackoverflow.com/questions/521505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51816/" ]
I am trying to understand lambdas and I get the idea but how do I define multiple conditions for a Point2 [x,y] comparison, so something like: ``` if x1 < x2: -1 if x1 == x2: 0 if x1 > x2: 1 ```
The code above is equivalent to: ``` cmp(x1,x2) ``` or in a (ugly) lambda expression: ``` lambda x1,x2: 1 if x1>x2 else (0 if x1==x2 else -1) ``` (works only in Python 2.6 and above). Normally you should use lambda expressions only for functions like ``` def fun(...): return ... ```
521,513
<p>Has anyone run into this problem...</p> <p>In my layout.phtml I have:</p> <pre><code>&lt;head&gt; &lt;?= $this-&gt;headTitle('Control Application - ') ?&gt; &lt;/head&gt; </code></pre> <p>then in index.phtml I have:</p> <pre><code>&lt;? $this-&gt;headTitle()-&gt;append('Client List'); ?&gt; </code></pre> <p...
[ { "answer_id": 521547, "author": "Jack Sleight", "author_id": 39428, "author_profile": "https://Stackoverflow.com/users/39428", "pm_score": 2, "selected": false, "text": "<p>I don't actually use headTitle, but do use ZF, and I had a quick look on the mailing list, this might solve the pr...
2009/02/06
[ "https://Stackoverflow.com/questions/521513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48523/" ]
Has anyone run into this problem... In my layout.phtml I have: ``` <head> <?= $this->headTitle('Control Application - ') ?> </head> ``` then in index.phtml I have: ``` <? $this->headTitle()->append('Client List'); ?> ``` I expect that, when I go to my index action, the title should be 'Control Application - ...
Default behaviour of the headTitle() is to append to the stack. Before calling headTitle() in layout.phtml, your stack is: > > Clientlist > > > Then, you call headTitle with the first argument and no second argument ([which makes it default to APPEND](http://framework.zend.com/manual/en/zend.view.helpers.html#zen...
521,525
<p>How can I compute the minimum <b>bipartite</b> vertex cover in C#? Is there a code snippet to do so?</p> <p>EDIT: while the problem <i>is NP-complete</i> for <b>general graphs</b>, it <b>is solvable in polynomial time</b> for bipartite graphs. I know that it's somehow related to maximum matching in <strong>bipartit...
[ { "answer_id": 521722, "author": "GWLlosa", "author_id": 18071, "author_profile": "https://Stackoverflow.com/users/18071", "pm_score": 1, "selected": false, "text": "<p>Its probably best to just go ahead and pick a node at random. For each node, either it goes in the vertex cover, or al...
2009/02/06
[ "https://Stackoverflow.com/questions/521525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I compute the minimum **bipartite** vertex cover in C#? Is there a code snippet to do so? EDIT: while the problem *is NP-complete* for **general graphs**, it **is solvable in polynomial time** for bipartite graphs. I know that it's somehow related to maximum matching in **bipartite** graphs (by Konig's theorem...
I could figure it out: ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; class VertexCover { static void Main(string[] args) { var v = new VertexCover(); v.ParseInput(); v.FindVertexCover(); v.PrintResults(); } private void Print...
521,532
<p>In other words, what's the sprintf equivalent to pprint? </p>
[ { "answer_id": 521545, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 9, "selected": true, "text": "<p>The <a href=\"http://docs.python.org/library/pprint.html\" rel=\"noreferrer\">pprint</a> module has a function named...
2009/02/06
[ "https://Stackoverflow.com/questions/521532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63439/" ]
In other words, what's the sprintf equivalent to pprint?
The [pprint](http://docs.python.org/library/pprint.html) module has a function named [pformat](http://docs.python.org/library/pprint.html#pprint.pformat), for just that purpose. From the documentation: > > Return the formatted representation of object as a string. indent, > width and depth will be passed to the Pret...
521,554
<p>I'm trying to display an update progress loading image whenever my update panel does it's Ajax thing. I've looked around at tutorials and it seems really straightforward but I'm having no luck. Here is pretty much what I have...</p> <pre><code>&lt;div id="panelWrapper"&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" ru...
[ { "answer_id": 521569, "author": "Element", "author_id": 50970, "author_profile": "https://Stackoverflow.com/users/50970", "pm_score": 2, "selected": false, "text": "<p>Don't put the update progress control inside the update panel control</p>\n" }, { "answer_id": 521984, "aut...
2009/02/06
[ "https://Stackoverflow.com/questions/521554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49294/" ]
I'm trying to display an update progress loading image whenever my update panel does it's Ajax thing. I've looked around at tutorials and it seems really straightforward but I'm having no luck. Here is pretty much what I have... ``` <div id="panelWrapper"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="...
I guess I figured out what was going on. The issue wasn't with anything I was doing wrong with the UpdateProgress or Panel. It was that I had other stuff loading in the background that was apparently holding up the UpdatePanel's Ajaxyness. So basically what happened was that the loading icon wouldn't show up on the i...
521,556
<p>I Have a unique id generated for each record that I store into the database I want to pass that id to PHP and run a select statement against that and get a value back from the database and pass it back to flash, what is the best possible way to do it?</p> <p>PS: I am using AS3</p>
[ { "answer_id": 522249, "author": "David Hanak", "author_id": 42136, "author_profile": "https://Stackoverflow.com/users/42136", "pm_score": 1, "selected": false, "text": "<p>I don't really see your problem. What makes this really different from a client-side javascript invoking a server-s...
2009/02/06
[ "https://Stackoverflow.com/questions/521556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16458/" ]
I Have a unique id generated for each record that I store into the database I want to pass that id to PHP and run a select statement against that and get a value back from the database and pass it back to flash, what is the best possible way to do it? PS: I am using AS3
You have to call the php script which makes the sql connection and gets the value. Here: <http://livedocs.adobe.com/flex/2/langref/flash/net/URLLoader.html#includeExamplesSummary> The important part is here: ``` public function URLLoaderExample() { var loader:URLLoader = new URLLoader(); configureLis...
521,557
<p>I have a collection of objects called <code>Gigs</code>.</p> <p>Each <code>Gig</code> has an <code>Acts</code> collection.</p> <p>Using Linq I want to query my collection of gigs to get all gigs where with an act that has an id of 7 for example.</p> <pre><code>act.id = 7; </code></pre> <p>So I started writting.....
[ { "answer_id": 521577, "author": "Mike_G", "author_id": 52051, "author_profile": "https://Stackoverflow.com/users/52051", "pm_score": 3, "selected": false, "text": "<pre><code>var x = gigs.Where(g=&gt;g.Acts.Select(a=&gt;a.ID).Contains(7));\n</code></pre>\n\n<p>these two queries also ret...
2009/02/06
[ "https://Stackoverflow.com/questions/521557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46616/" ]
I have a collection of objects called `Gigs`. Each `Gig` has an `Acts` collection. Using Linq I want to query my collection of gigs to get all gigs where with an act that has an id of 7 for example. ``` act.id = 7; ``` So I started writting... ``` return from gig in qry where gig.Acts //not sure how to do ...
Essentially the same as Mike\_G, only more verbose syntax and using equality. ``` var myCollection = from gig in qry where gig.Acts.Any(act => act.ID == 7) select gig; ``` Just an edit to bring comments to the answer: Actually query is for an ID on a member (Artist) on the Act ...
521,563
<p>I'm adjusting the height of the box with no problems, now I would like to adjust the height of the box grabbing the top handle and adjust height but upwards. What would be a good way of doing this? thanks </p> <p>(current downwards code)</p> <pre><code>var mY = event.clientY; var originalHeight = parseInt(documen...
[ { "answer_id": 521593, "author": "Andy Mikula", "author_id": 58114, "author_profile": "https://Stackoverflow.com/users/58114", "pm_score": 2, "selected": false, "text": "<p>An element's position is defined by its top-left corner - you'll have to move it up at the same time as you extend ...
2009/02/06
[ "https://Stackoverflow.com/questions/521563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm adjusting the height of the box with no problems, now I would like to adjust the height of the box grabbing the top handle and adjust height but upwards. What would be a good way of doing this? thanks (current downwards code) ``` var mY = event.clientY; var originalHeight = parseInt(document.getElementById('som...
An element's position is defined by its top-left corner - you'll have to move it up at the same time as you extend it from the bottom.
521,581
<p>I am writing an app that allows people to schedule things for certain times and then displays them. The time of the event is stored in the database as an SQL TIME, because there are things I'm doing in the DB that need this structure.</p> <p>However, on the output page I want the time to be in 12:00 am/pm format, ...
[ { "answer_id": 521605, "author": "alphadogg", "author_id": 59494, "author_profile": "https://Stackoverflow.com/users/59494", "pm_score": 1, "selected": false, "text": "<p>You do not state which DBMS and which platform, but most modern ones would have some sort of CONVERT or CAST function...
2009/02/06
[ "https://Stackoverflow.com/questions/521581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am writing an app that allows people to schedule things for certain times and then displays them. The time of the event is stored in the database as an SQL TIME, because there are things I'm doing in the DB that need this structure. However, on the output page I want the time to be in 12:00 am/pm format, but I don't...
The output page is your presentation layer. Don't mix up presentation issues into the database layer. Especially don't force a denormalisation just for presentation's sake. > > i dont want to run a conversion script every time i step through the database output loop > > > Whyever not? Depending on what language y...
521,591
<p>Hi there is possible to set a default language or set a new one in RichTextBox, i want to set it in "es-PE" for spellchecker propouses</p> <p>Thanks!</p>
[ { "answer_id": 521607, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 1, "selected": false, "text": "<p>Have you tried setting the current thread's culture to the one you want? Most stuff in .NET takes the culture from t...
2009/02/06
[ "https://Stackoverflow.com/questions/521591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1388553/" ]
Hi there is possible to set a default language or set a new one in RichTextBox, i want to set it in "es-PE" for spellchecker propouses Thanks!
It would seem to be possible setting the [xml:lang](http://msdn.microsoft.com/en-us/library/ms788718.aspx) as in the code below: ``` <StackPanel> <RichTextBox SpellCheck.IsEnabled="True"/> <RichTextBox SpellCheck.IsEnabled="True" xml:lang="es-PE"/> </StackPanel> ``` The first box checks in the default cul...
521,594
<p>I have a Data Grid View inside a control that is displayed in a certain area in an application.</p> <p>I'd like this activity grid to refresh when F5 is pressed.</p> <p>It's easy enough to do this when the Activity Grid View is the currently focused element on the screen by handling the Key Up event, but this obvi...
[ { "answer_id": 521607, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 1, "selected": false, "text": "<p>Have you tried setting the current thread's culture to the one you want? Most stuff in .NET takes the culture from t...
2009/02/06
[ "https://Stackoverflow.com/questions/521594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1512/" ]
I have a Data Grid View inside a control that is displayed in a certain area in an application. I'd like this activity grid to refresh when F5 is pressed. It's easy enough to do this when the Activity Grid View is the currently focused element on the screen by handling the Key Up event, but this obviously doesn't wor...
It would seem to be possible setting the [xml:lang](http://msdn.microsoft.com/en-us/library/ms788718.aspx) as in the code below: ``` <StackPanel> <RichTextBox SpellCheck.IsEnabled="True"/> <RichTextBox SpellCheck.IsEnabled="True" xml:lang="es-PE"/> </StackPanel> ``` The first box checks in the default cul...
521,596
<p><strong>EDIT:</strong> I have added "Slug" column to address performance issues on specific record selection.</p> <p>I have following columns in my table.</p> <pre><code>Id Int - Primary key (identity, clustered by default) Slug varchar(100) ... EntryDate DateTime </code></pre> <p>Most of the time, I'm ordering t...
[ { "answer_id": 521613, "author": "E.J. Brennan", "author_id": 53686, "author_profile": "https://Stackoverflow.com/users/53686", "pm_score": 0, "selected": false, "text": "<p>Have you tried simply adding a non-clustered index on the entrydate to see what kind of performance gain you get?<...
2009/02/06
[ "https://Stackoverflow.com/questions/521596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5704/" ]
**EDIT:** I have added "Slug" column to address performance issues on specific record selection. I have following columns in my table. ``` Id Int - Primary key (identity, clustered by default) Slug varchar(100) ... EntryDate DateTime ``` Most of the time, I'm ordering the select statement by EntryDate like below. ...
Based on the current table layout you want some indexes like this. ``` CREATE INDEX IX_YourTable_1 ON dbo.YourTable (EntryDate, Id) INCLUDE (SLug) WITH (FILLFACTOR=90) CREATE INDEX IX_YourTable_2 ON dbo.YourTable (EntryDate, Slug) INCLUDE (Id) WITH (FILLFACTOR=80) ``` Add any other columns you are returning to the ...
521,624
<p>I've googled around and searched the MYSQL docs ad nauseam and couldn't find a succinct way of automating deletion of records that exceeded a given timeframe. I've been able to get a query in 5.1 to cast a value of TIMESTAMP to DATETIME within a DIFF function with the current time to see if it meets the criteria of ...
[ { "answer_id": 521635, "author": "Malfist", "author_id": 12243, "author_profile": "https://Stackoverflow.com/users/12243", "pm_score": 1, "selected": false, "text": "<p>Write a query and have it ran on a job every so often. Say, check for the expired rows every 30 minutes or so.</p>\n" ...
2009/02/06
[ "https://Stackoverflow.com/questions/521624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59880/" ]
I've googled around and searched the MYSQL docs ad nauseam and couldn't find a succinct way of automating deletion of records that exceeded a given timeframe. I've been able to get a query in 5.1 to cast a value of TIMESTAMP to DATETIME within a DIFF function with the current time to see if it meets the criteria of exp...
You are talking about using the [MySQL Scheduler](http://dev.mysql.com/doc/refman/5.1/en/events.html). Once you create that event, MySQL will call it automatically at whatever interval you configure it with. If you are having trouble getting it set up, post the query and error your are getting.
521,637
<p>I get the following error when I try to compile an asp.net site using a custom build script.</p> <pre><code>error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an appl...
[ { "answer_id": 521670, "author": "Karmic Coder", "author_id": 36307, "author_profile": "https://Stackoverflow.com/users/36307", "pm_score": 3, "selected": true, "text": "<p>It is likely that your web.config file is placed in a directory that is not the root of the application. On most v...
2009/02/06
[ "https://Stackoverflow.com/questions/521637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49424/" ]
I get the following error when I try to compile an asp.net site using a custom build script. ``` error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS...
It is likely that your web.config file is placed in a directory that is not the root of the application. On most versions of IIS, you can convert any folder on your web site to an application root: 1. Open IIS and navigate to the appropriate folder 2. Right-click on the folder, select properties 3. Under Application S...
521,639
<p>How do you add Javascript file programmatically to the user control?</p> <p>I want the user control to be a complete package - ie I don't want to have to add javascript that's related to the user control on the page where it's used, when I can do it inside the control itself.</p> <p>Since there is no Page object i...
[ { "answer_id": 521654, "author": "Quintin Robinson", "author_id": 12707, "author_profile": "https://Stackoverflow.com/users/12707", "pm_score": 0, "selected": false, "text": "<p>I generally do it when rendering the HTML for the control and depending on whether it's a library injection or...
2009/02/06
[ "https://Stackoverflow.com/questions/521639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57997/" ]
How do you add Javascript file programmatically to the user control? I want the user control to be a complete package - ie I don't want to have to add javascript that's related to the user control on the page where it's used, when I can do it inside the control itself. Since there is no Page object in the user contro...
In the Page\_Load method of control.ascx.cs file: ``` LiteralControl jsResource = new LiteralControl(); jsResource.Text = "<script type=\"text/javascript\" src=\"js/mini-template-control.js\"></script>"; Page.Header.Controls.Add(jsResource); HtmlLink stylesLink = new HtmlLink(); stylesLink.Attributes["rel"] = "styles...
521,668
<p>I have a ComboBox in WPF which is databound, and has data template which controls how each of the items is displayed. I have made it so that each item is displayed with two bits of text (for the Name and Path properties) and one image (for the Icon property).</p> <p>At the moment when I select an item from the Comb...
[ { "answer_id": 521739, "author": "Jobi Joy", "author_id": 8091, "author_profile": "https://Stackoverflow.com/users/8091", "pm_score": 1, "selected": true, "text": "<p>Just place the Property Binding expression to the textBox,You dont need to apply template.</p>\n\n<p>Another way to get e...
2009/02/06
[ "https://Stackoverflow.com/questions/521668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1912/" ]
I have a ComboBox in WPF which is databound, and has data template which controls how each of the items is displayed. I have made it so that each item is displayed with two bits of text (for the Name and Path properties) and one image (for the Icon property). At the moment when I select an item from the ComboBox the t...
Just place the Property Binding expression to the textBox,You dont need to apply template. Another way to get exact Data template, Place a ContentControl in the place of textBox and assign the same DataTemplate (say x:Name="robinTemplate") ``` <ContentControl Content="{Binding ElementName=cmbBox,Path=SelectedValue}" ...
521,674
<p>Right now I am using a list, and was expecting something like:</p> <pre><code>verts = list (1000) </code></pre> <p>Should I use array instead?</p>
[ { "answer_id": 521688, "author": "Steve Losh", "author_id": 13498, "author_profile": "https://Stackoverflow.com/users/13498", "pm_score": 10, "selected": true, "text": "<p>The first thing that comes to mind for me is:</p>\n\n<pre><code>verts = [None]*1000\n</code></pre>\n\n<p>But do you ...
2009/02/06
[ "https://Stackoverflow.com/questions/521674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51816/" ]
Right now I am using a list, and was expecting something like: ``` verts = list (1000) ``` Should I use array instead?
The first thing that comes to mind for me is: ``` verts = [None]*1000 ``` But do you really need to preinitialize it?
521,687
<p>Is there a C# equivalent of Python's <code>enumerate()</code> and Ruby's <code>each_with_index</code>?</p>
[ { "answer_id": 521700, "author": "David Morton", "author_id": 45916, "author_profile": "https://Stackoverflow.com/users/45916", "pm_score": 6, "selected": false, "text": "<p>The C# foreach doesn't have a built in index. You'll need to add an integer outside the foreach loop and incremen...
2009/02/06
[ "https://Stackoverflow.com/questions/521687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53607/" ]
Is there a C# equivalent of Python's `enumerate()` and Ruby's `each_with_index`?
You can do the following ``` foreach (var it in someCollection.Select((x, i) => new { Value = x, Index = i }) ) { if (it.Index > SomeNumber) // } ``` This will create an anonymous type value for every entry in the collection. It will have two properties * `Value`: with the original value in the collection ...
521,692
<p>I am upgrading my environment from eclipse 3.3.1 and java 1.4 to eclipse 3.4.1 and java 1.5. My unit tests are in jUnit 3.</p> <p>eclipse java version 1.5.0__17</p> <p>stand alone env version 1.5.0__12, or 1.5.0-17, both work.</p> <p>I have a method on a class that writes an XML file to disk. It calls Transformer...
[ { "answer_id": 521708, "author": "eljenso", "author_id": 30316, "author_profile": "https://Stackoverflow.com/users/30316", "pm_score": 0, "selected": false, "text": "<p>Add the Xalan JAR to the classpath.</p>\n\n<p>Also see <a href=\"http://bugs.gridsphere.org/browse/GPF-307\" rel=\"nofo...
2009/02/06
[ "https://Stackoverflow.com/questions/521692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7659/" ]
I am upgrading my environment from eclipse 3.3.1 and java 1.4 to eclipse 3.4.1 and java 1.5. My unit tests are in jUnit 3. eclipse java version 1.5.0\_\_17 stand alone env version 1.5.0\_\_12, or 1.5.0-17, both work. I have a method on a class that writes an XML file to disk. It calls TransformerFactory tf = [javax....
I added the following line to setup of the unittest ``` System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); ``` I figured out what to do with a bit of RTFM. <http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFac...