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 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21,543 | 2 | null | 21,514 | 0 | null | If Windows won't let you connect through it's login mechanism, I think your only option is to run something on the remote machine with an open port (either directly or through remoting or a web service, as mentioned).
| null | CC BY-SA 2.5 | null | 2008-08-22T00:55:35.557 | 2008-08-22T00:55:35.557 | null | null | 1,490 | null |
21,534 | 2 | null | 21,514 | 0 | null | You should be able to do this with System.DirectoryServices.DirectoryEntry. If you are having trouble running it remotely, maybe you could install something on the remote machines to give you your data via some sort of RPC, like remoting or a web service. But I think what you're trying should be possible remotely wit... | null | CC BY-SA 2.5 | null | 2008-08-22T00:43:13.823 | 2008-08-22T00:43:13.823 | null | null | 1,219 | null |
21,546 | 2 | null | 21,514 | 1 | null | This should be easy to do using WMI. Here you have a pointer to some docs:
[WMI Documentation for Win32_UserAccount](http://msdn.microsoft.com/en-us/library/aa394507.aspx)
Even if you have no previous experience with WMI, it should be quite easy to turn that VB Script code at the bottom of the page into some .NET cod... | null | CC BY-SA 2.5 | null | 2008-08-22T00:57:21.463 | 2008-08-22T00:57:21.463 | null | null | 2,384 | null |
21,547 | 1 | 317,864 | null | 83 | 124,851 | I've spent a good amount of time coming up with solution to this problem, so in the spirit of [this post](https://stackoverflow.com/questions/21245/questions-vs-conveying-information), I'm posting it here, since I think it might be useful to others.
If anyone has a better script, or anything to add, please post it.
... | In SQL Server, how do I generate a CREATE TABLE statement for a given table? | CC BY-SA 2.5 | 0 | 2008-08-22T00:58:55.173 | 2020-09-13T03:40:18.227 | 2017-05-23T10:31:03.237 | -1 | 369 | [
"sql-server",
"scripting",
"dynamic-sql"
] |
21,537 | 2 | null | 13,678 | 2 | null | Oh my God, the answer is so simple. Use .
I have programmed embedded systems for 10 years, and I can say that without at least a couple months of infrastructure (very careful infrastructure!), you will not be as productive as you are on day 1 with .
If you are designing a robot to be sold and used for the military, g... | null | CC BY-SA 2.5 | null | 2008-08-22T00:47:38.400 | 2008-08-22T00:47:38.400 | null | null | 338 | null |
21,550 | 2 | null | 10,898 | 1 | null | We had this same issue with a production system late last year (sept 2007) and the official word from our Microsoft contact was that they had a 64 bit oledb driver to connect to ASI/DB2 it was in at the time.
Not sure when it will be out of beta but that was the news as of last year.
We decided to move the producti... | null | CC BY-SA 2.5 | null | 2008-08-22T01:01:54.557 | 2008-08-22T01:01:54.557 | null | null | 1,950 | null |
21,557 | 2 | null | 20,267 | 3 | null | Well, depending on how many variables you have in your template, how many templates you have, etc. this might be a work for a full template processor. The only one I've ever used for .NET is [NVelocity](http://www.castleproject.org/others/nvelocity/index.html), but I'm sure there must be scores of others out there, mos... | null | CC BY-SA 2.5 | null | 2008-08-22T01:12:30.460 | 2008-08-22T01:12:30.460 | null | null | 2,384 | null |
21,551 | 2 | null | 21,547 | 36 | null | Here's the script that I came up with. It handles Identity columns, default values, and primary keys. It does not handle foreign keys, indexes, triggers, or any other clever stuff. It works on SQLServer 2000, 2005 and 2008.
```
declare @schema varchar(100), @table varchar(100)
set @schema = 'dbo' -- set schema name he... | null | CC BY-SA 4.0 | null | 2008-08-22T01:03:11.870 | 2019-02-25T16:20:01.737 | 2019-02-25T16:20:01.737 | 1,606,872 | 369 | null |
21,555 | 2 | null | 21,489 | 2 | null | I hate cursors with a passion... but here's a dodgy cursor version...
```
Declare @NewName Varchar(50)
Declare @OldName Varchar(50)
Declare @CountNum int
Set @CountNum = 0
DECLARE nameCursor CURSOR FOR
SELECT Name
FROM NameTest
OPEN nameCursor
FETCH NEXT FROM nameCursor INTO @NewName
WHILE @@FETCH_STATUS = 0
... | null | CC BY-SA 2.5 | null | 2008-08-22T01:08:59.690 | 2008-08-22T01:08:59.690 | null | null | 49 | null |
21,554 | 2 | null | 21,437 | 1 | null | > It's just not possible. There is always the PrintScreen button.
I remember testing [ImageFreeze](http://www.imagefreeze.com/IF_ENG/index.htm) years ago. It used a Java applet to fetch and display images. The image data and connection was encrypted and the unencrypted image wasn't stored in a temp folder or even in J... | null | CC BY-SA 2.5 | null | 2008-08-22T01:08:03.403 | 2008-08-22T01:08:03.403 | null | null | 1,697 | null |
21,561 | 2 | null | 21,489 | 1 | null | How about this:
```
declare @tmp table (Id int, Nm varchar(50));
insert @tmp select 1, 'Harry Johns';
insert @tmp select 2, 'Adam Taylor';
insert @tmp select 3, 'John Smith';
insert @tmp select 4, 'John Smith';
insert @tmp select 5, 'Bill Manning';
insert @tmp select 6, 'John Smith';
select * from @tmp order by Id;
... | null | CC BY-SA 2.5 | null | 2008-08-22T01:17:34.007 | 2008-08-22T01:25:07.870 | 2008-08-22T01:25:07.870 | 1,219 | 1,219 | null |
21,564 | 1 | 21,620 | null | 181 | 77,600 | I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp. Ideally, the use would be something like:
```
cat somefile.txt | prepend-timestamp
```
(Before you answer... | Is there a Unix utility to prepend timestamps to stdin? | CC BY-SA 3.0 | 0 | 2008-08-22T01:24:34.817 | 2022-04-09T17:33:31.377 | 2016-03-09T14:58:18.963 | 1,993,501 | 156 | [
"unix",
"shell",
"awk"
] |
21,574 | 1 | 21,621 | null | 102 | 42,231 | I'm not clear on the differences between the "current" version of Ruby (1.8) and the "new" version (1.9). Is there an "easy" or a "simple" explanation of the differences and why it is so different?
| What is the difference between Ruby 1.8 and Ruby 1.9 | CC BY-SA 2.5 | 0 | 2008-08-22T01:32:54.937 | 2014-04-08T15:13:32.627 | 2010-11-09T14:09:42.810 | 19,750 | 757 | [
"ruby",
"ruby-1.9",
"ruby-1.8"
] |
21,545 | 2 | null | 21,489 | 2 | null | Try this:
```
select n.name,
(select count(*)
from myTable n1
where n1.name = n.name and n1.id >= n.id and (n1.id <=
(
select isnull(min(nn.id), (select max(id) + 1 from myTable))
from myTable nn
where nn.id > n.id and nn.name <> n.name
)
))
from myTable n
w... | null | CC BY-SA 2.5 | null | 2008-08-22T00:57:08.157 | 2008-08-22T01:11:00.790 | 2008-08-22T01:11:00.790 | 615 | 615 | null |
21,560 | 1 | 21,967 | null | 3 | 3,736 | [Multisampling](http://en.wikipedia.org/wiki/Multisample_anti-aliasing) is a way of applying (FSAA) in 3D applications. I need to use multisampling in my OpenGL program, which is currently embedded in a GUI. Is there a way to do this? Please respond only if you know the detailed steps to achieve this.
I'm aware of e... | How to enable multisampling for a wxWidgets OpenGL program? | CC BY-SA 3.0 | null | 2008-08-22T01:16:26.817 | 2011-08-21T11:17:22.783 | 2011-08-21T11:17:22.783 | 95 | 1,630 | [
"opengl",
"wxwidgets",
"multisampling"
] |
21,590 | 2 | null | 21,388 | 3 | null | If the objects aren't heavily keyed by other tables, and the lists are short, deleting everything in the domain and just re-inserting the correct list is the easiest. But that's not practical if the lists are large and you have lots of constraints to slow down the delete. I think your first method is really the clean... | null | CC BY-SA 2.5 | null | 2008-08-22T01:39:15.390 | 2008-08-22T01:39:15.390 | null | null | 1,219 | null |
21,553 | 2 | null | 13,678 | 2 | null | I love LabVIEW. I would highly recommend it especially if the other remembers have used something similar. It takes a while for normal programmers to get used to it, but the result's are much better if you already know how to program.
C/C++ equals manage your own memory. You'll be swimming in memory links and worrying... | null | CC BY-SA 2.5 | null | 2008-08-22T01:05:55.220 | 2008-08-22T01:05:55.220 | null | null | null | null |
21,589 | 1 | 66,513 | null | 4 | 1,434 | I did some tests a while ago and never figured out how to make this work.
- -
Run the .Net application and force an exception.
The update made from the .Net application rolls back.
The update made by the COM+ object does not roll back.
If I call the COM+ object from an old ASP page the rollback works... | Is it possible to share a transaction between a .Net application and a COM+ object? | CC BY-SA 3.0 | null | 2008-08-22T01:39:05.920 | 2013-12-02T13:37:38.003 | 2013-12-02T13:37:38.003 | 2,432,317 | 1,328 | [
".net",
"database",
"transactions",
"com+"
] |
21,593 | 1 | null | null | 2,981 | 833,281 | What is the difference between using angle brackets and quotes in an `include` directive?
- `#include <filename>`- `#include "filename"`
| What is the difference between #include <filename> and #include "filename"? | CC BY-SA 4.0 | 0 | 2008-08-22T01:40:06.993 | 2022-08-11T13:53:34.713 | 2022-07-04T21:45:52.627 | 365,102 | 2,399 | [
"c++",
"c",
"include",
"header-files",
"c-preprocessor"
] |
21,584 | 2 | null | 21,514 | 1 | null | I would recommend using the Win32 API function [NetLocalGroupGetMembers](http://msdn.microsoft.com/en-us/library/aa370601.aspx). It is much more straight forward than trying to figure out the crazy LDAP syntax, which is necessary for some of the other solutions recommended here. As long as you impersonate the user you ... | null | CC BY-SA 2.5 | null | 2008-08-22T01:36:33.757 | 2008-08-22T01:36:33.757 | null | null | 1,737,192 | null |
21,606 | 2 | null | 21,583 | 11 | null | [DBunit](http://dbunit.sourceforge.net/)
You can use this tool to export the state of a database at a given time, and then when you're unit testing, it can be rolled back to its previous state automatically at the beginning of the tests. We use it quite often where I work.
| null | CC BY-SA 2.5 | null | 2008-08-22T01:44:22.193 | 2008-08-22T01:44:22.193 | null | null | 2,223 | null |
21,602 | 2 | null | 21,564 | 25 | null | How about this?
```
cat somefile.txt | perl -pne 'print scalar(localtime()), " ";'
```
Judging from your desire to get live timestamps, maybe you want to do live updating on a log file or something? Maybe
```
tail -f /path/to/log | perl -pne 'print scalar(localtime()), " ";' > /path/to/log-with-timestamps
```
| null | CC BY-SA 2.5 | null | 2008-08-22T01:42:33.790 | 2008-08-22T01:42:33.790 | null | null | 430 | null |
21,598 | 2 | null | 21,558 | 1 | null | It means a call to a virtual function will be forwarded to the "right" class.
C++ [FAQ Lite](https://isocpp.org/wiki/faq/multiple-inheritance) FTW.
In short, it is often used in multiple-inheritance scenarios, where a "diamond" hierarchy is formed. Virtual inheritance will then break the ambiguity created in the bot... | null | CC BY-SA 3.0 | null | 2008-08-22T01:42:14.990 | 2015-02-23T11:58:23.073 | 2015-02-23T11:58:23.073 | 2,876,962 | 456 | null |
21,583 | 1 | 21,603 | null | 32 | 8,390 | This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit testing was one of the requirements. I ran into some trouble when I tried to test against the database. To my understanding, unit tests should be:
- - -
These requirements seem to be at odds with each other when developing for a databa... | Unit-Testing Databases | CC BY-SA 3.0 | 0 | 2008-08-22T01:35:33.773 | 2014-04-25T15:24:00.510 | 2013-06-17T11:44:44.400 | 16,587 | 1,266 | [
"database",
"unit-testing",
"transactions",
"xtunit"
] |
21,608 | 2 | null | 21,583 | 5 | null | The usual solution to external dependencies in unit tests is to use mock objects - which is to say, libraries that mimic the behavior of the real ones against which you are testing. This is not always straightforward, and sometimes requires some ingenuity, but there are several good (freeware) mock libraries out there... | null | CC BY-SA 2.5 | null | 2008-08-22T01:46:32.907 | 2008-08-22T01:46:32.907 | null | null | 958 | null |
21,609 | 2 | null | 21,583 | 1 | null | What you should do is run your tests from a blank copy of the database that you generate from a script. You can run your tests and then analyze the data to make sure it has exactly what it should after your tests run. Then you just delete the database, since it's a throwaway. This can all be automated, and can be co... | null | CC BY-SA 2.5 | null | 2008-08-22T01:46:36.633 | 2008-08-22T01:46:36.633 | null | null | 1,219 | null |
21,603 | 2 | null | 21,583 | 26 | null | There's no real way to unit test a database other than asserting that the tables exist, contain the expected columns, and have the appropriate constraints. But that's usually not really worth doing.
You don't typically test the database. You usually involve the database in tests.
You typically use your favourite au... | null | CC BY-SA 2.5 | null | 2008-08-22T01:43:32.523 | 2008-08-22T01:43:32.523 | null | null | 1,851 | null |
21,611 | 2 | null | 21,564 | -1 | null | If the value you are prepending is the same on every line, fire up emacs with the file, then:
+
at the beginning of the of the file (to mark that spot), then scroll down to the beginning of the last line (Alt + > will go to the end of file... which probably will involve the Shift key too, then Ctrl + a to go to the... | null | CC BY-SA 3.0 | null | 2008-08-22T01:46:58.007 | 2015-08-20T22:21:18.060 | 2015-08-20T22:21:18.060 | 7,226 | 122 | null |
21,558 | 1 | 21,607 | null | 462 | 345,344 | I want to know what a "" is and what it means.
Let me show an example:
```
class Foo
{
public:
void DoSomething() { /* ... */ }
};
class Bar : public virtual Foo
{
public:
void DoSpecific() { /* ... */ }
};
```
| In C++, what is a virtual base class? | CC BY-SA 3.0 | 0 | 2008-08-22T01:13:15.357 | 2021-02-20T22:22:23.697 | 2014-03-01T13:37:57.833 | 3,235,496 | 1,556 | [
"c++",
"virtual-inheritance"
] |
21,607 | 2 | null | 21,558 | 579 | null | Virtual base classes, used in virtual inheritance, is a way of preventing multiple "instances" of a given class appearing in an inheritance hierarchy when using multiple inheritance.
Consider the following scenario:
```
class A { public: void Foo() {} };
class B : public A {};
class C : public A {};
class D : public ... | null | CC BY-SA 4.0 | null | 2008-08-22T01:45:02.770 | 2020-01-23T11:02:56.287 | 2020-01-23T11:02:56.287 | 1,536,976 | 611 | null |
21,612 | 2 | null | 21,558 | 10 | null | > A virtual base class is a class that
cannot be instantiated : you cannot
create direct object out of it.
I think you are confusing two very different things. Virtual inheritance is not the same thing as an abstract class. Virtual inheritance modifies the behaviour of function calls; sometimes it resolves func... | null | CC BY-SA 2.5 | null | 2008-08-22T01:47:36.913 | 2008-08-22T01:47:36.913 | null | null | 456 | null |
21,599 | 2 | null | 21,589 | 1 | null | How are you implementing this? If you are using EnterpriseServices to manage the .NET transaction, then both transactions should get rolled back, since you're using the same context for them both.
| null | CC BY-SA 2.5 | null | 2008-08-22T01:42:23.133 | 2008-08-22T01:42:23.133 | null | null | 1,219 | null |
21,594 | 2 | null | 21,593 | 1,829 | null | What differs is the locations in which the preprocessor searches for the file to be included.
- `#include <filename>` The preprocessor searches in an implementation-defined manner, normally in directories pre-designated by the compiler/IDE. This method is normally used to include header files for the C standard libra... | null | CC BY-SA 4.0 | null | 2008-08-22T01:40:27.897 | 2022-08-11T13:53:34.713 | 2022-08-11T13:53:34.713 | 298,225 | 2,399 | null |
21,616 | 2 | null | 21,558 | 0 | null | Virtual classes are the same as virtual inheritance. Virtual classes you cannot instantiate, virtual inheritance is something else entirely.
Wikipedia describes it better than I can. [http://en.wikipedia.org/wiki/Virtual_inheritance](http://en.wikipedia.org/wiki/Virtual_inheritance)
| null | CC BY-SA 2.5 | null | 2008-08-22T01:52:04.920 | 2008-08-22T01:52:04.920 | null | null | 1,546 | null |
21,614 | 2 | null | 21,564 | 3 | null | I'm not an Unix guy, but I think you can use
```
gawk '{print strftime("%d/%m/%y",systime()) $0 }' < somefile.txt
```
| null | CC BY-SA 2.5 | null | 2008-08-22T01:48:58.750 | 2008-08-22T01:48:58.750 | null | null | 394 | null |
21,619 | 2 | null | 21,583 | 4 | null | Yeah, you should refactor your code to access Repositories and Services which access the database and you can then mock or stub those objects so that the object under test never touches the database. This is much faster than storing the state of the database and resetting it after every test!
I highly recommend [Moq](... | null | CC BY-SA 2.5 | null | 2008-08-22T01:52:49.397 | 2008-08-22T01:52:49.397 | null | null | 1,851 | null |
21,613 | 2 | null | 21,558 | 1 | null | You're being a little confusing. I dont' know if you're mixing up some concepts.
You don't have a virtual base class in your OP. You just have a base class.
You did virtual inheritance. This is usually used in multiple inheritance so that multiple derived classes use the members of the base class without reproducing... | null | CC BY-SA 2.5 | null | 2008-08-22T01:48:04.977 | 2008-08-22T01:48:04.977 | null | null | 1,179 | null |
21,620 | 2 | null | 21,564 | 194 | null | Could try using `awk`:
```
<command> | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'
```
You may need to make sure that `<command>` produces line buffered output, i.e. it flushes its output stream after each line; the timestamp `awk` adds will be the time that the end of the line appeared on its input... | null | CC BY-SA 3.0 | null | 2008-08-22T01:53:25.837 | 2014-09-24T04:14:40.353 | 2014-09-24T04:14:40.353 | 321,772 | 588 | null |
21,624 | 2 | null | 21,449 | 2 | null | Best article I read about endianness "[Understanding Big and Little Endian Byte Order](http://betterexplained.com/articles/understanding-big-and-little-endian-byte-order/)".
| null | CC BY-SA 2.5 | null | 2008-08-22T01:57:42.600 | 2008-08-22T01:57:42.600 | null | null | 718 | null |
21,625 | 2 | null | 21,388 | 2 | null | I did this in my last project, but it was for a table that only occasionally needed to be specifically ordered, and wasn't accessed too often. I think the spaced array would be the best option, because it reordering would be cheapest in the average case, just involving a change to one value and a query on two).
Als... | null | CC BY-SA 2.5 | null | 2008-08-22T01:58:14.423 | 2008-08-22T01:58:14.423 | null | null | 1,266 | null |
21,635 | 1 | 21,726 | null | 3 | 1,030 | I have a product which has been traditionally shipped as an MSI file. It is deployed through some sort of SMS push to thousands of desktops by our various clients. The software we use to create these installers is getting long in the tooth and we are looking to replace it. We have already standardized on InstallAnyw... | Pushing out MSI files | CC BY-SA 2.5 | null | 2008-08-22T02:13:38.363 | 2012-08-11T15:54:00.660 | null | null | 361 | [
"deployment",
"installation",
"windows-installer"
] |
21,629 | 2 | null | 21,558 | 7 | null | I'd like to add to OJ's kind clarifications.
Virtual inheritance doesn't come without a price. Like with all things virtual, you get a performance hit. There is a way around this performance hit that is possibly less elegant.
Instead of breaking the diamond by deriving virtually, you can add another layer to the di... | null | CC BY-SA 3.0 | null | 2008-08-22T02:03:04.067 | 2017-04-13T08:13:15.380 | 2017-04-13T08:13:15.380 | 4,539,511 | 456 | null |
21,636 | 2 | null | 20,426 | 1 | null | The problem you are having is clear, recursion in SQL. You need to get the parent of the parent... of the leaf and updates it's total (either subtracting the old and adding the new, or recomputing). You need some form of identifier to see the structure of the tree, and grab all of a nodes children and a list of the par... | null | CC BY-SA 2.5 | null | 2008-08-22T02:14:04.820 | 2011-03-29T03:28:02.353 | 2011-03-29T03:28:02.353 | 157 | 157 | null |
21,637 | 2 | null | 21,355 | 7 | null | In `Moq` it would be:
```
mockRepository.Expect( r => r.Query() ).Returns( myEnumerable.AsQueriable() );
```
In `RhinoMocks` it would be:
```
Expect.Call( repository.Query() ).Return( myEnumerable.AsQueriable() );
```
| null | CC BY-SA 3.0 | null | 2008-08-22T02:15:07.127 | 2012-08-11T15:54:29.943 | 2012-08-11T15:54:29.943 | 1,477,076 | 1,851 | null |
21,641 | 2 | null | 14,155 | 9 | null | [Thej already recommended it](https://stackoverflow.com/questions/14155/text-editors#14219), but to elaborate:
[SciTE](http://scintilla.sourceforge.net/SciTEDownload.html) - Free, has preset colouring for many languages, and it's multi-platform (Windows & Linux), and lightweight.
[alt text http://scitedebug.luaforge... | null | CC BY-SA 2.5 | null | 2008-08-22T02:18:43.187 | 2008-08-22T02:18:43.187 | 2017-05-23T12:01:32.580 | -1 | 2,134 | null |
21,644 | 2 | null | 19,708 | 0 | null | I think you should benchmark and take a look at what you are doing to determine if stat() is the slowest part of your code. Stating 1 file on each request on a server that gets about 100 hits/day is not a problem. Stating every file could be a problem when you have to eek out a few more requests a second.
You can avoi... | null | CC BY-SA 2.5 | null | 2008-08-22T02:19:51.827 | 2008-08-22T02:19:51.827 | null | null | 956 | null |
21,642 | 2 | null | 6,467 | 6 | null | To do arithmetic with dates on UNIX you get the date as the number seconds since the UNIX epoch, do some calculation, then convert back to your printable date format. The date command should be able to both give you the seconds since the epoch and convert from that number back to a printable date. My local date command... | null | CC BY-SA 2.5 | null | 2008-08-22T02:19:44.120 | 2009-11-23T23:48:07.420 | 2009-11-23T23:48:07.420 | 573 | 2,406 | null |
21,646 | 2 | null | 14,155 | 0 | null | How about developing your own text editor?
You can own your own editor with priceless experience.
| null | CC BY-SA 2.5 | null | 2008-08-22T02:20:31.047 | 2008-08-22T02:20:31.047 | null | null | 1,556 | null |
21,640 | 1 | 22,361 | null | 265 | 188,065 | Is there a simple way in .NET to quickly get the current protocol, host, and port? For example, if I'm on the following URL:
`http://www.mywebsite.com:80/pages/page1.aspx`
I need to return:
`http://www.mywebsite.com:80`
I know I can use `Request.Url.AbsoluteUri` to get the complete URL, and I know I can use `Reques... | .NET - Get protocol, host, and port | CC BY-SA 4.0 | 0 | 2008-08-22T02:18:28.307 | 2022-10-06T03:13:32.667 | 2018-07-19T08:57:52.063 | 133 | 2,076,253 | [
".net",
"asp.net",
"url",
"uri",
"authority"
] |
21,663 | 2 | null | 14,155 | 0 | null | gvim with lots of useful plugins, i.e. taglist, c-syntax, matchit, vcscommand, bufexplorer and many more. gvim is also nice in conjunction with file manager Total Commander where F4 invokes gvim to edit the file under the cursor.
| null | CC BY-SA 2.5 | null | 2008-08-22T02:56:21.257 | 2008-08-22T02:56:21.257 | null | null | 2,386 | null |
21,650 | 2 | null | 21,635 | 4 | null | If you want to create `MSI` files, try [WiX: Windows Installer XML (WiX) toolset](http://wix.sourceforge.net/).
It's an addon to Visual Studio 2005 and 2008, is open-source, and Microsoft developed. You can use XML to specify and create MSI files. There is a [wealth](http://robmensching.com/blog/) [of](http://www.jo... | null | CC BY-SA 3.0 | null | 2008-08-22T02:23:40.400 | 2012-08-11T15:53:40.397 | 2012-08-11T15:53:40.397 | 1,477,076 | 2,134 | null |
21,653 | 2 | null | 21,640 | 23 | null | Request.Url will return you the [Uri](http://msdn.microsoft.com/en-us/library/system.uri.aspx) of the request. Once you have that, you can retrieve pretty much anything you want. To get the protocol, call the [Scheme](http://msdn.microsoft.com/en-us/library/system.uri.scheme.aspx) property.
Sample:
```
Uri url = Re... | null | CC BY-SA 2.5 | null | 2008-08-22T02:48:54.160 | 2008-08-22T02:48:54.160 | null | null | 1,117 | null |
21,647 | 1 | 21,656 | null | 129 | 356,494 | The following code uses a object to read integers from a text file (which has one number per line) until it hits . Why does it read the integer on the last line twice? How to fix this?
```
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream iFile("input.txt"); // input.txt has... | Reading from text file until EOF repeats last line | CC BY-SA 3.0 | 0 | 2008-08-22T02:21:07.440 | 2016-09-07T10:54:42.500 | 2011-07-09T22:22:34.747 | 560,648 | 1,630 | [
"c++",
"iostream",
"fstream"
] |
21,656 | 2 | null | 21,647 | 134 | null | Just follow closely the chain of events.
- - - -
Look at the second-to-last iteration. You grabbed 30, then carried on to check for EOF. You haven't reached EOF because the EOF mark hasn't been read yet ("binarically" speaking, its conceptual location is just after the 30 line). Therefore you carry on to the next... | null | CC BY-SA 2.5 | null | 2008-08-22T02:50:56.403 | 2008-08-22T02:57:58.647 | 2008-08-22T02:57:58.647 | 456 | 456 | null |
21,666 | 2 | null | 21,647 | 42 | null | I like this example, which for now, leaves out the check which you could add inside the while block:
```
ifstream iFile("input.txt"); // input.txt has integers, one per line
int x;
while (iFile >> x)
{
cerr << x << endl;
}
```
Not sure how safe it is...
| null | CC BY-SA 2.5 | null | 2008-08-22T02:59:25.477 | 2008-08-22T02:59:25.477 | null | null | 2,091 | null |
21,652 | 1 | 138,532 | null | 10 | 1,283 | I have some code that gives a user id to a utility that then send email to that user.
```
emailUtil.sendEmail(userId, "foo");
public void sendEmail(String userId, String message) throws MailException {
/* ... logic that could throw a MailException */
}
```
`MailException` could be thrown for a number of reasons... | Do you write exceptions for specific issues or general exceptions? | CC BY-SA 2.5 | 0 | 2008-08-22T02:47:44.333 | 2009-08-07T10:28:08.960 | 2009-08-07T10:28:08.960 | 21,005 | 1,666 | [
"c#",
"java",
"exception"
] |
21,651 | 1 | 24,919 | null | 8 | 4,959 | I have a script that retrieves objects from a remote server through an Ajax call. The server returns objects in JSON notation.... | Adobe AIR: Handling JSON objects from server | CC BY-SA 3.0 | 0 | 2008-08-22T02:26:26.117 | 2017-04-24T10:11:55.790 | 2017-05-23T12:09:52.140 | -1 | 2,504,504 | [
"javascript",
"ajax",
"json",
"air"
] |
21,673 | 2 | null | 14,155 | 1 | null | @MrBrutal I love Notepad2 as well. The only problem is it's lame with large files. :(
| null | CC BY-SA 2.5 | null | 2008-08-22T03:05:33.153 | 2008-08-22T03:05:33.153 | null | null | 1,886 | null |
21,669 | 1 | 21,702 | null | 14 | 8,583 | I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution?
Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed).
| Complexity of Regex substitution | CC BY-SA 2.5 | 0 | 2008-08-22T03:02:34.550 | 2020-08-21T20:55:45.703 | 2008-08-22T03:20:49.670 | 1,448 | 1,448 | [
"regex",
"complexity-theory"
] |
21,668 | 2 | null | 14,155 | 7 | null | I'll echo the others who have endorsed Emacs. I program every day on, at a bare minimum, OS X, Windows, and Linux. Having the same IDE on all three systems gives me an enormous productivity boost. That said, the vanilla version of GNU Emacs...well, it sucks. I'd strongly encourage you to try [EmacsW32](http://ourcommen... | null | CC BY-SA 2.5 | null | 2008-08-22T03:02:27.827 | 2008-08-22T03:02:27.827 | null | null | 2,354 | null |
21,675 | 2 | null | 21,669 | 1 | null | Depends on the implementation. What language/library/class? There may be a best case, but it would be very specific to the number of features in the implementation.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:06:10.907 | 2008-08-22T03:06:10.907 | null | null | 2,134 | null |
21,667 | 2 | null | 21,652 | 1 | null | It depends on what your application is doing. You might want to throw individual exceptions in cases like
- - - - -
In most cases I would say just log the text of the exception and don't waste your time granularizing already pretty granular exceptions.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:00:04.850 | 2008-08-22T03:00:04.850 | null | null | 361 | null |
21,693 | 2 | null | 21,574 | 12 | null | One huge difference would be the move from Matz's interpreter to [YARV](http://en.wikipedia.org/wiki/YARV), a bytecode virtual machine that helps significantly with performance.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:11:30.643 | 2008-08-22T03:11:30.643 | null | null | 1,600 | null |
21,678 | 2 | null | 21,652 | 10 | null | In my code, I find that MOST exceptions percolate up to a UI layer where they are caught by my exception handlers which simply display a message to the user (and write to the log). It's an unexpected exception, after all.
Sometimes, I do want to catch a specific exception (as you seem to want to do). You'll probably f... | null | CC BY-SA 2.5 | null | 2008-08-22T03:07:02.260 | 2009-02-09T18:42:36.990 | 2009-02-09T18:42:36.990 | 814 | 814 | null |
21,702 | 2 | null | 21,669 | 15 | null | From a purely theoretical stance:
The implementation I am familiar with would be to build a Deterministic Finite Automaton to recognize the regex. This is done in O(2^m), m being the size of the regex, using a standard algorithm. Once this is built, running a string through it is linear in the length of the string -... | null | CC BY-SA 2.5 | null | 2008-08-22T03:15:13.690 | 2008-08-22T03:15:13.690 | null | null | 940 | null |
21,720 | 2 | null | 21,715 | 2 | null | I generally only derive my own collection classes if I need to "add value". Like, if the collection itself needed to have some "metadata" properties tagging along with it.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:28:35.267 | 2008-08-22T03:28:35.267 | null | null | 615 | null |
21,716 | 2 | null | 21,651 | 2 | null | Have you looked at [as3corelib](http://code.google.com/p/as3corelib/)? It appears to provide an AS3 parser for JSON data, and my hope would be that it doesn't rely upon eval (eval tends to be bad for security as you noted). There are similar libs for Javascript as well, and they tend to be the preferred way to parse ... | null | CC BY-SA 2.5 | null | 2008-08-22T03:25:15.743 | 2008-08-22T03:25:15.743 | null | null | 1,432 | null |
21,698 | 1 | null | null | 2 | 5,494 | I'm trying to write a RegEx for a code generator (in C#) to determine a proper class or package name of an AS3 class.
I know that class names
- - -
Is there anything else?
| What are the rules for naming AS3 classes? | CC BY-SA 3.0 | 0 | 2008-08-22T03:13:07.113 | 2012-12-29T19:53:01.503 | 2012-02-08T18:34:05.540 | 547,122 | 1,306 | [
"actionscript-3",
"naming",
"convention"
] |
21,715 | 1 | 21,786 | null | 45 | 4,772 | Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable
IE:
```
public class CollectionBase : IEnumerable
```
and then would derive their Business Object collections from that.
```
public class BusinessObjectCollection : Collection... | List<BusinessObject> or BusinessObjectCollection? | CC BY-SA 2.5 | 0 | 2008-08-22T03:25:09.487 | 2009-07-17T17:49:58.787 | 2008-08-30T23:39:48.660 | 305 | 1,965 | [
"c#",
".net",
"generics",
"collections",
"class-design"
] |
21,726 | 2 | null | 21,635 | 4 | null | If your clients are using SMS then you're in the clear... SMS supports EXE. You enter a command line when creating 'Programs' and clients are probably already calling msiexec to launch the MSI. Also I'm pretty sure SMS predates the MSI file format :)
However if they're using `Active Directory / Group Policy Objects`..... | null | CC BY-SA 3.0 | null | 2008-08-22T03:32:01.077 | 2012-08-11T15:54:00.660 | 2012-08-11T15:54:00.660 | 1,477,076 | 592 | null |
21,725 | 1 | 30,699 | null | 165 | 56,538 | What are your favorite (G)Vim plugins/scripts?
| Favorite (G)Vim plugins/scripts? | CC BY-SA 2.5 | 0 | 2008-08-22T03:31:48.940 | 2011-12-22T16:25:42.890 | 2009-12-27T14:25:24.107 | 2,386 | 2,386 | [
"vim",
"editor"
] |
21,724 | 2 | null | 21,715 | 2 | null | I do the exact same thing as you Jonathan... just inherit from `List<T>`. You get the best of both worlds. But I generally only do it when there is some value to add, like adding a `LoadAll()` method or whatever.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:31:48.597 | 2008-08-22T03:40:26.720 | 2008-08-22T03:40:26.720 | 1,436 | 1,436 | null |
21,722 | 2 | null | 21,715 | 4 | null | I've been going back and forth on 2 options:
```
public class BusinessObjectCollection : List<BusinessObject> {}
```
or methods that just do the following:
```
public IEnumerable<BusinessObject> GetBusinessObjects();
```
The benefits of the first approach is that you can change the underlying data store without h... | null | CC BY-SA 2.5 | null | 2008-08-22T03:31:15.150 | 2009-03-17T01:14:00.947 | 2009-03-17T01:14:00.947 | 1,737,192 | 1,894 | null |
21,727 | 2 | null | 21,715 | 0 | null |
Either way its the same thing. I only do it when I have reason to add custom code into the BusinessObjectCollection.
With out it having load methods return a list allows me to write more code in a common generic class and have it just work. Such as a Load method.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:33:17.253 | 2008-08-22T03:33:17.253 | null | null | 805 | null |
21,732 | 2 | null | 21,725 | 60 | null | [Tim Pope](http://www.tpope.net/) has some kickass plugins. I love his [surround](http://github.com/tpope/vim-surround) plugin.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:36:45.573 | 2010-05-27T00:08:36.757 | 2010-05-27T00:08:36.757 | 456 | 456 | null |
21,730 | 2 | null | 21,715 | 9 | null | I prefer just to use `List<BusinessObject>`. Typedefing it just adds unnecessary boilerplate to the code. `List<BusinessObject>` is a specific type, it's not just any `List` object, so it's still strongly typed.
More importantly, declaring something `List<BusinessObject>` makes it easier for everyone reading the cod... | null | CC BY-SA 2.5 | null | 2008-08-22T03:34:18.840 | 2008-08-22T03:34:18.840 | null | null | 2,363 | null |
21,733 | 2 | null | 21,715 | 14 | null | It's [recommended](http://blogs.msdn.com/fxcop/archive/2006/04/27/faq-why-does-donotexposegenericlists-recommend-that-i-expose-collection-lt-t-gt-instead-of-list-lt-t-gt-david-kean.aspx) that in public API's not to use List<T>, but to use Collection<T>
If you are inheriting from it though, you should be fine, afaik.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:39:05.990 | 2008-08-22T03:39:05.990 | null | null | 77 | null |
21,697 | 1 | 22,043 | null | 17 | 5,757 | I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP architecture because I'm sick of Winforms and wanted something that had a better separation of concerns.
So with MVP, the Presenter handles events raised by the View. Here's some code that I have in place to deal with the creation of users:... | How Do You Communicate Service Layer Messages/Errors to Higher Layers Using MVP? | CC BY-SA 3.0 | 0 | 2008-08-22T03:12:59.517 | 2012-03-29T19:04:40.937 | 2012-03-29T19:04:40.937 | 122,607 | 1,894 | [
"c#",
"asp.net",
"exception",
"mvp",
"n-tier-architecture"
] |
21,752 | 2 | null | 9,033 | 15 | null | How about the [FlagsAttribute](http://msdn.microsoft.com/en-us/library/system.flagsattribute.aspx) on an enumeration? It allows you to perform bitwise operations... took me forever to find out how to do bitwise operations in .NET nicely.
| null | CC BY-SA 2.5 | null | 2008-08-22T03:55:51.533 | 2010-06-25T17:10:19.600 | 2010-06-25T17:10:19.600 | 4,872 | 2,422 | null |
21,766 | 1 | 21,818 | null | 12 | 8,397 | I'm trying to locate an open source business rules engine that has a decent interface for building the rules.
OR at least one that works well on the .Net platform and has been updated sometime in the past 12 months.
Thanks,
| Open source rules engine with decent interface for writing rules | CC BY-SA 2.5 | 0 | 2008-08-22T04:20:07.280 | 2011-08-17T00:16:59.160 | 2008-09-04T14:05:19.313 | 797 | 2,424 | [
".net",
"rule-engine"
] |
21,765 | 2 | null | 21,725 | 25 | null | A very nice grep replacement for GVim is [Ack](http://petdance.com/ack/). A search plugin written in Perl that beats Vim's internal grep implementation and externally invoked greps, too. It also by default skips any CVS directories in the project directory, e.g. '.svn'. [This](http://blog.ant0ine.com/2007/03/ack_and_vi... | null | CC BY-SA 2.5 | null | 2008-08-22T04:19:34.940 | 2008-08-22T04:19:34.940 | null | null | 2,386 | null |
21,731 | 2 | null | 21,715 | 3 | null | You should probably avoid creating your own collection for that purpose. It's pretty common to want to change the type of data structure a few times during refactorings or when adding new features. With your approach, you would wind up with a separate class for BusinessObjectList, BusinessObjectDictionary, BusinessOb... | null | CC BY-SA 2.5 | null | 2008-08-22T03:35:09.090 | 2008-08-22T03:35:09.090 | null | null | 1,471 | null |
21,738 | 1 | 201,513 | null | 1 | 382 | Is anyone else having trouble running Swing applications from IntelliJ IDEA 8 Milestone 1? Even the simplest application of showing an empty JFrame seems to crash the JVM. I don't get a stack trace or anything, it looks like the JVM itself crashes and Windows shows me a pop-up that says the usual "This process is no ... | Problems running Swing application with IDEA 8M1 | CC BY-SA 2.5 | null | 2008-08-22T03:43:41.690 | 2008-10-14T14:57:36.640 | 2008-10-04T06:31:01.330 | 6,180 | 1,471 | [
"java",
"swing",
"ide",
"jvm",
"intellij-idea"
] |
21,749 | 1 | 21,978 | null | 4 | 7,532 | I have a Delphi 7 application that has two views of a document (e.g. a WYSIWYG HTML edit might have a WYSIWYG view and a source view - not my real application). They can be opened in separate windows, or docked into tabs in the main window.
If I open a modal dialog from one of the separate forms, the main form is brou... | Multiple form Delphi applications and dialogs | CC BY-SA 2.5 | 0 | 2008-08-22T03:51:42.980 | 2011-08-29T21:59:55.697 | 2011-08-29T21:59:55.697 | 10,300 | 2,219 | [
"delphi",
"delphi-7"
] |
21,753 | 1 | 22,073 | null | 0 | 679 | What is the best way to distribute files to users in remote offices, using [BITS](http://en.wikipedia.org/wiki/Background_Intelligent_Transfer_Service) with a UNC path or BITS with HTTP? I have a VB.NET project which currently downloads from a HTTP path, but there is added complexity involved (e.g. having a web server)... | How to use BITS to download from a UNC path? | CC BY-SA 3.0 | null | 2008-08-22T03:58:10.530 | 2014-11-06T10:27:41.823 | 2014-11-06T10:27:41.823 | 2,553,588 | 2,418 | [
"vb.net",
"bit"
] |
21,743 | 2 | null | 18,675 | 2 | null | Writing to the Program Files folder is a really bad idea, you should assume that this location is "read only" once installed.
Saving user settings in Program Files causes problems if more than two people use the computer at once (eg. Terminal Services) who's settings should be saved, do you want other users to know '... | null | CC BY-SA 2.5 | null | 2008-08-22T03:47:43.130 | 2008-08-22T03:47:43.130 | null | null | 592 | null |
21,775 | 2 | null | 21,635 | 1 | null | Actually, with group policies, there's the `ZAP` file alternative, but I would recommend regardless that you learn `MSI`. It's not that hard, and very flexible.
| null | CC BY-SA 3.0 | null | 2008-08-22T04:32:57.937 | 2012-08-11T15:53:16.607 | 2012-08-11T15:53:16.607 | 1,477,076 | 1,600 | null |
21,784 | 2 | null | 21,652 | 2 | null | @Chris.Lively
You know you can pass a message in your exception, or even the "status codes". You are reinventing the wheel here.
| null | CC BY-SA 2.5 | null | 2008-08-22T04:46:00.120 | 2008-08-22T04:46:00.120 | null | null | 1,965 | null |
21,768 | 2 | null | 21,489 | 2 | null | My solution just for kicks (this was a fun exercise), no cursors, no iterations, but i do have a helper field
```
-- Setup test table
DECLARE @names TABLE (
id INT IDENTITY(1,1),
name NVARCHAR(25) NOT NULL,
grp ... | null | CC BY-SA 2.5 | null | 2008-08-22T04:22:17.477 | 2008-08-22T04:49:18.303 | 2008-08-22T04:49:18.303 | 1,950 | 1,950 | null |
21,787 | 2 | null | 21,647 | 15 | null | There's an alternative approach to this:
```
#include <iterator>
#include <algorithm>
// ...
copy(istream_iterator<int>(iFile), istream_iterator<int>(),
ostream_iterator<int>(cerr, "\n"));
```
| null | CC BY-SA 2.5 | null | 2008-08-22T04:46:33.503 | 2008-08-22T04:52:55.970 | 2008-08-22T04:52:55.970 | 456 | 456 | null |
21,790 | 2 | null | 18,655 | 16 | null | Eric,
You are dead on. For any really scalable / easily maintained / robust application the only real answer is to dispense with all the garbage and stick to the basics.
I've followed a similiar trajectory with my career and have come to the same conclusions. Of course, we're considered heretics and looked at funny.... | null | CC BY-SA 2.5 | null | 2008-08-22T04:49:15.760 | 2008-08-22T04:49:15.760 | null | null | 2,424 | null |
21,792 | 2 | null | 12,103 | 15 | null | Note that map is going to modify your source array as well. So you could either do:
```
map {s/ //g} @outdata;
```
and skip the @filtered variable altogether, or if you need to retain the originals,
```
@filtered = @outdata;
map {s/ //g} @filtered;
```
Although, in that case, it might be more readable t... | null | CC BY-SA 2.5 | null | 2008-08-22T04:51:03.680 | 2008-08-22T04:51:03.680 | null | null | 2,425 | null |
21,773 | 2 | null | 17,928 | 2 | null | Sure..it's pretty easy. Here's a fun app I threw together. I'm assuming you have Visual C++.
Save to test.cpp and compile: cl.exe /EHsc test.cpp
To test with your OCX you'll need to either #import the typelib and use it's CLSID (or just hard-code the CLSID) in the CoCreateInstance call. Using #import will also help d... | null | CC BY-SA 2.5 | null | 2008-08-22T04:31:00.810 | 2008-08-22T04:31:00.810 | null | null | 2,420 | null |
21,793 | 2 | null | 18,655 | 4 | null | Entity Objects can facilitate cacheing on the application layer. Good luck caching a datareader.
| null | CC BY-SA 2.5 | null | 2008-08-22T04:51:23.897 | 2008-08-22T04:51:23.897 | null | null | 1,965 | null |
21,806 | 2 | null | 21,715 | 1 | null | I use generic lists for almost all scenarios. The only time that I would consider using a derived collection anymore is if I add collection specific members. However, the advent of LINQ has lessened the need for even that.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:02:08.037 | 2008-08-22T05:02:08.037 | null | null | 105 | null |
21,778 | 2 | null | 5,473 | 2,285 | null | Pat Notz is correct. You can get the commit back so long as it's been within a few days. git only garbage collects after about a month or so unless you explicitly tell it to remove newer blobs.
```
$ git init
Initialized empty Git repository in .git/
$ echo "testing reset" > file1
$ git add file1
$ git commit -m 'a... | null | CC BY-SA 2.5 | null | 2008-08-22T04:36:02.187 | 2009-01-29T05:35:42.437 | 2009-01-29T05:35:42.437 | 4,279 | 2,063 | null |
21,818 | 2 | null | 21,766 | 8 | null | NxBRE is one option.
[http://sourceforge.net/projects/nxbre/#item3rd-5](http://sourceforge.net/projects/nxbre/#item3rd-5)
| null | CC BY-SA 2.5 | null | 2008-08-22T05:18:12.397 | 2008-08-22T05:18:12.397 | null | null | 9 | null |
21,809 | 2 | null | 21,749 | 0 | null | First of all, I am not completely sure I follow, you might need to provide some additional details to help us understand what is happening and what the problem is. I guess I am not sure I understand exactly what you're trying to accomplish and what the problem is.
Second, you shouldn't need to set the dialog's parent ... | null | CC BY-SA 2.5 | null | 2008-08-22T05:06:19.120 | 2008-08-22T05:06:19.120 | null | null | 1,627 | null |
21,800 | 2 | null | 9,009 | 21 | null | Just to extend the previous answer... If, for whatever reason, the assignments need to be part of the conditional, you'd want to write it thusly:
```
$condition ? ($a=2) : ($a=3);
```
This would be useful if you're assigning to different variables based on the condition.
```
$condition ? ($a=2) : ($b=3);
```
And ... | null | CC BY-SA 2.5 | null | 2008-08-22T04:58:03.367 | 2008-08-22T04:58:03.367 | null | null | 2,425 | null |
21,777 | 2 | null | 21,652 | 1 | null | Instead of using exceptions, I tend to return a list of status objects from methods that may have problems executing. The status objects contain a severity enum (information, warning, error, ...) a status object name like "Email Address" and a user readable message like "Badly formatted Email Address"
The calling cod... | null | CC BY-SA 2.5 | null | 2008-08-22T04:35:53.297 | 2008-11-03T16:22:02.287 | 2008-11-03T16:22:02.287 | 2,424 | 2,424 | null |