Id int64 4 8.51M | PostTypeId int64 1 7 | AcceptedAnswerId int64 7 75.5M ⌀ | ParentId int64 4 41.8M ⌀ | Score int64 -208 27.7k | ViewCount int64 11 12.4M ⌀ | Body stringlengths 0 45k | Title stringlengths 2 150 ⌀ | ContentLicense stringclasses 3
values | FavoriteCount int64 0 225 ⌀ | CreationDate stringdate 2008-07-31 21:42:52 2011-12-14 18:48:47 | LastActivityDate stringdate 2008-08-01 12:19:17 2023-03-05 04:40:26 | LastEditDate stringdate 2008-08-01 13:54:25 2023-03-05 03:12:45 ⌀ | LastEditorUserId int64 -1 21.3M ⌀ | OwnerUserId int64 -1 21.1M ⌀ | Tags listlengths 1 6 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
31,039 | 2 | null | 31,031 | 1 | null | I would say use the standard "Open File" dialog box ([OpenFileDialog](http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx)), this makes it less intimidating for new users and helps with a consistant UI.
| null | CC BY-SA 2.5 | null | 2008-08-27T19:47:44.187 | 2008-08-27T19:47:44.187 | null | null | 832 | null |
31,040 | 2 | null | 31,031 | 1 | null | Close, Ryan, but you never showed the dialog. it should be:
```
if (dlg.ShowDialog() == DialogResult.OK)
```
| null | CC BY-SA 2.5 | null | 2008-08-27T19:47:55.760 | 2008-08-27T19:47:55.760 | null | null | 3,043 | null |
31,049 | 2 | null | 30,947 | 3 | null | Visual Assist X. Spell checks your comments and a whole lot more.
[http://www.wholetomato.com/](http://www.wholetomato.com/)
| null | CC BY-SA 2.5 | null | 2008-08-27T19:50:53.837 | 2008-08-27T19:50:53.837 | null | null | 1,254 | null |
30,988 | 2 | null | 30,966 | 4 | null | InputManagers are still available on Leopard, :
- `/Library/InputManagers`- -
[The Leopard AppKit Release Notes have more specific details.](http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSInputManager)
| null | CC BY-SA 2.5 | null | 2008-08-27T19:32:41.397 | 2008-08-27T19:32:41.397 | null | null | 1,600 | null |
31,042 | 2 | null | 29,144 | 4 | null | Honestly I think it depends on the discipline of the developers.
I use Subversion for my personal work and I've used it at a few jobs. What I like about Subversion is I don't have to hunt someone down and ask them why they're working on something and if it would be OK for me to do some work. The problem comes when s... | null | CC BY-SA 2.5 | null | 2008-08-27T19:48:57.443 | 2008-08-27T19:48:57.443 | null | null | 2,547 | null |
31,043 | 2 | null | 30,985 | 0 | null | I would use a minor variation in the second `union`:
```
where (ISNULL(feed_tbl.name, 'NONAME') <> ISNULL(data_tbl.name, 'NONAME')) OR
(ISNULL(data_tbl.status, 'NOSTATUS') <> ISNULL(feed_tbl.status, 'NOSTATUS')) OR
(ISNULL(data_tbl.update, '12/31/2039') <> ISNULL(feed_tbl.update, '12/31/2039'))
```
For reasons I hav... | null | CC BY-SA 3.0 | null | 2008-08-27T19:49:14.417 | 2013-06-11T15:26:57.973 | 2013-06-11T15:26:57.973 | 2,156,756 | 2,173 | null |
31,047 | 2 | null | 31,044 | 1,423 | null | Yes!
```
jQuery.fn.exists = function(){ return this.length > 0; }
if ($(selector).exists()) {
// Do something
}
```
This is in response to: [Herding Code podcast with Jeff Atwood](http://herdingcode.com/?p=36)
| null | CC BY-SA 3.0 | null | 2008-08-27T19:50:03.057 | 2017-02-13T22:37:16.237 | 2017-02-13T22:37:16.237 | null | 302 | null |
31,044 | 1 | 587,408 | null | 3,104 | 853,542 | How can I check the existence of an element in jQuery?
The current code that I have is this:
```
if ($(selector).length > 0) {
// Do something
}
```
Is there a more elegant way to approach this? Perhaps a plugin or a function?
| Is there an "exists" function for jQuery? | CC BY-SA 3.0 | 0 | 2008-08-27T19:49:41.107 | 2022-08-27T15:40:30.717 | 2017-12-16T11:29:03.803 | 449,444 | 302 | [
"javascript",
"jquery"
] |
30,947 | 1 | 102,168 | null | 33 | 6,926 | If possible one that supports at least spell checking:
- - -
| Visual Studio 08 Spell Check Addin? | CC BY-SA 2.5 | 0 | 2008-08-27T19:17:55.757 | 2011-09-28T11:23:36.763 | 2010-01-27T17:29:17.250 | 4,872 | 1,946 | [
"visual-studio",
"visual-studio-2008",
"add-in"
] |
31,051 | 1 | 31,300 | null | 3 | 536 | So we're trying to set up replicated repositories using PlasticSCM, one in the US, and one in Australia and running into a bit of a snag.
The US configuration is Active Directory, the AU configuration is User/Password. This in itself is not a big deal, I've already set up the SID translation table.
The problem is ... | Setting up replicated repositories in Plastic SCM | CC BY-SA 2.5 | null | 2008-08-27T19:51:09.420 | 2009-04-02T14:38:51.587 | 2008-08-27T19:52:43.863 | 832 | 2,170 | [
"version-control",
"repository",
"plasticscm"
] |
31,057 | 1 | 31,063 | null | 670 | 1,334,160 | I didn't see any similar questions asked on this topic, and I had to research this for something I'm working on right now. Thought I would post the answer for it in case anyone else had the same question.
| How to insert a line break in a SQL Server VARCHAR/NVARCHAR string | CC BY-SA 2.5 | 0 | 2008-08-27T19:53:01.303 | 2020-06-15T08:47:01.653 | 2013-07-10T19:18:56.273 | 72,324 | 1,284 | [
"sql",
"sql-server",
"line-breaks"
] |
31,056 | 2 | null | 31,053 | 46 | null | Will this do?
```
[^\r]\n
```
Basically it matches a '\n' that is preceded with a character that is not '\r'.
If you want it to detect lines that start with just a single '\n' as well, then try
```
([^\r]|$)\n
```
Which says that it should match a '\n' but only those that is the first character of a line or thos... | null | CC BY-SA 3.0 | null | 2008-08-27T19:52:19.043 | 2017-12-01T11:45:31.767 | 2017-12-01T11:45:31.767 | 107,675 | 3,055 | null |
31,059 | 1 | 514,368 | null | 260 | 242,863 | In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of the FolderBrowserDialog, but I've never really liked that dialog. It s... | How do you configure an OpenFileDialog to select folders? | CC BY-SA 3.0 | 0 | 2008-08-27T19:54:16.713 | 2020-11-16T06:05:27.663 | 2013-01-26T22:43:25.013 | 1,197,518 | 2,547 | [
".net",
"windows",
"winapi",
"openfiledialog"
] |
31,063 | 2 | null | 31,057 | 335 | null | I found the answer here: [http://blog.sqlauthority.com/2007/08/22/sql-server-t-sql-script-to-insert-carriage-return-and-new-line-feed-in-code/](http://blog.sqlauthority.com/2007/08/22/sql-server-t-sql-script-to-insert-carriage-return-and-new-line-feed-in-code/)
You just concatenate the string and insert a `CHAR(13)` w... | null | CC BY-SA 3.0 | null | 2008-08-27T19:55:42.467 | 2012-04-03T23:25:21.717 | 2012-04-03T23:25:21.717 | 75,642 | 1,284 | null |
31,068 | 1 | null | null | 38 | 76,268 | How do I find the 'temp' directory in Linux? I am writing a platform neutral C++ function that returns the temp directory. In Mac and Windows, there is an API that returns these results. In Linux, I'm stumped.
| How do I find the 'temp' directory in Linux? | CC BY-SA 3.0 | 0 | 2008-08-27T19:56:44.413 | 2021-05-05T09:01:16.500 | 2021-05-05T09:01:16.500 | 3,937,850 | 3,313 | [
"c++",
"linux"
] |
31,074 | 2 | null | 31,053 | 1 | null | ```
myStr.Replace("([^\r])\n", "$1\r\n");
```
$ may need to be a \
| null | CC BY-SA 2.5 | null | 2008-08-27T19:57:26.143 | 2008-08-27T19:57:26.143 | null | null | 96 | null |
31,070 | 2 | null | 31,053 | 3 | null | I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives would a... | null | CC BY-SA 2.5 | null | 2008-08-27T19:57:01.090 | 2008-08-27T20:30:46.313 | 2008-08-27T20:30:46.313 | 3,308 | 3,308 | null |
31,066 | 2 | null | 20,156 | 13 | null | I rather liked elements from both [Stu](https://stackoverflow.com/a/20166/3312)'s and [samjudson](https://stackoverflow.com/a/20175/3312)'s solutions and worked them together into what I think is a usable combo:
```
public static string Ordinal(this int number)
{
const string TH = "th";
var s = number.ToString(... | null | CC BY-SA 4.0 | null | 2008-08-27T19:56:15.977 | 2020-08-17T23:15:59.807 | 2020-08-17T23:15:59.807 | 1,364,007 | 3,312 | null |
31,075 | 1 | null | null | 0 | 218 | I have an executable (compiled by someone else) that is hitting an assertion near my code. I work on the code in Visual C++ 2003, but I don't have a project file for this particular executable (the code is used to build many different tools). Is it possible to launch the binary in Visual C++'s debugger and just tell it... | Attaching to a foreign executable in Visual C++ 2003 | CC BY-SA 2.5 | null | 2008-08-27T19:57:39.187 | 2008-12-28T15:46:32.010 | 2008-12-28T15:46:32.027 | 15,614 | 1,891 | [
"debugging",
"visual-c++",
"visual-studio-2003"
] |
31,076 | 2 | null | 30,540 | 0 | null | This likely causeed by a change made in the Flash Player version released in early April, I'm not too sure about the specifics, but I assume there were security concerns with this functionality.
What you need to do is indeed add that to your crossdomain.xml (which should be in your servers webroot)
You can read more ... | null | CC BY-SA 2.5 | null | 2008-08-27T19:58:40.650 | 2008-08-27T19:58:40.650 | null | null | 914 | null |
31,077 | 1 | 1,781,042 | null | 8 | 31,520 | Looking for a way to display a PDF in Flex. I'm sure there are several ways. Looking for the easiest to maintain / integrate / most user friendly. I'm guessing it's possible to display a browser window in the app and render it, but if it goes off of IE / FireFox it's not acceptable for this project.
Thanks...
| How do I display a PDF in Adobe Flex? | CC BY-SA 2.5 | 0 | 2008-08-27T19:58:50.337 | 2013-03-13T04:39:09.700 | null | null | 26 | [
"apache-flex",
"pdf",
"adobe"
] |
31,081 | 2 | null | 31,068 | 12 | null | Use the value of the $TMPDIR environment variable, and if that doesn't exist, use `/tmp`.
| null | CC BY-SA 2.5 | null | 2008-08-27T19:59:13.847 | 2008-08-30T12:20:16.923 | 2008-08-30T12:20:16.940 | 893 | 893 | null |
31,002 | 2 | null | 29,144 | 1 | null | > If I understand correctly, Perforce makes all files that are not checked out read-only.
This is only the default behaviour. If required, frequently changing files can be set to be read-write instead. See a full list of file modifiers [here](http://www.perforce.com/perforce/doc.current/manuals/p4guide/ab_filetypes.h... | null | CC BY-SA 2.5 | null | 2008-08-27T19:38:02.913 | 2008-08-27T19:38:02.913 | null | null | 3,295 | null |
31,067 | 2 | null | 31,057 | 18 | null | Following a [Google](http://www.google.co.uk/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&hs=8ER&q=linebreak+in+varchar+sql&btnG=Search&meta=)...
Taking the code from the website:
```
CREATE TABLE CRLF
(
col1 VARCHAR(1000)
)
INSERT CRLF SELECT 'The quick brown@'
INSERT CR... | null | CC BY-SA 2.5 | null | 2008-08-27T19:56:30.373 | 2008-08-27T19:56:30.373 | null | null | 832 | null |
31,053 | 1 | 31,056 | null | 44 | 80,915 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although they... | Regex (C#): Replace \n with \r\n | CC BY-SA 4.0 | 0 | 2008-08-27T19:51:30.730 | 2022-04-22T10:10:20.357 | 2022-04-22T10:10:20.357 | 5,446,749 | 838 | [
"c#",
"regex"
] |
31,061 | 2 | null | 30,985 | 2 | null | UNION will remove duplicates, so just UNION the two together, then search for anything with more than one entry. Given "code" as a primary key, you can say:
```
select dt.*
from
data_tbl dt
,(
select code
from
(
select * from feed_tbl
union
select * from data_tbl
)
gr... | null | CC BY-SA 2.5 | null | 2008-08-27T19:54:40.660 | 2008-08-28T13:15:15.290 | 2008-08-28T13:15:15.290 | 672 | 672 | null |
31,083 | 2 | null | 31,068 | 19 | null | Edit: Fair point from the commenter. `tmpnam` isn't a good choice these days; use `mktemp`/`mkstemp` instead.
| null | CC BY-SA 3.0 | null | 2008-08-27T20:00:04.373 | 2012-03-10T13:47:27.537 | 2012-03-10T13:47:27.537 | 1,200 | 1,200 | null |
31,082 | 2 | null | 31,059 | 29 | null | Better to use the FolderBrowserDialog for that.
```
using (FolderBrowserDialog dlg = new FolderBrowserDialog())
{
dlg.Description = "Select a folder";
if (dlg.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("You selected: " + dlg.SelectedPath);
}
}
```
| null | CC BY-SA 2.5 | null | 2008-08-27T19:59:17.763 | 2008-08-27T19:59:17.763 | null | null | 1,627 | null |
31,094 | 2 | null | 30,998 | 1 | null | I tend to make classes that consist of static functions, but some say the "right way" to do this is usually to use namespaces instead. (I developed my habits before C++ had namespaces.)
BTW, if you have a class that consists only of static data and functions, you should declare the constructor to be private, so nobod... | null | CC BY-SA 2.5 | null | 2008-08-27T20:04:41.853 | 2008-10-07T15:30:38.400 | 2008-10-07T15:30:38.400 | 1,175 | 1,175 | null |
31,086 | 2 | null | 20,958 | 186 | null | [UK Government Data Standards Catalogue](http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/254290/GDS%20Catalogue%20Vol%202.pdf) details the UK standards for this kind of thing.
It suggests 35 characters for each of Given Name and Family Name, or 70 characters for a single field to hold ... | null | CC BY-SA 3.0 | null | 2008-08-27T20:01:20.113 | 2012-06-25T11:58:32.043 | 2012-06-25T11:58:32.043 | 601,386 | 2,084 | null |
31,060 | 2 | null | 30,985 | 0 | null | You could also use a `FULL OUTER JOIN` and a `CASE ... END` statement on the `diff_type` column along with the aforementioned `where` clause in [querying 2 tables with the same spec for the differences](https://stackoverflow.com/questions/30985/querying-2-tables-with-the-same-spec-for-the-differences#31043)
That wo... | null | CC BY-SA 3.0 | null | 2008-08-27T19:54:31.113 | 2013-06-11T15:27:48.120 | 2017-05-23T12:30:56.003 | -1 | 2,170 | null |
31,096 | 1 | 31,164 | null | 19 | 17,921 | I'm trying to find out how much memory my own .Net server process is using (for monitoring and logging purposes).
I'm using:
```
Process.GetCurrentProcess().PrivateMemorySize64
```
However, the Process object has several different properties that let me read the memory space used:
Paged, NonPaged, PagedSystem, NonP... | Process Memory Size - Different Counters | CC BY-SA 2.5 | 0 | 2008-08-27T20:05:23.300 | 2018-11-13T21:52:41.623 | 2014-08-26T23:19:08.433 | 1,563,422 | 3,314 | [
"c#",
".net",
"memory",
"process",
"diagnostics"
] |
31,091 | 2 | null | 696 | 4 | null | Rather than setup a 2nd box, why don't you look into the PHP Connector for iSeries? My mainframe guys said it was very easy to setup on our iSeries here.
We wrote a simple server in PHP that loads data models from DB2 data, serializes them, and returns them to the caller. This approach means that only another PHP app... | null | CC BY-SA 2.5 | null | 2008-08-27T20:03:12.293 | 2008-08-27T20:03:12.293 | null | null | null | null |
31,100 | 2 | null | 31,068 | 32 | null | Check following variables:
- `TMPDIR`- [P_tmpdir macro](http://www.gnu.org/software/libc/manual/html_node/Temporary-Files.html#index-P_005ftmpdir-1608)
If all fails try to use the directory `/tmp`.
You can also use `tempnam` function to generate a unique temporary file name.
| null | CC BY-SA 3.0 | null | 2008-08-27T20:06:25.840 | 2013-05-16T00:13:02.893 | 2013-05-16T00:13:02.893 | 12,892 | 3,315 | null |
31,088 | 1 | 31,110 | null | 2 | 4,766 | I'm trying to set up an inheritance hierarchy similar to the following:
```
abstract class Vehicle
{
public string Name;
public List<Axle> Axles;
}
class Motorcycle : Vehicle
{
}
class Car : Vehicle
{
}
abstract class Axle
{
public int Length;
public void Turn(int numTurns) { ... }
}
class MotorcycleAxle :... | What is the best way to inherit an array that needs to store subclass specific data? | CC BY-SA 2.5 | null | 2008-08-27T20:02:00.813 | 2008-10-09T22:22:38.660 | 2008-10-09T22:22:38.660 | 20,310 | 327 | [
"c#",
"oop",
"inheritance",
"covariance",
"contravariance"
] |
31,111 | 2 | null | 30,998 | 27 | null | > but is it good or bad
The first adjective that comes to mind is "unnecessary". C++ has free functions and namespaces, so why would you need to make them static functions in a class?
The use of static methods in uninstantiable classes in C# and Java because those languages don't have free functions (that is, func... | null | CC BY-SA 2.5 | null | 2008-08-27T20:10:38.233 | 2008-08-27T20:10:38.233 | null | null | 2,131 | null |
31,116 | 2 | null | 24,270 | 1 | null | > Maybe a bonnet, lap or a tree is not a chair but they all are ISittable.
Yes, but only ex post facto. They're ISittable because someone sat on them.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:11:52.817 | 2008-08-27T20:11:52.817 | null | null | 2,131 | null |
31,118 | 2 | null | 31,090 | 1 | null | I don't think there's a built-in control that can do it in .NET. I'm poking around in the MSDN documentation for the standard Windows Button control, but it doesn't look like it's there.
I did find a [Code Project article](http://www.codeproject.com/KB/buttons/SplitButton.aspx) with a custom implementation; this migh... | null | CC BY-SA 2.5 | null | 2008-08-27T20:12:24.017 | 2008-08-27T20:12:24.017 | null | null | 2,547 | null |
31,120 | 2 | null | 7,652 | 1 | null | LinqBridge works fine under .NET 2.0, and you get all the Linq extensions and query language. You need VS 2008 in order to use it, but you already knew that.
However, Linq it not an ORM. It's a query syntax. If you want to use Linq to query a database, you will need .NET 3.5. That's because 2.0 does not provide the me... | null | CC BY-SA 2.5 | null | 2008-08-27T20:12:55.140 | 2008-08-27T20:12:55.140 | null | null | 3,282 | null |
31,097 | 1 | 31,860 | null | 11 | 1,090 | Visual Basic code does not render correctly with [prettify.js](https://code.google.com/archive/p/google-code-prettify) from Google.
on Stack Overflow:
```
Partial Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
... | Is there a lang-vb or lang-basic option for prettify.js from Google? | CC BY-SA 4.0 | 0 | 2008-08-27T20:05:30.883 | 2021-11-14T11:54:06.860 | 2021-11-14T11:54:06.860 | 4,751,173 | 83 | [
"javascript",
"vb.net",
"prettify"
] |
31,126 | 2 | null | 683 | 10 | null | you could always write one yourself:
```
def iterattr(iterator, attributename):
for obj in iterator:
yield getattr(obj, attributename)
```
will work with anything that iterates, be it a tuple, list, or whatever.
I love python, it makes stuff like this very simple and no more of a hassle than neccessary,... | null | CC BY-SA 2.5 | null | 2008-08-27T20:13:49.943 | 2008-08-27T20:13:49.943 | null | null | 3,119 | null |
31,127 | 1 | 45,580 | null | 48 | 41,192 | When running a Java app from eclipse my ImageIcon shows up just fine.
But after creating a jar the path to the image obviously gets screwed up.
Is there a way to extract an image from the jar at runtime so I can then open it up? Or, is there a better way to do this?
I'd like to distribute a single jar file if possi... | Java Swing: Displaying images from within a Jar | CC BY-SA 3.0 | 0 | 2008-08-27T20:14:07.150 | 2017-02-07T09:56:05.363 | 2015-06-24T17:11:22.080 | 95,674 | 2,598 | [
"java",
"swing",
"embedded-resource",
"imageicon"
] |
31,128 | 1 | 32,478 | null | 5 | 363 | The HTML standard defines a clear separation of concerns between CSS (presentation) and HTML (semantics or structure).
Does anyone use a coding standards document for CSS and XHTML that has clauses which help to maintain this separation? What would be good clauses to include in such a coding standards document?
| Enforcing web coding standards | CC BY-SA 3.0 | null | 2008-08-27T20:14:15.543 | 2017-02-23T10:45:47.193 | 2012-05-17T15:16:51.863 | 106,224 | 2,822 | [
"html",
"css",
"xhtml",
"coding-style"
] |
31,090 | 1 | 31,262 | null | 9 | 4,466 | The `Open` button on the open file dialog used in certain windows applications includes a dropdown arrow with a list of additional options — namely `Open With..`.
[](https://i.stack.imgur.com/GLM3T.png)
I haven't seen this in every Windows application, so you may have to try a few to get it, but SQL Server Manageme... | What control is this? ("Open" Button with Drop Down) | CC BY-SA 4.0 | 0 | 2008-08-27T20:03:03.820 | 2019-09-22T21:33:59.373 | 2019-09-22T21:33:59.373 | 3,043 | 3,043 | [
".net",
"winforms",
".net-2.0"
] |
31,124 | 2 | null | 14,410 | 1 | null | I recently came across [divascheme](http://www.cs.brown.edu/research/plt/software/divascheme/) - an alternative set of key bindings for [DrScheme](http://www.drscheme.org/). This is modal, and part of the justification is to do with RSI - specifically avoiding lots of wrist twisting to hit ---. The coder has done an ... | null | CC BY-SA 3.0 | null | 2008-08-27T20:13:32.017 | 2015-08-20T22:27:54.447 | 2015-08-20T22:27:54.447 | 7,226 | 3,189 | null |
31,139 | 2 | null | 30,811 | 12 | null | RoR is actually one of the things the GWT is made to work well with, as long as you're using REST properly. It's in the Google Web Toolkit Applications book, and you can see a demo from the book using this kind of idea [here](http://www.gwtapps.com/?page_id=33). That's not to say that you won't have any problems, but... | null | CC BY-SA 2.5 | null | 2008-08-27T20:16:37.017 | 2008-08-27T21:00:30.890 | 2008-08-27T21:00:30.890 | 3,230 | 3,230 | null |
31,119 | 2 | null | 30,998 | 1 | null | The problem with static functions is that they can lead to a design that breaks encapsulation. For example, if you find yourself writing something like:
```
public class TotalManager
{
public double getTotal(Hamburger burger)
{
return burger.getPrice() + burget.getTax();
}
}
```
...then you migh... | null | CC BY-SA 2.5 | null | 2008-08-27T20:12:34.017 | 2008-08-27T20:12:34.017 | null | null | 1,471 | null |
31,142 | 2 | null | 31,090 | 2 | null | I've not familiar with using either of these, but try searching msdn for splitbutton or dropdownbutton. I think those are similar to what you're looking for.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:17:20.090 | 2008-08-27T20:17:20.090 | null | null | 3,240 | null |
31,140 | 1 | null | null | 1 | 506 | A number of forms in my project inherit from a base form. It is easy to get at the Controls collection of the derived forms, but I have not found a simple way to access the Components collection, since VS marks this as private.
I assume this could be done with reflection, but I'm not really sure how best to go about ... | Accessing a Component on an inherited form from the base form | CC BY-SA 2.5 | null | 2008-08-27T20:16:58.953 | 2013-06-09T08:43:00.547 | null | null | 2,899 | [
".net",
"winforms",
"reflection",
"inheritance"
] |
31,146 | 2 | null | 31,127 | 24 | null | You can try something like:
```
InputStream stream = this.getClass().getClassLoader().getResourceAsStream("/images/image.jpg");
```
In your JAR file, you might have a directory structure of:
> MyJAR.jar
- com (class files in here)
- images
----image.jpg
| null | CC BY-SA 2.5 | null | 2008-08-27T20:18:29.307 | 2008-08-27T20:18:29.307 | null | null | 1,471 | null |
31,141 | 2 | null | 31,075 | 0 | null | Short of any other answers, I would try attaching to the executable process in Visual Studio, setting a break point in your code and when you step into the process you don't have source to, it should ask for a source file.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:16:59.980 | 2008-08-27T20:16:59.980 | null | null | 1,075 | null |
31,154 | 2 | null | 31,140 | 0 | null | If you're worried about forgetting to override the function, then make it abstract.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:19:53.890 | 2008-08-27T20:19:53.890 | null | null | 3,043 | null |
31,151 | 1 | 31,206 | null | 13 | 4,794 | Alright.
So I figure it's about time I get into unit testing, since everyone's been banging on about it for long enough. I've installed NUnit and gone through a few "intro to unit testing" type tutorials.
I'm currently putting together a small framework to help with the rebuild of one of our web apps, so I've create... | ASP.NET - How do you Unit Test WebControls? | CC BY-SA 2.5 | null | 2008-08-27T20:19:45.077 | 2018-03-08T15:34:28.630 | null | null | 366 | [
"asp.net",
"unit-testing"
] |
31,153 | 2 | null | 31,129 | 41 | null | Yeah, my previous answer does not work because I didn't pay any attention to your code. :)
The problem is that the anonymous function is a callback function - i.e. getJSON is an async operation that will return at some indeterminate point in time, so even if the scope of the variable were outside of that anonymous fun... | null | CC BY-SA 2.5 | null | 2008-08-27T20:19:51.580 | 2008-08-27T20:19:51.580 | null | null | 1,790 | null |
31,162 | 2 | null | 30,004 | 0 | null | Thanks for all the responses. I never expected to get an answer this quick. For my test application I think SQL Server Compact Edition would be the way to go. I'm basically creating a money managment app similar to Microsoft Money and although it is an exercise to learn skills, I would eventually want to use it to mana... | null | CC BY-SA 2.5 | null | 2008-08-27T20:22:52.667 | 2008-08-27T20:22:52.667 | null | null | 87,645 | null |
31,160 | 2 | null | 31,151 | 5 | null | Ues the [assembly:InternalsVisibleTo](http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx) attribute and you'll be able to access those private members.
Put it in your webcontrol project's (under node)
```
[assembly:InternalsVisibleTo("YourTestProjectName")]
```
... | null | CC BY-SA 3.0 | null | 2008-08-27T20:22:11.530 | 2012-04-13T13:26:15.903 | 2012-04-13T13:26:15.903 | 40,961 | 3,055 | null |
31,129 | 1 | 31,153 | null | 54 | 97,515 | I want to return `StudentId` to use elsewhere outside of the of the `$.getJSON()`
```
j.getJSON(url, data, function(result)
{
var studentId = result.Something;
});
//use studentId here
```
I would imagine this has to do with scoping, but it doesn't seem to work the same way does
| How can I return a variable from a $.getJSON function | CC BY-SA 3.0 | 0 | 2008-08-27T20:14:19.880 | 2018-11-16T10:24:39.177 | 2015-12-25T05:44:34.630 | 4,939,915 | 2,993 | [
"javascript",
"jquery",
"ajax",
"scope",
"return-value"
] |
31,163 | 1 | 31,170 | null | 43 | 10,046 | In Visual Studio 2005, whenever I would view a file in the main editor, the Solution Explorer would find and highlight that file. Some time ago, this stopped working and the Solution Explorer would do nothing.
This has become quite a pain since following a chain of "Go To Definition"s can lead you all over your solut... | Forcing the Solution Explorer to select the file in the editor in visual studio 2005 | CC BY-SA 2.5 | 0 | 2008-08-27T20:22:53.960 | 2015-07-30T06:39:26.453 | 2009-02-15T06:01:32.703 | 3,259 | 3,259 | [
"visual-studio"
] |
31,148 | 2 | null | 31,075 | 0 | null | Yes, it's possible. Just set up an empty project and specify the desired `.exe` file as debug target. I don't remember exactly how, but I know it's doable, because I used to set `winamp.exe` as debug target when I developed plug-ins for Winamp.
Since you don't have the source file it will only show the assembly code, ... | null | CC BY-SA 2.5 | null | 2008-08-27T20:18:54.407 | 2008-08-27T20:18:54.407 | null | null | 1,709 | null |
31,158 | 1 | null | null | 12 | 8,688 | What are in your opinion the best resources (books or web pages) describing algorithms or techniques to use for collision detection in a 2D environment?
I'm just eager to learn different techniques to make more sophisticated and efficient games.
| Resources of techniques use for collision detection in 2D? | CC BY-SA 3.0 | 0 | 2008-08-27T20:21:09.300 | 2021-02-12T19:51:19.800 | 2017-08-19T14:44:33.220 | 7,275,984 | 2,772 | [
"algorithm",
"collision-detection"
] |
31,165 | 2 | null | 31,151 | 3 | null | You have found the biggest pain point of ASP.NET. As far as sealed, private classes that hinder unit testing.
This is the main reason that TDD people will use a MVC framework (ASP.NET MVC, Castle MonoRail) as it provides a clear seperation from your view templates and your controller logic. The controllers are fully t... | null | CC BY-SA 2.5 | null | 2008-08-27T20:23:20.777 | 2008-08-27T20:23:20.777 | null | null | 2,993 | null |
31,168 | 2 | null | 31,163 | 13 | null |
1. Navigate to Tools -> Options
2. Select "Projects and Solutions" in the tree view on the left
3. Select "Track Active Item in Solution Explorer"
| null | CC BY-SA 2.5 | null | 2008-08-27T20:24:37.827 | 2008-08-27T20:24:37.827 | null | null | 2,822 | null |
31,175 | 2 | null | 30,318 | 1 | null | Also not related to Python, but [Ubiquity](http://labs.mozilla.com/2008/08/introducing-ubiquity/) (a firefox extension) is a graphical command-line-like tool for the web, with a similar spirit to Quicksilver/Launchy/GnomeDo.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:26:02.080 | 2008-08-27T20:26:02.080 | null | null | 3,002 | null |
31,173 | 1 | 33,548 | null | -3 | 1,523 | What's the most useful hack you've discovered for Mozilla's new [Ubiquity](https://wiki.mozilla.org/Labs/Ubiquity) tool?
| Ubiquity Hack | CC BY-SA 3.0 | null | 2008-08-27T20:25:07.623 | 2017-08-19T14:48:19.127 | 2017-08-19T14:48:19.127 | 7,275,984 | 1,372 | [
"ubiquity"
] |
31,174 | 2 | null | 31,057 | 706 | null | `char(13)` is `CR`. For DOS-/Windows-style `CRLF` linebreaks, you want `char(13)+char(10)`, like:
```
'This is line 1.' + CHAR(13)+CHAR(10) + 'This is line 2.'
```
| null | CC BY-SA 2.5 | null | 2008-08-27T20:25:14.207 | 2008-08-27T20:25:14.207 | null | null | 1,600 | null |
31,164 | 2 | null | 31,096 | 18 | null | If you want to know how much the GC uses try:
```
GC.GetTotalMemory(true)
```
If you want to know what your process uses from Windows (VM Size column in TaskManager) try:
```
Process.GetCurrentProcess().PrivateMemorySize64
```
If you want to know what your process has in RAM (as opposed to in the pagefile) (Mem U... | null | CC BY-SA 3.0 | null | 2008-08-27T20:23:11.090 | 2014-11-13T16:25:20.147 | 2014-11-13T16:25:20.147 | 426,671 | 1,242 | null |
31,171 | 2 | null | 31,158 | 2 | null | Personally, I love the work of [Paul Bourke](http://www.paulbourke.net/).
Also, Paul Nettle used to write on the topic. He has a full 3D collision detection library, but you may be more interested in the ideas behind such libraries (which are very applicable to 2D). For that, see [General Collision Detection for Games ... | null | CC BY-SA 4.0 | null | 2008-08-27T20:24:58.060 | 2021-02-12T19:51:19.800 | 2021-02-12T19:51:19.800 | 6,243,352 | 338 | null |
31,176 | 2 | null | 622 | 13 | null | [GateKiller](https://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-prime-numbers#2753), how about adding a `break` to that `if` in the `foreach` loop? That would speed up things because if like 6 is divisible by 2 you don't need to check with 3 and 5. (I'd vote your solution up anyway if I ha... | null | CC BY-SA 2.5 | null | 2008-08-27T20:26:27.947 | 2008-08-27T20:26:27.947 | 2017-05-23T12:34:21.673 | -1 | 3,063 | null |
31,179 | 2 | null | 31,057 | 3 | null | This is always cool, because when you get exported lists from, say Oracle, then you get records spanning several lines, which in turn can be interesting for, say, cvs files, so beware.
Anyhow, Rob's answer is good, but I would advise using something else than @, try a few more, like §§@@§§ or something, so it will hav... | null | CC BY-SA 4.0 | null | 2008-08-27T20:26:57.040 | 2019-01-14T20:32:49.630 | 2019-01-14T20:32:49.630 | 528,061 | 3,308 | null |
31,185 | 2 | null | 31,173 | 2 | null | That it can close Firefox faster then I can with the mouse and that little [x] thing in the corner... :-P
| null | CC BY-SA 2.5 | null | 2008-08-27T20:29:10.217 | 2008-08-27T20:29:10.217 | null | null | 157 | null |
31,182 | 2 | null | 31,096 | 0 | null | Working set isn't a good property to use. From what I gather, it includes everything the process can touch, even libraries shared by several processes, so you're seeing double-counted bytes in that counter. Private memory is a much better counter to look at.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:28:23.760 | 2008-08-27T20:28:23.760 | null | null | 2,547 | null |
31,178 | 2 | null | 31,163 | 3 | null | Tools->Options->Project and Solutions->General
Check the box "Track Active Item in Solution Explorer"
| null | CC BY-SA 2.5 | null | 2008-08-27T20:26:52.423 | 2008-08-27T20:26:52.423 | null | null | 225 | null |
31,170 | 2 | null | 31,163 | 63 | null | Click on the Tools → Options menu. Select the Projects and Solutions → General option page.
Make sure "Track active item in Solution Explorer" is checked. That should do it.
| null | CC BY-SA 3.0 | null | 2008-08-27T20:24:56.687 | 2014-04-18T21:04:45.640 | 2014-04-18T21:04:45.640 | 294,317 | 2,547 | null |
31,186 | 2 | null | 31,158 | 0 | null | If your objects are represented as points in 2D space you can use line intersection to determine if two objects have collided. You can use similar logic to check if an object is inside another object (and thus they have collided even any of their lines are not currently intersecting). The [math to do this](http://paulb... | null | CC BY-SA 3.0 | null | 2008-08-27T20:29:25.787 | 2013-04-05T10:45:02.537 | 2013-04-05T10:45:02.537 | 388,614 | 1,709 | null |
31,190 | 2 | null | 31,090 | 4 | null | I think what you are looking for is called a toolStripSplitButton. It is only available in a toolStrip. But you can add a toolStripContainer anywhere on your form and then put the toolStrip and toolStripSplitButton inside your container.
You won't want to show the grips so you'll want to set your gripMargin = 0. You ... | null | CC BY-SA 2.5 | null | 2008-08-27T20:31:18.607 | 2008-08-27T20:31:18.607 | null | null | 288 | null |
31,188 | 2 | null | 683 | 3 | null | If you plan on searching anything of remotely decent size, your best bet is going to be to use a dictionary or a set. Otherwise, you basically have to iterate through every element of the iterator until you get to the one you want.
If this isn't necessarily performance sensitive code, then the list comprehension way ... | null | CC BY-SA 2.5 | null | 2008-08-27T20:30:22.070 | 2008-08-27T20:30:22.070 | null | null | 2,147 | null |
31,183 | 2 | null | 31,077 | 2 | null | Check out Share on [Acrobat.com](http://www.acrobat.com), there you can upload PDFs and make them embedable Flash files (sort of like YouTube for documents). Should be possible to load those into Flex. Not an ideal solution, but unfortunately you need to convert the PDF to an SWF somehow to be able to load it into a Fl... | null | CC BY-SA 2.5 | null | 2008-08-27T20:28:37.537 | 2008-08-27T20:28:37.537 | null | null | 1,109 | null |
31,189 | 2 | null | 1,644 | 2 | null | I took all of the podcasts from the answers scoring 5 or better (and those in the original question) and added them to an aggregated page on Cullect.com:
[http://www.cullect.com/StackOverflow-Recommended-Podcasts](http://www.cullect.com/StackOverflow-Recommended-Podcasts)
It provides a handy way to get a glimpse of t... | null | CC BY-SA 2.5 | null | 2008-08-27T20:31:06.563 | 2008-08-27T20:31:06.563 | null | null | 1,124 | null |
31,194 | 2 | null | 31,077 | 3 | null | Check out: [http://www.swftools.org/](http://www.swftools.org/) for tools to convert your PDF to SWF, speifically pdf2swf- [http://www.swftools.org/pdf2swf.html](http://www.swftools.org/pdf2swf.html)
| null | CC BY-SA 2.5 | null | 2008-08-27T20:32:39.913 | 2008-08-27T20:32:39.913 | null | null | 1,638 | null |
31,195 | 2 | null | 31,090 | 0 | null | Since I found the control in Windows itself, I was hoping to find it built-in somewhere already so I didn't have to add anything to my code-base to use it. But the split button at [this link](http://blogs.msdn.com/jfoscoding/articles/491523.aspx) (found via the msdn suggestion) looks pretty promising.
I'll try it lat... | null | CC BY-SA 3.0 | null | 2008-08-27T20:33:26.743 | 2011-07-19T19:17:46.240 | 2011-07-19T19:17:46.240 | 709,202 | 3,043 | null |
31,192 | 1 | 31,217 | null | 5 | 1,861 | We're in the process of redesigning the customer-facing section of our site in .NET 3.5. It's been going well so far, we're using the same workflow and stored procedures, for the most part, the biggest changes are the UI, the ORM (from dictionaries to LINQ), and obviously the language. Most of the pages to this point h... | Migrating from ASP Classic to .NET and pain mitigation | CC BY-SA 3.0 | 0 | 2008-08-27T20:32:18.307 | 2022-12-31T01:38:48.627 | 2017-12-16T10:52:53.880 | 4,803,173 | 1,302 | [
"asp.net",
"asp-classic",
"migration"
] |
31,201 | 1 | 31,218 | null | 51 | 16,434 | I'm currently creating an explicit reference to this in the outer class so that I have a name to refer to in the anonymous inner class. Is there a better way to do this?
| How do you get a reference to the enclosing class from an anonymous inner class in Java? | CC BY-SA 2.5 | 0 | 2008-08-27T20:36:14.723 | 2008-09-21T07:37:34.410 | 2008-09-21T07:37:34.410 | 2,193 | 1,288 | [
"java",
"oop"
] |
31,203 | 2 | null | 18,601 | 2 | null | A common practice is to move all the code you can out of the codebehind and into an object you can test in isolation. Such code will usually follow the MVP or MVC design patterns. If you search on "Rhino Igloo" you will probably find the link to its Subversion repository. That code is worth a study, as it demonstrate o... | null | CC BY-SA 3.0 | null | 2008-08-27T20:36:30.467 | 2012-11-14T15:37:46.717 | 2012-11-14T15:37:46.717 | 3,282 | 3,282 | null |
31,208 | 2 | null | 31,140 | 1 | null | If you set the Modifiers property of your components to strict protected makes them accessible without the use of a components collection.
Edit:
Discoverability could be done using reflection to walk over each field. Although that might be suboptimal in your case.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:37:28.857 | 2008-08-28T07:10:05.840 | 2008-08-28T07:10:05.840 | 1,242 | 1,242 | null |
31,206 | 2 | null | 31,151 | 8 | null | You can do model-view-controller or model-view-presenter type architectures without using a full blown framework. You already found out that unit-testing ui-components is difficult. There are ways around that but you probably don't want to go that route. Usually this will make your tests very hard to maintain, more mai... | null | CC BY-SA 2.5 | null | 2008-08-27T20:37:06.767 | 2008-08-27T20:37:06.767 | null | null | 3,320 | null |
31,209 | 2 | null | 31,192 | 1 | null | You're going from classic ASP to ASP with 3.5 without just re-writing? Skillz. I've had to deal with some legacy ASP @work and I think it's just easier to parse it and re-write it.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:37:58.060 | 2008-08-27T20:37:58.060 | null | null | 1,122 | null |
31,207 | 2 | null | 31,096 | 9 | null | OK, I found through Google the same page that Lars mentioned, and I believe it's a great explanation for people that don't quite know how memory works (like me).
[http://shsc.info/WindowsMemoryManagement](http://shsc.info/WindowsMemoryManagement)
My short conclusion was:
- Private Bytes = The Memory my process has r... | null | CC BY-SA 2.5 | null | 2008-08-27T20:37:20.027 | 2008-08-27T20:37:20.027 | null | null | 3,314 | null |
31,211 | 2 | null | 31,151 | 0 | null | The MVC framework mentioned above is the best way to test what the control does. However testing how it works is a bit different.
This is totally off the cuff but you could make the user control expose some protected methods and properties to return validation information and then have a testing user control inherit ... | null | CC BY-SA 2.5 | null | 2008-08-27T20:38:17.887 | 2008-08-27T20:38:17.887 | null | null | 2,894 | null |
31,080 | 2 | null | 31,068 | 1 | null | In standard c, you could try: P_tmpdir
| null | CC BY-SA 2.5 | null | 2008-08-27T19:59:08.667 | 2008-08-27T19:59:08.667 | null | null | 814 | null |
31,216 | 2 | null | 31,201 | 19 | null | Use `EnclosingClass.this`
| null | CC BY-SA 2.5 | null | 2008-08-27T20:40:06.417 | 2008-08-27T20:40:06.417 | null | null | 1,450 | null |
31,213 | 2 | null | 30,998 | 2 | null | Use namespaces to make a collection of functions:
```
namespace Console {
void WriteLine(...) // ...
}
```
As for memory, functions use the same amount outside a function, as a static member function or in a namespace. That is: no memory other that the code itself.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:38:34.877 | 2008-08-27T20:38:34.877 | null | null | 3,102 | null |
31,215 | 1 | 31,220 | null | 7 | 3,235 | I have a Person object with two constructors - one takes an int (personId), the other a string (logonName). I would like another constructor that takes a string (badgeNumber). I know this can't be done, but seems it might be a common situation. Is there a graceful way of handling this? I suppose this would apply to... | Constructors with the same argument type | CC BY-SA 2.5 | null | 2008-08-27T20:39:51.517 | 2021-02-25T16:25:41.820 | 2008-10-09T00:47:35.733 | 3,295 | 1,865 | [
"c#",
".net",
"oop"
] |
31,220 | 2 | null | 31,215 | 7 | null | You might consider using custom types.
For example, create LogonName and BadgeNumber classes.
Then your function declarations look like...
```
public Person(LogonName ln)
{
this.Load(ln.ToString());
}
public Person(BadgeNumber bn)
{
//load logic here...
}
```
Such a solution might give you a good place to... | null | CC BY-SA 2.5 | null | 2008-08-27T20:41:16.210 | 2008-08-27T20:46:33.623 | 2008-08-27T20:46:33.623 | 83 | 83 | null |
31,214 | 2 | null | 31,192 | 2 | null | > After I have everything coded I'll do a few passes at refactoring/testing. I'm just wondering if anyone has any tips on how to make this process a little easier/more efficient.
[](https://i.stack.imgur.com/eJAgM.png)
[cartoonstock.com](https://www.cartoonstock.com/lowres/cga0226l.jpg)
Normally I'm not a fan of TDD, b... | null | CC BY-SA 4.0 | null | 2008-08-27T20:39:02.813 | 2022-12-31T01:38:48.627 | 2022-12-31T01:38:48.627 | 4,751,173 | 234 | null |
31,191 | 2 | null | 24,675 | 6 | null | For what it's worth, caching is DIRT SIMPLE in PHP even without an extension/helper package like memcached.
All you need to do is create an output buffer using `ob_start()`.
Create a global cache function. Call `ob_start`, pass the function as a callback. In the function, look for a cached version of the page. If e... | null | CC BY-SA 3.0 | null | 2008-08-27T20:32:06.683 | 2016-01-15T15:32:42.777 | 2016-01-15T15:32:42.777 | 4,932,070 | null | null |
31,222 | 2 | null | 31,215 | 1 | null | No.
You might consider a flag field (enum for readability) and then have the constructor use htat to determine what you meant.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:41:33.400 | 2008-08-27T20:41:33.400 | null | null | 2,894 | null |
31,218 | 2 | null | 31,201 | 93 | null | I just found this recently. Use `OuterClassName.this`.
```
class Outer {
void foo() {
new Thread() {
public void run() {
Outer.this.bar();
}
}.start();
}
void bar() {
System.out.println("BAR!");
}
}
```
If you just want the object itsel... | null | CC BY-SA 2.5 | null | 2008-08-27T20:40:40.300 | 2008-08-28T18:11:04.050 | 2008-08-28T18:11:04.050 | 338 | 338 | null |
31,221 | 1 | 31,437 | null | 33 | 74,150 | I have a method that where I want to redirect the user back to a login page located at the root of my web application.
I'm using the following code:
```
Response.Redirect("~/Login.aspx?ReturnPath=" + Request.Url.ToString());
```
This doesn't work though. My assumption was that ASP.NET would automatically resolve t... | Response.Redirect using ~ Path | CC BY-SA 2.5 | 0 | 2008-08-27T20:41:23.357 | 2018-10-11T21:30:32.987 | null | null | 1,226 | [
"c#",
"asp.net",
"response.redirect"
] |
31,217 | 2 | null | 31,192 | 6 | null | Believe me, I know where you are coming from.. I am currently migrating a large app from ASP classic to .NET.. And I am still learning ASP.NET! :S (yes, I am terrified!).
The main things I have kept in my mind is this:
- - -
Its very much like playing [Jenga](http://www.amazon.co.uk/Hasbro-14569186-Jenga/dp/B00004... | null | CC BY-SA 2.5 | null | 2008-08-27T20:40:31.000 | 2008-08-27T20:40:31.000 | null | null | 832 | null |
31,228 | 2 | null | 31,215 | 1 | null | That won't work. You might consider making a class called BadgeNumber that wraps a string in order to avoid this ambiguity.
| null | CC BY-SA 2.5 | null | 2008-08-27T20:42:59.733 | 2008-08-27T20:42:59.733 | null | null | 1,597 | null |