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 |
|---|---|---|---|---|---|---|
428,448 | <p>Does anyone know of a reporting tool that allows for controlling the print job on a page by page basis? Specifically, I need to be able to insert escape sequences to the printer.</p>
<p>The closest I have found is <a href="http://www.datadynamics.com/Products/ProductOverview.aspx?Product=ARNET3" rel="nofollow nore... | [
{
"answer_id": 428506,
"author": "Nik Reiman",
"author_id": 14302,
"author_profile": "https://Stackoverflow.com/users/14302",
"pm_score": 2,
"selected": false,
"text": "<p>From one vim'mer to another -- your search is futile, abort, abort, etc..</p>\n\n<p>If you're frustrated at whatever... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2470/"
] | Does anyone know of a reporting tool that allows for controlling the print job on a page by page basis? Specifically, I need to be able to insert escape sequences to the printer.
The closest I have found is [ActiveReports](http://www.datadynamics.com/Products/ProductOverview.aspx?Product=ARNET3). It provides an interf... | Found it after all :)
<http://haskell.org/haskellwiki/Yi>
Yi supports both vim (with modes and :commands) and emacs keymap. It uses proper incremental parser and is completely extensible with haskell (it interfaces with ghc and compiles your config/plugin + links itself to the result). Tabs, minibuffers and every oth... |
428,452 | <p>Does <a href="http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#474122" rel="nofollow noreferrer">Krzysztof's</a> recommendation apply to constructors? If so, how do you implement it properly?</p>
<blockquote>
<p>We recommend using Collection, ReadOnlyCollection, or KeyedCollection for outputs and pro... | [
{
"answer_id": 428465,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 4,
"selected": true,
"text": "<p>You should avoid downcasting; in your example I'd suggest that the type of your contructor parameter should match (should... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3619/"
] | Does [Krzysztof's](http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#474122) recommendation apply to constructors? If so, how do you implement it properly?
>
> We recommend using Collection, ReadOnlyCollection, or KeyedCollection for outputs and properties and interfaces IEnumerable, ICollection, IList fo... | You should avoid downcasting; in your example I'd suggest that the type of your contructor parameter should match (should be the same as) the type of your member data (i.e. **either** `Collection<String>` **or** `IEnumerable<String>`).
Or there's Marc's solution, which is different: because Marc's solution means that ... |
428,458 | <p>I'm using SQL Server 2005 and would like to know how I can get a list of all tables with the number of records in each.</p>
<p>I know I can get a list of tables using the <code>sys.tables</code> view, but I'm unable to find the count.</p>
<p>Thank you</p>
| [
{
"answer_id": 428468,
"author": "Paul Lefebvre",
"author_id": 25615,
"author_profile": "https://Stackoverflow.com/users/25615",
"pm_score": 2,
"selected": false,
"text": "<p>Perhaps something like this:</p>\n\n<pre><code>SELECT \n [TableName] = so.name, \n [RowCount] = MAX(si.rows... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | I'm using SQL Server 2005 and would like to know how I can get a list of all tables with the number of records in each.
I know I can get a list of tables using the `sys.tables` view, but I'm unable to find the count.
Thank you | From here: <http://web.archive.org/web/20080701045806/http://sqlserver2000.databases.aspfaq.com:80/how-do-i-get-a-list-of-sql-server-tables-and-their-row-counts.html>
```
SELECT
[TableName] = so.name,
[RowCount] = MAX(si.rows)
FROM
sysobjects so,
sysindexes si
WHERE
so.xtype = 'U'
AND
... |
428,461 | <p>I'm trying to read a feed from Yahoo Pipes into a Silverlight Application. I keep getting a SecurityException, which sounds like a cross domain policy problem, but Yahoo pipes, if you go through the pipes.yahooapis domain, has a cross domain policy, so should be ok. I tried the exact same code, but going to the Digg... | [
{
"answer_id": 428688,
"author": "Michael S. Scherotter",
"author_id": 27306,
"author_profile": "https://Stackoverflow.com/users/27306",
"pm_score": 0,
"selected": false,
"text": "<p>There is no Client Access policy file at <a href=\"http://pipes.yahoo.com/crossdomain.xml\" rel=\"nofollo... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22712/"
] | I'm trying to read a feed from Yahoo Pipes into a Silverlight Application. I keep getting a SecurityException, which sounds like a cross domain policy problem, but Yahoo pipes, if you go through the pipes.yahooapis domain, has a cross domain policy, so should be ok. I tried the exact same code, but going to the Digg AP... | The policy file in place is:
```
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only" />
<allow-access-from domain="*" />
</cross-domain-policy>
```
There is a current problem that Silve... |
428,470 | <p>I have created an intranet for our company using PHP. The same menu appears on every page, and includes links to sensitive pages and documents (like Word files).</p>
<p>Currently only in-office employees have access to the site, but we'd like to open it up to some out-of-office contractors. The catch is that I'd ha... | [
{
"answer_id": 428487,
"author": "alxp",
"author_id": 19513,
"author_profile": "https://Stackoverflow.com/users/19513",
"pm_score": 1,
"selected": false,
"text": "<p>I would make a PHP function that generates the menu items in your sidebar or where-ever these links are being shown, and j... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4376/"
] | I have created an intranet for our company using PHP. The same menu appears on every page, and includes links to sensitive pages and documents (like Word files).
Currently only in-office employees have access to the site, but we'd like to open it up to some out-of-office contractors. The catch is that I'd have to rest... | If users are logging in, then you can use their login details to restrict access. You might want to look into the idea of [Access Control Lists](http://en.wikipedia.org/wiki/Access_Control_Lists).
If your users are logging in using Apache, then you can access their user name from $\_SERVER['PHP\_AUTH\_USER']. So you m... |
428,478 | <p>Which should I use? </p>
<pre><code><input type="hidden" name="first_name"
value="<%= person.first_name %>" />
</code></pre>
<p>or </p>
<pre><code><input type="hidden" name="first_name"
value="<%= Html.Encode( person.first_name ) %>" />
</code></pre>
| [
{
"answer_id": 428519,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 4,
"selected": true,
"text": "<p>You should Html.Encode else a \" in the field could lead to injection problems</p>\n"
},
{
"answer_id": 42... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34798/"
] | Which should I use?
```
<input type="hidden" name="first_name"
value="<%= person.first_name %>" />
```
or
```
<input type="hidden" name="first_name"
value="<%= Html.Encode( person.first_name ) %>" />
``` | You should Html.Encode else a " in the field could lead to injection problems |
428,513 | <p>I have a page with a button that when I click, it retrieves data from a database and stores it into a datatable and binds it to a GridView. This datatable is stored in a Session variable. I also have a button that exports specified columns from the datatable to an excel file, but when I click the export button a s... | [
{
"answer_id": 428537,
"author": "Shawn",
"author_id": 26,
"author_profile": "https://Stackoverflow.com/users/26",
"pm_score": 3,
"selected": true,
"text": "<p>I am guessing the value is by reference, and when you change the Business column name it is changed in Session as well. I would ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | I have a page with a button that when I click, it retrieves data from a database and stores it into a datatable and binds it to a GridView. This datatable is stored in a Session variable. I also have a button that exports specified columns from the datatable to an excel file, but when I click the export button a second... | I am guessing the value is by reference, and when you change the Business column name it is changed in Session as well. I would try this:
```
DataTable dtExport = (Session["dtSearchResults"] as DataTable).Copy();
``` |
428,529 | <p>On this project I am working on right now, one of the newest feature requests is to output expense information which is stored into expense report that matches an Excel worksheet they already use for all of their expense reporting. </p>
<p>I was curious if there was a way that I could take this excel worksheet (wit... | [
{
"answer_id": 428546,
"author": "Ian Varley",
"author_id": 37539,
"author_profile": "https://Stackoverflow.com/users/37539",
"pm_score": 0,
"selected": false,
"text": "<p>Try <a href=\"http://www.aspose.com/categories/file-format-components/aspose.cells-for-.net-and-java/default.aspx\" ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22164/"
] | On this project I am working on right now, one of the newest feature requests is to output expense information which is stored into expense report that matches an Excel worksheet they already use for all of their expense reporting.
I was curious if there was a way that I could take this excel worksheet (with all of i... | I am pretty sure you can can use OleDB to open the excel file(with the template)
**Example 1**
```
string ConnectionString=@"Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Test Projects\Excel example\Excel - reading an excel file\ReadThis.xls;
Extended Properties=Excel 5.0";... |
428,542 | <p>I wonder if it is possible (and how) to provide a class in Objective-C with something like:</p>
<pre><code>Person.Select(@"Name").OrderAsc(@"Name").Where(@"Id").EqualTo(1).And(@"Id").NotEqualTo(2).Load<Array>
</code></pre>
<p>That could be very handy for a project I'm doing.</p>
<p>I like this way of coding... | [
{
"answer_id": 428676,
"author": "AnthonyLambert",
"author_id": 31762,
"author_profile": "https://Stackoverflow.com/users/31762",
"pm_score": 3,
"selected": false,
"text": "<p>There is an acticle comparing the Windows and Cocoa ways of doing this. Cocoa uses Key Paths And NSPredicate....... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | I wonder if it is possible (and how) to provide a class in Objective-C with something like:
```
Person.Select(@"Name").OrderAsc(@"Name").Where(@"Id").EqualTo(1).And(@"Id").NotEqualTo(2).Load<Array>
```
That could be very handy for a project I'm doing.
I like this way of coding present in Django & SubSonic. | The short answer is that there is not an equivalent to Linq for Objective-C but you can fake it with a mix of SQLite, NSPredicate and CoreData calls in a wrapper class shaped to your liking. You'd probably be interested in the [core data guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/... |
428,553 | <p><strong>EDIT</strong>: This issue has been fixed by google in gtest 1.4.0; <a href="http://code.google.com/p/googletest/issues/detail?id=114" rel="nofollow noreferrer">see the original bug report</a> for more information.</p>
<p>I've recently switched to gtest for my C++ testing framework, and one great feature of ... | [
{
"answer_id": 428575,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": 3,
"selected": false,
"text": "<p>Here's how I do it:</p>\n\n<pre><code> <target name=\"junit\" depends=\"compile-tests\" description=\"run all uni... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14302/"
] | **EDIT**: This issue has been fixed by google in gtest 1.4.0; [see the original bug report](http://code.google.com/p/googletest/issues/detail?id=114) for more information.
I've recently switched to gtest for my C++ testing framework, and one great feature of it which I am presently unable to use is the ability to gene... | **Edit**: Google test has fixed this issue, which is included in the gtest 1.4.0 release. [See the original bug report](http://code.google.com/p/googletest/issues/detail?id=114) for more info.
Bah! I've finally found the cause of this problem -- it's because gtest produces one giant XML file for all test results, and ... |
428,559 | <p>Some methods in the Flex API such as <a href="http://livedocs.adobe.com/flex/3/langref/mx/managers/CursorManager.html#setCursor()" rel="nofollow noreferrer">CursorManager.setCursor(cursorClass:Class, priority:int = 2, xOffset:Number = 0, yOffset:Number = 0)</a> take a parameter of type Class for a graphic. This exam... | [
{
"answer_id": 428850,
"author": "Simon Groenewolt",
"author_id": 31884,
"author_profile": "https://Stackoverflow.com/users/31884",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I know it is currently not possible to create classes at runtime inside a flash vm using as3. <stron... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13220/"
] | Some methods in the Flex API such as [CursorManager.setCursor(cursorClass:Class, priority:int = 2, xOffset:Number = 0, yOffset:Number = 0)](http://livedocs.adobe.com/flex/3/langref/mx/managers/CursorManager.html#setCursor()) take a parameter of type Class for a graphic. This example lets you specify a JPG/BMP/SWF as th... | This one looked interesting, so I decided to take a whack at it. Here's what I was able to do -- there's probably a more elegant solution, but I've tested this, and it definitely works ([here's a working example](http://roaming.turbonerd.com/classref.html)), so I figured I'd kick it back over to you to tinker with furt... |
428,573 | <p>Does anyone know of any good tools/utilities for managing <code>Web.Config</code> files between different build/deployment environments?</p>
<p>For example, I have a WCF project that in development I don't want to enable SSL, but I do want it enabled in production. I want different logging settings, different DB c... | [
{
"answer_id": 428613,
"author": "Jeff Martin",
"author_id": 13100,
"author_profile": "https://Stackoverflow.com/users/13100",
"pm_score": 1,
"selected": false,
"text": "<p>I have traditionally used the multiple web.configs as you mentioned. It can be a pain but it is mitigated by file ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28278/"
] | Does anyone know of any good tools/utilities for managing `Web.Config` files between different build/deployment environments?
For example, I have a WCF project that in development I don't want to enable SSL, but I do want it enabled in production. I want different logging settings, different DB connection strings, dif... | We split out all region specific settings into thier own config file. Under the root of the web app we create a config folder and place the region specific settings there. So whatever files are living under the root of config will get picked up.
our web.config looks something like:
```
.
.
.
<appSettings configSource... |
428,617 | <p>What is a <em>closure</em>? Do we have them in .NET?</p>
<p>If they do exist in .NET, could you please provide a code snippet (preferably in C#) explaining it?</p>
| [
{
"answer_id": 428621,
"author": "Dan Monego",
"author_id": 32771,
"author_profile": "https://Stackoverflow.com/users/32771",
"pm_score": 4,
"selected": false,
"text": "<p>Closures are functional values that hold onto variable values from their original scope. C# can use them in the form... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] | What is a *closure*? Do we have them in .NET?
If they do exist in .NET, could you please provide a code snippet (preferably in C#) explaining it? | I have [an article on this very topic](http://csharpindepth.com/Articles/Chapter5/Closures.aspx). (It has lots of examples.)
In essence, a closure is a block of code which can be executed at a later time, but which maintains the environment in which it was first created - i.e. it can still use the local variables etc ... |
428,630 | <p>In ANSI C++, how can I assign the cout stream to a variable name? What I want to do is, if the user has specified an output file name, I send output there, otherwise, send it to the screen. So something like:</p>
<pre><code>ofstream outFile;
if (outFileRequested)
outFile.open("foo.txt", ios::out);
else
out... | [
{
"answer_id": 428662,
"author": "Douglas Mayle",
"author_id": 8458,
"author_profile": "https://Stackoverflow.com/users/8458",
"pm_score": 2,
"selected": false,
"text": "<p>You can find a very detailed explanation of how to do this here:\n<a href=\"http://groups.google.com/group/comp.lan... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12576/"
] | In ANSI C++, how can I assign the cout stream to a variable name? What I want to do is, if the user has specified an output file name, I send output there, otherwise, send it to the screen. So something like:
```
ofstream outFile;
if (outFileRequested)
outFile.open("foo.txt", ios::out);
else
outFile = cout; ... | Use a reference. Note that the reference must be of type `std::ostream`, not `std::ofstream`, since `std::cout` is an `std::ostream`, so you must use the least common denominator.
```
std::ofstream realOutFile;
if(outFileRequested)
realOutFile.open("foo.txt", std::ios::out);
std::ostream & outFile = (outFileRequ... |
428,642 | <p>Can a list box have double click event on its items?</p>
| [
{
"answer_id": 428683,
"author": "Gunny",
"author_id": 12830,
"author_profile": "https://Stackoverflow.com/users/12830",
"pm_score": -1,
"selected": false,
"text": "<p>ListBox controls raise this (at least in Windows Forms) - here is a link that might help get you started, and includes s... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can a list box have double click event on its items? | Yes: [MSDN DHTML Reference](http://msdn.microsoft.com/en-us/library/ms536921(VS.85).aspx). Since your tags say javascript and HTML I am assuming you are talking about a Select element.
```
<select ondblclick = "handler" ... >
``` |
428,715 | <p>With <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query#LINQ_to_SQL" rel="noreferrer">LINQ to SQL</a> in a ASP.NET MVC website I can display objects (records) from my database table.</p>
<p>Now I would like to create a new object and save it back to the database.</p>
<p>In my Controller, I do this:</p... | [
{
"answer_id": 428749,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 6,
"selected": true,
"text": "<p>What you're looking for is:</p>\n\n<pre><code>dataContext.Messages.InsertOnSubmit(message);\ndataContext.SubmitChanges();\n</cod... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | With [LINQ to SQL](http://en.wikipedia.org/wiki/Language_Integrated_Query#LINQ_to_SQL) in a ASP.NET MVC website I can display objects (records) from my database table.
Now I would like to create a new object and save it back to the database.
In my Controller, I do this:
```
var dataContext = new MessageDataConte... | What you're looking for is:
```
dataContext.Messages.InsertOnSubmit(message);
dataContext.SubmitChanges();
```
Assuming you have a `Messages` table mapped into your LINQ to SQL DBML. |
428,723 | <p>I am using this statement to find all files recursively:</p>
<pre><code>fileNames = System.IO.Directory.GetFiles(path, "*.*",
System.IO.SearchOption.AllDirectories);
</code></pre>
<p>The total number of files that are found is sgnificantly lower than wehen using Windows XP Search Companion. This is not caused ... | [
{
"answer_id": 428764,
"author": "chakrit",
"author_id": 3055,
"author_profile": "https://Stackoverflow.com/users/3055",
"pm_score": 0,
"selected": false,
"text": "<p>System files?</p>\n\n<p><br />\nWhat's the result of:</p>\n\n<pre><code>dir/s/as \ndir/s/ah\n</code></pre>\n\n<p>The sea... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using this statement to find all files recursively:
```
fileNames = System.IO.Directory.GetFiles(path, "*.*",
System.IO.SearchOption.AllDirectories);
```
The total number of files that are found is sgnificantly lower than wehen using Windows XP Search Companion. This is not caused by hidden files, I checked... | Search Companion looks inside ZIP files. Do you have any of those in the directory tree? |
428,732 | <p>I am asp.net-MVC using the BeginForm syntax in my source ciew page and I was told if you want the form to submit you have to have the submit Button at the end of the using statement. I don't want to use a Button to call the desired Action I have an Actionlink set up like so:</p>
<pre><code> <%=Html.ActionLink("... | [
{
"answer_id": 428758,
"author": "Jeff Martin",
"author_id": 13100,
"author_profile": "https://Stackoverflow.com/users/13100",
"pm_score": 2,
"selected": false,
"text": "<p>What is the question?</p>\n\n<p>style=\"display:none;\" would hide the button. You aren't indicating where you are... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39809/"
] | I am asp.net-MVC using the BeginForm syntax in my source ciew page and I was told if you want the form to submit you have to have the submit Button at the end of the using statement. I don't want to use a Button to call the desired Action I have an Actionlink set up like so:
```
<%=Html.ActionLink("" + CreateMore, "... | I would once again turn to jQuery to handle this task
```
$(function(){
$('input:submit').hide(); //hide the submit button
$('#submitLinkID').click(function(){ // bind the link's click event
$('input:submit').click(); //click the hidden button
return false; //return false to stop the link from doing anyth... |
428,742 | <p>I have a signed cab on an aspx page. I am seeing the following inconsistent behavior. Any insights would be highly appreciated.</p>
<ol>
<li>On some machines, the cab is downloaded and installed on every page refresh.</li>
<li>On few of those machines, the IE "install cab" dialog pops up on every page refresh, whi... | [
{
"answer_id": 428758,
"author": "Jeff Martin",
"author_id": 13100,
"author_profile": "https://Stackoverflow.com/users/13100",
"pm_score": 2,
"selected": false,
"text": "<p>What is the question?</p>\n\n<p>style=\"display:none;\" would hide the button. You aren't indicating where you are... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a signed cab on an aspx page. I am seeing the following inconsistent behavior. Any insights would be highly appreciated.
1. On some machines, the cab is downloaded and installed on every page refresh.
2. On few of those machines, the IE "install cab" dialog pops up on every page refresh, while on the others it ... | I would once again turn to jQuery to handle this task
```
$(function(){
$('input:submit').hide(); //hide the submit button
$('#submitLinkID').click(function(){ // bind the link's click event
$('input:submit').click(); //click the hidden button
return false; //return false to stop the link from doing anyth... |
428,750 | <p>I have a function that accepts an anonymous function as an argument and sets it to a variable (scoped) for reference. I then try to execute another function with that reference but it obviously fails since that function is out of scope.</p>
<p>I was wondering if anyone knew of a simple way of passing the anonymous... | [
{
"answer_id": 428783,
"author": "Prestaul",
"author_id": 5628,
"author_profile": "https://Stackoverflow.com/users/5628",
"pm_score": 0,
"selected": false,
"text": "<p>You can do:</p>\n\n<pre><code>for (var i=0;i<arguments.length;i++){\n if (typeof(arguments[i])=='function'){\n ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53402/"
] | I have a function that accepts an anonymous function as an argument and sets it to a variable (scoped) for reference. I then try to execute another function with that reference but it obviously fails since that function is out of scope.
I was wondering if anyone knew of a simple way of passing the anonymous function s... | ```
var tf = arguments.splice(i,1)
```
This returns an array into tf. Is eventListen expecting an array? If not use:-
```
var tf = arguments.splice(i,1)[0]
```
Since you don't seem to have any other uses for your other arguments why are you using splice anyway? |
428,766 | <p>Do you know a quick way to implement method(s) from an Interface to a Class. If yes, how can you do it?</p>
<p>Situation : I have an Interface used by over 15 concrete classes. I added a new method and I need to implement this new method in all concrete class.</p>
<p><strong>Update</strong></p>
<p>All my concrete... | [
{
"answer_id": 428779,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 3,
"selected": false,
"text": "<p>Provide an abstract base class with a default implementation, and then have all your concrete classes inherit that ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] | Do you know a quick way to implement method(s) from an Interface to a Class. If yes, how can you do it?
Situation : I have an Interface used by over 15 concrete classes. I added a new method and I need to implement this new method in all concrete class.
**Update**
All my concrete class implement the interface and al... | Since you mentioned that you have ReSharper installed, here some way to quickly implement this:
* Use "Find Usages Advanced" with
"Implementations" checkbox checked
* For each class use quick action
"Implement members"
Also you can use "[solution wide analysis](http://www.jetbrains.com/resharper/features/code_analysi... |
428,798 | <p>What scenarios would warrant the use of the "<a href="http://en.wikipedia.org/wiki/MapReduce" rel="noreferrer">Map and Reduce</a>" algorithm?</p>
<p><br /> Is there a .NET implementation of this algorithm? </p>
| [
{
"answer_id": 603970,
"author": "Joel Martinez",
"author_id": 5416,
"author_profile": "https://Stackoverflow.com/users/5416",
"pm_score": 5,
"selected": false,
"text": "<p>The classes of problem that are well suited for a mapreduce style solution are problems of aggregation. Of extract... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] | What scenarios would warrant the use of the "[Map and Reduce](http://en.wikipedia.org/wiki/MapReduce)" algorithm?
Is there a .NET implementation of this algorithm? | Linq equivalents of Map and Reduce:
If you’re lucky enough to have linq then you don’t need to write your own map and reduce functions. C# 3.5 and Linq already has it albeit under different names.
* Map is `Select`:
```
Enumerable.Range(1, 10).Select(x => x + 2);
```
* Reduce is `Aggregate`:
```
Enumerable.Range(1... |
428,836 | <p>I'm using this code for login, but when I enter a username and password it just loads the page and the login page again is displayed.
Why does this happen?</p>
<pre><code><?php
session_start();
if(!isset($_POST['username']) || !isset($_POST['password']) || empty($_POST['username']) || empty($_POST['passw... | [
{
"answer_id": 428907,
"author": "BrynJ",
"author_id": 29538,
"author_profile": "https://Stackoverflow.com/users/29538",
"pm_score": 1,
"selected": false,
"text": "<p>You have a lot of code there for what you're trying to achieve. Without trying to sound condescending, I'd suggest a retu... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using this code for login, but when I enter a username and password it just loads the page and the login page again is displayed.
Why does this happen?
```
<?php
session_start();
if(!isset($_POST['username']) || !isset($_POST['password']) || empty($_POST['username']) || empty($_POST['password']))
{
?>
... | There's a few things you should change about that code...
1. You don't need to do `!isset()` and `empty()`: just `empty()` will do
2. You shouldn't be duplicating the HTML for the login page - either put it in a variable or `include()` it and use PHP to put the error message in there.
3. You're using deprecated HTML l... |
428,842 | <p>just wondering if anyone could suggest why I might be getting an error? I'm currently trying to execute a macro in a workbook by calling the Application.Run method that the interop exposes.</p>
<p>It's currently throwing the following COM Exception:</p>
<pre><code>{System.Runtime.InteropServices.COMException (0x80... | [
{
"answer_id": 429832,
"author": "Fionnuala",
"author_id": 2548,
"author_profile": "https://Stackoverflow.com/users/2548",
"pm_score": 0,
"selected": false,
"text": "<p>If the macro is stored in the personal workbook, you may have to reference the workbook name: personal.xls!macroname</p... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4019/"
] | just wondering if anyone could suggest why I might be getting an error? I'm currently trying to execute a macro in a workbook by calling the Application.Run method that the interop exposes.
It's currently throwing the following COM Exception:
```
{System.Runtime.InteropServices.COMException (0x800A03EC): Cannot run t... | It turned out that there were actually two identically-named macros which had been injected into the workbook. The exception above translates to a "Compile Error: Ambiguous name detected" error in VBA - I should have gone straight into VBA to look at this, rather than assuming that something odd was happening with the ... |
428,846 | <p>For some reason every 3-5 days our web app loses the ability to open a connection to the db with the following error, the strange thing is that all we have to do is reboot the container (it is a VPS) and it is restored to normal functionality. Then a few days later or so it happens again. Has anyone ever had such a ... | [
{
"answer_id": 428865,
"author": "Sam",
"author_id": 37379,
"author_profile": "https://Stackoverflow.com/users/37379",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried collecting basic information with perfmon and profiler (trace) to see how many connections are made, memory ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18309/"
] | For some reason every 3-5 days our web app loses the ability to open a connection to the db with the following error, the strange thing is that all we have to do is reboot the container (it is a VPS) and it is restored to normal functionality. Then a few days later or so it happens again. Has anyone ever had such a pro... | The number of allowed connections to sql server is a fixed resource. It sounds like you have code somewhere that isn't closing it's connection correctly, and after a period you can't open any more new ones. |
428,858 | <p>I have an XML string in which <code>Val.responseText</code> gives me </p>
<pre><code><NewDataSet>
<Table>
<FieldID>21</FieldID>
<TableName>F003v001</TableName>
<FieldName>Grade</FieldName>
<DisplayField>Grade</DisplayField>
<Field... | [
{
"answer_id": 428865,
"author": "Sam",
"author_id": 37379,
"author_profile": "https://Stackoverflow.com/users/37379",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried collecting basic information with perfmon and profiler (trace) to see how many connections are made, memory ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34219/"
] | I have an XML string in which `Val.responseText` gives me
```
<NewDataSet>
<Table>
<FieldID>21</FieldID>
<TableName>F003v001</TableName>
<FieldName>Grade</FieldName>
<DisplayField>Grade</DisplayField>
<FieldType>text</FieldType>
</Table>
</NewDataSet>
```
I'm calling `FillTable(sVal.response... | The number of allowed connections to sql server is a fixed resource. It sounds like you have code somewhere that isn't closing it's connection correctly, and after a period you can't open any more new ones. |
428,862 | <p>I've got a record management web application which displays a master record on one screen and AJAXes dynamically built editors into an editor div, which I've used JQuery to make draggable. That works.</p>
<p>Even though the div isn't a window, I thought it might be a nice idea to make it act a bit more like one, so... | [
{
"answer_id": 428872,
"author": "bchhun",
"author_id": 48500,
"author_profile": "https://Stackoverflow.com/users/48500",
"pm_score": 0,
"selected": false,
"text": "<p>CSS hacks are needed sometimes:</p>\n\n<pre><code>* + html #editor #closebutton /* IE7 */, * html #editor #closebutton /... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34384/"
] | I've got a record management web application which displays a master record on one screen and AJAXes dynamically built editors into an editor div, which I've used JQuery to make draggable. That works.
Even though the div isn't a window, I thought it might be a nice idea to make it act a bit more like one, so I coded i... | You may want to consider just using a [JQuery Dialog](http://docs.jquery.com/UI/Dialog) instead since its premade and the styles already work cross platform. |
428,870 | <p>Consider the following code:</p>
<pre><code> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Page.IsPostBack Then
If ViewState("test") IsNot Nothing Then
Response.Write((ViewState("test").ToString))
Else
... | [
{
"answer_id": 428876,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>You can turn off viewstate from the config file too.</p>\n\n<pre><code><configuration>\n <appSettings>\n &l... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26/"
] | Consider the following code:
```
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Page.IsPostBack Then
If ViewState("test") IsNot Nothing Then
Response.Write((ViewState("test").ToString))
Else
Response.W... | Figured it out, someone had changed the Page\_Load event to handle Page.Init
```
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
``` |
428,884 | <p>I'm looking for the easiest way to play a MP3 file in C. I am looking for either a library, in which I could just call the function on the filename, or an executable that will just run and quit. Please suggest.</p>
| [
{
"answer_id": 428961,
"author": "Guishu",
"author_id": 46662,
"author_profile": "https://Stackoverflow.com/users/46662",
"pm_score": 2,
"selected": false,
"text": "<p>I don't know if it is \"the easiest way\", but you could have a look at SDL (along with SDL_sound).</p>\n"
},
{
... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53429/"
] | I'm looking for the easiest way to play a MP3 file in C. I am looking for either a library, in which I could just call the function on the filename, or an executable that will just run and quit. Please suggest. | Using [FMOD](http://www.fmod.org/download/) (cross platform), this should be as simple as this:
```
#include <conio.h>
#include "inc/fmod.h"
FSOUND_SAMPLE* handle;
int main ()
{
// init FMOD sound system
FSOUND_Init (44100, 32, 0);
// load and play mp3
handle=FSOUND_Sample_Load (0,"my.mp3",0, 0, 0);
... |
428,908 | <p>So maybe I want to have values between -1.0 and 1.0 as floats. It's clumsy having to write this and bolt it on top using extension methods IMO.</p>
| [
{
"answer_id": 428912,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 4,
"selected": false,
"text": "<p>There's a <a href=\"http://msdn.microsoft.com/en-us/library/system.random.nextdouble.aspx\" rel=\"noreferrer\"><cod... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51816/"
] | So maybe I want to have values between -1.0 and 1.0 as floats. It's clumsy having to write this and bolt it on top using extension methods IMO. | ```
public static double NextDouble(this Random rnd, double min, double max){
return rnd.NextDouble() * (max - min) + min;
}
```
Call with:
```
double x = rnd.NextDouble(-1, 1);
```
to get a value in the range `-1 <= x < 1` |
428,918 | <p>I'm working with a date in this format: <code>yyyy-mm-dd</code>.</p>
<p>How can I increment this date by one day?</p>
| [
{
"answer_id": 428942,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 6,
"selected": false,
"text": "<p>Construct a Calendar object and call <code>add(Calendar.DATE, 1);</code></p>\n"
},
{
"answer_id": 428947,
... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48094/"
] | I'm working with a date in this format: `yyyy-mm-dd`.
How can I increment this date by one day? | Something like this should do the trick:
```
String dt = "2008-01-01"; // Start date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(sdf.parse(dt));
c.add(Calendar.DATE, 1); // number of days to add
dt = sdf.format(c.getTime()); // dt is now the new date
``... |
428,924 | <p>The program spits up one of those boxes saying an unhandled exception has occurred and the application must quit. The only clue I get to solve the problem is this in the event log:</p>
<blockquote>
<p>Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Dat... | [
{
"answer_id": 428956,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "<p>It may well be that the exception is being thrown on a different thread.</p>\n\n<p>Two events you may want to add hand... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51709/"
] | The program spits up one of those boxes saying an unhandled exception has occurred and the application must quit. The only clue I get to solve the problem is this in the event log:
>
> Event Type: Error
> Event Source: .NET Runtime 2.0 Error Reporting
> Event Category: None
> Event ID: 5000
> Date: 1/9/2009
> Ti... | It may well be that the exception is being thrown on a different thread.
Two events you may want to add handlers to:
* [AppDomain.UnhandledException](http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx)
* [Application.ThreadException](http://msdn.microsoft.com/en-us/library/system.windows... |
428,927 | <p>i can't find a way to do multiple row tabs with ASP.net ajax tab control. I also can't find a tutorial or example on using CSS to make multiple row of tabs.</p>
<p>In case you don't understand what i'm looking for here is a image of what i'm looking for
<a href="http://bp1.blogger.com/_WCGCQYWEaxs/Rq1c2bLNMDI/AAAAA... | [
{
"answer_id": 428941,
"author": "Eran Galperin",
"author_id": 10585,
"author_profile": "https://Stackoverflow.com/users/10585",
"pm_score": 1,
"selected": false,
"text": "<p>I usually use an unsorted list (UL) with its list items floated so they stack next to each other. There are plent... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28647/"
] | i can't find a way to do multiple row tabs with ASP.net ajax tab control. I also can't find a tutorial or example on using CSS to make multiple row of tabs.
In case you don't understand what i'm looking for here is a image of what i'm looking for
<http://bp1.blogger.com/_WCGCQYWEaxs/Rq1c2bLNMDI/AAAAAAAAABU/0sKw_CrKLL4... | Well each tab is a `li` object. Set each to `float:left` and unless you've set an absolute height on your `ul` container, when you run out of space on the first line, the `li`s should wrap onto the next line.
Something as simple as this should work but it might need some kicking:
```
<ul id="nav">
<li><a href="#"... |
428,933 | <p>When I insert records into a long table,I am getting the error
"Conversion failed when converting the varchar value 'NULL' to data type int"
How can I determine which column errors out?</p>
<p>The table has many fields and millions of records. Each iteration takes 10 minutes to bomb when I try to insert "NULL" stri... | [
{
"answer_id": 428944,
"author": "Robert C. Barth",
"author_id": 9209,
"author_profile": "https://Stackoverflow.com/users/9209",
"pm_score": 2,
"selected": false,
"text": "<p>Start commenting stuff out one at a time until it stops bombing. Or, take a look and see which value you're passi... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When I insert records into a long table,I am getting the error
"Conversion failed when converting the varchar value 'NULL' to data type int"
How can I determine which column errors out?
The table has many fields and millions of records. Each iteration takes 10 minutes to bomb when I try to insert "NULL" string into in... | If the value is truly `NULL`, there wouldn't be a conversion error. However, you have a string = "NULL" then you would get this error.
What you could do is...
```
NullIf(YourValueHere, 'NULL')
```
`NullIf` returns the value of the first parameter if it is not the same as the second parameter. If the parameters are ... |
428,957 | <p>According to the <a href="http://www.timeanddate.com/calendar/custom.html?year=2008&country=22&month=12&typ=2&months=2&display=0&space=0&fdow=1&wno=1&hol=" rel="noreferrer">official (gregorian) calendar</a>, the week number for 29/12/2008 is 1, because after the last day of week 5... | [
{
"answer_id": 428974,
"author": "Greg D",
"author_id": 6932,
"author_profile": "https://Stackoverflow.com/users/6932",
"pm_score": 1,
"selected": false,
"text": "<p>In my experience, the demonstrated behavior is the typical behavior, referring to the partial final week as week 53. This... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79101/"
] | According to the [official (gregorian) calendar](http://www.timeanddate.com/calendar/custom.html?year=2008&country=22&month=12&typ=2&months=2&display=0&space=0&fdow=1&wno=1&hol=), the week number for 29/12/2008 is 1, because after the last day of week 52 (i.e. 28/12) there are three or less days left in the year. Kinda... | This [article](http://blogs.msdn.com/shawnste/archive/2006/01/24/iso-8601-week-of-year-format-in-microsoft-net.aspx) looks deeper into the issue and possible workarounds. The hub of the matter is that the .NET calendar implementation does not seem to faithfully implement the ISO standard |
428,959 | <p>I am doing a little debugging, and so I want to log the eventArgs value</p>
<p>I have a simple line that basically does:</p>
<pre><code>logLine = "e.Value: " + IIf(e.Value Is Nothing, "", e.Value.ToString())
</code></pre>
<p>The way I understand the IIF function, if the e.Value is Nothing (null) then it should re... | [
{
"answer_id": 428965,
"author": "Chris Farmer",
"author_id": 404,
"author_profile": "https://Stackoverflow.com/users/404",
"pm_score": 2,
"selected": false,
"text": "<p>VB does not do short-circuiting evaluation in Iif. In your case, e.Value.ToString() is being evaluated no matter whet... | 2009/01/09 | [
"https://Stackoverflow.com/questions/428959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18821/"
] | I am doing a little debugging, and so I want to log the eventArgs value
I have a simple line that basically does:
```
logLine = "e.Value: " + IIf(e.Value Is Nothing, "", e.Value.ToString())
```
The way I understand the IIF function, if the e.Value is Nothing (null) then it should return the empty string, if not it ... | [IIf](http://msdn.microsoft.com/en-us/library/27ydhh0d.aspx) is an actual function, so all arguments get evaluated. The [If](http://msdn.microsoft.com/en-us/library/bb513985.aspx) keyword was added to VB.NET 2008 to provide the short-circuit functionality you're expecting.
Try
```
logLine = "e.Value: " + If(e.Value I... |
429,002 | <p>The documentation seems to suggest that in order for me to import Java classes into JRuby, that they must be in a JAR file:</p>
<p>"In order to use resources within a jar file from JRuby the jar file must either be on the classpath or you can make it available with the require method"
(<a href="http://wiki.jruby.or... | [
{
"answer_id": 429092,
"author": "bjnortier",
"author_id": 35448,
"author_profile": "https://Stackoverflow.com/users/35448",
"pm_score": 4,
"selected": true,
"text": "<p>I've managed to answer my own question :)</p>\n\n<p>If your class files are compiled to a relative path of \"target\",... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35448/"
] | The documentation seems to suggest that in order for me to import Java classes into JRuby, that they must be in a JAR file:
"In order to use resources within a jar file from JRuby the jar file must either be on the classpath or you can make it available with the require method"
(<http://wiki.jruby.org/wiki/Calling_Jav... | I've managed to answer my own question :)
If your class files are compiled to a relative path of "target", e.g. foo.Bar is located in "target/foo/Bar.class", then you do the following:
```
require 'java'
require 'target/foo/Bar'
module Foo
include_package 'foo'
end
puts Foo::Bar.new
```
And the result:
```
foo... |
429,022 | <p>I'm interested in providing a general "I'm making an ajax call" notification ... similar to how most of google's services have a little red loading notification when it's busy making a call. Is there a way of globally tapping into some event that I can use to show/hide that notification if there is an active call?<... | [
{
"answer_id": 429085,
"author": "Darin Dimitrov",
"author_id": 29407,
"author_profile": "https://Stackoverflow.com/users/29407",
"pm_score": 3,
"selected": false,
"text": "<p>If you are using JQuery to <a href=\"http://docs.jquery.com/Ajax/jQuery.ajax\" rel=\"nofollow noreferrer\">make ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5416/"
] | I'm interested in providing a general "I'm making an ajax call" notification ... similar to how most of google's services have a little red loading notification when it's busy making a call. Is there a way of globally tapping into some event that I can use to show/hide that notification if there is an active call?
We'... | I'm not sure why the previous answer was accepted, but you can just use the **LoadingElementId** parameter in your **AjaxOptions**, by specifying an ID of an element in your page which has its *display* CSS property set to *none*.
```
new AjaxOptions { UpdateTargetId = "somebox", LoadingElementId = "status-waiting" }... |
429,039 | <p>Hi im learning LISP and well, all day i program php for a living, so i was messing around with php.net and found the eval function... so i started playing around!</p>
<p>I would love to know more about how to use eval to do crazy stuff, i know you can make functions with this and everything... but i wanted to ask w... | [
{
"answer_id": 429069,
"author": "jacobangel",
"author_id": 31318,
"author_profile": "https://Stackoverflow.com/users/31318",
"pm_score": 2,
"selected": true,
"text": "<p>Your statement comes out to 'eval(\"eval(\"echo\"FOZZ\";\");\")'. Your double quotes are interfering with each other ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47846/"
] | Hi im learning LISP and well, all day i program php for a living, so i was messing around with php.net and found the eval function... so i started playing around!
I would love to know more about how to use eval to do crazy stuff, i know you can make functions with this and everything... but i wanted to ask why the nex... | Your statement comes out to 'eval("eval("echo"FOZZ";");")'. Your double quotes are interfering with each other and causing the error.
You might want to try changin the first line to $var = "echo \'FOZZ\';";
Note: Please be careful using eval. |
429,068 | <p>I'm having a hard time trying to get my team comfortable with interface based programming ... anyone have some suggestions?</p>
| [
{
"answer_id": 429096,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 4,
"selected": false,
"text": "<p><a href=\"https://web.archive.org/web/20140214135855/http://geekswithblogs.net:80/elinden/archive/2008/06/03/usin... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2701/"
] | I'm having a hard time trying to get my team comfortable with interface based programming ... anyone have some suggestions? | In order to help your team get comfortable with the idea, the best route would be to demonstrate what interface-based development can accomplish and contrast that with how the same thing would need to be done without it. For them to "really" accept and begin to understand it, they first need to understand and feel the ... |
429,076 | <p>In my code, when a button is clicked the progress bar is set to marquee and then my BackgroundWorker is called but when the BackgroundWorker is called the progress bar freezes or disappears. I use the BackgroundWorker to seperate the RefreshReport method of the ReportViewer from the UI thread. Any help is appreciate... | [
{
"answer_id": 429296,
"author": "Marcus Erickson",
"author_id": 38373,
"author_profile": "https://Stackoverflow.com/users/38373",
"pm_score": -1,
"selected": false,
"text": "<p>The problem is that the progress bar is not being given a chance to repaint while the background thead has the... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/299/"
] | In my code, when a button is clicked the progress bar is set to marquee and then my BackgroundWorker is called but when the BackgroundWorker is called the progress bar freezes or disappears. I use the BackgroundWorker to seperate the RefreshReport method of the ReportViewer from the UI thread. Any help is appreciated. ... | The problem is when you call `.BeginInvoke()` in your `RefreshReport()` method. The `BackgroundWorker.DoWork()` method is already raised in a different thread, so you can just call `rvReport.RefreshReport()`. It should look like this:
```
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.C... |
429,104 | <p>I'm writng a small application in PHP + MySQL and have come to the point where there is an object that has a couple (8 so far but not expected to increase) of flags associated with it. The flags are pretty much unrelated although there are some combinations that would make no sense. The object represents a row in a ... | [
{
"answer_id": 429131,
"author": "Kevin Loney",
"author_id": 13834,
"author_profile": "https://Stackoverflow.com/users/13834",
"pm_score": 0,
"selected": false,
"text": "<p>Assuming your using a version of MySQL after 5.0.5 you could define the column as BIT[<em>number of bits here</em>]... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41360/"
] | I'm writng a small application in PHP + MySQL and have come to the point where there is an object that has a couple (8 so far but not expected to increase) of flags associated with it. The flags are pretty much unrelated although there are some combinations that would make no sense. The object represents a row in a DB ... | In your [model](http://en.wikipedia.org/wiki/Entity-relationship_model), the object has 8 boolean properties. That implies 8 boolean (TINYINT for MySQL) columns in your database table and 8 getter/setter methods in your object. Simple and conventional.
Rethink your current approach. Imagine what the next guy who has t... |
429,112 | <p>Quite often, in programming we get situations where <code>null</code> checks show up in particularly large numbers. I'm talking about things like:</p>
<pre><code>if (doc != null)
{
if (doc.Element != null)
{
... and so on
}
else
throw new Exception("Element cannot be null");
} else {
throw new Exc... | [
{
"answer_id": 429129,
"author": "Zombies",
"author_id": 17675,
"author_profile": "https://Stackoverflow.com/users/17675",
"pm_score": 2,
"selected": false,
"text": "<p>That code example is hardly unreadable... You will have to check for nulls when there is a possibility of a variable be... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9476/"
] | Quite often, in programming we get situations where `null` checks show up in particularly large numbers. I'm talking about things like:
```
if (doc != null)
{
if (doc.Element != null)
{
... and so on
}
else
throw new Exception("Element cannot be null");
} else {
throw new Exception("document cannot b... | Check out this article: [A fluent approach to C# parameter validation](http://blog.getpaint.net/2008/12/06/a-fluent-approach-to-c-parameter-validation)
It's written by one of the Paint.NET Developers. He uses extension methods to simplify and clean up null checking code. |
429,114 | <p>I have the following situation I think would be best to show in sample program code. I have a Java class that extends <code>JPanel</code>. In this class are two objects which are two more <code>JPanels</code>. In one of the <code>JPanel</code> objects is a <code>JTable</code> object. I added a listener to this <... | [
{
"answer_id": 429158,
"author": "James Schek",
"author_id": 17871,
"author_profile": "https://Stackoverflow.com/users/17871",
"pm_score": 3,
"selected": false,
"text": "<p>To access a method on the Outer class, you need to use the syntax of Outer.this.method().</p>\n\n<p>So in this case... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41615/"
] | I have the following situation I think would be best to show in sample program code. I have a Java class that extends `JPanel`. In this class are two objects which are two more `JPanels`. In one of the `JPanel` objects is a `JTable` object. I added a listener to this `JTable` that detects a double click. When it detect... | One way to solve this is to use composition instead of inheritance. You could pass the JPanel into your subclass of the JTable.
```
public class TopPanel extends JPanel
{
private TheTable table;
public TopPanel()
{
table = new TheTable(this);
}
public void methodToFire() { }
}
public class TheTable ... |
429,125 | <p>Yes, I do understand the difference between them. What I want to know is: why OVERRIDE a method? What is the good in doing it?
In case of overload: the only advantage is you haven't to think in different names to functions?</p>
| [
{
"answer_id": 429142,
"author": "lc.",
"author_id": 44853,
"author_profile": "https://Stackoverflow.com/users/44853",
"pm_score": 2,
"selected": false,
"text": "<p>Override is useful when you inherit from a base class and wish to extend or modify its functionality. Even when the object ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50754/"
] | Yes, I do understand the difference between them. What I want to know is: why OVERRIDE a method? What is the good in doing it?
In case of overload: the only advantage is you haven't to think in different names to functions? | *Overloading* generally means that you have two or more functions in the same scope having the same name. The function that better matches the arguments when a call is made wins and is called. Important to note, as opposed to calling a virtual function, is that the function that's called is selected at compile time. It... |
429,136 | <p>I have these tables:</p>
<pre><code>customer
--------
customer_id int
name varchar(255)
order
-----
order_id int
customer_id int
discount boolean
</code></pre>
<p>I can get the number of orders made by each customer with a query like:</p>
<pre><code>select c.id, count(o.order_id)
from customer c
le... | [
{
"answer_id": 429166,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 3,
"selected": true,
"text": "<p>How about something like</p>\n\n<pre><code>select c.id, count(o.order_id),sum(if(o.discount,1,0))\nfrom customer c \nle... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648/"
] | I have these tables:
```
customer
--------
customer_id int
name varchar(255)
order
-----
order_id int
customer_id int
discount boolean
```
I can get the number of orders made by each customer with a query like:
```
select c.id, count(o.order_id)
from customer c
left join order as o using c.customer_i... | How about something like
```
select c.id, count(o.order_id),sum(if(o.discount,1,0))
from customer c
left join order as o using c.customer_id = o.customer_id
group by c.id
``` |
429,162 | <p>I have a command line app the continuously outputs YAML data in the form:</p>
<pre>
- col0: datum0
col1: datum1
col2: datum2
- col0: datum0
col1: datum1
col2: datum2
...
</pre>
<p>It does this for all of eternity. I would like to write a Python script that continuously reads each of these records.</p>
<p>... | [
{
"answer_id": 429305,
"author": "John Mulder",
"author_id": 2242,
"author_profile": "https://Stackoverflow.com/users/2242",
"pm_score": 2,
"selected": false,
"text": "<p>All of the references to stream in the the documentation seem to be referring to a stream of documents... I've never ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338/"
] | I have a command line app the continuously outputs YAML data in the form:
```
- col0: datum0
col1: datum1
col2: datum2
- col0: datum0
col1: datum1
col2: datum2
...
```
It does this for all of eternity. I would like to write a Python script that continuously reads each of these records.
The PyYAML library s... | Here is what I've ended up using since there does not seem to be a built-in method for accomplishing what I want. This function should be generic enough that it can read in a stream of YAML and return top-level objects as they are encountered.
```
def streamInYAML(stream):
y = stream.readline()
cont = 1
wh... |
429,164 | <p>I have a SOAP request that is known to work using a tool like, say, SoapUI, but I am trying to get it to work using urllib.</p>
<p>This is what I have tried so far and it did not work:</p>
<pre><code>import urllib
f = "".join(open("ws_request_that_works_in_soapui", "r").readlines())
urllib.urlopen('http://url.com/... | [
{
"answer_id": 429349,
"author": "Nick Stinemates",
"author_id": 4960,
"author_profile": "https://Stackoverflow.com/users/4960",
"pm_score": 3,
"selected": false,
"text": "<p>Well, I answered my own question</p>\n\n<pre><code>import httplib\n\nf = \"\".join(open('ws_request', 'r'))\n\nwe... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4960/"
] | I have a SOAP request that is known to work using a tool like, say, SoapUI, but I am trying to get it to work using urllib.
This is what I have tried so far and it did not work:
```
import urllib
f = "".join(open("ws_request_that_works_in_soapui", "r").readlines())
urllib.urlopen('http://url.com/to/Router?wsdl', f)
... | Short answer: yes you can.
Long answer:
Take a look at this [example](http://users.skynet.be/pascalbotte/rcx-ws-doc/postxmlpython.htm) it doesn't use urllib but will give you the idea of how to prepare SOAP request.
As far as urllib, I suggest using [urllib2](https://docs.python.org/2/library/urllib2.html), and yes ... |
429,165 | <p>The .net framework provides in the Math class a method for powering double. But by precision requirement I need to raise a decimal to a decimal power [ Pow(decimal a, decimal b) ]. Does the framework have such a function? Does anyone know of a library with this kind of function?</p>
| [
{
"answer_id": 429185,
"author": "Dmitri Nesteruk",
"author_id": 9476,
"author_profile": "https://Stackoverflow.com/users/9476",
"pm_score": -1,
"selected": false,
"text": "<p>Are you sure you actually want to do this? A <code>decimal</code> multiply is about 40 times slower than <code>d... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36147/"
] | The .net framework provides in the Math class a method for powering double. But by precision requirement I need to raise a decimal to a decimal power [ Pow(decimal a, decimal b) ]. Does the framework have such a function? Does anyone know of a library with this kind of function? | To solve my problem I found some [expansion series](http://mathworld.wolfram.com/MaclaurinSeries.html "expansion series"), and them I had them implemented to solve the equation X^n = e^(n \* ln x).
```
// Adjust this to modify the precision
public const int ITERATIONS = 27;
// power series
public static decimal Decim... |
429,186 | <p>OK, I'm confused how to write an INSERT/UPDATE for this simple app I'm developing locally to learn more about db interactions.</p>
<p>I have an "edit" page, which is populated from the db and lists up to 9 user links (<strong>user_id 2</strong> in this case), so something like:</p>
<pre><code><input type="text"... | [
{
"answer_id": 429217,
"author": "Dave Costa",
"author_id": 6568,
"author_profile": "https://Stackoverflow.com/users/6568",
"pm_score": 1,
"selected": false,
"text": "<p>I don't really understand what you're having trouble with. It might be helpful if you showed something you tried that... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | OK, I'm confused how to write an INSERT/UPDATE for this simple app I'm developing locally to learn more about db interactions.
I have an "edit" page, which is populated from the db and lists up to 9 user links (**user\_id 2** in this case), so something like:
```
<input type="text" name="link1" value="www.yahoo.com">... | The simplest way i can think of is to change your html to something like this
```
<input type="text" name="link1" value="www.yahoo.com">
<input type="hidden" name="oldlink1" value="www.yahoo.com">
<input type="text" name="link2" value="">
<input type="hidden" name="oldlink2" value="">
```
then when you read i... |
429,193 | <p>What's the simplest way to parse an Excel file in Perl? Converting it to a text file would also work.</p>
| [
{
"answer_id": 429195,
"author": "Mr. Muskrat",
"author_id": 2657951,
"author_profile": "https://Stackoverflow.com/users/2657951",
"pm_score": 3,
"selected": false,
"text": "<p>I have had great luck using <a href=\"http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.44/lib/Spreads... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1094969/"
] | What's the simplest way to parse an Excel file in Perl? Converting it to a text file would also work. | The best way is to use [Spreadsheet::ParseExcel](http://search.cpan.org/~dougw/Spreadsheet-ParseExcel-0.65/lib/Spreadsheet/ParseExcel.pm).
Here is an example:
```
#!/usr/bin/perl -w
use strict;
use warnings;
use Spreadsheet::ParseExcel;
my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse('... |
429,202 | <p><strong>UPDATE:</strong> <em>I've been experimenting with my controls some more and I think I've gotten closer. Please read on for updated info.</em></p>
<p>I have 2 ASP.NET 2.0 user controls, one of which is placed <em>inside</em> of the other one. Inside of the inner control I have an <code>HtmlAnchor</code> tag ... | [
{
"answer_id": 429311,
"author": "jhunter",
"author_id": 51709,
"author_profile": "https://Stackoverflow.com/users/51709",
"pm_score": 0,
"selected": false,
"text": "<p>Are you setting the HRef on the Page's OnInit method? If so try moving the assignment out to Page_Load.</p>\n\n<p>The ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] | **UPDATE:** *I've been experimenting with my controls some more and I think I've gotten closer. Please read on for updated info.*
I have 2 ASP.NET 2.0 user controls, one of which is placed *inside* of the other one. Inside of the inner control I have an `HtmlAnchor` tag control which I'm trying to set a URL for from t... | Greetings Dan,
I faced a similar problem before with the mess of nested controls, so I found myself eager to help, and I marked this as favourite too because I liked it.
I reproduced the problem as follows:-
**Created a user control called Inner:**
Inner.ascx
```
<%@ Control Language="C#" AutoEventWireup="true" Co... |
429,210 | <p>I use C#'s <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="noreferrer" title="BackgroundWorker">BackgroundWorker</a> object frequently to start a thread and perform a task. What's the easiest way to accomplish the same thing in Delphi?</p>
<p>Here's some code in C... | [
{
"answer_id": 429266,
"author": "mghie",
"author_id": 30568,
"author_profile": "https://Stackoverflow.com/users/30568",
"pm_score": 5,
"selected": true,
"text": "<p>Look into <a href=\"http://otl.17slon.com/\" rel=\"nofollow noreferrer\">OmniThreadLibrary</a> by Primoz Gabrijelcic, or i... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35229/"
] | I use C#'s [BackgroundWorker](http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx "BackgroundWorker") object frequently to start a thread and perform a task. What's the easiest way to accomplish the same thing in Delphi?
Here's some code in C#:
```
private void button1_Click(object sen... | Look into [OmniThreadLibrary](http://otl.17slon.com/) by Primoz Gabrijelcic, or into [AsyncCalls](http://andy.jgknet.de/blog/?page_id=100) by Andreas Hausladen, which should both give you similar functionality. |
429,219 | <p>I am working on a CF site and need to get data from MySQL tables.</p>
<p>I can create the CFQuery fine and check for records returned, but how do I take the records returned and loop through them and get data from specific fields in each row.</p>
<p>I can write while if/end if, etc, I just dont recall how to get a... | [
{
"answer_id": 429320,
"author": "Sam Farmer",
"author_id": 4927,
"author_profile": "https://Stackoverflow.com/users/4927",
"pm_score": 3,
"selected": false,
"text": "<p>Assuming you made a query called the_query with a firstname column:</p>\n\n<pre><code><cfoutput query=\"#the_query#... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am working on a CF site and need to get data from MySQL tables.
I can create the CFQuery fine and check for records returned, but how do I take the records returned and loop through them and get data from specific fields in each row.
I can write while if/end if, etc, I just dont recall how to get access to the data... | Assuming you made a query called the\_query with a firstname column:
```
<cfoutput query="#the_query#">
#firstName# ... etc <br>
</cfoutput>
``` |
429,225 | <p>I was just wondering if it is possible to capture the output of a separate process running on windows?</p>
<p>For instance if i have a console app running, could i run a second app, a forms app, and have that app capture the output from the console app and display it in a text box?</p>
| [
{
"answer_id": 429310,
"author": "Alex Shnayder",
"author_id": 26042,
"author_profile": "https://Stackoverflow.com/users/26042",
"pm_score": 2,
"selected": false,
"text": "<p>You can redirect the stdout / stderr (standary out put / error stream) of a process if you are the one starting i... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18811/"
] | I was just wondering if it is possible to capture the output of a separate process running on windows?
For instance if i have a console app running, could i run a second app, a forms app, and have that app capture the output from the console app and display it in a text box? | You can do this:
```
Process[] p = Process.GetProcessesByName("myprocess.exe");
StreamReader sr = p[0].StandardOutput;
while (sr.BaseStream.CanRead)
{
Console.WriteLine(sr.ReadLine());
}
``` |
429,251 | <p>I'm using the selenium IDE and the Selenium-Fitnesse Bridge fixture and I'm trying to test that when I clear a default value out of a form field, my form displays an error message.</p>
<p>So when I record with the Selenium IDE, what it does is the equivalent of telling Selenium to type nothing.</p>
<pre>| type | t... | [
{
"answer_id": 429285,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 3,
"selected": false,
"text": "<p>You can do it via javascript as such:</p>\n\n<pre><code>| verifyEval | javascript{this.browserbot.getCurrentWindow... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48523/"
] | I'm using the selenium IDE and the Selenium-Fitnesse Bridge fixture and I'm trying to test that when I clear a default value out of a form field, my form displays an error message.
So when I record with the Selenium IDE, what it does is the equivalent of telling Selenium to type nothing.
```
| type | text_field | |
... | I used this to get it to work. `reg_start_date` is the id of my input field.
```
| storeEval | window.document.getElementById('reg_start_date').value = '' |
```
From the selenium reference:
>
> Note that, by default, the snippet will run in the context of the "selenium" object itself, so `this` will refer to the S... |
429,275 | <p>I'm building a program that uses plugins. Unfortunately, the plugin framework's dynamic linking forces the RTL and VCL out of my project EXE and into the BPL versions, and they don't have debug info enabled.</p>
<p>So I built a testing framework that links to my plugins statically so I can actually see what I'm do... | [
{
"answer_id": 429453,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 4,
"selected": false,
"text": "<p>The error \"unit is compiled with a different version of...\" is an annoying one. It occurs in a situation like be... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32914/"
] | I'm building a program that uses plugins. Unfortunately, the plugin framework's dynamic linking forces the RTL and VCL out of my project EXE and into the BPL versions, and they don't have debug info enabled.
So I built a testing framework that links to my plugins statically so I can actually see what I'm doing while t... | The error "unit is compiled with a different version of..." is an annoying one. It occurs in a situation like below:
```
+--------+
| unit A |
+--------+
| |
| |
V |
+--------+ |
| unit B | |
+--------+ |
| |
| |
V V
+--------+... |
429,302 | <p>Some existing web services I consume have methods that look something like this:</p>
<pre><code>List<Employee> employees =
employeeService.GetEmployees(accessKey, allDepartments);
</code></pre>
<p>The accessKey serves two purposes; it acts as both authentication and identification. Only valid acces... | [
{
"answer_id": 429315,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 4,
"selected": true,
"text": "<p>You could send the authentication token using HTTP headers.</p>\n"
},
{
"answer_id": 429343,
"author": "Kevin Pa... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42620/"
] | Some existing web services I consume have methods that look something like this:
```
List<Employee> employees =
employeeService.GetEmployees(accessKey, allDepartments);
```
The accessKey serves two purposes; it acts as both authentication and identification. Only valid access codes are responded to (authent... | You could send the authentication token using HTTP headers. |
429,325 | <p>I have an <code><H2></code> with a background that has rounded corners. I'm looking for a way to create a <code>1px</code> line that moves from the box to end of the container at the right. Does anyone have an idea?</p>
| [
{
"answer_id": 429345,
"author": "brian",
"author_id": 53224,
"author_profile": "https://Stackoverflow.com/users/53224",
"pm_score": 0,
"selected": false,
"text": "<p>Include the line in the background image</p>\n"
},
{
"answer_id": 429400,
"author": "psayre23",
"author_i... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53471/"
] | I have an `<H2>` with a background that has rounded corners. I'm looking for a way to create a `1px` line that moves from the box to end of the container at the right. Does anyone have an idea? | Well, I finally gave up and stuck some divs in my h2. :(
**CSS**
```
#content h2 {
background: url(../images/bg-page-title.png) -900px 0px no-repeat;
font: 1.4em Georgia, Times, Arial bold;
height: 40px;
margin: 0px 20px;
text-transform: uppercase;
}
#content h2 .head {
background: url(../ima... |
429,386 | <p>I have a main TCL proc that sources tons of other tcl procs in other folders and subsequent subdirectories. For example, in the main proc it has:</p>
<pre><code>source $basepath/folderA/1A.tcl
source $basepath/folderA/2A.tcl
source $basepath/folderA/3A.tcl
source $basepath/folderB/1B.tcl
source $basepath/folderB/2... | [
{
"answer_id": 429490,
"author": "Andru Luvisi",
"author_id": 5922,
"author_profile": "https://Stackoverflow.com/users/5922",
"pm_score": 2,
"selected": false,
"text": "<p>Here is one way:</p>\n\n<pre><code>set includes [open \"|find $basedir -name \\*.tcl -print\" r]\n\nwhile { [gets $i... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16866/"
] | I have a main TCL proc that sources tons of other tcl procs in other folders and subsequent subdirectories. For example, in the main proc it has:
```
source $basepath/folderA/1A.tcl
source $basepath/folderA/2A.tcl
source $basepath/folderA/3A.tcl
source $basepath/folderB/1B.tcl
source $basepath/folderB/2B.tcl
source $b... | Building on ramanman's reply, heres a routine that tackles the problem using the built in TCL file commands and which works it way down the directory tree recursively.
```
# findFiles
# basedir - the directory to start looking in
# pattern - A pattern, as defined by the glob command, that the files must match
proc fin... |
429,401 | <p>I'm using Instruments to try to determine if there are places in my application that I could be more efficient with use of memory. I've taken the time to get somewhat familiar with Instruments but I'm generally a newbie with hunting memory management issues having come from a Java background. I seem to be using abou... | [
{
"answer_id": 429516,
"author": "Marc Charbonneau",
"author_id": 35136,
"author_profile": "https://Stackoverflow.com/users/35136",
"pm_score": 0,
"selected": false,
"text": "<p>You need to return an autoreleased object anyway, so there's really nothing you should be doing about the resu... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/386102/"
] | I'm using Instruments to try to determine if there are places in my application that I could be more efficient with use of memory. I've taken the time to get somewhat familiar with Instruments but I'm generally a newbie with hunting memory management issues having come from a Java background. I seem to be using about 1... | Is this method getting called a lot of times in a loop? Autoreleased objects only get released when the NSAutoreleasePool they're in gets released. As I understand it, the default autorelease pool is created and release every event loop. It's possible you're creating too many autoreleased objects in the course of a sin... |
429,414 | <p>this is what I did. is there a better way in python?</p>
<pre>
for k in a_list:
if kvMap.has_key(k):
kvMap[k]=kvMap[k]+1
else:
kvMap[k]=1
</pre>
<p>Thanks</p>
| [
{
"answer_id": 429442,
"author": "John Novatnack",
"author_id": 53490,
"author_profile": "https://Stackoverflow.com/users/53490",
"pm_score": 3,
"selected": false,
"text": "<p>Single element:</p>\n\n<pre><code>a_list.count(k)\n</code></pre>\n\n<p>All elements:</p>\n\n<pre><code>counts = ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53483/"
] | this is what I did. is there a better way in python?
```
for k in a_list:
if kvMap.has_key(k):
kvMap[k]=kvMap[k]+1
else:
kvMap[k]=1
```
Thanks | Use defaultdict
```
from collections import defaultdict
kvmap= defaultdict(int)
for k in a_list:
kvmap[k] += 1
``` |
429,416 | <p>I'm writing a piece of code that requires the <code>DOM</code> of a website to remain frozen while arbitrary JavaScript runs. Attributes changing is fine but I can't have anything changing the original tag structure of the page!</p>
<p>I know in JavaScript there are a base number of functions that can modify the <c... | [
{
"answer_id": 429432,
"author": "brian",
"author_id": 53224,
"author_profile": "https://Stackoverflow.com/users/53224",
"pm_score": 0,
"selected": false,
"text": "<p>Don't do this. Use a whitelist. Please.</p>\n"
},
{
"answer_id": 429436,
"author": "Ali",
"author_id": 49... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37522/"
] | I'm writing a piece of code that requires the `DOM` of a website to remain frozen while arbitrary JavaScript runs. Attributes changing is fine but I can't have anything changing the original tag structure of the page!
I know in JavaScript there are a base number of functions that can modify the `DOM`:
```
appendChild... | Have you tried **HTMLElement**.prototype.appendChild = function(){} to overwrite DOM methods at a higher level? |
429,439 | <p>I have built a simple web service that simply uses HttpListener to receive and send requests. Occasionally, the service fails with "Specified network name is no longer available". It appears to be thrown when I write to the output buffer of the HttpListenerResponse.</p>
<p>Here is the error:</p>
<blockqu... | [
{
"answer_id": 954676,
"author": "Thorarin",
"author_id": 64767,
"author_profile": "https://Stackoverflow.com/users/64767",
"pm_score": 0,
"selected": false,
"text": "<p>I've only gotten this particular exception once so far when using HttpListener.\nIt occurred when I resumed execution ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525/"
] | I have built a simple web service that simply uses HttpListener to receive and send requests. Occasionally, the service fails with "Specified network name is no longer available". It appears to be thrown when I write to the output buffer of the HttpListenerResponse.
Here is the error:
>
> ListenerCallback() Error: T... | I'm getting this too, when a `ContentLength64` is specified and `KeepAlive` is `false`. It seems as though the client is inspecting the `Content-Length` header (which, by all possible accounts, is set correctly, since I get an exception with any other value) and then saying "Whelp I'm done KTHXBYE" and closing the conn... |
429,446 | <p>I'm currently using ReSharper's 30-day trial, and so far I've been impressed with the suggestions it makes. One suggestion puzzles me, however.</p>
<p>When I explicitly define a variable, such as:</p>
<pre><code>List<String> lstString = new List<String>();
</code></pre>
<p>ReSharped adds a little squi... | [
{
"answer_id": 429447,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 4,
"selected": false,
"text": "<p>Nope. They emit the <b>exact same IL</b>.</p>\n\n<p>It's just a matter of style.</p>\n\n<p><code>var</code> has the benefit... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50786/"
] | I'm currently using ReSharper's 30-day trial, and so far I've been impressed with the suggestions it makes. One suggestion puzzles me, however.
When I explicitly define a variable, such as:
```
List<String> lstString = new List<String>();
```
ReSharped adds a little squiggly green line and tells me to:
>
> Use im... | >
> So, is there some sort of performance gain to be had from changing the List to a var
>
>
>
No but this is not the only valid reason for a refactoring. More importantly, it removes redundance and makes the code shorter without any loss in clarity.
>
> I've always been taught that explicitly defining a variabl... |
429,449 | <p>I know that I can display a PDF file in my c# executable (not web app) with:</p>
<pre><code>private AxAcroPDFLib.AxAcroPDF axAcroPDF1;
axAcroPDF1.LoadFile(@"somefile.pdf");
axAcroPDF1.Show();
</code></pre>
<p>But that is the regular pdf viewer like in the browser. I don't want that. I want full Adobe Standard or... | [
{
"answer_id": 429528,
"author": "Andy Webb",
"author_id": 10931,
"author_profile": "https://Stackoverflow.com/users/10931",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://sourceforge.net/projects/itextsharp/\" rel=\"nofollow noreferrer\">IText#</a> may help you out.</p>\... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28045/"
] | I know that I can display a PDF file in my c# executable (not web app) with:
```
private AxAcroPDFLib.AxAcroPDF axAcroPDF1;
axAcroPDF1.LoadFile(@"somefile.pdf");
axAcroPDF1.Show();
```
But that is the regular pdf viewer like in the browser. I don't want that. I want full Adobe Standard or Professional functionality ... | you can check out [ABCpdf](http://www.websupergoo.com/abcpdf-1.htm). I dont know if it has this capability but we have used it for several of our apps |
429,450 | <p>I am trying to post an array full of checkboxes and to open it in the next page..</p>
<p>It only gives me the last result, anyone know why? or how to fix it?</p>
<pre><code><form name="input" action="createevent.php" method="post">
Event title:
<input type="text" name="Eventtitle" size="20">
<br&g... | [
{
"answer_id": 429479,
"author": "Wally Lawless",
"author_id": 37,
"author_profile": "https://Stackoverflow.com/users/37",
"pm_score": 3,
"selected": false,
"text": "<p>The reason you are only getting one result is because you are posting multiple fields with the same name so by default ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45344/"
] | I am trying to post an array full of checkboxes and to open it in the next page..
It only gives me the last result, anyone know why? or how to fix it?
```
<form name="input" action="createevent.php" method="post">
Event title:
<input type="text" name="Eventtitle" size="20">
<br>Event Description
<input type="text"... | PHP will only automatically make a POST value into an array if it ends in `[]`.
So you need to have `name="day[]"` instead of just `name="day"`.
(Note that this works for any POST value, and also with associative arrays instead of just auto-incrementing -- you can do `name="foo[bar]"`, and you'd get `$_POST['foo']['b... |
429,452 | <p>I was wondering if there is a way (hopefully keyboard shortcut) to create auto generate function headers in visual studio.</p>
<p>Example:</p>
<pre><code>Private Function Foo(ByVal param1 As String, ByVal param2 As Integer)
</code></pre>
<p>And it would automagically become something like this...</p>
<p><br></p>... | [
{
"answer_id": 429484,
"author": "DCNYAM",
"author_id": 30419,
"author_profile": "https://Stackoverflow.com/users/30419",
"pm_score": 2,
"selected": false,
"text": "<p>You can use code snippets to insert any lines you want.</p>\n\n<p>Also, if you type three single quotation marks (''') o... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53484/"
] | I was wondering if there is a way (hopefully keyboard shortcut) to create auto generate function headers in visual studio.
Example:
```
Private Function Foo(ByVal param1 As String, ByVal param2 As Integer)
```
And it would automagically become something like this...
```
'----------------------------------
'Pre:
... | Make that "three single comment-markers"
In C# it's `///`
which as default spits out:
```cs
/// <summary>
///
/// </summary>
/// <returns></returns>
```
Here's [some tips on editing VS templates.](https://dbouwman.wordpress.com/2007/06/12/streamline-coding-with-visual-studio-templates/) |
429,468 | <p>Greetings stackers,</p>
<p>I'm trying to come up with the best database schema for an application that lets users create surveys and present them to the public. There are a bunch of "standard" demographic fields that most surveys (but not all) will include, like First Name, Last Name, etc. And of course users can c... | [
{
"answer_id": 429481,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 1,
"selected": false,
"text": "<p>I would suggest you always take a normalized approach to your database schema and then later decided if you need to... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5958/"
] | Greetings stackers,
I'm trying to come up with the best database schema for an application that lets users create surveys and present them to the public. There are a bunch of "standard" demographic fields that most surveys (but not all) will include, like First Name, Last Name, etc. And of course users can create an u... | Your first schema is the better choice of the two. At this point, you shouldn't worry about performance problems. Worry about making a good, flexible, extensible design. There are all sorts of tricks you can do later to cache data and make queries faster. Using a less flexible database schema in order to solve a perfor... |
429,478 | <p>Does the garbage collector clean up web service references or do I need to call dispose on the service reference after I'm finished calling whatever method I call?</p>
| [
{
"answer_id": 429499,
"author": "Dan Herbert",
"author_id": 392,
"author_profile": "https://Stackoverflow.com/users/392",
"pm_score": 6,
"selected": true,
"text": "<p>Instead of worrying about disposing your web services, you could keep only a single instance of each web service, using ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32908/"
] | Does the garbage collector clean up web service references or do I need to call dispose on the service reference after I'm finished calling whatever method I call? | Instead of worrying about disposing your web services, you could keep only a single instance of each web service, using a [singleton pattern](http://csharpindepth.com/Articles/General/Singleton.aspx). Web services are stateless, so they can safely be shared between connections and threads on a web server.
Here is an e... |
429,483 | <p>I can find lots of tutorials showing you how to load an array into a database field but can't seem to figure out how to pull each entry in a field into an array as seperate items. Seems simple enough just can't get it to work, any help?</p>
| [
{
"answer_id": 429511,
"author": "Sergey Kuznetsov",
"author_id": 102447,
"author_profile": "https://Stackoverflow.com/users/102447",
"pm_score": 0,
"selected": false,
"text": "<pre><code>$big_2_dimensional_array_of_data;\n\nforeach ($big_array_of_data as $row) {\n $query = \"INSERT INT... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I can find lots of tutorials showing you how to load an array into a database field but can't seem to figure out how to pull each entry in a field into an array as seperate items. Seems simple enough just can't get it to work, any help? | If using the modern PDO library, use the [`PDOStatement->fetchAll()`](http://www.php.net/manual/en/pdostatement.fetchall.php) function with the `fetch_style` parameter set to `PDO::FETCH_COLUMN`.
Based on a sample from that page:
```
$sth = $dbh->prepare("SELECT field FROM dbtable");
$sth->execute();
$array = $sth->f... |
429,486 | <p>I'm writing a C program for mac, and I need to allow the user to choose an application to send an apple event to. I can create a navigation window, using <code>NavCreateChooseFileDialog()</code>, but I can't get it to enable any .app files. If I restrict the types using <code>NavDialogSetFilterTypeIdentifiers</code>... | [
{
"answer_id": 429511,
"author": "Sergey Kuznetsov",
"author_id": 102447,
"author_profile": "https://Stackoverflow.com/users/102447",
"pm_score": 0,
"selected": false,
"text": "<pre><code>$big_2_dimensional_array_of_data;\n\nforeach ($big_array_of_data as $row) {\n $query = \"INSERT INT... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53491/"
] | I'm writing a C program for mac, and I need to allow the user to choose an application to send an apple event to. I can create a navigation window, using `NavCreateChooseFileDialog()`, but I can't get it to enable any .app files. If I restrict the types using `NavDialogSetFilterTypeIdentifiers`, it will only allow me t... | If using the modern PDO library, use the [`PDOStatement->fetchAll()`](http://www.php.net/manual/en/pdostatement.fetchall.php) function with the `fetch_style` parameter set to `PDO::FETCH_COLUMN`.
Based on a sample from that page:
```
$sth = $dbh->prepare("SELECT field FROM dbtable");
$sth->execute();
$array = $sth->f... |
429,487 | <p>Within my a certain function of a class, I need to use <code>setInterval</code> to break up the execution of the code. However, within the <code>setInterval</code> function, "this" no longer refers to the class "myObject." How can I access the variable "name" from within the <code>setInterval</code> function?</p>
... | [
{
"answer_id": 429501,
"author": "jacobangel",
"author_id": 31318,
"author_profile": "https://Stackoverflow.com/users/31318",
"pm_score": 5,
"selected": true,
"text": "<pre><code>myObject.prototype.test = function() {\n // this works\n alert(this.name);\n var oThis = this;\n ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53487/"
] | Within my a certain function of a class, I need to use `setInterval` to break up the execution of the code. However, within the `setInterval` function, "this" no longer refers to the class "myObject." How can I access the variable "name" from within the `setInterval` function?
```
function myObject() {
this.name =... | ```
myObject.prototype.test = function() {
// this works
alert(this.name);
var oThis = this;
var intervalId = setInterval(function() {
// this does not work
alert(oThis.name);
clearInterval(intervalId);
},0);
}
```
This should work. The anonymous function's "this" is not t... |
429,508 | <p>So I've got a for loop that processes a list of IDs and has some fairly complex things to do. Without going into all the ugly details, basically this:</p>
<pre>
DECLARE
l_selected APEX_APPLICATION_GLOBAL.VC_ARR2;
...snip...
BEGIN
-- get the list ids
l_selected := APEX_UTIL.STRING_T... | [
{
"answer_id": 429585,
"author": "Adam Hawkes",
"author_id": 6703,
"author_profile": "https://Stackoverflow.com/users/6703",
"pm_score": 0,
"selected": false,
"text": "<p>This is a case where a GOTO statement <em>might</em> be useful. See the <a href=\"http://download.oracle.com/docs/cd/... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50798/"
] | So I've got a for loop that processes a list of IDs and has some fairly complex things to do. Without going into all the ugly details, basically this:
```
DECLARE
l_selected APEX_APPLICATION_GLOBAL.VC_ARR2;
...snip...
BEGIN
-- get the list ids
l_selected := APEX_UTIL.STRING_TO_TABLE(... | To count the number of rows is also possible (see Pourquoi Litytestdata) but you can also do what you want to do in the `when_no_data_found exception` block.
```
declare
l_selected apex_application_global.vc_arr2;
l_county_id org_county_accountable.count_id%type;
begin
l_selected := apex_util.string_to_tab... |
429,510 | <p>I'm trying to understand this bit of code:</p>
<p>in display.php:</p>
<pre><code><html>
...
<body>
<table>
<tr>
<td>
User info: <iframe id="SpControlFrame1" name="SpControlFrame1" src="javascript:'';"path_src="index.php?cmd=YYY" ></iframe>
&l... | [
{
"answer_id": 429546,
"author": "Chris K",
"author_id": 51789,
"author_profile": "https://Stackoverflow.com/users/51789",
"pm_score": 3,
"selected": true,
"text": "<p>Without seeing the code in question, I couldn't really say what's happening. Your example presumes that the code in que... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29505/"
] | I'm trying to understand this bit of code:
in display.php:
```
<html>
...
<body>
<table>
<tr>
<td>
User info: <iframe id="SpControlFrame1" name="SpControlFrame1" src="javascript:'';"path_src="index.php?cmd=YYY" ></iframe>
</td>
</tr>
</table>
</body>
</html>
```
in another f... | Without seeing the code in question, I couldn't really say what's happening. Your example presumes that the code in question is server-side, and when a particular variable/condition is met, then the iframe is created or populated by blah.php.
You would have to ensure that the same code is called when creating this ot... |
429,514 | <p>I want to proxy all requests to Mongreel except for a few ruby apps that are running with fastcgi on apache.</p>
<p>So basically i have <a href="http://domain.com/" rel="nofollow noreferrer">http://domain.com/</a> Mongreel app<br>
<a href="http://domain.com/appa" rel="nofollow noreferrer">http://domain.com/appa</a... | [
{
"answer_id": 429548,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 2,
"selected": false,
"text": "<p>The correct way is</p>\n\n<pre>\nRewriteEngine On\nRewriteCond %{REQUEST_URI} !appa\nRewriteCond %{REQUEST_URI} !... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789/"
] | I want to proxy all requests to Mongreel except for a few ruby apps that are running with fastcgi on apache.
So basically i have <http://domain.com/> Mongreel app
<http://domain.com/appa> ruby app handled by apache
<http://domain.com/app_testb> ruby app handled by apache
My httpd.conf looks like this:
```
Rewr... | It seems i have found a way:
```
ProxyPass /appa !
ProxyPass /app_testb !
ProxyPass / http://127.0.0.1:port/
ProxyPassReverse / http://127.0.0.1:port/
``` |
429,527 | <p>Ok, I'm an MVC newbie coming from a webforms background, so please excuse any ignorance here. Here is my scenario. I've got a table consisting of a list of applications and associated permissions. Each table row consists of 3 pieces of information: a checkbox, some text describing the row, and a dropdown list allowi... | [
{
"answer_id": 429914,
"author": "TStamper",
"author_id": 39809,
"author_profile": "https://Stackoverflow.com/users/39809",
"pm_score": 3,
"selected": true,
"text": "<p>You are halfway right in order to post your data that the controller can read the info it must be inside a form as so :... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] | Ok, I'm an MVC newbie coming from a webforms background, so please excuse any ignorance here. Here is my scenario. I've got a table consisting of a list of applications and associated permissions. Each table row consists of 3 pieces of information: a checkbox, some text describing the row, and a dropdown list allowing ... | You are halfway right in order to post your data that the controller can read the info it must be inside a form as so :
```
<% using(Html.BeginForm("Retrieve", "Home")) %>//Retrieve is the name of the action while Home is the name of the controller
<% { %>
<%foreach (var app in newApps) ... |
429,529 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/91817/whats-the-use-meaning-of-the-character-in-variable-names-in-c">What's the use/meaning of the @ character in variable names in C#?</a> </p>
</blockquote>
<p>I understand that the @ symbol can be used b... | [
{
"answer_id": 429534,
"author": "Michael Meadows",
"author_id": 7643,
"author_profile": "https://Stackoverflow.com/users/7643",
"pm_score": 11,
"selected": true,
"text": "<p>The @ symbol allows you to use reserved word. For example:</p>\n\n<pre><code>int @class = 15;\n</code></pre>\n\n... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42484/"
] | >
> **Possible Duplicate:**
>
> [What's the use/meaning of the @ character in variable names in C#?](https://stackoverflow.com/questions/91817/whats-the-use-meaning-of-the-character-in-variable-names-in-c)
>
>
>
I understand that the @ symbol can be used before a string literal to change how the compiler parse... | The @ symbol allows you to use reserved word. For example:
```
int @class = 15;
```
The above works, when the below wouldn't:
```
int class = 15;
``` |
429,586 | <p>I have a GridView that is populated via a database, inside the GridView tags I have:</p>
<pre><code><Columns>
<asp:TemplateField>
<ItemTemplate><asp:Panel ID="bar" runat="server" /></ItemTemplate>
</TemplateField>
</Columns>
</code></pre>
<p>Now, I want to be able ... | [
{
"answer_id": 429603,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 2,
"selected": false,
"text": "<pre><code><asp:Panel ID=\"bar\" runat=\"server\" Width='<%# Eval(\"Width\") %>' />\n</code></pre>\n\n<p>If you li... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a GridView that is populated via a database, inside the GridView tags I have:
```
<Columns>
<asp:TemplateField>
<ItemTemplate><asp:Panel ID="bar" runat="server" /></ItemTemplate>
</TemplateField>
</Columns>
```
Now, I want to be able to (in the code) apply a width attribute to the "bar" panel for each... | ```
<asp:Panel ID="bar" runat="server" Width='<%# Eval("Width") %>' />
```
If you like, you can change `Eval("Width")` to the expression that calculates the width. |
429,588 | <p>I trying to export an HTML table named Table that is dynamically binded to ViewData.Model in C#. I have a method called export that is called based on another method's actions. so everything before that is set up.. I just don't know how to export the data to a CSV or Excel file.. So when the I step inside the Export... | [
{
"answer_id": 429610,
"author": "Iain Holder",
"author_id": 1122,
"author_profile": "https://Stackoverflow.com/users/1122",
"pm_score": 0,
"selected": false,
"text": "<p>CSV is a simple format and can be built up easily as a string.</p>\n\n<p><a href=\"http://en.wikipedia.org/wiki/Comma... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39809/"
] | I trying to export an HTML table named Table that is dynamically binded to ViewData.Model in C#. I have a method called export that is called based on another method's actions. so everything before that is set up.. I just don't know how to export the data to a CSV or Excel file.. So when the I step inside the Export me... | I don't quite understand the whole "export an HTML table named Table that is dynamically binded to ViewData.Model" so I'll just ignore that and focus on your *Export(List<data> list)* method. Btw, you never really mentioned what was going wrong and where.
I see you had written "if they have Excel export to excel and i... |
429,614 | <p>I want to verify if a computer is running .net 3.5 or 3.5 sp1, where do I look this info up?</p>
| [
{
"answer_id": 429623,
"author": "Filip Ekberg",
"author_id": 39106,
"author_profile": "https://Stackoverflow.com/users/39106",
"pm_score": 2,
"selected": false,
"text": "<p>You can find the answer <a href=\"http://www.walkernews.net/2008/05/16/how-to-check-net-framework-version-installe... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I want to verify if a computer is running .net 3.5 or 3.5 sp1, where do I look this info up? | In the registry:
```
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
```
This topic has been covered here:
[Determine highest .NET Framework version](https://stackoverflow.com/questions/182910/determine-highest-net-framework-version#182935) |
429,615 | <p>I'm using access 03.
let's say i'm modeling a parties database. each party has some people invited. each party also has a location and date.
when presenting the information in a form, i want to be able to merge the recurring cells. something like:</p>
<pre><code> _________________ ____________ ___________
| ... | [
{
"answer_id": 429628,
"author": "simon",
"author_id": 6040,
"author_profile": "https://Stackoverflow.com/users/6040",
"pm_score": 2,
"selected": false,
"text": "<p>On a form you could use a main form with the Party location and party date and then have a sub-form with the list of invite... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43355/"
] | I'm using access 03.
let's say i'm modeling a parties database. each party has some people invited. each party also has a location and date.
when presenting the information in a form, i want to be able to merge the recurring cells. something like:
```
_________________ ____________ ___________
| | ... | On a form you could use a main form with the Party location and party date and then have a sub-form with the list of invitees. |
429,632 | <p>We're doing a great deal of floating-point to integer number conversions in our project. Basically, something like this</p>
<pre><code>for(int i = 0; i < HUGE_NUMBER; i++)
int_array[i] = float_array[i];
</code></pre>
<p>The default C function which performs the conversion turns out to be quite time consumi... | [
{
"answer_id": 429671,
"author": "Martin York",
"author_id": 14065,
"author_profile": "https://Stackoverflow.com/users/14065",
"pm_score": 2,
"selected": false,
"text": "<p>Is the time large enough that it outweighs the cost of starting a couple of threads?</p>\n\n<p>Assuming you have a ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1007/"
] | We're doing a great deal of floating-point to integer number conversions in our project. Basically, something like this
```
for(int i = 0; i < HUGE_NUMBER; i++)
int_array[i] = float_array[i];
```
The default C function which performs the conversion turns out to be quite time consuming.
Is there any work around... | Most of the other answers here just try to eliminate loop overhead.
Only [deft\_code's answer](https://stackoverflow.com/a/429812/768469) gets to the heart of what is likely the real problem -- that converting floating point to integers is shockingly expensive on an x86 processor. deft\_code's solution is correct, tho... |
429,655 | <p>When retrieving objects from an NSMutableArray in cocoa-touch is the below code ok? Should I be allocating([alloc]) new Page objects each time or is just pointing to it alright? Do I need to do anything to the Page *pageObj after, such as set it to nil?</p>
<pre><code>const char *sql = "insert into Page(Book_ID, Pa... | [
{
"answer_id": 429665,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 1,
"selected": false,
"text": "<p>Of course not. You have allocated it before and are just referencing the same object. No need to reallocate. Also you don't... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29941/"
] | When retrieving objects from an NSMutableArray in cocoa-touch is the below code ok? Should I be allocating([alloc]) new Page objects each time or is just pointing to it alright? Do I need to do anything to the Page \*pageObj after, such as set it to nil?
```
const char *sql = "insert into Page(Book_ID, Page_Num, Page_... | The way you're declaring a pointer is correct. You don't need alloc, since that creates a new object, when you want to refer to an existing object in the array. You would want to retain it if you were going to keep the reference outside of that method, but since you're only using it temporarily it's fine not to.
The a... |
429,657 | <p>Many years ago I remember a fellow programmer counselling this:</p>
<pre><code>new Some::Class; # bad! (but why?)
Some::Class->new(); # good!
</code></pre>
<p>Sadly now I cannot remember the/his reason why. :( Both forms will work correctly even if the constructor does not actually exist in the Some::Class ... | [
{
"answer_id": 429679,
"author": "brian d foy",
"author_id": 2766176,
"author_profile": "https://Stackoverflow.com/users/2766176",
"pm_score": 4,
"selected": false,
"text": "<p>See <a href=\"http://perldoc.perl.org/perlobj.html#Indirect-Object-Syntax\" rel=\"nofollow noreferrer\">Indirec... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40468/"
] | Many years ago I remember a fellow programmer counselling this:
```
new Some::Class; # bad! (but why?)
Some::Class->new(); # good!
```
Sadly now I cannot remember the/his reason why. :( Both forms will work correctly even if the constructor does not actually exist in the Some::Class module but instead is inherit... | Using `new Some::Class` is called "indirect" method invocation, and it's bad because it introduces some ambiguity into the syntax.
One reason it can fail is if you have an array or hash of objects. You might expect
```
dosomethingwith $hashref->{obj}
```
to be equal to
```
$hashref->{obj}->dosomethingwith();
```... |
429,684 | <p>I have a SQL Server 2005 database that is linked to an Oracle database. What I want to do is run a query to pull some ID numbers out of it, then find out which ones are in Oracle.</p>
<p>So I want to take the results of this query:</p>
<pre><code>SELECT pidm
FROM sql_server_table
</code></pre>
<p>And do somethin... | [
{
"answer_id": 429695,
"author": "jcollum",
"author_id": 30946,
"author_profile": "https://Stackoverflow.com/users/30946",
"pm_score": 1,
"selected": false,
"text": "<p>Store openquery results in a temp table, then do an inner join between the SQL table and the temp table. </p>\n"
},
... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | I have a SQL Server 2005 database that is linked to an Oracle database. What I want to do is run a query to pull some ID numbers out of it, then find out which ones are in Oracle.
So I want to take the results of this query:
```
SELECT pidm
FROM sql_server_table
```
And do something like this to query the Oracle da... | Ahhhh, pidms. Brings back bad memories! :)
You could do the join, but you would do it like this:
```
select sql.pidm,sql.field2 from sqltable as sql
inner join
(select pidm,field2 from oracledb..schema.table) as orcl
on
sql.pidm = orcl.pidm
```
I'm not sure if you could write a PL/SQL procedure that would take a t... |
429,692 | <p>I have a system-wide manual reset event that I create by doing the following:</p>
<pre><code>EventWaitHandle notifyEvent = new EventWaitHandle(false, EventResetMode.ManualReset, notifyEventName, out createdEvent);
</code></pre>
<p>Several processes create this event (e.g. it is shared amongst them). It is used for... | [
{
"answer_id": 429729,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 0,
"selected": false,
"text": "<p>You are using the wrong synchronization type here. Instead of an event, you should use the Semaphore class, with the... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1869/"
] | I have a system-wide manual reset event that I create by doing the following:
```
EventWaitHandle notifyEvent = new EventWaitHandle(false, EventResetMode.ManualReset, notifyEventName, out createdEvent);
```
Several processes create this event (e.g. it is shared amongst them). It is used for notifying when something ... | You're using the EventWaitHandle class incorrectly. A reset event shouldn't be used to signal multiple threads. Instead, you need to create a reset event for each thread and then when you're ready loop through them all and use Set(). The master thread should not be calling the Reset() method. Each thread should be resp... |
429,707 | <p>I have a ListView that I am databinding to a collection of objects something like this:</p>
<pre><code>int total;
List<Client> clientList =
clientData.GetClients(criteria, pageNum, pageSize, out total);
uxClientList.DataSource = clientList;
uxClientList.DataBind();
</code></pre>
<p>Where the pageNum, pa... | [
{
"answer_id": 430179,
"author": "Seth Reno",
"author_id": 50225,
"author_profile": "https://Stackoverflow.com/users/50225",
"pm_score": 3,
"selected": true,
"text": "<p>You haven't overlooked anything.</p>\n\n<p>When dealing with large result sets you need to turn paging off and add you... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4296/"
] | I have a ListView that I am databinding to a collection of objects something like this:
```
int total;
List<Client> clientList =
clientData.GetClients(criteria, pageNum, pageSize, out total);
uxClientList.DataSource = clientList;
uxClientList.DataBind();
```
Where the pageNum, pageSize and total parameters faci... | You haven't overlooked anything.
When dealing with large result sets you need to turn paging off and add your own paging controls.
In my experience << < > >> suffice. Nobody goes past the 3rd page anyway. |
429,719 | <p>I have the following regex:</p>
<pre><code>(?!^[&#]*$)^([A-Za-z0-9-'.,&@:?!()$#/\\]*)$
</code></pre>
<p>So allow A-Z, a-Z, 0-9, and these special chars <code>'.,&@:?!()$#/\</code></p>
<p>I want to NOT match if the following set of chars is encountered anywhere in the string in this order:</p>
<pre><c... | [
{
"answer_id": 429749,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>I would actually do it in two parts:</p>\n\n<ol>\n<li>Check your allowed character set. To do this I would look fo... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22451/"
] | I have the following regex:
```
(?!^[&#]*$)^([A-Za-z0-9-'.,&@:?!()$#/\\]*)$
```
So allow A-Z, a-Z, 0-9, and these special chars `'.,&@:?!()$#/\`
I want to NOT match if the following set of chars is encountered anywhere in the string in this order:
```
&#
```
When I run this regex with just "&#" as input, it does... | Borrowing a technique for matching quoted strings, remove `&` from your character class, add an alternative for `&` **not** followed by `#`, and allow the string to optionally end with `&`:
>
> `^((?:[A-Za-z0-9-'.,@:?!()$#/\\]+|&[^#])*&?)$`
>
>
> |
429,745 | <p>I am looking for the best way to check that a database login exists in SQL Server 2005. I am currently using </p>
<pre><code>IF suser_sid('loginname') IS NOT NULL
</code></pre>
<p>but suser_sid() returns a value in some cases where a login does not exist. </p>
<p>In SQL 2000 we use </p>
<pre><code>SELECT * FROM... | [
{
"answer_id": 429754,
"author": "George Mastros",
"author_id": 1408129,
"author_profile": "https://Stackoverflow.com/users/1408129",
"pm_score": 3,
"selected": true,
"text": "<p>For sql2005...</p>\n\n<pre><code>select * from master.sys.syslogins WHERE [name] ='loginname'\n</code></pre>\... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3341/"
] | I am looking for the best way to check that a database login exists in SQL Server 2005. I am currently using
```
IF suser_sid('loginname') IS NOT NULL
```
but suser\_sid() returns a value in some cases where a login does not exist.
In SQL 2000 we use
```
SELECT * FROM [Master].[dbo].[sysxlogins] WHERE [name] =... | For sql2005...
```
select * from master.sys.syslogins WHERE [name] ='loginname'
``` |
429,758 | <p>I've seen two common approaches for checking if a column exists in an IDataReader:</p>
<pre><code>public bool HasColumn(IDataReader reader, string columnName)
{
try
{
reader.getOrdinal(columnName)
return true;
}
catch
{
return false;
}
}
</code></pre>
<p>Or:</p>
<pre><code>public b... | [
{
"answer_id": 430117,
"author": "Eric Rosenberger",
"author_id": 41624,
"author_profile": "https://Stackoverflow.com/users/41624",
"pm_score": 1,
"selected": false,
"text": "<p>A lot depends on how you're using HasColumn. Are you calling it just once or twice, or repeatedly in a loop? I... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] | I've seen two common approaches for checking if a column exists in an IDataReader:
```
public bool HasColumn(IDataReader reader, string columnName)
{
try
{
reader.getOrdinal(columnName)
return true;
}
catch
{
return false;
}
}
```
Or:
```
public bool HasColumn(IDataReader reader, str... | I think I have a reasonable answer for this old gem.
I would go with the first approach cause its much simpler. If you want to avoid the exception you can cache the field names and do a TryGet on the cache.
```
public Dictionary<string,int> CacheFields(IDataReader reader)
{
var cache = new Dictionary<string,int... |
429,762 | <p>If I open and close a socket by calling for instance</p>
<pre><code>Socket s = new Socket( ... );
s.setReuseAddress(true);
in = s.getInputStream();
...
in.close();
s.close();
</code></pre>
<p>Linux states that this socket is still open or at least the file descriptor for the connection is presen. When query... | [
{
"answer_id": 429779,
"author": "MarkR",
"author_id": 13724,
"author_profile": "https://Stackoverflow.com/users/13724",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe it's a socket of some other protocol (\"Can't identify protocol\" eh?) used internally in the implementation to do ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30294/"
] | If I open and close a socket by calling for instance
```
Socket s = new Socket( ... );
s.setReuseAddress(true);
in = s.getInputStream();
...
in.close();
s.close();
```
Linux states that this socket is still open or at least the file descriptor for the connection is presen. When querying the open files for thi... | If those sockets are all in the TIME\_WAIT state, this is normal, at least for a little while. Check that with netstat; it is common for sockets to hang around for a few minutes to ensure that straggling data from the socket is successfully thrown away before reusing the port for a new socket. |
429,763 | <p>I'm working on a website of a client, a local church. I've embedded a Google Map using the Link feature on the Maps page. The info window on the map includes "Reviews," and the church is concerned about this. Is there a way to remove that from the info window? I don't want to remove any reviews themselves, just ... | [
{
"answer_id": 429814,
"author": "Michael Itzoe",
"author_id": 28240,
"author_profile": "https://Stackoverflow.com/users/28240",
"pm_score": 0,
"selected": false,
"text": "<p>I think I found the answer to my own question. The info window itself can't be modified, but by linking to the m... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28240/"
] | I'm working on a website of a client, a local church. I've embedded a Google Map using the Link feature on the Maps page. The info window on the map includes "Reviews," and the church is concerned about this. Is there a way to remove that from the info window? I don't want to remove any reviews themselves, just that li... | Nearly 2 years ago, I created a [custom map](http://biesdesign.com/ross/index.php) with complete control over the contents of the bubble, using the API and some code manipulation. Click on the above link for a demo. I've cleaned up the code for this answer, although to implement you'll need to replace all YOUR\_\_BLANK... |
429,777 | <p>Has anyone seen this error when trying to call an external C function from an Oracle query? I'm using Oracle 10g and get this error every time I try to call one of the two functions in the library. A call to the other function returns fine every time, though the function that works is all self-contained, no calls ... | [
{
"answer_id": 429814,
"author": "Michael Itzoe",
"author_id": 28240,
"author_profile": "https://Stackoverflow.com/users/28240",
"pm_score": 0,
"selected": false,
"text": "<p>I think I found the answer to my own question. The info window itself can't be modified, but by linking to the m... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75/"
] | Has anyone seen this error when trying to call an external C function from an Oracle query? I'm using Oracle 10g and get this error every time I try to call one of the two functions in the library. A call to the other function returns fine every time, though the function that works is all self-contained, no calls to an... | Nearly 2 years ago, I created a [custom map](http://biesdesign.com/ross/index.php) with complete control over the contents of the bubble, using the API and some code manipulation. Click on the above link for a demo. I've cleaned up the code for this answer, although to implement you'll need to replace all YOUR\_\_BLANK... |
429,805 | <p>I'm trying to create a relation where any of four different parts may be included, but any collection of the same parts should be handled as unique.</p>
<p>Example:
An assignment must have an assigned company, may optionally have an assigned location, workgroup and program.
An assignment may not have a workgroup wi... | [
{
"answer_id": 429826,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 2,
"selected": false,
"text": "<p>The only way I can think of handling this without additional triggers/programming would be to have a single \"Non... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to create a relation where any of four different parts may be included, but any collection of the same parts should be handled as unique.
Example:
An assignment must have an assigned company, may optionally have an assigned location, workgroup and program.
An assignment may not have a workgroup without a lo... | This is a Feature (though not what I expected, either).
[This thread](http://lists.mysql.com/mysql/203863) suggests making your key a Primary key to get the behavior you expected:
>
> This is a feature - a NULL value is an
> undefined value, therefore two NULL
> values are not the same. Can be a
> little confusin... |
429,806 | <p>I've wrapped Perl's <a href="http://search.cpan.org/perldoc?Net::SSH::Expect" rel="nofollow noreferrer">Net::SSH::Expect</a> with a small module to reduce the boilerplate code needed to write a new configuration script for use with our HP <a href="http://en.wikipedia.org/wiki/HP_Integrated_Lights-Out" rel="nofollow ... | [
{
"answer_id": 429894,
"author": "Andru Luvisi",
"author_id": 5922,
"author_profile": "https://Stackoverflow.com/users/5922",
"pm_score": 3,
"selected": false,
"text": "<p>The usual way to raise exceptions in Perl is with <a href=\"http://perldoc.perl.org/functions/die.html\" rel=\"nofol... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38388/"
] | I've wrapped Perl's [Net::SSH::Expect](http://search.cpan.org/perldoc?Net::SSH::Expect) with a small module to reduce the boilerplate code needed to write a new configuration script for use with our HP [iLO](http://en.wikipedia.org/wiki/HP_Integrated_Lights-Out) cards. While on one hand I want this wrapper to be as lea... | If you're familiar with exceptions from languages like Java, then think of `die` as `throw` and `eval` as `try` and `catch`. Instead of returning `undef`, you could do something like this:
```
if ($self->{ssh}->waitfor($response, $self->{CMD_TIMEOUT}, '-re')) {
return {
before => $self->{ssh}->before(),
... |
429,816 | <p>I have a system in production that has several servers in several roles. I would like to test a new app server by deploying to that specific server, without having to redeploy to every server in production. Is there a way to ask Capistrano to deploy to a specific server? Ideally I'd like to be able to run something ... | [
{
"answer_id": 430422,
"author": "Dave Pirotte",
"author_id": 53600,
"author_profile": "https://Stackoverflow.com/users/53600",
"pm_score": 1,
"selected": false,
"text": "<p>You should be able to do something like this in deploy.rb:</p>\n\n<pre><code>task :production do\n if ENV['SERVER... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53529/"
] | I have a system in production that has several servers in several roles. I would like to test a new app server by deploying to that specific server, without having to redeploy to every server in production. Is there a way to ask Capistrano to deploy to a specific server? Ideally I'd like to be able to run something lik... | I ended up posting a question on the capistrano users list [here](http://groups.google.com/group/capistrano/browse_thread/thread/592ab63dda72d7e), and got the following response from Jamis (edited a bit by me here for clarity):
---
Try the HOSTS environment variable:
```
cap HOSTS=app2.example.com production deploy
... |
429,841 | <pre><code>-(NSDictionary *)properties;
+(NSDictionary *)ClassProperties;
</code></pre>
<p>Now, how can I call ClassProperties from sub-classes?</p>
<pre><code>-(NSDictionary *)properties {
return [? ClassProperties];
}
</code></pre>
<p>The point is that <code>ClassProperties</code> gets the list of properties i... | [
{
"answer_id": 429848,
"author": "Marc Charbonneau",
"author_id": 35136,
"author_profile": "https://Stackoverflow.com/users/35136",
"pm_score": 1,
"selected": false,
"text": "<p>You can just use the class name of the subclass.</p>\n"
},
{
"answer_id": 430173,
"author": "Cody ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | ```
-(NSDictionary *)properties;
+(NSDictionary *)ClassProperties;
```
Now, how can I call ClassProperties from sub-classes?
```
-(NSDictionary *)properties {
return [? ClassProperties];
}
```
The point is that `ClassProperties` gets the list of properties in the class, so i can't call the base class definitio... | Along the lines of Marc's response, you could more generally call the method with
```
[[self class] ClassProperties]
```
In fact, if your base class and all the subclasses implement `+ (NSDictionary *)ClassProperties`, then your base class can do this
```
- (NSDictionary *)properties {
return [[self class] Clas... |
429,849 | <p>I have a question on C++ double dispatch. In the code below, I want the results from the second set to match the results from the first set. </p>
<p>I don't know the actual type (unless I try dynamic_cast) but I do know that the object inherited from the BaseClass type. What is the most efficient (performance-wise)... | [
{
"answer_id": 429867,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 3,
"selected": false,
"text": "<p>You'll have to put a virtual method on BaseClass to call processObj from the derived classes.</p>\n\n<pre><code>class Bas... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53532/"
] | I have a question on C++ double dispatch. In the code below, I want the results from the second set to match the results from the first set.
I don't know the actual type (unless I try dynamic\_cast) but I do know that the object inherited from the BaseClass type. What is the most efficient (performance-wise) way to a... | You'll have to put a virtual method on BaseClass to call processObj from the derived classes.
```
class BaseClass{
public:
BaseClass(){}
virtual void ProcessThis(Processor &p) { p.processObj(this); }
virtual void myFunction(){cout << "base myFunction called" << endl;}
};
class Derived1: public Ba... |
429,864 | <p>I am writing an application to manage user access to files. The short version of a very long story is that I have to use directory and file priveleges to do it. No document management system for our cheap CEO...</p>
<p>Anyway... I have everything working except the case where the user can view which files are in th... | [
{
"answer_id": 429901,
"author": "Eric Rosenberger",
"author_id": 41624,
"author_profile": "https://Stackoverflow.com/users/41624",
"pm_score": 4,
"selected": true,
"text": "<p>The FileSystemRights enum maps both ReadData and ListDirectory to the value 1, so the two are 100% equivalent a... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53531/"
] | I am writing an application to manage user access to files. The short version of a very long story is that I have to use directory and file priveleges to do it. No document management system for our cheap CEO...
Anyway... I have everything working except the case where the user can view which files are in the director... | The FileSystemRights enum maps both ReadData and ListDirectory to the value 1, so the two are 100% equivalent as far as .NET is concerned.
Have you tried Traverse as opposed to ListDirectory?
Edit: Based on [this](http://support.microsoft.com/kb/308419) KB article it appears that Windows XP considers them to be the s... |