question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
152,307
152,366
Google 404 and .NET Custom Error Pages
I've got an ASP.NET 2.0 website with a custom 404 page. When content is not found the site serves the custom 404 page with a query string addition of aspxerrorpath=/mauro.aspx. The 404 page itself is served with an HTTP status of 200. To try to resolve this I've added protected void Page_Load(object sender, EventArgs e...
I've handled the 404 by doing this in the global.asax file protected void Application_BeginRequest(object sender, EventArgs e) { string url = Request.RawUrl; if ((url.Contains(".aspx")) && (!System.IO.File.Exists(Server.MapPath(url)))) { Server.Transfer("/Error/FileNotFound.aspx"); } } Now, if anyone can help me with t...
Google 404 and .NET Custom Error Pages I've got an ASP.NET 2.0 website with a custom 404 page. When content is not found the site serves the custom 404 page with a query string addition of aspxerrorpath=/mauro.aspx. The 404 page itself is served with an HTTP status of 200. To try to resolve this I've added protected vo...
TITLE: Google 404 and .NET Custom Error Pages QUESTION: I've got an ASP.NET 2.0 website with a custom 404 page. When content is not found the site serves the custom 404 page with a query string addition of aspxerrorpath=/mauro.aspx. The 404 page itself is served with an HTTP status of 200. To try to resolve this I've ...
[ "asp.net", "http-status-code-404", "google-widget" ]
9
1
7,063
2
0
2008-09-30T09:01:08.617000
2008-09-30T09:25:18.997000
152,314
152,380
How to capture the "Print" button from the menu bar in a macro
I have a sheet with a custom button on it from where I control the printing process. Now the user clicks on the menu bar's print icon and this produces an "undefined" output. How can I intercept this menu bar button? Thanks
Handle the Workbook_BeforePrint event. private sub Workbook_BeforePrint (cancel as boolean) '//g_MyFlag is set when the user clicks you toolbar button. '//It must get cleared in the end of your procedure. if not g_MyFlag then cancel = true: exit sub end sub In MS Word, it's also possible to redefine the system macro i...
How to capture the "Print" button from the menu bar in a macro I have a sheet with a custom button on it from where I control the printing process. Now the user clicks on the menu bar's print icon and this produces an "undefined" output. How can I intercept this menu bar button? Thanks
TITLE: How to capture the "Print" button from the menu bar in a macro QUESTION: I have a sheet with a custom button on it from where I control the printing process. Now the user clicks on the menu bar's print icon and this produces an "undefined" output. How can I intercept this menu bar button? Thanks ANSWER: Handle...
[ "excel", "printing", "vba" ]
4
4
560
1
0
2008-09-30T09:03:35.693000
2008-09-30T09:33:24.250000
152,318
152,343
Learning C++ Templates
Can anyone recommend any good resources for learning C++ Templates? Many thanks.
I've found cplusplus.com to be helpful on numerous occasions. Looks like they've got a pretty good intro to templates. If its an actual book you're looking for, Effective C++ is a classic with a great section on templates.
Learning C++ Templates Can anyone recommend any good resources for learning C++ Templates? Many thanks.
TITLE: Learning C++ Templates QUESTION: Can anyone recommend any good resources for learning C++ Templates? Many thanks. ANSWER: I've found cplusplus.com to be helpful on numerous occasions. Looks like they've got a pretty good intro to templates. If its an actual book you're looking for, Effective C++ is a classic w...
[ "c++", "templates" ]
17
12
12,185
7
0
2008-09-30T09:05:50.727000
2008-09-30T09:17:10.793000
152,319
152,325
VBA array sort function?
I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice. Please note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and anything.net related.
Take a look here: Edit: The referenced source (allexperts.com) has since closed, but here are the relevant author comments: There are many algorithms available on the web for sorting. The most versatile and usually the quickest is the Quicksort algorithm. Below is a function for it. Call it simply by passing an array o...
VBA array sort function? I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice. Please note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and anything.net related...
TITLE: VBA array sort function? QUESTION: I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice. Please note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and an...
[ "arrays", "sorting", "vba", "vb6", "ms-project" ]
103
131
365,152
14
0
2008-09-30T09:06:04.907000
2008-09-30T09:10:21.027000
152,323
152,411
Send mail from a Windows script
I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box. The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my machine with Perl, but unfortunately Perl is not avail...
It is possible with Wscript, using CDO: Dim objMail Set objMail = CreateObject("CDO.Message") objMail.From = "Me " objMail.To = "You " objMail.Subject = "That's a mail" objMail.Textbody = "Hello World" objMail.AddAttachment "C:\someFile.ext" ---8<----- You don't need this part if you have an active Outlook [Express]...
Send mail from a Windows script I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box. The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my machine with Perl, but...
TITLE: Send mail from a Windows script QUESTION: I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box. The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my mach...
[ "windows", "email", "scripting", "smtp", "wsh" ]
11
11
53,757
7
0
2008-09-30T09:08:05.497000
2008-09-30T09:45:17.310000
152,328
152,355
How do you structure your SVN repository?
What is better? A: server:1080/repo/projectA/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... server:1080/repo/projectB/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... B: server:1080/repo/trunk/projectA/... branches/projectA/branch1 branch...
The Repository Administration chapter of the SVN book includes a section on Planning Your Repository Organization outlining different strategies and their implication, particularly the implications of the repository layout on branching and merging.
How do you structure your SVN repository? What is better? A: server:1080/repo/projectA/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... server:1080/repo/projectB/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... B: server:1080/repo/trunk/pro...
TITLE: How do you structure your SVN repository? QUESTION: What is better? A: server:1080/repo/projectA/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... server:1080/repo/projectB/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... B: server:1...
[ "svn", "project-management", "repository" ]
13
17
22,671
6
0
2008-09-30T09:10:46.190000
2008-09-30T09:20:38.210000
152,337
156,695
GetProcessesByName() and Windows Server 2003 scheduled task
Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003: System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName) When NOT running as scheduled task i.e. under a logged in user, as long as the user is...
My humblest apologies. The user I was using was NOT a member of "Performance Monitor Users" group. This is necessary for.NET Framework 1.1 implementation of System.Diagnostics. I have added the user to this group, and all is well.
GetProcessesByName() and Windows Server 2003 scheduled task Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003: System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName) When NOT running as schedu...
TITLE: GetProcessesByName() and Windows Server 2003 scheduled task QUESTION: Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003: System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName) When NOT...
[ "windows", "permissions", "scheduled-tasks", ".net-1.1" ]
1
2
5,887
4
0
2008-09-30T09:15:02.890000
2008-10-01T08:26:25.477000
152,338
152,427
WCF Unit Test
How to unit test WCF services? Any 3rd Party tools available?
As aku says, if you're testing service methods (ie code behaviour) then you can unit test that directly and bypass the WCF infrastructure. Of course, if your code depends on WCF context classes (like OperationContext) then I suggest introducing wrappers much like ASP.NET MVC does for HttpContext. For testing connectivi...
WCF Unit Test How to unit test WCF services? Any 3rd Party tools available?
TITLE: WCF Unit Test QUESTION: How to unit test WCF services? Any 3rd Party tools available? ANSWER: As aku says, if you're testing service methods (ie code behaviour) then you can unit test that directly and bypass the WCF infrastructure. Of course, if your code depends on WCF context classes (like OperationContext)...
[ "wcf", "unit-testing" ]
38
28
35,567
8
0
2008-09-30T09:15:11.983000
2008-09-30T09:52:22.067000
152,342
152,348
In Java, do I need to declare my collection synchronized if it's read-only?
I fill a collection one single time when my J2EE webapp starts. Then, several thread may access it at same time but only to read it. I know using a synchronized collection is mandatory for parallels write but do I still need it for parallels read?
Normally no because you are not changing the internal state of the collection in this case. When you iterate over the collection a new instance of the iterator is created and the state of the iteration is per iterator instance. Aside note: Remember that by keeping a read-only collection you are only preventing modifica...
In Java, do I need to declare my collection synchronized if it's read-only? I fill a collection one single time when my J2EE webapp starts. Then, several thread may access it at same time but only to read it. I know using a synchronized collection is mandatory for parallels write but do I still need it for parallels re...
TITLE: In Java, do I need to declare my collection synchronized if it's read-only? QUESTION: I fill a collection one single time when my J2EE webapp starts. Then, several thread may access it at same time but only to read it. I know using a synchronized collection is mandatory for parallels write but do I still need i...
[ "java", "multithreading", "synchronization", "web-applications" ]
23
20
5,831
5
0
2008-09-30T09:16:48.737000
2008-09-30T09:18:59.603000
152,384
152,410
Define a one-to-one relationship with LinqToSQL
I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into issues mapping a fairly important one-to-one relationship, so I suspect I am using the feature incorrectly for my database design. Assume two tables, Category and CategoryDetail. Category contains the CategoryId (PK), Paren...
You can view properties of the association. (Right click on the line representing the association and show properties.) The properties will tell you if it is a one-to-one or one-to-many relationship. This is reflected in code by having either a single entity association (one-to-one) or an entity set association (one-to...
Define a one-to-one relationship with LinqToSQL I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into issues mapping a fairly important one-to-one relationship, so I suspect I am using the feature incorrectly for my database design. Assume two tables, Category and CategoryDeta...
TITLE: Define a one-to-one relationship with LinqToSQL QUESTION: I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into issues mapping a fairly important one-to-one relationship, so I suspect I am using the feature incorrectly for my database design. Assume two tables, Categor...
[ "linq-to-sql", "multilingual" ]
3
2
2,147
4
0
2008-09-30T09:35:11.233000
2008-09-30T09:45:15.907000
152,387
152,476
What technologies do C++ programmers need to know?
C++ was the first programming language I really got into, but the majority of my work on it was academic or for game programming. Most of the programming jobs where I live require Java or.NET programmers and I have a fairly good idea of what technologies they require aside from the basic language. For example, a Java p...
As for every language, I believe there are three interconnected levels of knowledge: Master your language. Every programmer should (do what it takes to) master the syntax. Good references to achieve this are: The C++ Programming Language by Bjarne Stroustrup. Effective C++ series by Scott Meyers. Know your libraries ex...
What technologies do C++ programmers need to know? C++ was the first programming language I really got into, but the majority of my work on it was academic or for game programming. Most of the programming jobs where I live require Java or.NET programmers and I have a fairly good idea of what technologies they require a...
TITLE: What technologies do C++ programmers need to know? QUESTION: C++ was the first programming language I really got into, but the majority of my work on it was academic or for game programming. Most of the programming jobs where I live require Java or.NET programmers and I have a fairly good idea of what technolog...
[ "c++" ]
40
38
25,230
10
0
2008-09-30T09:36:14.740000
2008-09-30T10:08:43.617000
152,405
153,055
How do I merge TMainMenu's that use separate imagelists and retain the correct images by each menu item?
I have a program with two TForm classes and have added a TMainMenu to them each. I am then trying to merge them dynamically at run-time. My problem is that when they merge the menu items in the merged in TMainMenu now display images stored in the imagelist in the form they were merged into rather than the images stored...
The way I handle this is to have a single image list on a datamodule, and then include that in each form so that they can share that single set of icons.
How do I merge TMainMenu's that use separate imagelists and retain the correct images by each menu item? I have a program with two TForm classes and have added a TMainMenu to them each. I am then trying to merge them dynamically at run-time. My problem is that when they merge the menu items in the merged in TMainMenu n...
TITLE: How do I merge TMainMenu's that use separate imagelists and retain the correct images by each menu item? QUESTION: I have a program with two TForm classes and have added a TMainMenu to them each. I am then trying to merge them dynamically at run-time. My problem is that when they merge the menu items in the mer...
[ "delphi", "c++builder", "vcl" ]
2
8
1,378
2
0
2008-09-30T09:43:42.010000
2008-09-30T13:41:44.557000
152,416
152,423
How do you write a (simple) variable "toggle"?
Given the following idioms: 1) variable = value1 if condition variable = value2 2) variable = value2 if not condition variable = value1 3) if condition variable = value2 else variable = value1 4) if not condition variable = value1 else variable = value2 Which do you prefer, and why? We assume the most common execution ...
In theory, I prefer #3 as it avoids having to assign a value to the variable twice. In the real world though I use any of the four above that would be more readable or would express more clearly my intention.
How do you write a (simple) variable "toggle"? Given the following idioms: 1) variable = value1 if condition variable = value2 2) variable = value2 if not condition variable = value1 3) if condition variable = value2 else variable = value1 4) if not condition variable = value1 else variable = value2 Which do you prefer...
TITLE: How do you write a (simple) variable "toggle"? QUESTION: Given the following idioms: 1) variable = value1 if condition variable = value2 2) variable = value2 if not condition variable = value1 3) if condition variable = value2 else variable = value1 4) if not condition variable = value1 else variable = value2 W...
[ "language-agnostic", "coding-style", "idioms" ]
1
10
721
12
0
2008-09-30T09:47:08.333000
2008-09-30T09:49:19.220000
152,432
152,442
Caching the sessionfactory
As far as I've gathered (read: measured), building the configuration and the sessionfactory by far takes the most time in executing a query using nhibernate. Is there anything against making the sessionfactory static, so it will only be configured once per appDomain? I know there are locking and racing issues when usin...
Session factory should be started at the application start indeed. You could check the best practices here.
Caching the sessionfactory As far as I've gathered (read: measured), building the configuration and the sessionfactory by far takes the most time in executing a query using nhibernate. Is there anything against making the sessionfactory static, so it will only be configured once per appDomain? I know there are locking ...
TITLE: Caching the sessionfactory QUESTION: As far as I've gathered (read: measured), building the configuration and the sessionfactory by far takes the most time in executing a query using nhibernate. Is there anything against making the sessionfactory static, so it will only be configured once per appDomain? I know ...
[ "c#", "asp.net", "nhibernate", "caching" ]
3
5
861
1
0
2008-09-30T09:54:32
2008-09-30T09:57:38.810000
152,436
152,461
Do you recommend Native C++ to C++\CLI shift?
I have been working as a native C++ programmer for last few years. Now we are starting a new project from the scratch. So what is your thoughts on shifting to C++\CLI at the cost of losing platform independent code. Are there are any special advantages that one can gain by shifting to C++\CLI?
I would recommend the following, based on my experience with C++, C# and.NET: If you want to go the.NET way, use C#. If you do not want.NET, use traditional C++. If you have to bridge traditional C++ with.NET code, use C++/CLI. Works both with.NET calling C++ classes and C++ calling.NET classes. I see no sense in just ...
Do you recommend Native C++ to C++\CLI shift? I have been working as a native C++ programmer for last few years. Now we are starting a new project from the scratch. So what is your thoughts on shifting to C++\CLI at the cost of losing platform independent code. Are there are any special advantages that one can gain by ...
TITLE: Do you recommend Native C++ to C++\CLI shift? QUESTION: I have been working as a native C++ programmer for last few years. Now we are starting a new project from the scratch. So what is your thoughts on shifting to C++\CLI at the cost of losing platform independent code. Are there are any special advantages tha...
[ "c#", "c++", "c++-cli" ]
12
31
2,130
8
0
2008-09-30T09:55:15.617000
2008-09-30T10:05:18.183000
152,441
160,052
Unit testing for PL/SQL
Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing?
I use utPLSQL as the framework and OUnit as the client. utPLSQL isn't really meant to be used by itself, a good graphical client is required. OUnit is the predecessor to Qute. Qute is also a good tool but more complex than my requirements - it allows you to construct tests using a GUI and does good stuff like test code...
Unit testing for PL/SQL Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing?
TITLE: Unit testing for PL/SQL QUESTION: Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing? ANSWER: I use utPLSQL as the framew...
[ "oracle", "unit-testing", "plsql" ]
23
9
10,703
8
0
2008-09-30T09:57:21.337000
2008-10-01T22:29:25.013000
152,447
156,112
SQL-Server: Is there a SQL script that I can use to determine the progress of a SQL Server backup or restore process?
When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still need to wait for it to finish. If I kick off the backup or restore with a script, is there a way to monitor the progress, or do I just sit back and...
Yes. If you have installed sp_who2k5 into your master database, you can simply run: sp_who2k5 1,1 The resultset will include all the active transactions. The currently running backup(s) will contain the string "BACKUP" in the requestCommand field. The aptly named percentComplete field will give you the progress of the ...
SQL-Server: Is there a SQL script that I can use to determine the progress of a SQL Server backup or restore process? When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still need to wait for it to finish...
TITLE: SQL-Server: Is there a SQL script that I can use to determine the progress of a SQL Server backup or restore process? QUESTION: When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still need to wai...
[ "sql-server", "backup", "restore" ]
114
12
285,620
18
0
2008-09-30T09:59:34.780000
2008-10-01T03:22:35.117000
152,468
152,484
What is the best way to change a user-password remotely in Unix?
What is the best way to change a user-password remotely in Unix? This must be performed by the user, in a Web-app or Windows-App, without using SSH or any direct connection between the user and the server (direct command line not allowed). Thanks Webmin seemed to be a good application to do that, but I found it extreme...
Use Webmin (more specifically the UserMin module). Webmin provides a mini webserver, so you just need to install and configure it slightly. You'll get a lot more than just password-changing, and you can remove functionality you don't want the user to have.
What is the best way to change a user-password remotely in Unix? What is the best way to change a user-password remotely in Unix? This must be performed by the user, in a Web-app or Windows-App, without using SSH or any direct connection between the user and the server (direct command line not allowed). Thanks Webmin s...
TITLE: What is the best way to change a user-password remotely in Unix? QUESTION: What is the best way to change a user-password remotely in Unix? This must be performed by the user, in a Web-app or Windows-App, without using SSH or any direct connection between the user and the server (direct command line not allowed...
[ "unix", "change-password" ]
3
5
1,381
4
0
2008-09-30T10:07:18.880000
2008-09-30T10:10:20.010000
152,469
152,523
ASP.NET user login best practices
I want to make a login system using ASP.NET (MVC). On the internet, I found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider. However, I want to roll my own. I don't want to use the built-in membership provider, as it only seems to work on MS SQL...
I dont know about best practices but I can tell you what I do. Its not hitech security but it does the job. I use forms authentication. I receive the password secured with ssl via a textbox on the login page. I take that password and hash it. (Hashing is like one way encryption, you can get hash code that cant be rever...
ASP.NET user login best practices I want to make a login system using ASP.NET (MVC). On the internet, I found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider. However, I want to roll my own. I don't want to use the built-in membership provider, ...
TITLE: ASP.NET user login best practices QUESTION: I want to make a login system using ASP.NET (MVC). On the internet, I found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider. However, I want to roll my own. I don't want to use the built-in mem...
[ "asp.net", "asp.net-mvc" ]
9
5
5,043
7
0
2008-09-30T10:07:40.267000
2008-09-30T10:30:44.890000
152,483
152,573
Is there a way to print all methods of an object?
Is there a way to print all methods of an object in JavaScript?
Sure: function getMethods(obj) { var result = []; for (var id in obj) { try { if (typeof(obj[id]) == "function") { result.push(id + ": " + obj[id].toString()); } } catch (err) { result.push(id + ": inaccessible"); } } return result; } Using it: alert(getMethods(document).join("\n"));
Is there a way to print all methods of an object? Is there a way to print all methods of an object in JavaScript?
TITLE: Is there a way to print all methods of an object? QUESTION: Is there a way to print all methods of an object in JavaScript? ANSWER: Sure: function getMethods(obj) { var result = []; for (var id in obj) { try { if (typeof(obj[id]) == "function") { result.push(id + ": " + obj[id].toString()); } } catch (err) { r...
[ "javascript" ]
82
103
89,071
6
0
2008-09-30T10:09:58.920000
2008-09-30T10:55:23.693000
152,487
152,685
MSBuild: How to obtain number of warnings raised?
There is a MSBuild script, that includes number if Delphi and C# projects, unit tests etc. The problem is: how to mark build failed if warnings were raised (for testing purposes, not for release builds)? Using LogError instead of LogWarning in custom tasks seems to be not a good option, because the build should test as...
AFAIK MSBuild has no built-in support to retrieve the warning count at a given point of the build script. You can however follow these steps to achieve this goal: Create a custom logger that listens for the warning event and counts the number of warnings Create a custom task that exposes an [Output] WarningCount proper...
MSBuild: How to obtain number of warnings raised? There is a MSBuild script, that includes number if Delphi and C# projects, unit tests etc. The problem is: how to mark build failed if warnings were raised (for testing purposes, not for release builds)? Using LogError instead of LogWarning in custom tasks seems to be n...
TITLE: MSBuild: How to obtain number of warnings raised? QUESTION: There is a MSBuild script, that includes number if Delphi and C# projects, unit tests etc. The problem is: how to mark build failed if warnings were raised (for testing purposes, not for release builds)? Using LogError instead of LogWarning in custom t...
[ "msbuild", "cruisecontrol.net" ]
6
7
3,946
3
0
2008-09-30T10:10:43.973000
2008-09-30T11:46:49.513000
152,506
154,805
What does this do? tasklist /m "mscor*"
Saw this question here: What Great.NET Developers Ought To Know (More.NET Interview Questions)
It will show processes that have loaded modules (usaully.DLL files) hosting the.NET runtime. The same technique can be used to search for other DLLs that have been loaded. On a related note, Process Explorer is a Microsoft task manager replacement that will show.NET processes highlighted. I cannot recommend it enough. ...
What does this do? tasklist /m "mscor*" Saw this question here: What Great.NET Developers Ought To Know (More.NET Interview Questions)
TITLE: What does this do? tasklist /m "mscor*" QUESTION: Saw this question here: What Great.NET Developers Ought To Know (More.NET Interview Questions) ANSWER: It will show processes that have loaded modules (usaully.DLL files) hosting the.NET runtime. The same technique can be used to search for other DLLs that have...
[ ".net" ]
12
14
9,265
3
0
2008-09-30T10:22:47.187000
2008-09-30T20:13:45.303000
152,514
152,741
How do I rename all folders and files to lowercase on Linux?
I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter). Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell script, since a shell should be available on any Linux box. T...
A concise version using the "rename" command: find my_root_dir -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \; This avoids problems with directories being renamed before files and trying to move files into non-existing directories (e.g. "A/A" into "a/a" ). Or, a more verbose version without using "rename". for S...
How do I rename all folders and files to lowercase on Linux? I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter). Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell ...
TITLE: How do I rename all folders and files to lowercase on Linux? QUESTION: I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter). Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way...
[ "linux", "rename", "lowercase" ]
246
202
287,355
31
0
2008-09-30T10:25:17.930000
2008-09-30T12:03:32.720000
152,537
153,101
What is the best way to select string fields based on character ranges?
I need to add the ability for users of my software to select records by character ranges. How can I write a query that returns all widgets from a table whose name falls in the range Ba-Bi for example? Currently I'm using greater than and less than operators, so the above example would become: select * from widget where...
Let's skip directly to localization. Would you say "aa" >= "ba"? Probably not, but that is where it sorts in Sweden. Also, you simply can't assume that you can ignore casing in any language. Casing is explicitly language-dependent, with the most common example being Turkish: uppercase i is İ. Lowercase I is ı. Now, you...
What is the best way to select string fields based on character ranges? I need to add the ability for users of my software to select records by character ranges. How can I write a query that returns all widgets from a table whose name falls in the range Ba-Bi for example? Currently I'm using greater than and less than ...
TITLE: What is the best way to select string fields based on character ranges? QUESTION: I need to add the ability for users of my software to select records by character ranges. How can I write a query that returns all widgets from a table whose name falls in the range Ba-Bi for example? Currently I'm using greater t...
[ "sql", "sql-server", "oracle", "localization", "collation" ]
6
3
1,272
6
0
2008-09-30T10:39:12.827000
2008-09-30T13:50:20.497000
152,541
152,553
Stored procedure bit parameter activating additional where clause to check for null
I have a stored procedure that looks like: CREATE PROCEDURE dbo.usp_TestFilter @AdditionalFilter BIT = 1 AS SELECT * FROM dbo.SomeTable T WHERE T.Column1 IS NOT NULL AND CASE WHEN @AdditionalFilter = 1 THEN T.Column2 IS NOT NULL Needless to say, this doesn't work. How can I activate the additional where clause that che...
CREATE PROCEDURE dbo.usp_TestFilter @AdditionalFilter BIT = 1 AS SELECT * FROM dbo.SomeTable T WHERE T.Column1 IS NOT NULL AND (@AdditionalFilter = 0 OR T.Column2 IS NOT NULL) If @AdditionalFilter is 0, the column won't be evaluated since it can't affect the outcome of the part between brackets. If it's anything other ...
Stored procedure bit parameter activating additional where clause to check for null I have a stored procedure that looks like: CREATE PROCEDURE dbo.usp_TestFilter @AdditionalFilter BIT = 1 AS SELECT * FROM dbo.SomeTable T WHERE T.Column1 IS NOT NULL AND CASE WHEN @AdditionalFilter = 1 THEN T.Column2 IS NOT NULL Needles...
TITLE: Stored procedure bit parameter activating additional where clause to check for null QUESTION: I have a stored procedure that looks like: CREATE PROCEDURE dbo.usp_TestFilter @AdditionalFilter BIT = 1 AS SELECT * FROM dbo.SomeTable T WHERE T.Column1 IS NOT NULL AND CASE WHEN @AdditionalFilter = 1 THEN T.Column2 I...
[ "sql", "stored-procedures" ]
4
6
12,888
4
0
2008-09-30T10:40:47.583000
2008-09-30T10:44:57.073000
152,555
152,671
*.h or *.hpp for your class definitions
I've always used a *.h file for my class definitions, but after reading some boost library code, I realised they all use *.hpp. I've always had an aversion to that file extension, I think mainly because I'm not used to it. What are the advantages and disadvantages of using *.hpp over *.h?
Here are a couple of reasons for having different naming of C vs C++ headers: Automatic code formatting, you might have different guidelines for formatting C and C++ code. If the headers are separated by extension you can set your editor to apply the appropriate formatting automatically Naming, I've been on projects wh...
*.h or *.hpp for your class definitions I've always used a *.h file for my class definitions, but after reading some boost library code, I realised they all use *.hpp. I've always had an aversion to that file extension, I think mainly because I'm not used to it. What are the advantages and disadvantages of using *.hpp ...
TITLE: *.h or *.hpp for your class definitions QUESTION: I've always used a *.h file for my class definitions, but after reading some boost library code, I realised they all use *.hpp. I've always had an aversion to that file extension, I think mainly because I'm not used to it. What are the advantages and disadvantag...
[ "c++", "header" ]
759
729
485,398
21
0
2008-09-30T10:47:16.163000
2008-09-30T11:41:07.437000
152,580
152,596
What's the canonical way to check for type in Python?
How do I check if an object is of a given type, or if it inherits from a given type? How do I check if the object o is of type str? Beginners often wrongly expect the string to already be "a number" - either expecting Python 3.x input to convert type, or expecting that a string like '1' is also simultaneously an intege...
Use isinstance to check if o is an instance of str or any subclass of str: if isinstance(o, str): To check if the type of o is exactly str, excluding subclasses of str: if type(o) is str: See Built-in Functions in the Python Library Reference for relevant information. Checking for strings in Python 2 For Python 2, this...
What's the canonical way to check for type in Python? How do I check if an object is of a given type, or if it inherits from a given type? How do I check if the object o is of type str? Beginners often wrongly expect the string to already be "a number" - either expecting Python 3.x input to convert type, or expecting t...
TITLE: What's the canonical way to check for type in Python? QUESTION: How do I check if an object is of a given type, or if it inherits from a given type? How do I check if the object o is of type str? Beginners often wrongly expect the string to already be "a number" - either expecting Python 3.x input to convert ty...
[ "python", "types" ]
1,898
2,225
1,499,680
18
0
2008-09-30T11:00:10.140000
2008-09-30T11:07:45.597000
152,582
152,616
Is this a reasonable "Application entry point"?
I have recently come across a situation where code is dynamically loading some libraries, wiring them up, then calling what is termed the "application entry point" (one of the libraries must implement IApplication.Run()). Is this a valid "Appliation entry point"? I would always have considered the application entry poi...
The terms application and system are terms that are so widely and diversely used that you need to agree what they mean upfront with your conversation partner. E.g. sometimes an application is something with a UI, and a system is 'UI-less'. In general it's just a case of you say potato, I say potato. As for the example ...
Is this a reasonable "Application entry point"? I have recently come across a situation where code is dynamically loading some libraries, wiring them up, then calling what is termed the "application entry point" (one of the libraries must implement IApplication.Run()). Is this a valid "Appliation entry point"? I would ...
TITLE: Is this a reasonable "Application entry point"? QUESTION: I have recently come across a situation where code is dynamically loading some libraries, wiring them up, then calling what is termed the "application entry point" (one of the libraries must implement IApplication.Run()). Is this a valid "Appliation entr...
[ "definition" ]
1
1
2,058
5
0
2008-09-30T11:01:22.930000
2008-09-30T11:17:15.280000
152,585
152,652
Identify GET and POST parameters in Ruby on Rails
What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $_GET and $_POST variables in PHP?
I don't know of any convenience methods in Rails for this, but you can access the querystring directly to parse out parameters that are set there. Something like the following: request.query_string.split(/&/).inject({}) do |hash, setting| key, val = setting.split(/=/) hash[key.to_sym] = val hash end
Identify GET and POST parameters in Ruby on Rails What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $_GET and $_POST variables in PHP?
TITLE: Identify GET and POST parameters in Ruby on Rails QUESTION: What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $_GET and $_POST variables in PHP? ANSWER: I don't know of any convenience methods in Rails for this, but you can...
[ "ruby-on-rails" ]
33
29
54,621
11
0
2008-09-30T11:02:32.227000
2008-09-30T11:34:33.007000
152,586
152,628
How to initialize ConnectionStrings collection in NUnit
I want to test ASP.NET application using NUnit, but it seems WebConfigurationManager.ConnectionStrings collection is empty when running from NUnit GUI. Could you tell me how to initialize this collection (probably in [SetUp] function of [TestFixture])? Should I copy Web.config somethere? Thank you!
If you have your unit-test assembly named Company.Component.Tests.dll, then just make sure that Company.Component.Tests.dll.config is there with the proper connection string. Additionally, it might be a good idea to decouple your connection provider class from the configuration, so that you will have flexibility in per...
How to initialize ConnectionStrings collection in NUnit I want to test ASP.NET application using NUnit, but it seems WebConfigurationManager.ConnectionStrings collection is empty when running from NUnit GUI. Could you tell me how to initialize this collection (probably in [SetUp] function of [TestFixture])? Should I co...
TITLE: How to initialize ConnectionStrings collection in NUnit QUESTION: I want to test ASP.NET application using NUnit, but it seems WebConfigurationManager.ConnectionStrings collection is empty when running from NUnit GUI. Could you tell me how to initialize this collection (probably in [SetUp] function of [TestFixt...
[ "asp.net", "nunit", "web-config", "automated-tests" ]
5
7
3,922
3
0
2008-09-30T11:02:59.027000
2008-09-30T11:22:05.737000
152,602
152,933
F# style - prefer () or <|
Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"? f arg (obj.DoStuff()) f arg <| obj.DoStuff()
Overall, I don't know that one or the other is more idiomatic. Personally, the only time I use <| is with "raise": raise <| new FooException("blah") Apart from that, I always use parens. Note that since most F# code uses curried functions, this does not typically imply any "extra" parens: f arg (g x y) It's when you ge...
F# style - prefer () or <| Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"? f arg (obj.DoStuff()) f arg <| obj.DoStuff()
TITLE: F# style - prefer () or <| QUESTION: Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"? f arg (obj.DoStuff()) f arg <| obj.DoStuff() ANSWER: Overall, I don't know that one or the other is more idiomatic. Personally, the only time I use <| is with "raise": rai...
[ "f#", "coding-style" ]
3
5
530
4
0
2008-09-30T11:11:16.197000
2008-09-30T13:01:02.097000
152,613
152,626
C#: Getting maximum and minimum values of arbitrary properties of all items in a list
I have a specialized list that holds items of type IThing: public class ThingList: IList {...} public interface IThing { Decimal Weight { get; set; } Decimal Velocity { get; set; } Decimal Distance { get; set; } Decimal Age { get; set; } Decimal AnotherValue { get; set; } [...even more properties and methods...] } So...
Yes, you should use a delegate and anonymous methods. For an example see here. Basically you need to implement something similar to the Find method of Lists. Here is a sample implementation public class Thing { public int theInt; public char theChar; public DateTime theDateTime; public Thing(int theInt, char theChar, ...
C#: Getting maximum and minimum values of arbitrary properties of all items in a list I have a specialized list that holds items of type IThing: public class ThingList: IList {...} public interface IThing { Decimal Weight { get; set; } Decimal Velocity { get; set; } Decimal Distance { get; set; } Decimal Age { get; se...
TITLE: C#: Getting maximum and minimum values of arbitrary properties of all items in a list QUESTION: I have a specialized list that holds items of type IThing: public class ThingList: IList {...} public interface IThing { Decimal Weight { get; set; } Decimal Velocity { get; set; } Decimal Distance { get; set; } Dec...
[ "c#", ".net", "reflection", ".net-2.0" ]
18
10
45,020
8
0
2008-09-30T11:15:26.063000
2008-09-30T11:21:23.413000
152,618
152,632
How can I know on the client side when the HTTP handler is done processing?
Probably a long question for a simple solution, but here goes... I have a custom made silverlight control for selecting multiple files and sending them to the server. It sends files to a general handler (FileReciever.ashx) using the OpenWriteAsync method of a WebCLient control. Basically, the silverlight code does some...
Hrm, maybe a simple solutioin could be to tag the url with a GUID(the guid being unique per file, or transfer, whatever makes sense to your situatuation). Then you can have another simple web service that is capable of checking on the status of the other service, based on the guid, and have your silverlight client quer...
How can I know on the client side when the HTTP handler is done processing? Probably a long question for a simple solution, but here goes... I have a custom made silverlight control for selecting multiple files and sending them to the server. It sends files to a general handler (FileReciever.ashx) using the OpenWriteAs...
TITLE: How can I know on the client side when the HTTP handler is done processing? QUESTION: Probably a long question for a simple solution, but here goes... I have a custom made silverlight control for selecting multiple files and sending them to the server. It sends files to a general handler (FileReciever.ashx) usi...
[ "silverlight", "webclient", "ashx" ]
1
0
2,068
5
0
2008-09-30T11:18:28.707000
2008-09-30T11:24:48.210000
152,643
152,665
Idiomatic C++ for reading from a const map
For an std::map variables, I'd like to do this: BOOST_CHECK_EQUAL(variables["a"], "b"); The only problem is, in this context variables is const, so operator[] won't work:( Now, there are several workarounds to this; casting away the const, using variables.count("a")? variables.find("a")->second: std::string() or even m...
template V get(std::map const& map, K const& key) { std::map::const_iterator iter(map.find(key)); return iter!= map.end()? iter->second: V(); } Improved implementation based on comments: template typename T::mapped_type get(T const& map, typename T::key_type const& key) { typename T::const_iterator iter(map.find(key));...
Idiomatic C++ for reading from a const map For an std::map variables, I'd like to do this: BOOST_CHECK_EQUAL(variables["a"], "b"); The only problem is, in this context variables is const, so operator[] won't work:( Now, there are several workarounds to this; casting away the const, using variables.count("a")? variables...
TITLE: Idiomatic C++ for reading from a const map QUESTION: For an std::map variables, I'd like to do this: BOOST_CHECK_EQUAL(variables["a"], "b"); The only problem is, in this context variables is const, so operator[] won't work:( Now, there are several workarounds to this; casting away the const, using variables.cou...
[ "c++", "stl" ]
14
11
7,296
7
0
2008-09-30T11:29:14.207000
2008-09-30T11:38:08.240000
152,664
152,779
Different item template for each item in a WPF List?
I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I want it to have ItemTemplateB for rendering. At the mo...
the ItemTemplateSelector will work but I think it is easier to create multiple DataTemplate s in your resource section and then just giving each one a DataType. This will automatically then use this DataTemplate if the items generator detects the matching data type?... Also make sure that you have no x:Key set for the ...
Different item template for each item in a WPF List? I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I w...
TITLE: Different item template for each item in a WPF List? QUESTION: I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a Objec...
[ "wpf", "itemtemplate" ]
13
15
12,268
2
0
2008-09-30T11:37:22.827000
2008-09-30T12:18:29.593000
152,675
152,719
DataReader within try block causing potential null reference error
There is probably is simple fix for this but I currently have code similar to dim dr as dbDataReader try dr = connection.getDataReader(sql_str) Catch ex as sqlClientException log.error(ex) finally if not IsNothing(dr) then dr.close end if end try However Visual Studio still warns me that the if not IsNothing(dr) then...
Explicitly initialize the dr declaration to Nothing as such: Dim dr As DbDataReader = Nothing And the warning will disappear.
DataReader within try block causing potential null reference error There is probably is simple fix for this but I currently have code similar to dim dr as dbDataReader try dr = connection.getDataReader(sql_str) Catch ex as sqlClientException log.error(ex) finally if not IsNothing(dr) then dr.close end if end try Howe...
TITLE: DataReader within try block causing potential null reference error QUESTION: There is probably is simple fix for this but I currently have code similar to dim dr as dbDataReader try dr = connection.getDataReader(sql_str) Catch ex as sqlClientException log.error(ex) finally if not IsNothing(dr) then dr.close e...
[ "vb.net", "visual-studio", "exception" ]
3
10
3,136
4
0
2008-09-30T11:43:16.403000
2008-09-30T11:57:00.300000
152,692
171,426
How can you scan an image with X++
Does anyone know how to scan an image with X++?
There's no way to do it directly, but you should be able to call the Windows Image Acquisition API via COM
How can you scan an image with X++ Does anyone know how to scan an image with X++?
TITLE: How can you scan an image with X++ QUESTION: Does anyone know how to scan an image with X++? ANSWER: There's no way to do it directly, but you should be able to call the Windows Image Acquisition API via COM
[ "axapta", "microsoft-dynamics", "x++", "ax" ]
2
4
603
1
0
2008-09-30T11:49:54.797000
2008-10-05T03:23:09.290000
152,694
527,044
CruiseControl.net : Using SvnLabeller / SvnRevisionLabeller
I'm setting up a new project using CruiseControl.net 1.4. I see from ccnet contributions that there are two options for a subversion repository number labeller - a feature that I would really like to make use of. 1) SVNLabeller available from jcxsoftware and 2) Svnrevisionlabeller available from google code My problem ...
this is David Keaveny, author/maintainer of SvnRevisionLabeller. I use it against v1.4.2 on a daily basis at work, so I think it's safe to say that it works OK. I should probably update the Google Code site to reflect this. Update: I've updated the project wiki to reflect this. Oh, and I'm also picking up on a bunch of...
CruiseControl.net : Using SvnLabeller / SvnRevisionLabeller I'm setting up a new project using CruiseControl.net 1.4. I see from ccnet contributions that there are two options for a subversion repository number labeller - a feature that I would really like to make use of. 1) SVNLabeller available from jcxsoftware and 2...
TITLE: CruiseControl.net : Using SvnLabeller / SvnRevisionLabeller QUESTION: I'm setting up a new project using CruiseControl.net 1.4. I see from ccnet contributions that there are two options for a subversion repository number labeller - a feature that I would really like to make use of. 1) SVNLabeller available from...
[ "svn", "cruisecontrol.net" ]
0
2
1,338
3
0
2008-09-30T11:50:51.190000
2009-02-09T03:07:56.800000
152,699
152,996
Open the default browser in Ruby
In Python, you can do this: import webbrowser webbrowser.open_new("http://example.com/") It will open the passed in url in the default browser Is there a ruby equivalent?
Cross-platform solution: First, install the Launchy gem: $ gem install launchy Then, you can run this: require 'launchy' Launchy.open("http://stackoverflow.com")
Open the default browser in Ruby In Python, you can do this: import webbrowser webbrowser.open_new("http://example.com/") It will open the passed in url in the default browser Is there a ruby equivalent?
TITLE: Open the default browser in Ruby QUESTION: In Python, you can do this: import webbrowser webbrowser.open_new("http://example.com/") It will open the passed in url in the default browser Is there a ruby equivalent? ANSWER: Cross-platform solution: First, install the Launchy gem: $ gem install launchy Then, you ...
[ "ruby", "browser" ]
61
92
28,971
9
0
2008-09-30T11:51:37.270000
2008-09-30T13:22:02.780000
152,708
152,711
How can I search for a multiline pattern in a file?
I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using find piped with xargs grep: find. -iname '*.py' | xargs grep -e 'YOUR_PATTERN' But if I need to find patterns that spans on more than one line, I'm stuck because vanilla grep can't find multiline patt...
So I discovered pcregrep which stands for Perl Compatible Regular Expressions GREP. the -M option makes it possible to search for patterns that span line boundaries. For example, you need to find files where the ' _name ' variable is followed on the next line by the ' _description ' variable: find. -iname '*.py' | xarg...
How can I search for a multiline pattern in a file? I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using find piped with xargs grep: find. -iname '*.py' | xargs grep -e 'YOUR_PATTERN' But if I need to find patterns that spans on more than one line, I'm ...
TITLE: How can I search for a multiline pattern in a file? QUESTION: I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using find piped with xargs grep: find. -iname '*.py' | xargs grep -e 'YOUR_PATTERN' But if I need to find patterns that spans on more t...
[ "linux", "command-line", "grep", "find", "pcregrep" ]
168
109
164,969
13
0
2008-09-30T11:54:17.657000
2008-09-30T11:54:44.207000
152,712
152,732
Could I get in legal trouble for copying a website's stylesheet?
I like the simplistic look and design of some of the Microsoft blogs. Alas, I can't join the Microsoft dev party and create my own development blog on the blogs.msdn.com page because I don't work at Microsoft, and I already have my own wordpress blog. I was looking to have my blog styled to one of the default looking t...
Could Microsoft take legal action against me if I used a stylesheet from their page? Absolutely, since you infringed their copyright. On the other hand, it's debatable whether the stylesheet alone constitues a sufficient threshold of originality to justify legal actions 1. At the least, taking without asking is often c...
Could I get in legal trouble for copying a website's stylesheet? I like the simplistic look and design of some of the Microsoft blogs. Alas, I can't join the Microsoft dev party and create my own development blog on the blogs.msdn.com page because I don't work at Microsoft, and I already have my own wordpress blog. I w...
TITLE: Could I get in legal trouble for copying a website's stylesheet? QUESTION: I like the simplistic look and design of some of the Microsoft blogs. Alas, I can't join the Microsoft dev party and create my own development blog on the blogs.msdn.com page because I don't work at Microsoft, and I already have my own w...
[ "css", "wordpress" ]
21
23
12,262
8
0
2008-09-30T11:55:14.377000
2008-09-30T12:00:36.347000
152,714
153,198
Multiple correct results with Hamcrest (is there an or-matcher?)
I am relatively new to matchers. I am toying around with hamcrest in combination with JUnit and I kinda like it. Is there a way, to state that one of multiple choices is correct? Something like assertThat( result, is( either( 1, or( 2, or( 3 ) ) ) ) ) //does not work in hamcrest The method I am testing returns one elem...
assertThat(result, anyOf(equalTo(1), equalTo(2), equalTo(3))) From Hamcrest tutorial: anyOf - matches if any matchers match, short circuits (like Java ||) See also Javadoc. Moreover, you could write your own Matcher, which is quite easy to do.
Multiple correct results with Hamcrest (is there an or-matcher?) I am relatively new to matchers. I am toying around with hamcrest in combination with JUnit and I kinda like it. Is there a way, to state that one of multiple choices is correct? Something like assertThat( result, is( either( 1, or( 2, or( 3 ) ) ) ) ) //d...
TITLE: Multiple correct results with Hamcrest (is there an or-matcher?) QUESTION: I am relatively new to matchers. I am toying around with hamcrest in combination with JUnit and I kinda like it. Is there a way, to state that one of multiple choices is correct? Something like assertThat( result, is( either( 1, or( 2, o...
[ "java", "junit", "hamcrest", "matcher" ]
87
138
46,193
3
0
2008-09-30T11:55:22.067000
2008-09-30T14:13:19.070000
152,744
178,426
Should a client handling process be added to the supervisor tree?
in Erlang I have a supervisor-tree of processes, containing one that accepts tcp/ip connections. For each incoming connection I spawn a new process. Should this process be added to the supervisor tree or not? Regards, Steve
Yes, you should add these processes to the supervision heirarchy as you want them to be correctly/gracefully shutdown when your application is stopped. (Otherwise you end up leaking connections that will fail as the application infrastructure they depend on been shutdown). You could create a simple_one_for_one strategy...
Should a client handling process be added to the supervisor tree? in Erlang I have a supervisor-tree of processes, containing one that accepts tcp/ip connections. For each incoming connection I spawn a new process. Should this process be added to the supervisor tree or not? Regards, Steve
TITLE: Should a client handling process be added to the supervisor tree? QUESTION: in Erlang I have a supervisor-tree of processes, containing one that accepts tcp/ip connections. For each incoming connection I spawn a new process. Should this process be added to the supervisor tree or not? Regards, Steve ANSWER: Yes...
[ "erlang", "erlang-supervisor" ]
4
4
593
2
0
2008-09-30T12:05:15.617000
2008-10-07T13:25:40.727000
152,745
152,784
Optimising C++ 2-D arrays
I need a way to represent a 2-D array (a dense matrix) of doubles in C++, with absolute minimum accessing overhead. I've done some timing on various linux/unix machines and gcc versions. An STL vector of vectors, declared as: vector > matrix(n,vector (n)); and accessed through matrix[i][j] is between 5% and 100% slower...
If you're using GCC the compiler can analyze your matrix accesses and change the order in memory in certain cases. The magic compiler flag is defined as: -fipa-matrix-reorg Perform matrix flattening and transposing. Matrix flattening tries to replace a m-dimensional matrix with its equivalent n-dimensional matrix, wher...
Optimising C++ 2-D arrays I need a way to represent a 2-D array (a dense matrix) of doubles in C++, with absolute minimum accessing overhead. I've done some timing on various linux/unix machines and gcc versions. An STL vector of vectors, declared as: vector > matrix(n,vector (n)); and accessed through matrix[i][j] is ...
TITLE: Optimising C++ 2-D arrays QUESTION: I need a way to represent a 2-D array (a dense matrix) of doubles in C++, with absolute minimum accessing overhead. I've done some timing on various linux/unix machines and gcc versions. An STL vector of vectors, declared as: vector > matrix(n,vector (n)); and accessed throug...
[ "c++", "linux", "optimization", "gcc", "stl" ]
7
8
2,818
10
0
2008-09-30T12:05:36.427000
2008-09-30T12:19:53.053000
152,766
152,808
Which are the differences between dialog|main/child/mdi windows?
I need to understand the differences between windows main/mdi/child/dialogs.... how win32 messages should be propagated... why some messages are present in one type and not other...
Main window The application's top window. It is flagged as the process main window and this information can be readily accessed by calling processes with the appropriate permission. MDI (Multiple document interface) window This is, typically, in an application main window and it contains a set of MDI Children. This is ...
Which are the differences between dialog|main/child/mdi windows? I need to understand the differences between windows main/mdi/child/dialogs.... how win32 messages should be propagated... why some messages are present in one type and not other...
TITLE: Which are the differences between dialog|main/child/mdi windows? QUESTION: I need to understand the differences between windows main/mdi/child/dialogs.... how win32 messages should be propagated... why some messages are present in one type and not other... ANSWER: Main window The application's top window. It i...
[ "windows", "winapi" ]
1
2
1,650
3
0
2008-09-30T12:10:37.397000
2008-09-30T12:26:39.013000
152,770
152,963
Transpose a set of rows as columns in SQL Server 2000
Is there any facility of transposing rows to columns in SQL Server (it is possible in MS-Access)? I was befuddled because this facility is available in MS-Access but not in SQL Server. Is it by design that this feature has not been included in SQL Server?
The example at http://jdixon.dotnetdevelopersjournal.com/pivot_table_data_in_sql_server_2000_and_2005.htm only works if you know in advance what the row values can be. For example, let's say you have an entity with custom attributes and the custom attributes are implemented as rows in a child table, where the child tab...
Transpose a set of rows as columns in SQL Server 2000 Is there any facility of transposing rows to columns in SQL Server (it is possible in MS-Access)? I was befuddled because this facility is available in MS-Access but not in SQL Server. Is it by design that this feature has not been included in SQL Server?
TITLE: Transpose a set of rows as columns in SQL Server 2000 QUESTION: Is there any facility of transposing rows to columns in SQL Server (it is possible in MS-Access)? I was befuddled because this facility is available in MS-Access but not in SQL Server. Is it by design that this feature has not been included in SQL ...
[ "sql-server", "pivot" ]
8
3
23,131
5
0
2008-09-30T12:12:31.497000
2008-09-30T13:13:23.923000
152,774
153,014
Is there a better way to trim a DateTime to a specific precision?
What's the best way to trim a DateTime object to a specific precision? For instance, if I have a DateTime with a value of '2008-09-29 09:41:43', but I only want it's precision to be to the minute, is there any better way to do it than this? private static DateTime TrimDateToMinute(DateTime date) { return new DateTime( ...
static class Program { //using extension method: static DateTime Trim(this DateTime date, long roundTicks) { return new DateTime(date.Ticks - date.Ticks % roundTicks, date.Kind); } //sample usage: static void Main(string[] args) { Console.WriteLine(DateTime.Now); Console.WriteLine(DateTime.Now.Trim(TimeSpan.TicksPerDa...
Is there a better way to trim a DateTime to a specific precision? What's the best way to trim a DateTime object to a specific precision? For instance, if I have a DateTime with a value of '2008-09-29 09:41:43', but I only want it's precision to be to the minute, is there any better way to do it than this? private stati...
TITLE: Is there a better way to trim a DateTime to a specific precision? QUESTION: What's the best way to trim a DateTime object to a specific precision? For instance, if I have a DateTime with a value of '2008-09-29 09:41:43', but I only want it's precision to be to the minute, is there any better way to do it than t...
[ "c#", ".net", "datetime" ]
69
123
39,167
5
0
2008-09-30T12:16:12.970000
2008-09-30T13:26:37.917000
152,814
152,832
Best way to get data from a DataReader into a Farpoint Spreadsheet?
I need to move data from a datareader into a Farpoint Spreadsheet component in a Windows form. The DataSource of an fps sheet can't be set to a datareader. I don't want to change my app to use ADO just for this purpose. Right now I'm looping through the query data and pushing it into the sheet cell-by-cell. That's ugly...
I'm not familiar with the product, but you can try loading the reader into a DataTable and binding that if it's supported. Dim dt as Datatable dt.load(reader)
Best way to get data from a DataReader into a Farpoint Spreadsheet? I need to move data from a datareader into a Farpoint Spreadsheet component in a Windows form. The DataSource of an fps sheet can't be set to a datareader. I don't want to change my app to use ADO just for this purpose. Right now I'm looping through th...
TITLE: Best way to get data from a DataReader into a Farpoint Spreadsheet? QUESTION: I need to move data from a datareader into a Farpoint Spreadsheet component in a Windows form. The DataSource of an fps sheet can't be set to a datareader. I don't want to change my app to use ADO just for this purpose. Right now I'm ...
[ "vb.net", "farpoint-spread" ]
0
2
1,280
1
0
2008-09-30T12:27:57.387000
2008-09-30T12:32:22.307000
152,817
152,840
"Class does not support automation" error when i call Request.ServerVariables("remote_host")
I'm in the process of writing a basic cookie for an ecommerce site which is going to store the user's IP among other details. We'll then record the pages they view in the database and pull out a list of recently viewed pages. However i'm having an issue with the following code. dim caller caller = Response.Cookies("cal...
Should be Request.Cookies when checking the value.: dim caller caller = Request.Cookies("caller") if caller = "" then caller = Request.ServerVariables("remote_host") end if
"Class does not support automation" error when i call Request.ServerVariables("remote_host") I'm in the process of writing a basic cookie for an ecommerce site which is going to store the user's IP among other details. We'll then record the pages they view in the database and pull out a list of recently viewed pages. H...
TITLE: "Class does not support automation" error when i call Request.ServerVariables("remote_host") QUESTION: I'm in the process of writing a basic cookie for an ecommerce site which is going to store the user's IP among other details. We'll then record the pages they view in the database and pull out a list of recent...
[ "cookies", "asp-classic", "vbscript", "remote-host" ]
0
1
1,047
1
0
2008-09-30T12:28:17.637000
2008-09-30T12:35:30.473000
152,822
414,009
How to declare a user-defined function returning node-set?
I want something like this:??? getNodes() {... return... }... What return type should i use for getNodes() and what should i put in it's body?
In principle you need to use the XPathNodeIterator to return node sets (as Samjudson says). I take it that the example you gave is a degenerated function, as you do not supply it with any parameters. However, I think it is instructive the see how you could fabricate nodes out of thin air. XPathNodeIterator getNodes() {...
How to declare a user-defined function returning node-set? I want something like this:??? getNodes() {... return... }... What return type should i use for getNodes() and what should i put in it's body?
TITLE: How to declare a user-defined function returning node-set? QUESTION: I want something like this:??? getNodes() {... return... }... What return type should i use for getNodes() and what should i put in it's body? ANSWER: In principle you need to use the XPathNodeIterator to return node sets (as Samjudson says)....
[ ".net", "xslt", "msxml" ]
4
5
5,154
2
0
2008-09-30T12:29:57.430000
2009-01-05T18:16:51.413000
152,823
152,861
.htaccess files, PHP, includes directories, and windows XAMPP configuration nightmare
XAMPP makes configuring a local LAMP stack for windows a breeze. So it's quite disappointing that enabling.htaccess files is such a nightmare. My problem: I've got a PHP application that requires apache/php to search for an /includes/ directory contained within the application. To do this,.htaccess files must be allowe...
Why do you need to rename.htaccess to htaccess.txt Try setting the include_path using set_include_path() and see if that helps (as an intermediate fix) Verify which php.ini to use through a phpinfo()
.htaccess files, PHP, includes directories, and windows XAMPP configuration nightmare XAMPP makes configuring a local LAMP stack for windows a breeze. So it's quite disappointing that enabling.htaccess files is such a nightmare. My problem: I've got a PHP application that requires apache/php to search for an /includes/...
TITLE: .htaccess files, PHP, includes directories, and windows XAMPP configuration nightmare QUESTION: XAMPP makes configuring a local LAMP stack for windows a breeze. So it's quite disappointing that enabling.htaccess files is such a nightmare. My problem: I've got a PHP application that requires apache/php to search...
[ "php", "apache", ".htaccess", "xampp", "config" ]
2
5
19,909
6
0
2008-09-30T12:29:57.897000
2008-09-30T12:39:32.757000
152,834
152,892
Default port for SQL Server
I need to know the default port settings for the following services SQL Server SQL Browser SQL Reporting services SQL Analysis services I need to know the port settings for these services for different versions of SQL Server (2000,2005,2008) Also let me know whether the default port setting will change based on sql ser...
The default SQL Server port is 1433 but only if it's a default install. Named instances get a random port number. The browser service runs on port UDP 1434. Reporting services is a web service - so it's port 80, or 443 if it's SSL enabled. Analysis services is 2382 but only if it's a default install. Named instances ge...
Default port for SQL Server I need to know the default port settings for the following services SQL Server SQL Browser SQL Reporting services SQL Analysis services I need to know the port settings for these services for different versions of SQL Server (2000,2005,2008) Also let me know whether the default port setting ...
TITLE: Default port for SQL Server QUESTION: I need to know the default port settings for the following services SQL Server SQL Browser SQL Reporting services SQL Analysis services I need to know the port settings for these services for different versions of SQL Server (2000,2005,2008) Also let me know whether the def...
[ "asp.net", "sql", "sql-server" ]
64
106
124,043
7
0
2008-09-30T12:32:40.463000
2008-09-30T12:47:37.527000
152,837
410,490
How to insert a string which contains an "&"
How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database. I'm not sure if it makes a difference, but I'm using Oracle 9i.
I keep on forgetting this and coming back to it again! I think the best answer is a combination of the responses provided so far. Firstly, & is the variable prefix in sqlplus/sqldeveloper, hence the problem - when it appears, it is expected to be part of a variable name. SET DEFINE OFF will stop sqlplus interpreting & ...
How to insert a string which contains an "&" How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database. I'm not sure if it makes a difference, but I'm using Oracle 9i.
TITLE: How to insert a string which contains an "&" QUESTION: How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database. I'm not sure if it makes a difference, but I'm using Oracle 9i. ANSWER: I keep on forgetting this and c...
[ "sql", "oracle", "escaping", "sqlplus" ]
51
73
249,314
14
0
2008-09-30T12:34:18.120000
2009-01-04T05:07:20.790000
152,846
153,433
What features distinguish Flex from DHTML?
I just got started using Adobe Flex SDK. I was very excited because it's the first time I've found a good, free way to create Flash applications. But then I noticed something: Flex doesn't seem to be much about making animations or designs. It seems more like an application to build forms and menus and the like... whic...
Flex has a cohesive component model, and the basic building blocks were designed to support applications. HTML, on the other hand was designed for displaying text, and the DOM is a sorry excuse for a component model -- and it was most definitely not designed with applications in mind. There is a plethora of JavaScript ...
What features distinguish Flex from DHTML? I just got started using Adobe Flex SDK. I was very excited because it's the first time I've found a good, free way to create Flash applications. But then I noticed something: Flex doesn't seem to be much about making animations or designs. It seems more like an application to...
TITLE: What features distinguish Flex from DHTML? QUESTION: I just got started using Adobe Flex SDK. I was very excited because it's the first time I've found a good, free way to create Flash applications. But then I noticed something: Flex doesn't seem to be much about making animations or designs. It seems more like...
[ "apache-flex", "flash", "animation", "dhtml" ]
2
3
1,049
10
0
2008-09-30T12:36:28.520000
2008-09-30T14:59:21.360000
152,866
152,873
How can you use "external" configuration files (i.e. with configSource) with an MSTest unit test project?
For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate.config files, and then reference them from the main config file using the 'configSource' attribute. For example: and then placing all of the key/value pairs in that appSettings.config file inst...
Found it: If you edit the test run configuration (by double clicking the.testrunconfig file that gets put into the 'Solution Items' solution folder when you add a new unit test), you get a test run configuration dialog. There's a section there called 'Deployment' where you can specifiy files or whole folders from anywh...
How can you use "external" configuration files (i.e. with configSource) with an MSTest unit test project? For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate.config files, and then reference them from the main config file using the 'configSource...
TITLE: How can you use "external" configuration files (i.e. with configSource) with an MSTest unit test project? QUESTION: For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate.config files, and then reference them from the main config file using...
[ ".net", "unit-testing", "mstest" ]
11
11
11,374
3
0
2008-09-30T12:41:02.393000
2008-09-30T12:43:20.360000
152,869
153,102
Using jQuery to Highlight Selected ASP.NET DataGrid Row
It is easy to highlight a selected datagrid row, by for example using toggleClass in the tr's click event. But how best to later remove the highlight after a different row has been selected? Iterating over all the rows to unhighlight them could become expensive for larger datagrids. I'd be interested in the simplest so...
This method stores the active row into a variable. The $ at the start of the variable is just my own hungarian notation for jQuery objects. var $activeRow; $('#myGrid tr').click(function() { if ($activeRow) $activeRow.removeClass('active'); $activeRow = $(this).addClass('active'); });
Using jQuery to Highlight Selected ASP.NET DataGrid Row It is easy to highlight a selected datagrid row, by for example using toggleClass in the tr's click event. But how best to later remove the highlight after a different row has been selected? Iterating over all the rows to unhighlight them could become expensive fo...
TITLE: Using jQuery to Highlight Selected ASP.NET DataGrid Row QUESTION: It is easy to highlight a selected datagrid row, by for example using toggleClass in the tr's click event. But how best to later remove the highlight after a different row has been selected? Iterating over all the rows to unhighlight them could b...
[ "asp.net", "jquery" ]
4
3
4,184
3
0
2008-09-30T12:41:57.243000
2008-09-30T13:50:36.533000
152,871
153,200
Isn't resource-oriented really object-oriented?
When you think about it, doesn't the REST paradigm of being resource-oriented boil down to being object-oriented (with constrained functionality, leveraging HTTP as much as possible)? I'm not necessarily saying it's a bad thing, but rather that if they are essentially the same very similar then it becomes much easier t...
REST is similar to OO in that they both model the world as entities that accept messages (i.e., methods) but beyond that they're different. Object orientation emphasizes encapsulation of state and opacity, using as many different methods necessary to operate on the state. REST is about transfer of (representation of) s...
Isn't resource-oriented really object-oriented? When you think about it, doesn't the REST paradigm of being resource-oriented boil down to being object-oriented (with constrained functionality, leveraging HTTP as much as possible)? I'm not necessarily saying it's a bad thing, but rather that if they are essentially the...
TITLE: Isn't resource-oriented really object-oriented? QUESTION: When you think about it, doesn't the REST paradigm of being resource-oriented boil down to being object-oriented (with constrained functionality, leveraging HTTP as much as possible)? I'm not necessarily saying it's a bad thing, but rather that if they a...
[ "rest", "oop" ]
8
24
4,698
8
0
2008-09-30T12:42:34.340000
2008-09-30T14:13:32.250000
152,887
190,934
How do I resolve a merge conflict with SVN properties?
This has been bugging me for a long time -- how do I properly resolve a merge conflict within the SVN properties set on a directory? Say for instance there are two developers working on a project where svn:ignore is set on some directory. If both developers make changes to this property, when the second one updates, th...
Just a quick update after some additional research -- it is not possible to easily merge SVN properties. My originally described method (revert, merge data from.prej files, propset, re-commit) appears to be the best way to deal with this type of problem.
How do I resolve a merge conflict with SVN properties? This has been bugging me for a long time -- how do I properly resolve a merge conflict within the SVN properties set on a directory? Say for instance there are two developers working on a project where svn:ignore is set on some directory. If both developers make ch...
TITLE: How do I resolve a merge conflict with SVN properties? QUESTION: This has been bugging me for a long time -- how do I properly resolve a merge conflict within the SVN properties set on a directory? Say for instance there are two developers working on a project where svn:ignore is set on some directory. If both ...
[ "svn" ]
41
11
31,090
7
0
2008-09-30T12:45:49.967000
2008-10-10T11:45:02.103000
152,889
152,905
OSI model - What's the presentation and session layer for?
So I feel I pretty well understand the application layer, and everything below (and including) the transport layer. The session and presentation layers, though, I don't fully understand. I've read the simplistic descriptions in Wikipedia, but it doesn't have an example of why separating out those layers is useful. So: ...
The session layer is meant to store states between two connections, like what we use cookies for when working with web programming. The presentation layer is meant to convert between different formats. This was simpler when the only format that was worried about was character encoding, ie ASCII and EBCDIC. When you con...
OSI model - What's the presentation and session layer for? So I feel I pretty well understand the application layer, and everything below (and including) the transport layer. The session and presentation layers, though, I don't fully understand. I've read the simplistic descriptions in Wikipedia, but it doesn't have an...
TITLE: OSI model - What's the presentation and session layer for? QUESTION: So I feel I pretty well understand the application layer, and everything below (and including) the transport layer. The session and presentation layers, though, I don't fully understand. I've read the simplistic descriptions in Wikipedia, but ...
[ "networking", "model", "stack", "osi" ]
16
18
15,239
7
0
2008-09-30T12:47:03.817000
2008-09-30T12:53:33.130000
152,900
153,013
.NET XmlDocument LoadXML and Entities
When loading XML into an XmlDocument, i.e. XmlDocument document = new XmlDocument(); document.LoadXml(xmlData); is there any way to stop the process from replacing entities? I've got a strange problem where I've got a TM symbol (stored as the entity #8482) in the xml being converted into the TM character. As far as I'm...
This is a standard misunderstanding of the XML toolset. The whole business with "&#x", is a syntactic feature designed to cope with character encodings. Your XmlDocument isn't a stream of characters - it has been freed of character encoding issues - instead it contains an abstract model of XML type data. Words for this...
.NET XmlDocument LoadXML and Entities When loading XML into an XmlDocument, i.e. XmlDocument document = new XmlDocument(); document.LoadXml(xmlData); is there any way to stop the process from replacing entities? I've got a strange problem where I've got a TM symbol (stored as the entity #8482) in the xml being converte...
TITLE: .NET XmlDocument LoadXML and Entities QUESTION: When loading XML into an XmlDocument, i.e. XmlDocument document = new XmlDocument(); document.LoadXml(xmlData); is there any way to stop the process from replacing entities? I've got a strange problem where I've got a TM symbol (stored as the entity #8482) in the ...
[ "c#", "xml", "entity" ]
4
4
7,081
7
0
2008-09-30T12:51:19.297000
2008-09-30T13:26:22.300000
152,901
152,914
Horrible VMware keyboard shortcuts
I'm a VMware user and far too often I use keyboard shortcuts while programming. However, this has proved to be quite distressing as sometimes the VMware gets hold of it and turns off / pauses ( Ctrl + Z ) the virtual machine. Is there a way to disable keyboard shortcuts on VMware? Has anyone here ever found a workaroun...
I use AutoHotKey (are you running VMWare on Windows?) to disable certain shortcuts. You can find this tool here: http://www.autohotkey.com/ It's open source and I quite like it. Can be used for automation tasks, but you can also have it respond differently to different windows. With some AHK scripting, I think you shou...
Horrible VMware keyboard shortcuts I'm a VMware user and far too often I use keyboard shortcuts while programming. However, this has proved to be quite distressing as sometimes the VMware gets hold of it and turns off / pauses ( Ctrl + Z ) the virtual machine. Is there a way to disable keyboard shortcuts on VMware? Has...
TITLE: Horrible VMware keyboard shortcuts QUESTION: I'm a VMware user and far too often I use keyboard shortcuts while programming. However, this has proved to be quite distressing as sometimes the VMware gets hold of it and turns off / pauses ( Ctrl + Z ) the virtual machine. Is there a way to disable keyboard shortc...
[ "keyboard", "vmware", "shortcut" ]
18
7
6,096
3
0
2008-09-30T12:52:15.207000
2008-09-30T12:57:13.353000
152,919
862,138
Get the contents of a Application Server directory
I need to get a listing of a server-side directory inside SAP. How do I achieve this in ABAP? Are there any built-in SAP functions I can call? Ideally I want a function which I can pass a path as input, and which will return a list of filenames in an internal table.
After reading the answers of Chris Carrthers and tomdemuyt I would say: 1) Use RZL_READ_DIR_LOCAL if you need simple list of filenames. 2) EPS_GET_DIRECTORY_LISTING is more powerfull - it can also list subdirectories. Thanks You both! With best Regards Niki Galanov
Get the contents of a Application Server directory I need to get a listing of a server-side directory inside SAP. How do I achieve this in ABAP? Are there any built-in SAP functions I can call? Ideally I want a function which I can pass a path as input, and which will return a list of filenames in an internal table.
TITLE: Get the contents of a Application Server directory QUESTION: I need to get a listing of a server-side directory inside SAP. How do I achieve this in ABAP? Are there any built-in SAP functions I can call? Ideally I want a function which I can pass a path as input, and which will return a list of filenames in an ...
[ "abap", "directory-listing" ]
11
3
38,874
5
0
2008-09-30T12:58:58.467000
2009-05-14T08:13:56.373000
152,938
152,945
When is modal UI acceptable?
By and large, modal interfaces suck big rocks. On the other hand, I can't think of a better way to handle File Open..., or Print... and this, I think, is because they are occasional actions, infrequent and momentous, and they are atomic in nature; you either finish specifying all your print options and go through with ...
IMO, modal interfaces should only be used when you HAVE to deal with whatever the dialog is doing or asking before the application can continue. Any other time, if you're using a dialog, it should be non-modal.
When is modal UI acceptable? By and large, modal interfaces suck big rocks. On the other hand, I can't think of a better way to handle File Open..., or Print... and this, I think, is because they are occasional actions, infrequent and momentous, and they are atomic in nature; you either finish specifying all your print...
TITLE: When is modal UI acceptable? QUESTION: By and large, modal interfaces suck big rocks. On the other hand, I can't think of a better way to handle File Open..., or Print... and this, I think, is because they are occasional actions, infrequent and momentous, and they are atomic in nature; you either finish specify...
[ "user-interface", "modal-dialog" ]
10
17
4,085
5
0
2008-09-30T13:02:41.593000
2008-09-30T13:05:51.897000
152,967
152,980
Can you use Java libraries in a VB.net program?
I'm wondering if a Java library can be called from a VB.net application. (A Google search turns up lots of shady answers, but nothing definitive)
No, you can't. Unless you are willing to use some "J#" libraries (which is not nearly the same as Java) or IKVM which is a Java implementation that runs on top of.NET, but as their documentation says: IKVM.OpenJDK.ClassLibrary.dll: compiled version of the Java class libraries derived from the OpenJDK class library with...
Can you use Java libraries in a VB.net program? I'm wondering if a Java library can be called from a VB.net application. (A Google search turns up lots of shady answers, but nothing definitive)
TITLE: Can you use Java libraries in a VB.net program? QUESTION: I'm wondering if a Java library can be called from a VB.net application. (A Google search turns up lots of shady answers, but nothing definitive) ANSWER: No, you can't. Unless you are willing to use some "J#" libraries (which is not nearly the same as J...
[ "java", "vb.net" ]
5
4
16,382
8
0
2008-09-30T13:14:29.117000
2008-09-30T13:18:17.343000
152,968
152,978
How can I convert a number to its multiple form in Perl?
Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M? Right now I can do this by making several comparisons, but I'm not happy with my method: if($bytes > 1000000000){ $bytes = ( sprintf( "%0.2f", $bytes/1000000...
The Number::Bytes::Human module should be able to help you out. An example of how to use it can be found in its synopsis: use Number::Bytes::Human qw(format_bytes); $size = format_bytes(0); # '0' $size = format_bytes(2*1024); # '2.0K' $size = format_bytes(1_234_890, bs => 1000); # '1.3M' $size = format_bytes(1E9, bs ...
How can I convert a number to its multiple form in Perl? Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M? Right now I can do this by making several comparisons, but I'm not happy with my method: if($bytes >...
TITLE: How can I convert a number to its multiple form in Perl? QUESTION: Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M? Right now I can do this by making several comparisons, but I'm not happy with my m...
[ "perl", "format", "numbers" ]
7
20
4,767
5
0
2008-09-30T13:14:31.283000
2008-09-30T13:18:04.770000
152,975
153,047
How do I detect a click outside an element?
I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area. Is something like this possible with jQuery? $("#menuscontainer").clickOutsideThisElement(function() { // Hide the menus });
Note: Using stopPropagation is something that should be avoided as it breaks normal event flow in the DOM. See this CSS Tricks article for more information. Consider using this method instead. Attach a click event to the document body which closes the window. Attach a separate click event to the container which stops p...
How do I detect a click outside an element? I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area. Is something like this possible with jQuery? $("#menuscontainer").clickOutsideThisElement(function(...
TITLE: How do I detect a click outside an element? QUESTION: I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area. Is something like this possible with jQuery? $("#menuscontainer").clickOutsideThi...
[ "javascript", "jquery", "click" ]
2,937
2,016
1,753,989
91
0
2008-09-30T13:17:12.340000
2008-09-30T13:38:11.133000
152,981
152,990
What would be a recommended choice of SSIS component to perform SFTP or FTPS task?
Sometimes normal FTP doesn't quite cut it... When you need to do secure FTP via SSIS packages, which product would you recommend? Before answering, please see if someone has already suggested the same thing and, if so, vote it up. NOTE: Ideally, it needs to handle both SSH and SSL FTP connections, but I'd consider two ...
I use Rebex.net File Transfer Pack for SFTP and FTP transfers in.NET.
What would be a recommended choice of SSIS component to perform SFTP or FTPS task? Sometimes normal FTP doesn't quite cut it... When you need to do secure FTP via SSIS packages, which product would you recommend? Before answering, please see if someone has already suggested the same thing and, if so, vote it up. NOTE: ...
TITLE: What would be a recommended choice of SSIS component to perform SFTP or FTPS task? QUESTION: Sometimes normal FTP doesn't quite cut it... When you need to do secure FTP via SSIS packages, which product would you recommend? Before answering, please see if someone has already suggested the same thing and, if so, ...
[ "ssis", "ftp", "sftp", "ftps" ]
6
2
15,786
6
0
2008-09-30T13:18:42.787000
2008-09-30T13:20:05.857000
153,019
164,965
How does ADO.Net Data services support POST being something other than create?
From the documentation that I have read so far, ADO.Net data services is positioned as way of exposing a CRUD like interface to tables in a database in a RESTful way. This is great for applications that only do those four operations, but what about applications that do more? What about verbs like Print, Approve, Submit...
Data Services can expose "any" object graph that you implement IQueryable on and optionally IUpdateable. The objects don't need to in any way be mapped to the db. This should do what you are looking for. Check out this 15min video http://channel9.msdn.com/posts/mtaulty/ADONET-Data-Services-VS08-Sp1-B1-Surfacing-Data/ Y...
How does ADO.Net Data services support POST being something other than create? From the documentation that I have read so far, ADO.Net data services is positioned as way of exposing a CRUD like interface to tables in a database in a RESTful way. This is great for applications that only do those four operations, but wha...
TITLE: How does ADO.Net Data services support POST being something other than create? QUESTION: From the documentation that I have read so far, ADO.Net data services is positioned as way of exposing a CRUD like interface to tables in a database in a RESTful way. This is great for applications that only do those four o...
[ "rest", "wcf-data-services" ]
0
0
244
1
0
2008-09-30T13:27:52.157000
2008-10-02T22:58:35.233000
153,021
153,208
How do I create an XML file using templating similar to ASP.NET
I need to generate an XML file in C#. I want to write the code that generates this in a file that is mostly XML with code inside of it as I can in an ASP.NET MVC page. So I want a code file that looks like: <% foreach(data in myData) { %> < <%= data.somefield %> <% } %> More angle brackets> This would generate my XM...
First off, its MUCH easier to generate XML using XElements. There are many examples floating around. Just search for "Linq to XML." Alternatively, if you absolutely need to do templating, I'd suggest using a template engine such as NVelocity rather than trying to kludge ASP.NET into doing it for you.
How do I create an XML file using templating similar to ASP.NET I need to generate an XML file in C#. I want to write the code that generates this in a file that is mostly XML with code inside of it as I can in an ASP.NET MVC page. So I want a code file that looks like: <% foreach(data in myData) { %> < <%= data.somef...
TITLE: How do I create an XML file using templating similar to ASP.NET QUESTION: I need to generate an XML file in C#. I want to write the code that generates this in a file that is mostly XML with code inside of it as I can in an ASP.NET MVC page. So I want a code file that looks like: <% foreach(data in myData) { %>...
[ "c#", "asp.net", "xml" ]
1
2
1,445
5
0
2008-09-30T13:28:31.033000
2008-09-30T14:14:24.870000
153,023
157,815
Insert rows into Access db from C# using Microsoft.Jet.OLEDB.4.0, autonumber column is set to zero
I'm using C# and Microsoft.Jet.OLEDB.4.0 provider to insert rows into an Access mdb. Yes, I know Access sucks. It's a huge legacy app, and everything else works OK. The table has an autonumber column. I insert the rows, but the autonumber column is set to zero. I Googled the question and read all the articles I could f...
In Access it is possible to INSERT an explicit value into an IDENTITY (a.k.a. Automnumber) column. If you (or your middleware) is writing the value zero to the IDENTITY column and there is no unique constraint on the IDENTITY column then that might explain it. Just to be clear you should be using the syntax INSERT INTO...
Insert rows into Access db from C# using Microsoft.Jet.OLEDB.4.0, autonumber column is set to zero I'm using C# and Microsoft.Jet.OLEDB.4.0 provider to insert rows into an Access mdb. Yes, I know Access sucks. It's a huge legacy app, and everything else works OK. The table has an autonumber column. I insert the rows, b...
TITLE: Insert rows into Access db from C# using Microsoft.Jet.OLEDB.4.0, autonumber column is set to zero QUESTION: I'm using C# and Microsoft.Jet.OLEDB.4.0 provider to insert rows into an Access mdb. Yes, I know Access sucks. It's a huge legacy app, and everything else works OK. The table has an autonumber column. I ...
[ "ms-jet-ace", "autonumber" ]
0
2
9,140
2
0
2008-09-30T13:29:12.717000
2008-10-01T14:16:59.847000
153,033
153,080
SQL Server Management Studio 2005 "Remember Password" doesn't work
Folks, I connect to a large number of SQL Server 2005 databases through SQL Server Management Studio 2005. I frequently check off "Remember password", yet the next time I try to connect it doesn't actually remember it. Have you had this experience? Any workarounds?
According to the bug report this is a known issue, still not fixed and there is no workaround.
SQL Server Management Studio 2005 "Remember Password" doesn't work Folks, I connect to a large number of SQL Server 2005 databases through SQL Server Management Studio 2005. I frequently check off "Remember password", yet the next time I try to connect it doesn't actually remember it. Have you had this experience? Any ...
TITLE: SQL Server Management Studio 2005 "Remember Password" doesn't work QUESTION: Folks, I connect to a large number of SQL Server 2005 databases through SQL Server Management Studio 2005. I frequently check off "Remember password", yet the next time I try to connect it doesn't actually remember it. Have you had thi...
[ "sql-server-2005", "ssms" ]
2
5
1,299
3
0
2008-09-30T13:33:13.017000
2008-09-30T13:46:09.663000
153,035
153,665
How do I make foreign-key combo boxes user-friendly on an Access form?
I've got two tables: Employees: uid (number) | first_name (string) | last_name (string) |... Projects: uid | project_title (string) | point_of_contact_id (FK: Employees.uid) |... I'd like to create a form for Projects with a "Point of Contact" combo box (dropdown) field. The display values should be "first_name last_n...
To expand on Loesje's answer, you use the Bound Column property along with Column Count and Column Widths when you are displaying multiple fields so that you can tell Access which one should be written to the database. (There are other ways to do this using VBA, but this should work for your particular case.) In your c...
How do I make foreign-key combo boxes user-friendly on an Access form? I've got two tables: Employees: uid (number) | first_name (string) | last_name (string) |... Projects: uid | project_title (string) | point_of_contact_id (FK: Employees.uid) |... I'd like to create a form for Projects with a "Point of Contact" comb...
TITLE: How do I make foreign-key combo boxes user-friendly on an Access form? QUESTION: I've got two tables: Employees: uid (number) | first_name (string) | last_name (string) |... Projects: uid | project_title (string) | point_of_contact_id (FK: Employees.uid) |... I'd like to create a form for Projects with a "Poin...
[ "ms-access", "forms", "user-interface" ]
1
3
5,029
2
0
2008-09-30T13:33:47.447000
2008-09-30T15:49:57.760000
153,039
157,949
ASP.NET MVC Client Side Validation
I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation. I know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted. I have seen an interesting article by Steve Sanderson... using Live ...
"Obviously you'll still need to validate your input on the server side for the small percentage of users who disable javascript." Just an update to this comment. Server-side validation has nothing to do with users that run with JavaScript disabled. Instead, it is needed for security reasons, and to do complex validatio...
ASP.NET MVC Client Side Validation I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation. I know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted. I have seen an interesting articl...
TITLE: ASP.NET MVC Client Side Validation QUESTION: I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation. I know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted. I have seen an ...
[ "javascript", "asp.net-mvc", "validation", "client-side" ]
5
18
9,670
5
0
2008-09-30T13:35:02.157000
2008-10-01T14:39:04.833000
153,046
153,058
Launch web page from my application
Ok, this probably has a really simple answer, but I've never tried to do it before: How do you launch a web page from within an app? You know, "click here to go to our FAQ", and when they do it launches their default web browser and goes to your page. I'm working in C/C++ in Windows, but if there's a broader, more port...
#include void main() { ShellExecute(NULL, "open", "http://yourwebpage.com", NULL, NULL, SW_SHOWNORMAL); }
Launch web page from my application Ok, this probably has a really simple answer, but I've never tried to do it before: How do you launch a web page from within an app? You know, "click here to go to our FAQ", and when they do it launches their default web browser and goes to your page. I'm working in C/C++ in Windows,...
TITLE: Launch web page from my application QUESTION: Ok, this probably has a really simple answer, but I've never tried to do it before: How do you launch a web page from within an app? You know, "click here to go to our FAQ", and when they do it launches their default web browser and goes to your page. I'm working in...
[ "c++", "c", "windows", "browser" ]
10
19
16,155
6
0
2008-09-30T13:37:45.660000
2008-09-30T13:42:17.210000
153,048
153,056
How to mock with static methods?
I'm new to mock objects, but I understand that I need to have my classes implement interfaces in order to mock them. The problem I'm having is that in my data access layer, I want to have static methods, but I can't put a static method in an interface. What's the best way around this? Should I just use instance methods...
I would use a method object pattern. Have a static instance of this, and call it in the static method. It should be possible to subclass for testing, depending on your mocking framework. i.e. in your class with the static method have: private static final MethodObject methodObject = new MethodObject(); public static v...
How to mock with static methods? I'm new to mock objects, but I understand that I need to have my classes implement interfaces in order to mock them. The problem I'm having is that in my data access layer, I want to have static methods, but I can't put a static method in an interface. What's the best way around this? S...
TITLE: How to mock with static methods? QUESTION: I'm new to mock objects, but I understand that I need to have my classes implement interfaces in order to mock them. The problem I'm having is that in my data access layer, I want to have static methods, but I can't put a static method in an interface. What's the best ...
[ "c#", ".net", "mocking", "interface", "static-methods" ]
35
22
46,704
7
0
2008-09-30T13:38:53.770000
2008-09-30T13:41:55.603000
153,051
197,572
What Happened to ASP.Net Mobile Web Forms?
Previously Visual Studio had templates for mobile web forms (not the mobile SDK). They appear to be gone in Visual Studio 2008 and the only solution I've seen is to download some templates from Omar here: http://blogs.msdn.com/webdevtools/archive/2007/09/17/tip-trick-asp-net-mobile-development-with-visual-studio-2008.a...
I thought I'd come back to answer this. The mobile forms controls are still there and the templates provided unofficially above are the only ones available that I've found. I'm not sure why they took them out in Visual Studio 2008. Without the templates, you mostly you just need to change your pages to derive from Mobi...
What Happened to ASP.Net Mobile Web Forms? Previously Visual Studio had templates for mobile web forms (not the mobile SDK). They appear to be gone in Visual Studio 2008 and the only solution I've seen is to download some templates from Omar here: http://blogs.msdn.com/webdevtools/archive/2007/09/17/tip-trick-asp-net-m...
TITLE: What Happened to ASP.Net Mobile Web Forms? QUESTION: Previously Visual Studio had templates for mobile web forms (not the mobile SDK). They appear to be gone in Visual Studio 2008 and the only solution I've seen is to download some templates from Omar here: http://blogs.msdn.com/webdevtools/archive/2007/09/17/t...
[ ".net", "asp.net", "mobilewebforms" ]
3
7
3,679
4
0
2008-09-30T13:39:45.997000
2008-10-13T13:27:16.073000
153,053
781,916
Microsoft JET SQL Query Logging or "How do I debug my customer's program?"
The problem: We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program. Now this program is ...
To get your grubby hands on exactly what Access is doing query-wise behind the scenes there's an undocumented feature called JETSHOWPLAN - when switched on in the registry it creates a showplan.out text file. The details are in this TechRepublic article alternate, summarized here: The ShowPlan option was added to Jet 3...
Microsoft JET SQL Query Logging or "How do I debug my customer's program?" The problem: We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with...
TITLE: Microsoft JET SQL Query Logging or "How do I debug my customer's program?" QUESTION: The problem: We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it come...
[ "debugging", "ms-access", "vb6", "jet", "trace" ]
5
10
4,135
5
0
2008-09-30T13:40:42.580000
2009-04-23T14:11:35.840000
153,054
317,442
Is there any way to programmatically set the application name in Elmah?
I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does anyone have any experience with this? Or is there another way to do it?
By default, Elmah uses the AppPool's application GUID as the default application name. It uses this as the key to identify the errors in the Elmah_Error table when you look at the web interface that's created through it's HTTP Module. I was tasked to explore this option for my company earlier this year. I couldn't find...
Is there any way to programmatically set the application name in Elmah? I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does anyone have any exp...
TITLE: Is there any way to programmatically set the application name in Elmah? QUESTION: I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does a...
[ "c#", "asp.net", "elmah" ]
14
6
5,675
2
0
2008-09-30T13:41:00.020000
2008-11-25T14:06:06.193000
153,061
153,155
Any ideas on how to make edit-in-place degradable?
I'm currently writing an edit-in-place script for MooTools and I'm a little stumped as to how I can make it degrade gracefully without JavaScript while still having some functionality. I would like to use progressive enhancement in some way. I'm not looking for code, but more a concept as to how one would approach the ...
It sounds like you might be approaching this from the wrong direction. Rather than creating the edit-in-place and getting it degrade nicely (the Graceful Degradation angle), you should really be creating a non-Javascript version for editing and then adding the edit-in-place using Javascript after page load, reffered to...
Any ideas on how to make edit-in-place degradable? I'm currently writing an edit-in-place script for MooTools and I'm a little stumped as to how I can make it degrade gracefully without JavaScript while still having some functionality. I would like to use progressive enhancement in some way. I'm not looking for code, b...
TITLE: Any ideas on how to make edit-in-place degradable? QUESTION: I'm currently writing an edit-in-place script for MooTools and I'm a little stumped as to how I can make it degrade gracefully without JavaScript while still having some functionality. I would like to use progressive enhancement in some way. I'm not l...
[ "javascript", "mootools", "graceful-degradation", "progressive-enhancement", "edit-in-place" ]
1
10
634
6
0
2008-09-30T13:43:03.103000
2008-09-30T14:05:41.647000
153,064
153,300
Why isn't bittorrent more widespread?
I suppose this question is a variation on a theme, but different. Torrents will never replace HTTP, or even FTP download options. This said, why aren't there torrent links next to those options on more websites? I'm imagining a web-system whereby downloaded files are able to be downloaded via HTTP, say from http://exam...
first of all: http://torrent.ubuntu.com/ for torrents on ubuntu. second of all: opera has a built in torrent client. third: I agree with the stigma attached to p2p. So much so that we have sites that need to be called legaltorrents and such like because by default a torrent would be an illegal thing, and let us not kid...
Why isn't bittorrent more widespread? I suppose this question is a variation on a theme, but different. Torrents will never replace HTTP, or even FTP download options. This said, why aren't there torrent links next to those options on more websites? I'm imagining a web-system whereby downloaded files are able to be dow...
TITLE: Why isn't bittorrent more widespread? QUESTION: I suppose this question is a variation on a theme, but different. Torrents will never replace HTTP, or even FTP download options. This said, why aren't there torrent links next to those options on more websites? I'm imagining a web-system whereby downloaded files ...
[ "http", "bittorrent" ]
2
7
1,138
8
0
2008-09-30T13:43:33.243000
2008-09-30T14:28:09.923000
153,065
153,077
Converting a pointer into an integer
I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void* argument that is converted into suitable type in the function itself. A short example: void function(MESSAGE_ID id, void* param) { if(id == FOO) { int real_param = (int)param; //... } } O...
Use intptr_t and uintptr_t. To ensure it is defined in a portable way, you can use code like this: #if defined(__BORLANDC__) typedef unsigned char uint8_t; typedef __int64 int64_t; typedef unsigned long uintptr_t; #elif defined(_MSC_VER) typedef unsigned char uint8_t; typedef __int64 int64_t; #else #include #endif Just...
Converting a pointer into an integer I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void* argument that is converted into suitable type in the function itself. A short example: void function(MESSAGE_ID id, void* param) { if(id == FOO) { int...
TITLE: Converting a pointer into an integer QUESTION: I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void* argument that is converted into suitable type in the function itself. A short example: void function(MESSAGE_ID id, void* param) { i...
[ "c++", "gcc", "casting", "64-bit", "32-bit" ]
116
73
227,638
11
0
2008-09-30T13:43:47.440000
2008-09-30T13:45:34.987000
153,074
153,122
Tool to visualise code flow (C/C++)
Do you have any sugestions of tools to ease the task of understanding C/C++ code? We just inherited a large piece of software written by others and we need to quickly get up to speed on it. Any advice on tools that might simplify this task?
SourceInsight and Understand for C++ are the best tools you can get for c/c++ code analysis including flow charts.
Tool to visualise code flow (C/C++) Do you have any sugestions of tools to ease the task of understanding C/C++ code? We just inherited a large piece of software written by others and we need to quickly get up to speed on it. Any advice on tools that might simplify this task?
TITLE: Tool to visualise code flow (C/C++) QUESTION: Do you have any sugestions of tools to ease the task of understanding C/C++ code? We just inherited a large piece of software written by others and we need to quickly get up to speed on it. Any advice on tools that might simplify this task? ANSWER: SourceInsight an...
[ "c++", "c", "code-analysis" ]
86
26
79,133
16
0
2008-09-30T13:45:04.083000
2008-09-30T13:56:10.747000
153,078
295,706
SQL Server 2008 Reporting Services on Failover Cluster
When I try to install the Reporting Services on a second node of a failover cluster, I get the following error message: Existing clustered or cluster-prepared instance failed. The instance selected for installation is already installed and clustered on node 2. But, we never installed it before. Does anyone have any ide...
Just one thing though. You have to install Reporting Services using the Enterprise Edition media and to avoid doing all kinds of nasty stuff to the Licensing the fail-over cluster also have to be Enterprise Edition. If you try to do this using the SQL Server Standard media you will not be able to install SSRS to a "Sha...
SQL Server 2008 Reporting Services on Failover Cluster When I try to install the Reporting Services on a second node of a failover cluster, I get the following error message: Existing clustered or cluster-prepared instance failed. The instance selected for installation is already installed and clustered on node 2. But,...
TITLE: SQL Server 2008 Reporting Services on Failover Cluster QUESTION: When I try to install the Reporting Services on a second node of a failover cluster, I get the following error message: Existing clustered or cluster-prepared instance failed. The instance selected for installation is already installed and cluster...
[ "sql-server", "reporting-services", "failovercluster" ]
3
2
21,507
3
0
2008-09-30T13:45:44.423000
2008-11-17T14:40:31.450000
153,079
153,203
How can I read MS Office files in a server without installing MS Office and without using the Interop Library?
The interop library is slow and needs MS Office installed. Many times you don't want to install MS Office on servers. I'd like to use Apache POI, but I'm on.NET. I need only to extract the text portion of the files, not creating nor "storing information" in Office files. I need to tell you that I've got a very large do...
For all MS Office versions: You could use the third-party components like TX Text Controls for Word and TMS Flexcel Studio for Excel For the new Office (2007): You could do some basic stuff using.net functionality from system.io.packaging. See how at http://msdn.microsoft.com/en-us/library/bb332058.aspx For the old Off...
How can I read MS Office files in a server without installing MS Office and without using the Interop Library? The interop library is slow and needs MS Office installed. Many times you don't want to install MS Office on servers. I'd like to use Apache POI, but I'm on.NET. I need only to extract the text portion of the ...
TITLE: How can I read MS Office files in a server without installing MS Office and without using the Interop Library? QUESTION: The interop library is slow and needs MS Office installed. Many times you don't want to install MS Office on servers. I'd like to use Apache POI, but I'm on.NET. I need only to extract the te...
[ "java", ".net", "apache", "ms-office", "office-interop" ]
5
3
5,393
9
0
2008-09-30T13:45:48.370000
2008-09-30T14:13:44.963000
153,087
153,146
Getting / setting file owner in C#
I have a requirement to read and display the owner of a file (for audit purposes), and potentially changing it as well (this is secondary requirement). Are there any nice C# wrappers? After a quick google, I found only the WMI solution and a suggestion to PInvoke GetSecurityInfo
No need to P/Invoke. System.IO.File.GetAccessControl will return a FileSecurity object, which has a GetOwner method. Edit: Reading the owner is pretty simple, though it's a bit of a cumbersome API: const string FILE = @"C:\test.txt"; var fs = File.GetAccessControl(FILE); var sid = fs.GetOwner(typeof(SecurityIdentifie...
Getting / setting file owner in C# I have a requirement to read and display the owner of a file (for audit purposes), and potentially changing it as well (this is secondary requirement). Are there any nice C# wrappers? After a quick google, I found only the WMI solution and a suggestion to PInvoke GetSecurityInfo
TITLE: Getting / setting file owner in C# QUESTION: I have a requirement to read and display the owner of a file (for audit purposes), and potentially changing it as well (this is secondary requirement). Are there any nice C# wrappers? After a quick google, I found only the WMI solution and a suggestion to PInvoke Get...
[ "c#", ".net" ]
32
50
42,859
2
0
2008-09-30T13:48:20.860000
2008-09-30T14:04:18.607000
153,112
153,202
How do I setup remote debugging from scratch for an Asp.Net app
I would like to be able to step through an application deployed to a remote location which as yet has nothing bar version 3.5 of the.Net framework. What steps do I need to go through to achieve this and how long would you envisage this taking?
If you have unrestricted TCP/IP access to the remote location, this will be very easy (as in, 5 minutes tops to get it to work): see How to: Set Up Remote Debugging and How to: Run the Remote Debugging Monitor for the steps involved. If your development machine is separated from the remote server by firewalls, routers,...
How do I setup remote debugging from scratch for an Asp.Net app I would like to be able to step through an application deployed to a remote location which as yet has nothing bar version 3.5 of the.Net framework. What steps do I need to go through to achieve this and how long would you envisage this taking?
TITLE: How do I setup remote debugging from scratch for an Asp.Net app QUESTION: I would like to be able to step through an application deployed to a remote location which as yet has nothing bar version 3.5 of the.Net framework. What steps do I need to go through to achieve this and how long would you envisage this ta...
[ "asp.net", "debugging", ".net-3.5" ]
2
2
623
2
0
2008-09-30T13:52:38.823000
2008-09-30T14:13:44.917000
153,134
153,239
How do I get a multi line tooltip in MFC
Right now, I have a tool tip that pops up when I hover over an edit box. The problem is that this tool tip contains multiple error messages and they are all in one long line. I need to have each error message be on its own line. The error messages are contained in a CString with a new line seperating them. My existing ...
Creating multiline tooltips is explained here in the MSDN library - read the "Implementing Multiline ToolTips" section. You should send a TTM_SETMAXTIPWIDTH message to the ToolTip control in response to a TTN_GETDISPINFO notification to force it to use multiple lines. In your string you should separate lines with \r\n....
How do I get a multi line tooltip in MFC Right now, I have a tool tip that pops up when I hover over an edit box. The problem is that this tool tip contains multiple error messages and they are all in one long line. I need to have each error message be on its own line. The error messages are contained in a CString with...
TITLE: How do I get a multi line tooltip in MFC QUESTION: Right now, I have a tool tip that pops up when I hover over an edit box. The problem is that this tool tip contains multiple error messages and they are all in one long line. I need to have each error message be on its own line. The error messages are contained...
[ "c++", "mfc" ]
8
13
9,975
1
0
2008-09-30T14:01:08.363000
2008-09-30T14:20:03.297000
153,151
153,191
Connect to an Oracle 8.0 database using a 10g client
I recently upgraded my oracle client to 10g (10.2.0.1.0). Now when I try to connect to a legacy 8.0 database, I get ORA-03134: Connections to this server version are no longer supported. Is there any workaround for this problem, or do I have to install two clients on my local machine?
Yes, you can connect to an Oracle 8i database with the 10g client, but the 8i Database requires the 8.1.7.3 patchset, which you can get from Oracle's Metalink support site (requires login). Here's an Oracle forum post with the details. If updating your Oracle Database isn't an option, then you can have 2 different clie...
Connect to an Oracle 8.0 database using a 10g client I recently upgraded my oracle client to 10g (10.2.0.1.0). Now when I try to connect to a legacy 8.0 database, I get ORA-03134: Connections to this server version are no longer supported. Is there any workaround for this problem, or do I have to install two clients on...
TITLE: Connect to an Oracle 8.0 database using a 10g client QUESTION: I recently upgraded my oracle client to 10g (10.2.0.1.0). Now when I try to connect to a legacy 8.0 database, I get ORA-03134: Connections to this server version are no longer supported. Is there any workaround for this problem, or do I have to inst...
[ "oracle", "oracleclient" ]
5
7
22,282
3
0
2008-09-30T14:05:09.243000
2008-09-30T14:12:42.067000
153,152
362,564
Resizing an iframe based on content
I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes. How do I resize the iframes to fit the height of the iframes' content? I've tried to decipher the javascript Google uses but it's obfuscated, and searching the web has been fruitless so far. Update: P...
We had this type of problem, but slightly in reverse to your situation - we were providing the iframed content to sites on other domains, so the same origin policy was also an issue. After many hours spent trawling google, we eventually found a (somewhat..) workable solution, which you may be able to adapt to your need...
Resizing an iframe based on content I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes. How do I resize the iframes to fit the height of the iframes' content? I've tried to decipher the javascript Google uses but it's obfuscated, and searching the web ...
TITLE: Resizing an iframe based on content QUESTION: I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes. How do I resize the iframes to fit the height of the iframes' content? I've tried to decipher the javascript Google uses but it's obfuscated, and ...
[ "javascript", "iframe", "widget" ]
521
596
344,219
26
0
2008-09-30T14:05:11.523000
2008-12-12T12:04:38.810000
153,156
153,969
How to count distinct values in a node?
How to count distinct values in a node in XSLT? Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3. 62 212 Argentina 4 108 Australia 4 111 Australia 12 78 Germany
If you have a large document, you probably want to use the "Muenchian Method", which is usually used for grouping, to identify the distinct nodes. Declare a key that indexes the things you want to count by the values that are distinct: Then you can get the elements that have distinct countries using: /Artists_by_Countr...
How to count distinct values in a node? How to count distinct values in a node in XSLT? Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3. 62 212 Argentina 4 108 Australia 4 111 Australia 12 78 Germany
TITLE: How to count distinct values in a node? QUESTION: How to count distinct values in a node in XSLT? Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3. 62 212 Argentina 4 108 Australia 4 111 Australia 12 78 Germany ANSWER: If you have a large document, you pro...
[ "xml", "xslt", "xslt-grouping" ]
13
28
51,988
4
0
2008-09-30T14:05:44.577000
2008-09-30T16:53:00.200000
153,183
153,245
RoR: nested namespace routes, undefined method error
I am working on the admin section of a new rails app and i'm trying to setup some routes to do things "properly". I have the following controller: class Admin::BlogsController < ApplicationController def index @blogs = Blog.find(:all) end def show @blog = Blog.find(params[:id]) end... end in routes.rb: map.namespace:a...
Your Delete link should end in _path: <%= link_to 'Delete', admin_blog_path(blog),:method =>:delete %>
RoR: nested namespace routes, undefined method error I am working on the admin section of a new rails app and i'm trying to setup some routes to do things "properly". I have the following controller: class Admin::BlogsController < ApplicationController def index @blogs = Blog.find(:all) end def show @blog = Blog.find(...
TITLE: RoR: nested namespace routes, undefined method error QUESTION: I am working on the admin section of a new rails app and i'm trying to setup some routes to do things "properly". I have the following controller: class Admin::BlogsController < ApplicationController def index @blogs = Blog.find(:all) end def show ...
[ "ruby-on-rails", "ruby" ]
4
10
5,423
3
0
2008-09-30T14:11:25.250000
2008-09-30T14:21:03.230000
153,221
154,660
Running a Python web server as a service in Windows
I have a small web server application I've written in Python that goes and gets some data from a database system and returns it to the user as XML. That part works fine - I can run the Python web server application from the command line and I can have clients connect to it and get data back. At the moment, to run the w...
This is what I do: Instead of instancing directly the class BaseHTTPServer.HTTPServer, I write a new descendant from it that publishes an "stop" method: class AppHTTPServer (SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): def serve_forever(self): self.stop_serving = False while not self.stop_serving: self.hand...
Running a Python web server as a service in Windows I have a small web server application I've written in Python that goes and gets some data from a database system and returns it to the user as XML. That part works fine - I can run the Python web server application from the command line and I can have clients connect ...
TITLE: Running a Python web server as a service in Windows QUESTION: I have a small web server application I've written in Python that goes and gets some data from a database system and returns it to the user as XML. That part works fine - I can run the Python web server application from the command line and I can hav...
[ "python", "windows", "webserver" ]
8
4
9,104
1
0
2008-09-30T14:17:08.857000
2008-09-30T19:47:49.903000
153,222
153,351
MVP pattern - Passive View and exposing complex types through IView (Asp.Net, Web Forms)
I've recently switch to MVP pattern with a Passive View approach. I feel it very comfortable to work with when the view interface exposes only basic clr types, such as string mapped to TextBoxes, IDictionary mapped to DropDownLists, IEnumerable mapped to some grids, repeaters. However, this last approach works only whe...
MVP makes webforms development much easier, except in cases like this. However, if you used TDD to verify that your IView really needs that grid of data, then I don't really see what the problem is. I assume you're trying to do something like this: public interface IView { DataTable DataSource {get; set;} } public cla...
MVP pattern - Passive View and exposing complex types through IView (Asp.Net, Web Forms) I've recently switch to MVP pattern with a Passive View approach. I feel it very comfortable to work with when the view interface exposes only basic clr types, such as string mapped to TextBoxes, IDictionary mapped to DropDownLists...
TITLE: MVP pattern - Passive View and exposing complex types through IView (Asp.Net, Web Forms) QUESTION: I've recently switch to MVP pattern with a Passive View approach. I feel it very comfortable to work with when the view interface exposes only basic clr types, such as string mapped to TextBoxes, IDictionary mappe...
[ "asp.net", "mvp" ]
3
3
2,805
1
0
2008-09-30T14:17:09.713000
2008-09-30T14:39:44.013000
153,223
153,265
How do you organize your Unit Tests in TDD?
I do TDD, and I've been fairly loose in organizing my unit tests. I tend to start with a file representing the next story or chunk of functionality and write all the unit-tests to make that work. Of course, if I'm introducing a new class, I usually make a separate unit-test module or file for that class, but I don't or...
Divide your tests in 2 sets: functional tests units tests Functional tests are per-user story. Unit tests are per-class. The former check that you actually support the story, the latter exercise and document your functionality. There is one directory (package) for functional tests. Unit tests should be closely bound wi...
How do you organize your Unit Tests in TDD? I do TDD, and I've been fairly loose in organizing my unit tests. I tend to start with a file representing the next story or chunk of functionality and write all the unit-tests to make that work. Of course, if I'm introducing a new class, I usually make a separate unit-test m...
TITLE: How do you organize your Unit Tests in TDD? QUESTION: I do TDD, and I've been fairly loose in organizing my unit tests. I tend to start with a file representing the next story or chunk of functionality and write all the unit-tests to make that work. Of course, if I'm introducing a new class, I usually make a se...
[ "unit-testing", "tdd" ]
26
17
6,345
5
0
2008-09-30T14:17:28.980000
2008-09-30T14:23:34.020000
153,226
153,253
TSVNCache.exe is heating up my Mac
I run windows in a VMWare partition. At times, TSVNCache.exe process starts doing some weird things (Seems like its doing an endless loop of I/O operations). Suddenly my whole VMWare session starts slowing down. My mac heats up badly. In the sense its freaking hot. My question is what is this TSVNCache process anyway?,...
It's what produces the overlaid icons in Explorer that tell you whether files/directories are modified, conflicted etc or not. There have been several fixes to it recently, make sure you have the latest version of TortoiseSVN. Performance will also improve if you minimize the set of things SVN has to check - tell it to...
TSVNCache.exe is heating up my Mac I run windows in a VMWare partition. At times, TSVNCache.exe process starts doing some weird things (Seems like its doing an endless loop of I/O operations). Suddenly my whole VMWare session starts slowing down. My mac heats up badly. In the sense its freaking hot. My question is what...
TITLE: TSVNCache.exe is heating up my Mac QUESTION: I run windows in a VMWare partition. At times, TSVNCache.exe process starts doing some weird things (Seems like its doing an endless loop of I/O operations). Suddenly my whole VMWare session starts slowing down. My mac heats up badly. In the sense its freaking hot. M...
[ "svn", "tortoisesvn", "tsvncache" ]
2
6
524
3
0
2008-09-30T14:18:06.623000
2008-09-30T14:21:53.120000
153,227
153,284
Extension functions and 'help'
When I call help(Mod.Cls.f) (Mod is a C extension module), I get the output Help on method_descriptor: f(...) doc_string What do I need to do so that the help output is of the form Help on method f in module Mod: f(x, y, z) doc_string like it is for random.Random.shuffle, for example? My PyMethodDef entry is currentl...
You cannot. The inspect module, which is what 'pydoc' and 'help()' use, has no way of figuring out what the exact signature of a C function is. The best you can do is what the builtin functions do: include the signature in the first line of the docstring: >>> help(range) Help on built-in function range in module __buil...
Extension functions and 'help' When I call help(Mod.Cls.f) (Mod is a C extension module), I get the output Help on method_descriptor: f(...) doc_string What do I need to do so that the help output is of the form Help on method f in module Mod: f(x, y, z) doc_string like it is for random.Random.shuffle, for example? M...
TITLE: Extension functions and 'help' QUESTION: When I call help(Mod.Cls.f) (Mod is a C extension module), I get the output Help on method_descriptor: f(...) doc_string What do I need to do so that the help output is of the form Help on method f in module Mod: f(x, y, z) doc_string like it is for random.Random.shuff...
[ "python", "cpython" ]
1
2
147
2
0
2008-09-30T14:18:14.407000
2008-09-30T14:26:30.910000
153,234
153,565
How deep are your unit tests?
The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem do is test my constructor has set all the properties but is this overkill? My question is to what level of granularity do you write you unit t...
I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence (I suspect this level of confidence is high compared to industry standards, but that could just be hubris). If I don't typically make a kind of mistake (like setting the wrong variables ...
How deep are your unit tests? The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem do is test my constructor has set all the properties but is this overkill? My question is to what level of granu...
TITLE: How deep are your unit tests? QUESTION: The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem do is test my constructor has set all the properties but is this overkill? My question is to w...
[ "unit-testing", "tdd" ]
88
221
110,180
17
0
2008-09-30T14:19:14.593000
2008-09-30T15:30:47.823000
153,242
153,432
Can someone give me a high overview of how lucene.net works?
I have an MS SQL database and have a varchar field that I would like to do queries like where name like '%searchTerm%'. But right now it is too slow, even with SQL enterprise's full text indexing. Can someone explain how Lucene.Net might help my situation? How does the indexer work? How do queries work? What is done fo...
I saw this guy (Michael Neel) present on Lucene at a user group meeting - effectively, you build index files (using Lucene) and they have pointers to whatever you want (database rows, whatever) http://code.google.com/p/vinull/source/browse/#svn/Examples/LuceneSearch Very fast, flexible and powerful. What's good with Lu...
Can someone give me a high overview of how lucene.net works? I have an MS SQL database and have a varchar field that I would like to do queries like where name like '%searchTerm%'. But right now it is too slow, even with SQL enterprise's full text indexing. Can someone explain how Lucene.Net might help my situation? Ho...
TITLE: Can someone give me a high overview of how lucene.net works? QUESTION: I have an MS SQL database and have a varchar field that I would like to do queries like where name like '%searchTerm%'. But right now it is too slow, even with SQL enterprise's full text indexing. Can someone explain how Lucene.Net might hel...
[ "sql", "sql-server", "full-text-search", "lucene", "lucene.net" ]
11
6
1,885
2
0
2008-09-30T14:20:25.010000
2008-09-30T14:59:15.400000
153,248
153,277
Programmatically creating Excel 2007 Sheets
I'm trying to create Excel 2007 Documents programmatically. Now, there are two ways I've found: Manually creating the XML, as outlined in this post Using a Third Party Library like ExcelPackage. Currently, I use ExcelPackage, which has some really serious drawbacks and issues. As I do not need to create overly complex ...
You could try using the Office Open XML SDK. This will allow you to create Excel files in memory using say a MemoryStream and much more easily than generating all the XML by hand. As Brian Kim pointed out, version 2.0 of the SDK requires.NET 3.5 which you stated wasn't available. Version 1 of the SDK is also available ...
Programmatically creating Excel 2007 Sheets I'm trying to create Excel 2007 Documents programmatically. Now, there are two ways I've found: Manually creating the XML, as outlined in this post Using a Third Party Library like ExcelPackage. Currently, I use ExcelPackage, which has some really serious drawbacks and issues...
TITLE: Programmatically creating Excel 2007 Sheets QUESTION: I'm trying to create Excel 2007 Documents programmatically. Now, there are two ways I've found: Manually creating the XML, as outlined in this post Using a Third Party Library like ExcelPackage. Currently, I use ExcelPackage, which has some really serious dr...
[ "c#", ".net", "excel" ]
14
9
5,148
8
0
2008-09-30T14:21:26.303000
2008-09-30T14:25:43.190000
153,257
153,525
Random MoveFileEx failures on Vista
I noticed that writing to a file, closing it and moving it to destination place randomly fails on Vista. Specifically, MoveFileEx() would return ERROR_ACCESS_DENIED for no apparent reason. This happens on Vista SP1 at least (32 bit). Does not happen on XP SP3. Found this thread on the internets about exactly the same p...
I suggest you use Process Monitor (edit: the artist formerly known as FileMon) to watch and see which application exactly is getting in the way. It can show you the entire trace of file system calls made on your machine. (edit: thanks to @moocha for the change in application)
Random MoveFileEx failures on Vista I noticed that writing to a file, closing it and moving it to destination place randomly fails on Vista. Specifically, MoveFileEx() would return ERROR_ACCESS_DENIED for no apparent reason. This happens on Vista SP1 at least (32 bit). Does not happen on XP SP3. Found this thread on th...
TITLE: Random MoveFileEx failures on Vista QUESTION: I noticed that writing to a file, closing it and moving it to destination place randomly fails on Vista. Specifically, MoveFileEx() would return ERROR_ACCESS_DENIED for no apparent reason. This happens on Vista SP1 at least (32 bit). Does not happen on XP SP3. Found...
[ "c++", "windows", "winapi", "windows-vista" ]
7
4
3,338
4
0
2008-09-30T14:22:21.713000
2008-09-30T15:21:01.573000