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
3,470
3,473
How do I Transform Sql Columns into Rows?
I have a very simple problem which requires a very quick and simple solution in SQL Server 2005. I have a table with x Columns. I want to be able to select one row from the table and then transform the columns into rows. TableA Column1, Column2, Column3 SQL Statement to ruturn ResultA Value of Column1 Value of Column2 ...
You should take a look at the UNPIVOT clause. Update1: GateKiller, strangely enough I read an article (about something unrelated) about it this morning and I'm trying to jog my memory where I saw it again, had some decent looking examples too. It'll come back to me I'm sure. Update2: Found it: http://weblogs.sqlteam.co...
How do I Transform Sql Columns into Rows? I have a very simple problem which requires a very quick and simple solution in SQL Server 2005. I have a table with x Columns. I want to be able to select one row from the table and then transform the columns into rows. TableA Column1, Column2, Column3 SQL Statement to ruturn ...
TITLE: How do I Transform Sql Columns into Rows? QUESTION: I have a very simple problem which requires a very quick and simple solution in SQL Server 2005. I have a table with x Columns. I want to be able to select one row from the table and then transform the columns into rows. TableA Column1, Column2, Column3 SQL St...
[ "sql-server", "sql-server-2005" ]
17
6
6,631
6
0
2008-08-06T14:36:56.640000
2008-08-06T14:39:09.457000
3,486
3,827
Block user access to internals of a site using HTTP_REFERER
I have control over the HttpServer but not over the ApplicationServer or the Java Applications sitting there but I need to block direct access to certain pages on those applications. Precisely, I don't want users automating access to forms issuing direct GET/POST HTTP requests to the appropriate servlet. So, I decided ...
I'm not sure if I can solve this in one go, but we can go back and forth as necessary. First, I want to repeat what I think you are saying and make sure I'm clear. You want to disallow requests to servlet1 and servlet2 is the request doesn't have the proper referer and it does have a query string? I'm not sure I unders...
Block user access to internals of a site using HTTP_REFERER I have control over the HttpServer but not over the ApplicationServer or the Java Applications sitting there but I need to block direct access to certain pages on those applications. Precisely, I don't want users automating access to forms issuing direct GET/P...
TITLE: Block user access to internals of a site using HTTP_REFERER QUESTION: I have control over the HttpServer but not over the ApplicationServer or the Java Applications sitting there but I need to block direct access to certain pages on those applications. Precisely, I don't want users automating access to forms is...
[ "security", "apache", "mod-rewrite", "http-referer" ]
5
2
2,433
9
0
2008-08-06T14:44:09.137000
2008-08-06T18:41:13.057000
3,510
3,511
What does the term "BODMAS" mean?
What is BODMAS and why is it useful in programming?
http://www.easymaths.com/What_on_earth_is_Bodmas.htm: What do you think the answer to 2 + 3 x 5 is? Is it (2 + 3) x 5 = 5 x 5 = 25? or 2 + (3 x 5) = 2 + 15 = 17? BODMAS can come to the rescue and give us rules to follow so that we always get the right answer: (B)rackets (O)rder (D)ivision (M)ultiplication (A)ddition (S...
What does the term "BODMAS" mean? What is BODMAS and why is it useful in programming?
TITLE: What does the term "BODMAS" mean? QUESTION: What is BODMAS and why is it useful in programming? ANSWER: http://www.easymaths.com/What_on_earth_is_Bodmas.htm: What do you think the answer to 2 + 3 x 5 is? Is it (2 + 3) x 5 = 5 x 5 = 25? or 2 + (3 x 5) = 2 + 15 = 17? BODMAS can come to the rescue and give us rul...
[ "math", "operator-precedence" ]
16
20
12,958
7
0
2008-08-06T14:54:52.360000
2008-08-06T14:57:01.403000
3,512
3,552
Searching directories for tons of files?
I'm using MSVE, and I have my own tiles I'm displaying in layers on top. Problem is, there's a ton of them, and they're on a network server. In certain directories, there are something on the order of 30,000+ files. Initially I called Directory.GetFiles, but once I started testing in a pseudo-real environment, it timed...
I've worked on a SAN system in the past with telephony audio recordings which had issues with numbers of files in a single folder - that system became unusable somewhere near 5,000 (on Windows 2000 Advanced Server with an application in C#.Net 1.1)- the only sensible solution that we came up with was to change the fold...
Searching directories for tons of files? I'm using MSVE, and I have my own tiles I'm displaying in layers on top. Problem is, there's a ton of them, and they're on a network server. In certain directories, there are something on the order of 30,000+ files. Initially I called Directory.GetFiles, but once I started testi...
TITLE: Searching directories for tons of files? QUESTION: I'm using MSVE, and I have my own tiles I'm displaying in layers on top. Problem is, there's a ton of them, and they're on a network server. In certain directories, there are something on the order of 30,000+ files. Initially I called Directory.GetFiles, but on...
[ "c#", "directory", "file-management" ]
15
6
1,067
5
0
2008-08-06T14:57:16.597000
2008-08-06T15:35:30.203000
3,530
3,543
How do I run Rake tasks within a Ruby script?
I have a Rakefile with a Rake task that I would normally call from the command line: rake blog:post Title I'd like to write a Ruby script that calls that Rake task multiple times, but the only solution I see is shelling out using `` (backticks) or system. What's the right way to do this?
from timocracy.com: require 'rake' def capture_stdout s = StringIO.new oldstdout = $stdout $stdout = s yield s.string ensure $stdout = oldstdout end Rake.application.rake_require 'metric_fetcher', ['../../lib/tasks'] results = capture_stdout {Rake.application['metric_fetcher'].invoke}
How do I run Rake tasks within a Ruby script? I have a Rakefile with a Rake task that I would normally call from the command line: rake blog:post Title I'd like to write a Ruby script that calls that Rake task multiple times, but the only solution I see is shelling out using `` (backticks) or system. What's the right w...
TITLE: How do I run Rake tasks within a Ruby script? QUESTION: I have a Rakefile with a Rake task that I would normally call from the command line: rake blog:post Title I'd like to write a Ruby script that calls that Rake task multiple times, but the only solution I see is shelling out using `` (backticks) or system. ...
[ "ruby", "rake", "command-line-interface" ]
61
45
31,858
4
0
2008-08-06T15:15:54.143000
2008-08-06T15:24:00.787000
3,544
3,561
What is the best way to deploy a VB.NET application?
Generally when I use ClickOnce when I build a VB.NET program but it has a few downsides. I've never really used anything else, so I'm not sure what my options are. Downsides to ClickOnce: Consists of multiple files - Seems easier to distribute one file than manageing a bunch of file and the downloader to download those...
Have you seen WiX yet? http://wix.sourceforge.net/ It builds windows installers using an XML file and has additional libraries to use if you want to fancify your installers and the like. I'll admit the learning curve for me was medium-high in getting things started, but afterwards I was able to build a second installer...
What is the best way to deploy a VB.NET application? Generally when I use ClickOnce when I build a VB.NET program but it has a few downsides. I've never really used anything else, so I'm not sure what my options are. Downsides to ClickOnce: Consists of multiple files - Seems easier to distribute one file than manageing...
TITLE: What is the best way to deploy a VB.NET application? QUESTION: Generally when I use ClickOnce when I build a VB.NET program but it has a few downsides. I've never really used anything else, so I'm not sure what my options are. Downsides to ClickOnce: Consists of multiple files - Seems easier to distribute one f...
[ "vb.net", "visual-studio", "installation", "clickonce" ]
8
6
13,149
5
0
2008-08-06T15:25:51.237000
2008-08-06T15:38:52.287000
3,567
3,578
SQL query for a database scheme
In SQL Server how do you query a database to bring back all the tables that have a field of a specific name?
The following query will bring back a unique list of tables where Column_Name is equal to the column you are looking for: SELECT Table_Name FROM INFORMATION_SCHEMA.COLUMNS WHERE Column_Name = 'Desired_Column_Name' GROUP BY Table_Name
SQL query for a database scheme In SQL Server how do you query a database to bring back all the tables that have a field of a specific name?
TITLE: SQL query for a database scheme QUESTION: In SQL Server how do you query a database to bring back all the tables that have a field of a specific name? ANSWER: The following query will bring back a unique list of tables where Column_Name is equal to the column you are looking for: SELECT Table_Name FROM INFORMA...
[ "sql", "sql-server" ]
7
7
1,384
3
0
2008-08-06T15:41:13.827000
2008-08-06T15:46:09.777000
3,585
3,601
Create a new Ruby on Rails application using MySQL instead of SQLite
I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite?
If you already have a rails project, change the adapter in the config/database.yml file to mysql and make sure you specify a valid username and password, and optionally, a socket: development: adapter: mysql2 database: db_name_dev username: koploper password: host: localhost socket: /tmp/mysql.sock Next, make sure you ...
Create a new Ruby on Rails application using MySQL instead of SQLite I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite?
TITLE: Create a new Ruby on Rails application using MySQL instead of SQLite QUESTION: I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite? ANSWER: If you already have a rails project, change the adapter in the conf...
[ "mysql", "ruby-on-rails", "ruby" ]
135
144
160,255
19
0
2008-08-06T15:50:49.813000
2008-08-06T16:04:05.043000
3,589
3,609
Backup SQL Schema Only?
I need to create a backup of a SQL Server 2005 Database that's only the structure...no records, just the schema. Is there any way to do this? EDIT: I'm trying to create a backup file to use with old processes, so a script wouldn't work for my purposes, sorry
Use a 3 step process: Generate a script from the working database Create a new database from that script Create a backup of the new database
Backup SQL Schema Only? I need to create a backup of a SQL Server 2005 Database that's only the structure...no records, just the schema. Is there any way to do this? EDIT: I'm trying to create a backup file to use with old processes, so a script wouldn't work for my purposes, sorry
TITLE: Backup SQL Schema Only? QUESTION: I need to create a backup of a SQL Server 2005 Database that's only the structure...no records, just the schema. Is there any way to do this? EDIT: I'm trying to create a backup file to use with old processes, so a script wouldn't work for my purposes, sorry ANSWER: Use a 3 st...
[ "sql", "sql-server", "oracle", "sql-server-2005", "backup" ]
22
11
23,760
5
0
2008-08-06T15:53:51.647000
2008-08-06T16:12:44.213000
3,607
370,131
Integrating Fogbugz with TortoiseSVN with no URL/Subversion backend
I've got TotroiseSVN installed and have a majority of my repositories checking in and out from C:\subversion\ and a couple checking in and out from a network share (I forgot about this when I originally posted this question). This means that I don't have a "subversion" server per-se. How do I integrate TortoiseSVN and ...
I've been investigating this issue and have managed to get it working. There are a couple of minor problems but they can be worked-around. There are 3 distinct parts to this problem, as follows: The TortoiseSVN part - getting TortoiseSVN to insert the Bugid and hyperlink in the svn log The FogBugz part - getting FogBug...
Integrating Fogbugz with TortoiseSVN with no URL/Subversion backend I've got TotroiseSVN installed and have a majority of my repositories checking in and out from C:\subversion\ and a couple checking in and out from a network share (I forgot about this when I originally posted this question). This means that I don't ha...
TITLE: Integrating Fogbugz with TortoiseSVN with no URL/Subversion backend QUESTION: I've got TotroiseSVN installed and have a majority of my repositories checking in and out from C:\subversion\ and a couple checking in and out from a network share (I forgot about this when I originally posted this question). This mea...
[ "svn", "tortoisesvn", "integration", "fogbugz" ]
16
18
5,302
5
0
2008-08-06T16:10:44.313000
2008-12-16T00:03:30.553000
3,611
3,618
PHP Error - Uploading a file
I'm trying to write some PHP to upload a file to a folder on my webserver. Here's what I have: Dump Upload Upload a File Select the File: I'm getting these errors: Warning: move_uploaded_file(./test.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in E:\inetpub\vhosts\mywebsite.com\httpdocs\...
As it's Windows, there is no real 777. If you're using chmod, check the Windows-related comments. Check that the IIS Account can access (read, write, modify) these two folders: E:\inetpub\vhosts\mywebsite.com\httpdocs\dump\ C:\WINDOWS\Temp\
PHP Error - Uploading a file I'm trying to write some PHP to upload a file to a folder on my webserver. Here's what I have: Dump Upload Upload a File Select the File: I'm getting these errors: Warning: move_uploaded_file(./test.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in E:\inetpub\v...
TITLE: PHP Error - Uploading a file QUESTION: I'm trying to write some PHP to upload a file to a folder on my webserver. Here's what I have: Dump Upload Upload a File Select the File: I'm getting these errors: Warning: move_uploaded_file(./test.txt) [function.move-uploaded-file]: failed to open stream: Permission deni...
[ "php", "iis", "upload" ]
18
9
14,534
8
0
2008-08-06T16:13:02.250000
2008-08-06T16:16:01.667000
3,625
102,129
What's the Developer Express equivalent of System.Windows.Forms.LinkButton?
I can't seem to find Developer Express' version of the LinkButton. (The Windows Forms linkbutton, not the ASP.NET linkbutton.) HyperLinkEdit doesn't seem to be what I'm looking for since it looks like a TextEdit/TextBox. Anyone know what their version of it is? I'm using the latest DevX controls: 8.2.1.
The control is called the HyperLinkEdit. You have to adjust the properties to get it to behave like the System.Windows.Forms control like so: control.BorderStyle = BorderStyles.NoBorder; control.Properties.Appearance.BackColor = Color.Transparent; control.Properties.AppearanceFocused.BackColor = Color.Transparent; cont...
What's the Developer Express equivalent of System.Windows.Forms.LinkButton? I can't seem to find Developer Express' version of the LinkButton. (The Windows Forms linkbutton, not the ASP.NET linkbutton.) HyperLinkEdit doesn't seem to be what I'm looking for since it looks like a TextEdit/TextBox. Anyone know what their ...
TITLE: What's the Developer Express equivalent of System.Windows.Forms.LinkButton? QUESTION: I can't seem to find Developer Express' version of the LinkButton. (The Windows Forms linkbutton, not the ASP.NET linkbutton.) HyperLinkEdit doesn't seem to be what I'm looking for since it looks like a TextEdit/TextBox. Anyon...
[ "devexpress" ]
3
3
1,538
2
0
2008-08-06T16:20:06.290000
2008-09-19T14:12:29.407000
3,654
3,655
HTML version choice
When developing a new web based application which version of html should you aim for? EDIT: cool I was just attempting to get a feel from others I tend to use XHTML 1.0 Strict in my own work and Transitional when others are involved in the content creation. I marked the first XHTML 1.0 Transitional post as the 'correct...
I'd shoot for XHTML Transitional 1.0. There are still a few nuances out there that don't like XHTML strict, and most editors I've seen now will give you the proper nudges to make sure that things are done right.
HTML version choice When developing a new web based application which version of html should you aim for? EDIT: cool I was just attempting to get a feel from others I tend to use XHTML 1.0 Strict in my own work and Transitional when others are involved in the content creation. I marked the first XHTML 1.0 Transitional ...
TITLE: HTML version choice QUESTION: When developing a new web based application which version of html should you aim for? EDIT: cool I was just attempting to get a feel from others I tend to use XHTML 1.0 Strict in my own work and Transitional when others are involved in the content creation. I marked the first XHTML...
[ "html", "xml", "xhtml" ]
23
9
1,629
14
0
2008-08-06T16:40:23.130000
2008-08-06T16:43:00.410000
3,667
29,213
What is your favorite web app deployment workflow with SVN?
We are currently using a somewhat complicated deployment setup that involves a remote SVN server, 3 SVN branches for DEV, STAGE, and PROD, promoting code between them through patches, etc. I wonder what do you use for deployment in a small dev team situation?
trunk for development, and a branch (production) for the production stuff. On my local machine, I have a VirtualHost that points to the trunk branch, to test my changes. Any commit to trunk triggers a commit hook that does an svn export and sync to the online server's dev URL - so if the site is stackoverflow.com then ...
What is your favorite web app deployment workflow with SVN? We are currently using a somewhat complicated deployment setup that involves a remote SVN server, 3 SVN branches for DEV, STAGE, and PROD, promoting code between them through patches, etc. I wonder what do you use for deployment in a small dev team situation?
TITLE: What is your favorite web app deployment workflow with SVN? QUESTION: We are currently using a somewhat complicated deployment setup that involves a remote SVN server, 3 SVN branches for DEV, STAGE, and PROD, promoting code between them through patches, etc. I wonder what do you use for deployment in a small de...
[ "svn", "deployment" ]
15
15
3,337
11
0
2008-08-06T16:48:24.127000
2008-08-26T23:45:56.213000
3,682
155,901
Distribution of table in time
I have a MySQL table with approximately 3000 rows per user. One of the columns is a datetime field, which is mutable, so the rows aren't in chronological order. I'd like to visualize the time distribution in a chart, so I need a number of individual datapoints. 20 datapoints would be enough. I could do this: select tim...
Michal Sznajder almost had it, but you can't use column aliases in a WHERE clause in SQL. So you have to wrap it as a derived table. I tried this and it returns 20 rows: SELECT * FROM ( SELECT @rownum:=@rownum+1 AS rownum, e.* FROM (SELECT @rownum:= 0) r, entries e) AS e2 WHERE uid =? AND rownum % 150 = 0;
Distribution of table in time I have a MySQL table with approximately 3000 rows per user. One of the columns is a datetime field, which is mutable, so the rows aren't in chronological order. I'd like to visualize the time distribution in a chart, so I need a number of individual datapoints. 20 datapoints would be enoug...
TITLE: Distribution of table in time QUESTION: I have a MySQL table with approximately 3000 rows per user. One of the columns is a datetime field, which is mutable, so the rows aren't in chronological order. I'd like to visualize the time distribution in a chart, so I need a number of individual datapoints. 20 datapoi...
[ "sql", "mysql" ]
12
6
1,934
7
0
2008-08-06T16:58:34.153000
2008-10-01T01:49:27.897000
3,713
3,777
Call ASP.NET function from JavaScript
I'm writing a web page in ASP.NET. I have some JavaScript code, and I have a submit button with a click event. Is it possible to call a method I created in ASP with JavaScript's click event?
Well, if you don't want to do it using Ajax or any other way and just want a normal ASP.NET postback to happen, here is how you do it (without using any other libraries): It is a little tricky though...:) i. In your code file (assuming you are using C# and.NET 2.0 or later) add the following Interface to your Page clas...
Call ASP.NET function from JavaScript I'm writing a web page in ASP.NET. I have some JavaScript code, and I have a submit button with a click event. Is it possible to call a method I created in ASP with JavaScript's click event?
TITLE: Call ASP.NET function from JavaScript QUESTION: I'm writing a web page in ASP.NET. I have some JavaScript code, and I have a submit button with a click event. Is it possible to call a method I created in ASP with JavaScript's click event? ANSWER: Well, if you don't want to do it using Ajax or any other way and...
[ "javascript", "c#", "asp.net", "onclick" ]
147
99
311,462
20
0
2008-08-06T17:16:36.630000
2008-08-06T18:04:25.270000
3,725
3,776
How to create a tree-view preferences dialog type of interface in C#?
I'm writing an application that is basically just a preferences dialog, much like the tree-view preferences dialog that Visual Studio itself uses. The function of the application is simply a pass-through for data from a serial device to a file. It performs many, many transformations on the data before writing it to the...
A tidier way is to create separate forms for each 'pane' and, in each form constructor, set this.TopLevel = false; this.FormBorderStyle = FormBorderStyle.None; this.Dock = DockStyle.Fill; That way, each of these forms can be laid out in its own designer, instantiated one or more times at runtime, and added to the empty...
How to create a tree-view preferences dialog type of interface in C#? I'm writing an application that is basically just a preferences dialog, much like the tree-view preferences dialog that Visual Studio itself uses. The function of the application is simply a pass-through for data from a serial device to a file. It pe...
TITLE: How to create a tree-view preferences dialog type of interface in C#? QUESTION: I'm writing an application that is basically just a preferences dialog, much like the tree-view preferences dialog that Visual Studio itself uses. The function of the application is simply a pass-through for data from a serial devic...
[ "c#", "user-interface" ]
18
12
4,491
3
0
2008-08-06T17:22:27.350000
2008-08-06T18:02:31.480000
3,781
3,782
Prototyping a GUI with a customer
When prototyping initial GUI functionality with a customer is it better to use a pen/paper drawing or to mock something up using a tool and show them that? The argument against a tool generated design being that the customer can sometimes focus on the low-level specifics of the mock-up rather than taking a higher level...
Always start with paper or paper-like mock-ups first. You do not want to fall into a trap of giving the impression of completeness when the back-end is completely hollow. A polished prototype or pixel-perfect example puts too much emphasis on the design. With an obvious sketch, you have a better shot of discussing desi...
Prototyping a GUI with a customer When prototyping initial GUI functionality with a customer is it better to use a pen/paper drawing or to mock something up using a tool and show them that? The argument against a tool generated design being that the customer can sometimes focus on the low-level specifics of the mock-up...
TITLE: Prototyping a GUI with a customer QUESTION: When prototyping initial GUI functionality with a customer is it better to use a pen/paper drawing or to mock something up using a tool and show them that? The argument against a tool generated design being that the customer can sometimes focus on the low-level specif...
[ "user-interface", "prototyping" ]
17
16
2,842
12
0
2008-08-06T18:10:23.477000
2008-08-06T18:10:56.317000
3,790
3,833
Is there a WMI Redistributable Package?
I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an "optional component". I know there are a lot of really good alternatives to queryin...
You didn't mention for what OS, but the WMI Redistributable Components version 1.0 definitely exists. For Windows Server 2003, the WMI SDK and redistributables are part of the Server SDK I believe that the same is true for the Server 2008 SDK
Is there a WMI Redistributable Package? I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an "optional component". I know there are a lo...
TITLE: Is there a WMI Redistributable Package? QUESTION: I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an "optional component". I k...
[ "windows", "64-bit", "wmi" ]
4
2
2,165
2
0
2008-08-06T18:15:43.357000
2008-08-06T18:44:55.373000
3,793
1,704,579
Best way to get InnerXml of an XElement?
What's the best way to get the contents of the mixed body element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after. The code as written almost does what I want, but includes the s...
I wanted to see which of these suggested solutions performed best, so I ran some comparative tests. Out of interest, I also compared the LINQ methods to the plain old System.Xml method suggested by Greg. The variation was interesting and not what I expected, with the slowest methods being more than 3 times slower than ...
Best way to get InnerXml of an XElement? What's the best way to get the contents of the mixed body element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after. The code as written al...
TITLE: Best way to get InnerXml of an XElement? QUESTION: What's the best way to get the contents of the mixed body element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after. The ...
[ ".net", "xml", "xelement", "innerxml" ]
154
213
90,225
14
0
2008-08-06T18:16:55.853000
2009-11-09T23:08:14.530000
3,801
3,824
More vs. Faster Cores on a Webserver
The discussion of Dual vs. Quadcore is as old as the Quadcores itself and the answer is usually "it depends on your scenario". So here the scenario is a Web Server (Windows 2003 (not sure if x32 or x64), 4 GB RAM, IIS, ASP.net 3.0). My impression is that the CPU in a Webserver does not need to be THAT fast because requ...
For something like a webserver, dividing up the tasks of handling each connection is (relatively) easy. I say it's safe to say that web servers is one of the most common (and ironed out) uses of parallel code. And since you are able to split up much of the processing into multiple discrete threads, more cores actually ...
More vs. Faster Cores on a Webserver The discussion of Dual vs. Quadcore is as old as the Quadcores itself and the answer is usually "it depends on your scenario". So here the scenario is a Web Server (Windows 2003 (not sure if x32 or x64), 4 GB RAM, IIS, ASP.net 3.0). My impression is that the CPU in a Webserver does ...
TITLE: More vs. Faster Cores on a Webserver QUESTION: The discussion of Dual vs. Quadcore is as old as the Quadcores itself and the answer is usually "it depends on your scenario". So here the scenario is a Web Server (Windows 2003 (not sure if x32 or x64), 4 GB RAM, IIS, ASP.net 3.0). My impression is that the CPU in...
[ "asp.net", "windows", "iis", "hardware" ]
11
16
3,631
4
0
2008-08-06T18:28:04.987000
2008-08-06T18:40:08.393000
3,802
3,874
How do you typeset code elements in normal text?
What is the best way to typeset a function with arguments for readibility, brevity, and accuracy? I tend to put empty parentheses after the function name like func(), even if there are actually arguments for the function. I have trouble including the arguments and still feeling like the paragraph is readable. Any thoug...
I usually take that approach, but if I feel like it's going to cause confusion, I'll use ellipses like: myFunction(...) I guess if I were good, I would use those any time I was omitting parameters from a function in text.
How do you typeset code elements in normal text? What is the best way to typeset a function with arguments for readibility, brevity, and accuracy? I tend to put empty parentheses after the function name like func(), even if there are actually arguments for the function. I have trouble including the arguments and still ...
TITLE: How do you typeset code elements in normal text? QUESTION: What is the best way to typeset a function with arguments for readibility, brevity, and accuracy? I tend to put empty parentheses after the function name like func(), even if there are actually arguments for the function. I have trouble including the ar...
[ "language-agnostic", "format" ]
8
3
454
2
0
2008-08-06T18:28:38.573000
2008-08-06T19:16:06.403000
3,809
3,812
Setup Visual Studio 2005 to print line numbers
How can I get line numbers to print in Visual Studio 2005 when printing code listings?
There is an option in the Print Dialog to do the same (in VS 2005 and 2008 atleast)!
Setup Visual Studio 2005 to print line numbers How can I get line numbers to print in Visual Studio 2005 when printing code listings?
TITLE: Setup Visual Studio 2005 to print line numbers QUESTION: How can I get line numbers to print in Visual Studio 2005 when printing code listings? ANSWER: There is an option in the Print Dialog to do the same (in VS 2005 and 2008 atleast)!
[ "visual-studio", "visual-studio-2005", "line-numbers" ]
11
5
1,487
2
0
2008-08-06T18:32:37.957000
2008-08-06T18:35:41.400000
3,823
3,848
Suggestions for implementing audit tables in SQL Server?
One simple method I've used in the past is basically just creating a second table whose structure mirrors the one I want to audit, and then create an update/delete trigger on the main table. Before a record is updated/deleted, the current state is saved to the audit table via the trigger. While effective, the data in t...
How much writing vs. reading of this table(s) do you expect? I've used a single audit table, with columns for Table, Column, OldValue, NewValue, User, and ChangeDateTime - generic enough to work with any other changes in the DB, and while a LOT of data got written to that table, reports on that data were sparse enough ...
Suggestions for implementing audit tables in SQL Server? One simple method I've used in the past is basically just creating a second table whose structure mirrors the one I want to audit, and then create an update/delete trigger on the main table. Before a record is updated/deleted, the current state is saved to the au...
TITLE: Suggestions for implementing audit tables in SQL Server? QUESTION: One simple method I've used in the past is basically just creating a second table whose structure mirrors the one I want to audit, and then create an update/delete trigger on the main table. Before a record is updated/deleted, the current state ...
[ "sql", "sql-server", "database", "audit" ]
32
19
14,393
6
0
2008-08-06T18:39:33.560000
2008-08-06T18:51:48.793000
3,839
3,860
How do I Concatenate entire result sets in MySQL?
I'm trying out the following query: SELECT A,B,C FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C FROM table WHERE field LIKE '%query' UNION SELECT A,B,C FROM table WHERE field LIKE '%query%' GROUP BY B ORDER BY B ASC LIMIT 5 That's three queries stuck together, kinda sorta. However, the result set that comes ba...
Maybe you should try including a fourth column, stating the table it came from, and then order and group by it: SELECT A,B,C, "query 1" as origin FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C, "query 2" as origin FROM table WHERE field LIKE '%query' UNION SELECT A,B,C, "query 3" as origin FROM table WHERE fie...
How do I Concatenate entire result sets in MySQL? I'm trying out the following query: SELECT A,B,C FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C FROM table WHERE field LIKE '%query' UNION SELECT A,B,C FROM table WHERE field LIKE '%query%' GROUP BY B ORDER BY B ASC LIMIT 5 That's three queries stuck together, ...
TITLE: How do I Concatenate entire result sets in MySQL? QUESTION: I'm trying out the following query: SELECT A,B,C FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C FROM table WHERE field LIKE '%query' UNION SELECT A,B,C FROM table WHERE field LIKE '%query%' GROUP BY B ORDER BY B ASC LIMIT 5 That's three querie...
[ "mysql", "sql", "union" ]
21
16
12,896
8
0
2008-08-06T18:47:24.137000
2008-08-06T18:59:36.467000
3,856
3,880
Adobe Flex component events
I wrote a component that displays a filename, a thumbnail and has a button to load/play the file. The component is databound to a repeater. How can I make it so that the button event fires to the main application and tells it which file to play?
On your custom component you can listen to the button click event and then generate a custom event that holds information about the file you want to play. You can then set the bubbles property to true on the event and dispatch the custom event from your custom component. The bubbles property will make your event float ...
Adobe Flex component events I wrote a component that displays a filename, a thumbnail and has a button to load/play the file. The component is databound to a repeater. How can I make it so that the button event fires to the main application and tells it which file to play?
TITLE: Adobe Flex component events QUESTION: I wrote a component that displays a filename, a thumbnail and has a button to load/play the file. The component is databound to a repeater. How can I make it so that the button event fires to the main application and tells it which file to play? ANSWER: On your custom comp...
[ "apache-flex", "actionscript-3" ]
7
1
3,427
2
0
2008-08-06T18:57:38.313000
2008-08-06T19:25:37.400000
3,859
3,865
What is the difference between all the different types of version control?
After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question. What is the difference between all the different types of version control and is there a guide that anybody knows of for version control that's very simple and easy to understand?
Eric Sink has a good overview of source control. There are also some existing questions here on SO.
What is the difference between all the different types of version control? After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question. What is the difference between all the different types of version control and is there a guide that anybody k...
TITLE: What is the difference between all the different types of version control? QUESTION: After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question. What is the difference between all the different types of version control and is there a gu...
[ "version-control", "language-agnostic" ]
22
15
13,984
13
0
2008-08-06T18:58:53.707000
2008-08-06T19:02:28.303000
3,867
3,941
Automated release script and Visual Studio Setup projects
I think most people here understand the importance of fully automated builds. The problem is one of our project is now using an integrated Visual Studio Setup project (vdproj) and has recently been ported to Visual Studio 2008. Unfortunatly, those won't build in MSBuild and calling devenv.exe /build on 2008 just crashe...
The low cost solution is to switch to using ClickOnce, which you can automate using MSBuild. But if you still need to create a Windows Installer package, you will need to convert your project to WiX (pretty straight foward) and build that with your solution. This will get you started: Automate Releases With MSBuild And...
Automated release script and Visual Studio Setup projects I think most people here understand the importance of fully automated builds. The problem is one of our project is now using an integrated Visual Studio Setup project (vdproj) and has recently been ported to Visual Studio 2008. Unfortunatly, those won't build in...
TITLE: Automated release script and Visual Studio Setup projects QUESTION: I think most people here understand the importance of fully automated builds. The problem is one of our project is now using an integrated Visual Studio Setup project (vdproj) and has recently been ported to Visual Studio 2008. Unfortunatly, th...
[ "visual-studio", "msbuild", "wix", "build-automation", "vdproj" ]
11
6
4,764
3
0
2008-08-06T19:04:51.823000
2008-08-06T20:25:24.673000
3,868
3,958
How can I turn a string of HTML into a DOM object in a Firefox extension?
I'm downloading a web page (tag soup HTML) with XMLHttpRequest and I want to take the output and turn it into a DOM object that I can then run XPATH queries on. How do I convert from a string into DOM object? It appears that the general solution is to create a hidden iframe and throw the contents of the string into tha...
Ajaxian actually had a post on inserting / retrieving html from an iframe today. You can probably use the js snippet they have posted there. As for handling closing of a browser / tab, you can attach to the onbeforeunload ( http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx ) event and do whatever you need to...
How can I turn a string of HTML into a DOM object in a Firefox extension? I'm downloading a web page (tag soup HTML) with XMLHttpRequest and I want to take the output and turn it into a DOM object that I can then run XPATH queries on. How do I convert from a string into DOM object? It appears that the general solution ...
TITLE: How can I turn a string of HTML into a DOM object in a Firefox extension? QUESTION: I'm downloading a web page (tag soup HTML) with XMLHttpRequest and I want to take the output and turn it into a DOM object that I can then run XPATH queries on. How do I convert from a string into DOM object? It appears that the...
[ "javascript", "firefox", "dom" ]
26
10
3,646
5
0
2008-08-06T19:08:19.290000
2008-08-06T20:37:32.260000
3,881
3,886
IllegalArgumentException or NullPointerException for a null parameter?
I have a simple setter method for a property and null is not appropriate for this particular property. I have always been torn in this situation: should I throw an IllegalArgumentException, or a NullPointerException? From the javadocs, both seem appropriate. Is there some kind of an understood standard? Or is this just...
It seems like an IllegalArgumentException is called for if you don't want null to be an allowed value, and the NullPointerException would be thrown if you were trying to use a variable that turns out to be null.
IllegalArgumentException or NullPointerException for a null parameter? I have a simple setter method for a property and null is not appropriate for this particular property. I have always been torn in this situation: should I throw an IllegalArgumentException, or a NullPointerException? From the javadocs, both seem app...
TITLE: IllegalArgumentException or NullPointerException for a null parameter? QUESTION: I have a simple setter method for a property and null is not appropriate for this particular property. I have always been torn in this situation: should I throw an IllegalArgumentException, or a NullPointerException? From the javad...
[ "java", "exception", "null", "nullpointerexception", "illegalargumentexception" ]
578
315
205,983
26
0
2008-08-06T19:26:30.627000
2008-08-06T19:29:24.427000
3,903
3,911
Is this a good way to determine OS Architecture?
Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote up a method using the registry to try and determine whether or not the current system is a 32 or 64bit system. private Boolean is64BitOperatingSystem() { RegistryKey localEnvironment = Registry.LocalMachine.OpenSubK...
Take a look at Raymond Chens solution: How to detect programmatically whether you are running on 64-bit Windows and here's the PINVOKE for.NET: IsWow64Process (kernel32) Update: I'd take issue with checking for 'x86'. Who's to say what intel's or AMD's next 32 bit processor may be designated as. The probability is low ...
Is this a good way to determine OS Architecture? Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote up a method using the registry to try and determine whether or not the current system is a 32 or 64bit system. private Boolean is64BitOperatingSystem() { RegistryKey ...
TITLE: Is this a good way to determine OS Architecture? QUESTION: Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote up a method using the registry to try and determine whether or not the current system is a 32 or 64bit system. private Boolean is64BitOperatingSyste...
[ "c#", "windows", "registry" ]
22
8
6,010
4
0
2008-08-06T19:41:59.813000
2008-08-06T19:49:35.727000
3,927
100,490
What Are Some Good .NET Profilers?
What profilers have you used when working with.net programs, and which would you particularly recommend?
I have used JetBrains dotTrace and Redgate ANTS extensively. They are fairly similar in features and price. They both offer useful performance profiling and quite basic memory profiling. dotTrace integrates with Resharper, which is really convenient, as you can profile the performance of a unit test with one click from...
What Are Some Good .NET Profilers? What profilers have you used when working with.net programs, and which would you particularly recommend?
TITLE: What Are Some Good .NET Profilers? QUESTION: What profilers have you used when working with.net programs, and which would you particularly recommend? ANSWER: I have used JetBrains dotTrace and Redgate ANTS extensively. They are fairly similar in features and price. They both offer useful performance profiling ...
[ "c#", ".net", "profiling", "profiler" ]
373
284
339,312
30
0
2008-08-06T20:14:57.173000
2008-09-19T08:29:08.040000
3,942
4,238
What's the best way to find long-running code in a Windows Forms Application
I inherited a Windows Forms app written in VB.Net. Certain parts of the app run dreadfully slow. What's the easiest way to find which parts of the code are holding things up? I'm looking for a way to quickly find the slowest subroutines and tackle them first in an attempt to speed up the app. I know that there are seve...
I appreciate the desire to find free software. However, in this case, I would strongly recommend looking at all options, including commercial products. I tried to play with nProf (which is at version 0.1 I think) and didn't have much luck. Even so, performance profiling an application is a subtle business and is best a...
What's the best way to find long-running code in a Windows Forms Application I inherited a Windows Forms app written in VB.Net. Certain parts of the app run dreadfully slow. What's the easiest way to find which parts of the code are holding things up? I'm looking for a way to quickly find the slowest subroutines and ta...
TITLE: What's the best way to find long-running code in a Windows Forms Application QUESTION: I inherited a Windows Forms app written in VB.Net. Certain parts of the app run dreadfully slow. What's the easiest way to find which parts of the code are holding things up? I'm looking for a way to quickly find the slowest ...
[ ".net", "vb.net" ]
8
4
1,063
4
0
2008-08-06T20:26:21.923000
2008-08-07T01:01:16.177000
3,975
5,907
How do I know which SQL Server 2005 index recommendations to implement, if any?
We're in the process of upgrading one of our SQL Server instances from 2000 to 2005. I installed the performance dashboard ( http://www.microsoft.com/downloads/details.aspx?FamilyId=1d3a4a0d-7e0c-4730-8204-e419218c1efc&displaylang=en ) for access to some high level reporting. One of the reports shows missing (recommend...
First thing to be aware of: When you upgrade from 2000 to 2005 (by using detach and attach) make sure that you: Set compability to 90 Rebuild the indexes Run update statistics with full scan If you don't do this you will get suboptimal plans. IF the table is mostly write you want as few indexes as possible IF the table...
How do I know which SQL Server 2005 index recommendations to implement, if any? We're in the process of upgrading one of our SQL Server instances from 2000 to 2005. I installed the performance dashboard ( http://www.microsoft.com/downloads/details.aspx?FamilyId=1d3a4a0d-7e0c-4730-8204-e419218c1efc&displaylang=en ) for ...
TITLE: How do I know which SQL Server 2005 index recommendations to implement, if any? QUESTION: We're in the process of upgrading one of our SQL Server instances from 2000 to 2005. I installed the performance dashboard ( http://www.microsoft.com/downloads/details.aspx?FamilyId=1d3a4a0d-7e0c-4730-8204-e419218c1efc&dis...
[ "sql-server", "sql-server-2005" ]
9
4
1,388
3
0
2008-08-06T20:59:58.190000
2008-08-08T13:32:30.550000
3,978
3,998
Multi-Paradigm Languages
In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms. Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?
It all depends on the problem you're trying to solve. Obviously you can solve any problem in either style (procedural or OO), but you usually can figure out in the planning stages before you start writing code which style suits you better. Some people like to write up use cases and if they see a lot of the same nouns s...
Multi-Paradigm Languages In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms. Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?
TITLE: Multi-Paradigm Languages QUESTION: In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms. Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision? ANSWER: It all depends on the proble...
[ "php", "oop", "paradigms", "procedural" ]
22
11
2,133
2
0
2008-08-06T21:02:16.207000
2008-08-06T21:15:35.150000
3,984
418,605
TestDriven.NET is not running my SetUp methods for MbUnit
I've created some MbUnit Test Fixtures that have SetUp methods marked with the SetUp attribute. These methods run before the tests just fine using the MbUnit GUI, the console runner, and the ReSharper MbUnit plugin. However, when I run the tests with TestDriven.NET it does not run the SetUp methods at all. Does anyone ...
No longer an issue with recent versions of Gallio since v3.0.4. Just make sure to use the 64-bit installer.
TestDriven.NET is not running my SetUp methods for MbUnit I've created some MbUnit Test Fixtures that have SetUp methods marked with the SetUp attribute. These methods run before the tests just fine using the MbUnit GUI, the console runner, and the ReSharper MbUnit plugin. However, when I run the tests with TestDriven....
TITLE: TestDriven.NET is not running my SetUp methods for MbUnit QUESTION: I've created some MbUnit Test Fixtures that have SetUp methods marked with the SetUp attribute. These methods run before the tests just fine using the MbUnit GUI, the console runner, and the ReSharper MbUnit plugin. However, when I run the test...
[ ".net", "visual-studio", "tdd", "mbunit", "testdriven.net" ]
21
5
1,549
4
0
2008-08-06T21:06:32.797000
2009-01-06T23:25:47.280000
3,996
4,043
How do I configure a Vista Ultimate (64bit) account so it can access a SMB share on OSX?
I have Windows File sharing enabled on an OS X 10.4 computer. It's accessible via \rudy\myshare for all the Windows users on the network, except for one guy running Vista Ultimate 64-bit edition. All the other users are running Vista or XP, all 32-bit. All the workgroup information is the same, all login with the same ...
Try changing the local security policy on that Vista box for "Local Policies\Security Options\Network Security: LAN manager authentication level" from “Send NTLMv2 response only” to “Send LM & NTLM - use NTLMv2 session security if negotiated”.
How do I configure a Vista Ultimate (64bit) account so it can access a SMB share on OSX? I have Windows File sharing enabled on an OS X 10.4 computer. It's accessible via \rudy\myshare for all the Windows users on the network, except for one guy running Vista Ultimate 64-bit edition. All the other users are running Vis...
TITLE: How do I configure a Vista Ultimate (64bit) account so it can access a SMB share on OSX? QUESTION: I have Windows File sharing enabled on an OS X 10.4 computer. It's accessible via \rudy\myshare for all the Windows users on the network, except for one guy running Vista Ultimate 64-bit edition. All the other use...
[ "macos", "windows-vista", "smb" ]
10
3
1,101
2
0
2008-08-06T21:14:57.507000
2008-08-06T21:50:49.837000
4,034
4,346
Multiple languages in an ASP.NET MVC application?
What is the best way to support multiple languages for the interface in an ASP.NET MVC application? I've seen people use resource files for other applications. Is this still the best way?
If you're using the default view engines, then local resources work in the views. However, if you need to grab resource strings within a controller action, you can't get local resources, and have to use global resources. This makes sense when you think about it because local resources are local to an aspx page and in t...
Multiple languages in an ASP.NET MVC application? What is the best way to support multiple languages for the interface in an ASP.NET MVC application? I've seen people use resource files for other applications. Is this still the best way?
TITLE: Multiple languages in an ASP.NET MVC application? QUESTION: What is the best way to support multiple languages for the interface in an ASP.NET MVC application? I've seen people use resource files for other applications. Is this still the best way? ANSWER: If you're using the default view engines, then local re...
[ "asp.net-mvc", "internationalization", "multilingual" ]
70
43
42,299
6
0
2008-08-06T21:43:33.923000
2008-08-07T03:04:04.320000
4,046
4,902
Example of a build.xml for an EAR that deploys in WebSphere 6
I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow.:P I started a build.xml for a project that generates a JAR file but stopped there and I need real examples to compare notes. My good friends! I do...
My Environment: Fedora 8; WAS 6.1 (as installed with Rational Application Developer 7) The documentation is very poor in this area and there is a dearth of practical examples. Using the WebSphere Application Server (WAS) Ant tasks To run as described here, you need to run them from your server profile bin directory usi...
Example of a build.xml for an EAR that deploys in WebSphere 6 I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow.:P I started a build.xml for a project that generates a JAR file but stopped there an...
TITLE: Example of a build.xml for an EAR that deploys in WebSphere 6 QUESTION: I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow.:P I started a build.xml for a project that generates a JAR file bu...
[ "jakarta-ee", "deployment", "ant", "websphere", "ear" ]
22
14
24,714
4
0
2008-08-06T21:55:24.257000
2008-08-07T16:16:00.010000
4,051
4,192
Passing multidimensional arrays as function arguments in C
In C can I pass a multidimensional array to a function as a single argument when I don't know what the dimensions of the array are going to be? Besides, my multidimensional array may contain types other than strings.
You can do this with any data type. Simply make it a pointer-to-pointer: typedef struct { int myint; char* mystring; } data; data** array; But don't forget you still have to malloc the variable, and it does get a bit complex: //initialize int x,y,w,h; w = 10; //width of array h = 20; //height of array //malloc the 'y...
Passing multidimensional arrays as function arguments in C In C can I pass a multidimensional array to a function as a single argument when I don't know what the dimensions of the array are going to be? Besides, my multidimensional array may contain types other than strings.
TITLE: Passing multidimensional arrays as function arguments in C QUESTION: In C can I pass a multidimensional array to a function as a single argument when I don't know what the dimensions of the array are going to be? Besides, my multidimensional array may contain types other than strings. ANSWER: You can do this w...
[ "c", "function", "multidimensional-array" ]
55
23
82,524
5
0
2008-08-06T22:01:25.463000
2008-08-07T00:34:21.097000
4,052
4,139
How to enable Full-text Indexing in SQL Server 2005 Express?
I am trying to enable Full-text indexing in SQL Server 2005 Express. I am running this on my laptop with Vista Ultimate. I understand that the standard version of SQL Server Express does not have full-text indexing. I have already downloaded and installed "Microsoft SQL Server 2005 Express Edition with Advanced Service...
sp_fulltext_database 'enable' CREATE FULLTEXT CATALOG [myFullText] WITH ACCENT_SENSITIVITY = ON CREATE FULLTEXT INDEX ON [dbo].[tblName] KEY INDEX [PK_something] ON [myFullText] WITH CHANGE_TRACKING AUTO ALTER FULLTEXT INDEX ON [dbo].[otherTable] ADD ([Text]) ALTER FULLTEXT INDEX ON [dbo].[teyOtherTable] ENABLE
How to enable Full-text Indexing in SQL Server 2005 Express? I am trying to enable Full-text indexing in SQL Server 2005 Express. I am running this on my laptop with Vista Ultimate. I understand that the standard version of SQL Server Express does not have full-text indexing. I have already downloaded and installed "Mi...
TITLE: How to enable Full-text Indexing in SQL Server 2005 Express? QUESTION: I am trying to enable Full-text indexing in SQL Server 2005 Express. I am running this on my laptop with Vista Ultimate. I understand that the standard version of SQL Server Express does not have full-text indexing. I have already downloaded...
[ "sql-server", "sql-server-2005", "full-text-search" ]
18
14
16,716
3
0
2008-08-06T22:02:33.993000
2008-08-06T23:46:30.210000
4,062
4,222
What methods of caching, other than to file or database, are available?
Currently I know of only two ways to cache data (I use PHP but I assume that the same will apply to most languages). Save the cache to a file Save the cache to a large DB field Are there any other (perhaps better) ways of caching or is it really just this simple?
Maybe you want to explicit more precisely what you want to cache. You have all this opportunities to cache: Accessing the Data Base where you cache the data first correctly tuning your RDBMS, then using a layer to delegate the decision to detect multiple queries for the same data (with AdoDB for example.) Extracting ca...
What methods of caching, other than to file or database, are available? Currently I know of only two ways to cache data (I use PHP but I assume that the same will apply to most languages). Save the cache to a file Save the cache to a large DB field Are there any other (perhaps better) ways of caching or is it really ju...
TITLE: What methods of caching, other than to file or database, are available? QUESTION: Currently I know of only two ways to cache data (I use PHP but I assume that the same will apply to most languages). Save the cache to a file Save the cache to a large DB field Are there any other (perhaps better) ways of caching ...
[ "language-agnostic", "caching" ]
13
2
717
4
0
2008-08-06T22:21:55.373000
2008-08-07T00:46:58.467000
4,072
13,738
SVN merge merged extra stuff
I just did a merge using something like: svn merge -r 67212:67213 https://my.svn.repository/trunk. I only had 2 files, one of which is a simple ChangeLog. Rather than just merging my ChangeLog changes, it actually pulled mine plus some previous ones that were not in the destination ChangeLog. I noticed there was a conf...
This only happens with conflicts - basically svn tried to merge the change in, but (roughly speaking) saw the change as: Add 2008-08-06 Mike Stone * changed_file: Details. before 2008-08-06 Someone Else And it couldn't find the Someone Else line while doing the merge, so chucked that bit in for context when putting in ...
SVN merge merged extra stuff I just did a merge using something like: svn merge -r 67212:67213 https://my.svn.repository/trunk. I only had 2 files, one of which is a simple ChangeLog. Rather than just merging my ChangeLog changes, it actually pulled mine plus some previous ones that were not in the destination ChangeLo...
TITLE: SVN merge merged extra stuff QUESTION: I just did a merge using something like: svn merge -r 67212:67213 https://my.svn.repository/trunk. I only had 2 files, one of which is a simple ChangeLog. Rather than just merging my ChangeLog changes, it actually pulled mine plus some previous ones that were not in the de...
[ "svn", "merge" ]
13
2
1,202
2
0
2008-08-06T22:30:26.387000
2008-08-17T17:17:46.193000
4,080
79,845
What code analysis tools do you use for your Java projects?
What code analysis tools do you use on your Java projects? I am interested in all kinds static code analysis tools (FindBugs, PMD, and any others) code coverage tools (Cobertura, Emma, and any others) any other instrumentation-based tools anything else, if I'm missing something If applicable, also state what build tool...
For static analysis tools I often use CPD, PMD, FindBugs, and Checkstyle. CPD is the PMD "Copy/Paste Detector" tool. I was using PMD for a little while before I noticed the "Finding Duplicated Code" link on the PMD web page. I'd like to point out that these tools can sometimes be extended beyond their "out-of-the-box" ...
What code analysis tools do you use for your Java projects? What code analysis tools do you use on your Java projects? I am interested in all kinds static code analysis tools (FindBugs, PMD, and any others) code coverage tools (Cobertura, Emma, and any others) any other instrumentation-based tools anything else, if I'm...
TITLE: What code analysis tools do you use for your Java projects? QUESTION: What code analysis tools do you use on your Java projects? I am interested in all kinds static code analysis tools (FindBugs, PMD, and any others) code coverage tools (Cobertura, Emma, and any others) any other instrumentation-based tools any...
[ "java", "code-coverage", "static-analysis" ]
118
72
42,369
12
0
2008-08-06T22:45:27.543000
2008-09-17T04:02:23.067000
4,110
4,126
What program can I use to generate diagrams of SQL view/table structure?
I've been tasked with redesigning part of a ms-sql database structure which currently involves a lot of views, some of which contain joins to other views. Anyway, I wonder if anyone here could recommend a utility to automatically generate diagrams to help me visualise the whole structure. What's the best program you've...
I am a big fan of Embarcadero's ER/Studio. It is very powerful and produces excellent on-screen as well as printed results. They have a free trial as well, so you should be able to get in and give it a shot without too much strife. Good luck!
What program can I use to generate diagrams of SQL view/table structure? I've been tasked with redesigning part of a ms-sql database structure which currently involves a lot of views, some of which contain joins to other views. Anyway, I wonder if anyone here could recommend a utility to automatically generate diagrams...
TITLE: What program can I use to generate diagrams of SQL view/table structure? QUESTION: I've been tasked with redesigning part of a ms-sql database structure which currently involves a lot of views, some of which contain joins to other views. Anyway, I wonder if anyone here could recommend a utility to automatically...
[ "sql", "sql-server", "database", "diagram" ]
15
4
4,865
5
0
2008-08-06T23:19:50.500000
2008-08-06T23:36:58.547000
4,138
4,140
SVN Client Ignore Pattern for VB.NET Solutions
What is the best SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution?
this is what I use for C# w/resharper, should work just the same with vb.net: build deploy */bin */bin/* obj *.dll *.pdb *.user *.suo _ReSharper* *.resharper* bin
SVN Client Ignore Pattern for VB.NET Solutions What is the best SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution?
TITLE: SVN Client Ignore Pattern for VB.NET Solutions QUESTION: What is the best SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution? ANSWER: this is what I use for C# w/resharper, should work just the same with vb.net: build deploy */bin */bin/* obj *.dll *.pdb *.user *.suo _ReSharper* *.resharper* bin
[ "vb.net", "svn", "tortoisesvn" ]
17
17
1,974
2
0
2008-08-06T23:46:24.673000
2008-08-06T23:48:46.353000
4,149
154,588
How do I use Java to read from a file that is actively being written to?
I have an application that writes information to file. This information is used post-execution to determine pass/failure/correctness of the application. I'd like to be able to read the file as it is being written so that I can do these pass/failure/correctness checks in real time. I assume it is possible to do this, bu...
Could not get the example to work using FileChannel.read(ByteBuffer) because it isn't a blocking read. Did however get the code below to work: boolean running = true; BufferedInputStream reader = new BufferedInputStream(new FileInputStream( "out.txt" ) ); public void run() { while( running ) { if( reader.available() >...
How do I use Java to read from a file that is actively being written to? I have an application that writes information to file. This information is used post-execution to determine pass/failure/correctness of the application. I'd like to be able to read the file as it is being written so that I can do these pass/failur...
TITLE: How do I use Java to read from a file that is actively being written to? QUESTION: I have an application that writes information to file. This information is used post-execution to determine pass/failure/correctness of the application. I'd like to be able to read the file as it is being written so that I can do...
[ "java", "file", "file-io" ]
109
46
61,485
9
0
2008-08-06T23:57:10.173000
2008-09-30T19:32:24.637000
4,157
4,220
ConfigurationManager.AppSettings Performance Concerns
I plan to be storing all my config settings in my application's app.config section (using the ConfigurationManager.AppSettings class). As the user changes settings using the app's UI (clicking checkboxes, choosing radio buttons, etc.), I plan to be writing those changes out to the AppSettings. At the same time, while t...
since you're using a winforms app, if it's in.net 2.0 there's actually a user settings system (called Properties) that is designed for this purpose. This article on MSDN has a pretty good introduction into this If you're still worried about performance then take a look at SQL Compact Edition which is similar to SQLite ...
ConfigurationManager.AppSettings Performance Concerns I plan to be storing all my config settings in my application's app.config section (using the ConfigurationManager.AppSettings class). As the user changes settings using the app's UI (clicking checkboxes, choosing radio buttons, etc.), I plan to be writing those cha...
TITLE: ConfigurationManager.AppSettings Performance Concerns QUESTION: I plan to be storing all my config settings in my application's app.config section (using the ConfigurationManager.AppSettings class). As the user changes settings using the app's UI (clicking checkboxes, choosing radio buttons, etc.), I plan to be...
[ "c#", ".net", "performance", "configuration", "properties" ]
27
10
6,942
8
0
2008-08-07T00:12:55.663000
2008-08-07T00:45:37.393000
4,164
4,209
What is a good barebones CMS or framework?
I'm about to start a project for a customer who wants CMS-like functionality. They want users to be able to log in, modify a profile, and a basic forum. They also wish to be able to submit things to a front page. Is there a framework or barebones CMS that I could expand on or tailor to my needs? I don't need anything a...
if you are looking.net you can take a look at umbraco, haven't done much with it (company i work for wanted much more functionality so went with something else) but it seemed lightweight. Edit: if the customer wants a tiny CMS with a forum, I would still probably just go Drupal with phpBB or simple machines forum, almo...
What is a good barebones CMS or framework? I'm about to start a project for a customer who wants CMS-like functionality. They want users to be able to log in, modify a profile, and a basic forum. They also wish to be able to submit things to a front page. Is there a framework or barebones CMS that I could expand on or ...
TITLE: What is a good barebones CMS or framework? QUESTION: I'm about to start a project for a customer who wants CMS-like functionality. They want users to be able to log in, modify a profile, and a basic forum. They also wish to be able to submit things to a front page. Is there a framework or barebones CMS that I c...
[ "frameworks", "content-management-system" ]
16
0
7,297
17
0
2008-08-07T00:20:03.607000
2008-08-07T00:39:23.070000
4,168
4,577
Graph serialization
I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compile time. I know it must be a fairly common thing to do - compilers do it all the time - but my google-fu has been weak t...
Topological Sort (From Wikipedia): In graph theory, a topological sort or topological ordering of a directed acyclic graph (DAG) is a linear ordering of its nodes in which each node comes before all nodes to which it has outbound edges. Every DAG has one or more topological sorts. Pseudo code: L ← Empty list where we p...
Graph serialization I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compile time. I know it must be a fairly common thing to do - compilers do it all the time - but my googl...
TITLE: Graph serialization QUESTION: I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compile time. I know it must be a fairly common thing to do - compilers do it all the t...
[ "algorithm", "sorting", "graph-algorithm", "directed-graph" ]
48
67
51,571
4
0
2008-08-07T00:22:54.007000
2008-08-07T10:53:31.237000
4,170
4,204
How to learn ADO.NET
I need to learn ADO.NET to build applications based on MS Office. I have read a good deal about ADO.NET in the MSDN Library, but everything seems rather messy to me. What are the basics one must figure out when using ADO.NET? I think a few key words will suffice to let me organize my learning.
There are three key components (assuming ur using SQL server): SQLConnection SqlCommand SqlDataReader (if you're using something else, replace Sql with "Something", like MySqlConnection, OracleCommand ) Everything else is just built on top of that. Example 1: using (SqlConnection connection = new SqlConnection("CONNECT...
How to learn ADO.NET I need to learn ADO.NET to build applications based on MS Office. I have read a good deal about ADO.NET in the MSDN Library, but everything seems rather messy to me. What are the basics one must figure out when using ADO.NET? I think a few key words will suffice to let me organize my learning.
TITLE: How to learn ADO.NET QUESTION: I need to learn ADO.NET to build applications based on MS Office. I have read a good deal about ADO.NET in the MSDN Library, but everything seems rather messy to me. What are the basics one must figure out when using ADO.NET? I think a few key words will suffice to let me organize...
[ "ado.net" ]
17
6
1,216
2
0
2008-08-07T00:25:03.457000
2008-08-07T00:37:04.727000
4,208
4,332
Windows Equivalent of 'nice'
Is there a Windows equivalent of the Unix command, nice? I'm specifically looking for something I can use at the command line, and not the "Set Priority" menu from the task manager. My attempts at finding this on Google have been thwarted by those who can't come up with better adjectives.
If you want to set priority when launching a process you could use the built-in START command: START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [/B] [command/program] [parameters] Use the low through belownormal options to set p...
Windows Equivalent of 'nice' Is there a Windows equivalent of the Unix command, nice? I'm specifically looking for something I can use at the command line, and not the "Set Priority" menu from the task manager. My attempts at finding this on Google have been thwarted by those who can't come up with better adjectives.
TITLE: Windows Equivalent of 'nice' QUESTION: Is there a Windows equivalent of the Unix command, nice? I'm specifically looking for something I can use at the command line, and not the "Set Priority" menu from the task manager. My attempts at finding this on Google have been thwarted by those who can't come up with be...
[ "windows", "unix", "process-management" ]
80
71
38,492
4
0
2008-08-07T00:39:17.453000
2008-08-07T02:49:21.107000
4,219
4,228
SVN vs. Team Foundation Server
A few months back my team switched our source control over to Apache Subversion from Visual SourceSafe, and we haven't been happier. Recently I've been looking at Team Foundation Server, and at least on the surface, it seems very impressive. There is some great integration with Visual Studio, and lots of great tools fo...
I joined an Open Source project over at CodePlex, recently. They use TFS for their source control and I have to say that it's absolutely magnificent. I'm incredibly impressed with it, so far. I'm a huge fan of the IDE integration and how easy it is to branch and tag your code. Adding a solution to source control is som...
SVN vs. Team Foundation Server A few months back my team switched our source control over to Apache Subversion from Visual SourceSafe, and we haven't been happier. Recently I've been looking at Team Foundation Server, and at least on the surface, it seems very impressive. There is some great integration with Visual Stu...
TITLE: SVN vs. Team Foundation Server QUESTION: A few months back my team switched our source control over to Apache Subversion from Visual SourceSafe, and we haven't been happier. Recently I've been looking at Team Foundation Server, and at least on the surface, it seems very impressive. There is some great integrati...
[ "svn", "tfs" ]
77
46
56,008
26
0
2008-08-07T00:43:33.700000
2008-08-07T00:52:27.130000
4,225
4,281
Territory Map Generation
Is there a trivial, or at least moderately straight-forward way to generate territory maps (e.g. Risk)? I have looked in the past and the best I could find were vague references to Voronoi diagrams. An example of a Voronoi diagram is this:. These hold promise, but I guess i haven't seen any straight-forward ways of ren...
The best reference I've seen on them is Computational Geometry: Algorithms and Applications, which covers Voronoi diagrams, Delaunay triangulations (similar to Voronoi diagrams and each can be converted into the other), and other similar data structures. They talk about all the data structures you need but they don't g...
Territory Map Generation Is there a trivial, or at least moderately straight-forward way to generate territory maps (e.g. Risk)? I have looked in the past and the best I could find were vague references to Voronoi diagrams. An example of a Voronoi diagram is this:. These hold promise, but I guess i haven't seen any str...
TITLE: Territory Map Generation QUESTION: Is there a trivial, or at least moderately straight-forward way to generate territory maps (e.g. Risk)? I have looked in the past and the best I could find were vague references to Voronoi diagrams. An example of a Voronoi diagram is this:. These hold promise, but I guess i ha...
[ "language-agnostic", "maps", "voronoi" ]
17
7
1,400
4
0
2008-08-07T00:48:04.953000
2008-08-07T01:47:54.133000
4,227
4,735,712
Accessing a Dictionary.Keys Key through a numeric index
I'm using a Dictionary where the int is a count of the key. Now, I need to access the last-inserted Key inside the Dictionary, but I do not know the name of it. The obvious attempt: int LastCount = mydict[mydict.keys[mydict.keys.Count]]; does not work, because Dictionary.Keys does not implement a []-indexer. I just won...
As @Falanwe points out in a comment, doing something like this is incorrect: int LastCount = mydict.Keys.ElementAt(mydict.Count -1); You should not depend on the order of keys in a Dictionary. If you need ordering, you should use an OrderedDictionary, as suggested in this answer. The other answers on this page are inte...
Accessing a Dictionary.Keys Key through a numeric index I'm using a Dictionary where the int is a count of the key. Now, I need to access the last-inserted Key inside the Dictionary, but I do not know the name of it. The obvious attempt: int LastCount = mydict[mydict.keys[mydict.keys.Count]]; does not work, because Dic...
TITLE: Accessing a Dictionary.Keys Key through a numeric index QUESTION: I'm using a Dictionary where the int is a count of the key. Now, I need to access the last-inserted Key inside the Dictionary, but I do not know the name of it. The obvious attempt: int LastCount = mydict[mydict.keys[mydict.keys.Count]]; does not...
[ "c#", ".net", "dictionary" ]
167
233
280,163
15
0
2008-08-07T00:51:21.720000
2011-01-19T13:21:27.887000
4,230
4,244
The Difference Between a DataGrid and a GridView in ASP.NET?
I've been doing ASP.NET development for a little while now, and I've used both the GridView and the DataGrid controls before for various things, but I never could find a really good reason to use one or the other. I'd like to know: What is the difference between these 2 ASP.NET controls? What are the advantages or disa...
DataGrid was an ASP.NET 1.1 control, still supported. GridView arrived in 2.0, made certain tasks simpler added different databinding features: This link has a comparison of DataGrid and GridView features - https://msdn.microsoft.com/en-us/library/05yye6k9(v=vs.100).aspx
The Difference Between a DataGrid and a GridView in ASP.NET? I've been doing ASP.NET development for a little while now, and I've used both the GridView and the DataGrid controls before for various things, but I never could find a really good reason to use one or the other. I'd like to know: What is the difference betw...
TITLE: The Difference Between a DataGrid and a GridView in ASP.NET? QUESTION: I've been doing ASP.NET development for a little while now, and I've used both the GridView and the DataGrid controls before for various things, but I never could find a really good reason to use one or the other. I'd like to know: What is t...
[ "asp.net" ]
53
47
79,726
9
0
2008-08-07T00:54:31.883000
2008-08-07T01:06:22.687000
4,234
4,260
What to use for Messaging with C#
So my company stores alot of data in a foxpro database and trying to get around the performance hit of touching it directly I was thinking of messaging anything that can be done asynchronously for a snappier user experience. I started looking at ActiveMQ but don't know how well C# will hook with it. Wanting to hear wha...
ActiveMQ works well with C# using the Spring.NET integrations and NMS. A post with some links to get you started in that direction is here. Also consider using MSMQ (The System.Messaging namespace) or a.NET based asynchronous messaging solution, with some options here.
What to use for Messaging with C# So my company stores alot of data in a foxpro database and trying to get around the performance hit of touching it directly I was thinking of messaging anything that can be done asynchronously for a snappier user experience. I started looking at ActiveMQ but don't know how well C# will...
TITLE: What to use for Messaging with C# QUESTION: So my company stores alot of data in a foxpro database and trying to get around the performance hit of touching it directly I was thinking of messaging anything that can be done asynchronously for a snappier user experience. I started looking at ActiveMQ but don't kno...
[ "c#", "messaging" ]
14
8
7,065
7
0
2008-08-07T00:56:41.880000
2008-08-07T01:20:13.890000
4,242
4,247
Why doesn't Java autoboxing extend to method invocations of methods of the autoboxed types?
I want to convert a primitive to a string, and I tried: myInt.toString(); This fails with the error: int cannot be dereferenced Now, I get that primitives are not reference types (ie, not an Object) and so cannot have methods. However, Java 5 introduced autoboxing and unboxing (a la C#... which I never liked in C#, but...
Java autoboxing/unboxing doesn't go to the extent to allow you to dereference a primitive, so your compiler prevents it. Your compiler still knows myInt as a primitive. There's a paper about this issue at jcp.org. Autoboxing is mainly useful during assignment or parameter passing -- allowing you to pass a primitive as ...
Why doesn't Java autoboxing extend to method invocations of methods of the autoboxed types? I want to convert a primitive to a string, and I tried: myInt.toString(); This fails with the error: int cannot be dereferenced Now, I get that primitives are not reference types (ie, not an Object) and so cannot have methods. H...
TITLE: Why doesn't Java autoboxing extend to method invocations of methods of the autoboxed types? QUESTION: I want to convert a primitive to a string, and I tried: myInt.toString(); This fails with the error: int cannot be dereferenced Now, I get that primitives are not reference types (ie, not an Object) and so cann...
[ "java", "autoboxing" ]
53
47
7,101
8
0
2008-08-07T01:05:15.420000
2008-08-07T01:09:17.547000
4,246
4,271
What is best practice for FTP from a SQL Server 2005 stored procedure?
What is the best method for executing FTP commands from a SQL Server stored procedure? we currently use something like this: EXEC master..xp_cmdshell 'ftp -n -s:d:\ftp\ftpscript.xmt 172.1.1.1' The problem is that the command seems to succeed even if the FTP ended in error. Also, the use of xp_cmdshell requires special ...
If you're running SQL 2005 you could do this in a CLR integration assembly and use the FTP classes in the System.Net namespace to build a simple FTP client. You'd benefit from being able to trap and handle exceptions and reduce the security risk of having to use xp_cmdshell. Just some thoughts.
What is best practice for FTP from a SQL Server 2005 stored procedure? What is the best method for executing FTP commands from a SQL Server stored procedure? we currently use something like this: EXEC master..xp_cmdshell 'ftp -n -s:d:\ftp\ftpscript.xmt 172.1.1.1' The problem is that the command seems to succeed even if...
TITLE: What is best practice for FTP from a SQL Server 2005 stored procedure? QUESTION: What is the best method for executing FTP commands from a SQL Server stored procedure? we currently use something like this: EXEC master..xp_cmdshell 'ftp -n -s:d:\ftp\ftpscript.xmt 172.1.1.1' The problem is that the command seems ...
[ "sql-server", "ftp" ]
15
5
6,792
3
0
2008-08-07T01:09:04.820000
2008-08-07T01:29:43.200000
4,287
4,304
How Do You Determine The PID of the Parent of a Process
I have a process in erlang that is supposed to do something immediately after spawn, then send the result back to the parent when it is finished. How do I figure out the PID of the process that spawned it?
You should pass self() to the child as one of the arguments to the entry function. spawn_link(?MODULE, child, [self()]).
How Do You Determine The PID of the Parent of a Process I have a process in erlang that is supposed to do something immediately after spawn, then send the result back to the parent when it is finished. How do I figure out the PID of the process that spawned it?
TITLE: How Do You Determine The PID of the Parent of a Process QUESTION: I have a process in erlang that is supposed to do something immediately after spawn, then send the result back to the parent when it is finished. How do I figure out the PID of the process that spawned it? ANSWER: You should pass self() to the c...
[ "erlang" ]
16
15
3,539
4
0
2008-08-07T01:54:12.107000
2008-08-07T02:27:32.740000
4,303
4,310
Why should I practice Test Driven Development and how should I start?
Lots of people talk about writing tests for their code before they start writing their code. This practice is generally known as Test Driven Development or TDD for short. What benefits do I gain from writing software this way? How do I get started with this practice?
There are a lot of benefits: You get immediate feedback on if your code is working, so you can find bugs faster By seeing the test go from red to green, you know that you have both a working regression test, and working code You gain confidence to refactor existing code, which means you can clean up code without worryi...
Why should I practice Test Driven Development and how should I start? Lots of people talk about writing tests for their code before they start writing their code. This practice is generally known as Test Driven Development or TDD for short. What benefits do I gain from writing software this way? How do I get started wi...
TITLE: Why should I practice Test Driven Development and how should I start? QUESTION: Lots of people talk about writing tests for their code before they start writing their code. This practice is generally known as Test Driven Development or TDD for short. What benefits do I gain from writing software this way? How d...
[ "testing", "tdd" ]
60
37
8,400
4
0
2008-08-07T02:27:03.397000
2008-08-07T02:33:10.437000
4,306
4,311
What is the best way to create a sparse array in C++?
I am working on a project that requires the manipulation of enormous matrices, specifically pyramidal summation for a copula calculation. In short, I need to keep track of a relatively small number of values (usually a value of 1, and in rare cases more than 1) in a sea of zeros in the matrix (multidimensional array). ...
For C++, a map works well. Several million objects won't be a problem. 10 million items took about 4.4 seconds and about 57 meg on my computer. My test application is as follows: #include #include #include class triple { public: int x; int y; int z; bool operator<(const triple &other) const { if (x < other.x) return tr...
What is the best way to create a sparse array in C++? I am working on a project that requires the manipulation of enormous matrices, specifically pyramidal summation for a copula calculation. In short, I need to keep track of a relatively small number of values (usually a value of 1, and in rare cases more than 1) in a...
TITLE: What is the best way to create a sparse array in C++? QUESTION: I am working on a project that requires the manipulation of enormous matrices, specifically pyramidal summation for a copula calculation. In short, I need to keep track of a relatively small number of values (usually a value of 1, and in rare cases...
[ "c++", "oop", "data-structures", "hash", "maps" ]
63
33
62,005
11
0
2008-08-07T02:29:58.180000
2008-08-07T02:33:16.973000
4,314
4,322
What is Object Mocking and when do I need it?
Many people use Mock Objects when they are writing unit tests. What is a Mock Object? Why would I ever need one? Do I need a Mock Object Framework?
Object Mocking is used to keep dependencies out of your unit test. Sometimes you'll have a test like "SelectPerson" which will select a person from the database and return a Person object. To do this, you would normally need a dependency on the database, however with object mocking you can simulate the interaction with...
What is Object Mocking and when do I need it? Many people use Mock Objects when they are writing unit tests. What is a Mock Object? Why would I ever need one? Do I need a Mock Object Framework?
TITLE: What is Object Mocking and when do I need it? QUESTION: Many people use Mock Objects when they are writing unit tests. What is a Mock Object? Why would I ever need one? Do I need a Mock Object Framework? ANSWER: Object Mocking is used to keep dependencies out of your unit test. Sometimes you'll have a test lik...
[ "testing", "mocking" ]
45
36
11,657
9
0
2008-08-07T02:37:07.807000
2008-08-07T02:43:59.340000
4,335
13,097
High availability
Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster. Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available I would like to redirect traffic to ...
You need to use a layer 4 load balancer in front of the two endpoints. Prob best to stick with a dedicated piece of hardware.
High availability Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster. Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available I would like to re...
TITLE: High availability QUESTION: Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster. Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available ...
[ "c#", ".net", "wcf", "soa" ]
20
10
3,771
4
0
2008-08-07T02:50:13.320000
2008-08-16T11:38:55.397000
4,347
4,597
Where is a good place to start programming GUIs for windows?
I have experience writing console and network client/server applications in C and C++, but I know next to nothing about using the win32 visual API, MFC, Qt, wxWidgets, etc. Where is a good place to start, and what method should I specialize in, so as to be future ready and robust?
This is a rather broad question, as programming GUI applications in Windows can be done in so many ways. There are two main parts to developing any GUI app: the language and the API/framework. Considering you're interested in learning to build Windows GUI apps, the language isn't really a point of focus for you. Hence,...
Where is a good place to start programming GUIs for windows? I have experience writing console and network client/server applications in C and C++, but I know next to nothing about using the win32 visual API, MFC, Qt, wxWidgets, etc. Where is a good place to start, and what method should I specialize in, so as to be fu...
TITLE: Where is a good place to start programming GUIs for windows? QUESTION: I have experience writing console and network client/server applications in C and C++, but I know next to nothing about using the win32 visual API, MFC, Qt, wxWidgets, etc. Where is a good place to start, and what method should I specialize ...
[ "winapi", "qt", "mfc" ]
26
43
4,457
9
0
2008-08-07T03:06:19.870000
2008-08-07T11:24:54.997000
4,363
4,386
What is the best way to do unit testing for ASP.NET 2.0 web pages?
Any suggestions? Using visual studio in C#. Are there any specific tools to use or methods to approach this? Update: Sorry, I should have been a little more specific. I am using ASP.Net 2.0 and was looking more for a tool like jUnit for Java. I took a look at NUnit and NUnitAsp and that looks very promising. And I didn...
Boy, that's a pretty general question. I'll do my best, but be prepared to see me miss by a mile. Assumptions You are using ASP.NET, not plain ASP You don't really want to test your web pages, but the logic behind them. Unit testing the actual.ASPX pages is rather painful, but there are frameworks out there to do it. N...
What is the best way to do unit testing for ASP.NET 2.0 web pages? Any suggestions? Using visual studio in C#. Are there any specific tools to use or methods to approach this? Update: Sorry, I should have been a little more specific. I am using ASP.Net 2.0 and was looking more for a tool like jUnit for Java. I took a l...
TITLE: What is the best way to do unit testing for ASP.NET 2.0 web pages? QUESTION: Any suggestions? Using visual studio in C#. Are there any specific tools to use or methods to approach this? Update: Sorry, I should have been a little more specific. I am using ASP.Net 2.0 and was looking more for a tool like jUnit fo...
[ "c#", "asp.net", "visual-studio", "unit-testing" ]
41
34
10,933
7
0
2008-08-07T03:23:45.983000
2008-08-07T04:23:38
4,369
4,385
How to include PHP files that require an absolute path?
I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want the directory structure like that for a specific reason. When executing script...
This should work $root = realpath($_SERVER["DOCUMENT_ROOT"]); include "$root/inc/include1.php"; Edit: added imporvement by aussieviking
How to include PHP files that require an absolute path? I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want the directory structur...
TITLE: How to include PHP files that require an absolute path? QUESTION: I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want the ...
[ "php" ]
99
157
145,225
11
0
2008-08-07T03:46:47.713000
2008-08-07T04:20:47.647000
4,371
4,376
How do I retrieve my MySQL username and password?
I lost my MySQL username and password. How do I retrieve it?
Stop the MySQL process. Start the MySQL process with the --skip-grant-tables option. Start the MySQL console client with the -u root option. List all the users; SELECT * FROM mysql.user; Reset password; UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]'; But DO NOT FORGET to Stop the MySQL pr...
How do I retrieve my MySQL username and password? I lost my MySQL username and password. How do I retrieve it?
TITLE: How do I retrieve my MySQL username and password? QUESTION: I lost my MySQL username and password. How do I retrieve it? ANSWER: Stop the MySQL process. Start the MySQL process with the --skip-grant-tables option. Start the MySQL console client with the -u root option. List all the users; SELECT * FROM mysql.u...
[ "mysql", "mysql-workbench" ]
192
204
870,872
10
0
2008-08-07T03:54:14.593000
2008-08-07T04:02:17.090000
4,393
4,401
Drop all tables whose names begin with a certain string
How can I drop all tables whose names begin with a given string? I think this can be done with some dynamic SQL and the INFORMATION_SCHEMA tables.
You may need to modify the query to include the owner if there's more than one in the database. DECLARE @cmd varchar(4000) DECLARE cmds CURSOR FOR SELECT 'drop table [' + Table_Name + ']' FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name LIKE 'prefix%' OPEN cmds WHILE 1 = 1 BEGIN FETCH cmds INTO @cmd IF @@fetch_status!=...
Drop all tables whose names begin with a certain string How can I drop all tables whose names begin with a given string? I think this can be done with some dynamic SQL and the INFORMATION_SCHEMA tables.
TITLE: Drop all tables whose names begin with a certain string QUESTION: How can I drop all tables whose names begin with a given string? I think this can be done with some dynamic SQL and the INFORMATION_SCHEMA tables. ANSWER: You may need to modify the query to include the owner if there's more than one in the data...
[ "sql", "sql-server", "dynamic-sql" ]
181
181
276,753
18
0
2008-08-07T04:41:37.713000
2008-08-07T04:53:29.857000
4,416
4,427
Where can I get the Windows Workflow "wca.exe" application?
I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you provide it. I can't find that file. I thought it would be in the latest.NET 3.5 SD...
Should be part of the.NET 3 SDK (and later version as well). If you've already installed this, the path might look something like C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\wca.exe More info on Guy Burstein's blog.
Where can I get the Windows Workflow "wca.exe" application? I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you provide it. I can't fi...
TITLE: Where can I get the Windows Workflow "wca.exe" application? QUESTION: I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you prov...
[ ".net-3.5" ]
5
1
904
2
0
2008-08-07T05:13:31.020000
2008-08-07T05:40:18.733000
4,418
4,431
How do I update Ruby Gems from behind a Proxy (ISA-NTLM)
The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?... or am I just being lazy? Note: rubysspi-1.2.4 does not work. This also works for "igem", part of the IronRuby project
I wasn't able to get mine working from the command-line switch but I have been able to do it just by setting my HTTP_PROXY environment variable. (Note that case seems to be important). I have a batch file that has a line like this in it: SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT% I set the four referenced ...
How do I update Ruby Gems from behind a Proxy (ISA-NTLM) The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?... or am I just being lazy? Note: rubysspi-1.2.4 does not work. This also works for "i...
TITLE: How do I update Ruby Gems from behind a Proxy (ISA-NTLM) QUESTION: The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?... or am I just being lazy? Note: rubysspi-1.2.4 does not work. This...
[ "ruby", "proxy", "rubygems", "ironruby" ]
240
218
267,382
20
0
2008-08-07T05:21:16.807000
2008-08-07T05:49:00.557000
4,430
12,585
How to easily consume a web service from PHP
Is there available any tool for PHP which can be used to generate code for consuming a web service based on its WSDL? Something comparable to clicking "Add Web Reference" in Visual Studio or the Eclipse plugin which does the same thing for Java.
I've had great success with wsdl2php. It will automatically create wrapper classes for all objects and methods used in your web service.
How to easily consume a web service from PHP Is there available any tool for PHP which can be used to generate code for consuming a web service based on its WSDL? Something comparable to clicking "Add Web Reference" in Visual Studio or the Eclipse plugin which does the same thing for Java.
TITLE: How to easily consume a web service from PHP QUESTION: Is there available any tool for PHP which can be used to generate code for consuming a web service based on its WSDL? Something comparable to clicking "Add Web Reference" in Visual Studio or the Eclipse plugin which does the same thing for Java. ANSWER: I'...
[ "php", "web-services", "visual-studio", "wsdl" ]
62
21
174,079
6
0
2008-08-07T05:48:33.570000
2008-08-15T18:36:14.227000
4,432
4,441
CSV string handling
Typical way of creating a CSV string (pseudocode): Create a CSV container object (like a StringBuilder in C#). Loop through the strings you want to add appending a comma after each one. After the loop, remove that last superfluous comma. Code sample: public string ReturnAsCSV(ContactList contactList) { StringBuilder sb...
You could use LINQ to Objects: string [] strings = contactList.Select(c => c.Name).ToArray(); string csv = string.Join(",", strings); Obviously that could all be done in one line, but it's a bit clearer on two.
CSV string handling Typical way of creating a CSV string (pseudocode): Create a CSV container object (like a StringBuilder in C#). Loop through the strings you want to add appending a comma after each one. After the loop, remove that last superfluous comma. Code sample: public string ReturnAsCSV(ContactList contactList...
TITLE: CSV string handling QUESTION: Typical way of creating a CSV string (pseudocode): Create a CSV container object (like a StringBuilder in C#). Loop through the strings you want to add appending a comma after each one. After the loop, remove that last superfluous comma. Code sample: public string ReturnAsCSV(Conta...
[ "c#", "csv" ]
21
21
9,598
13
0
2008-08-07T05:49:04.253000
2008-08-07T05:56:15.957000
4,434
4,443
Can I configure Visual Studio NOT to change StartUp Project every time I open a file from one of the projects?
Let's say that there is a solution that contains two projects (Project1 and Project2). Project1 is set as a StartUp Project (its name is displayed in a bold font). I double-click some file in Project2 to open it. The file opens, but something else happens too - Project2 gets set as a StartUp Project. I tried to find an...
The way to select a startup project is described in Sara Ford's blog "Visual Studio Tip of the Day " (highly recommended). She has a post there about setting up StartUp projects. Essentially there are 2 ways, the easiest one being right-clicking on the desired project, and choosing "Set As StartUp Project". That preven...
Can I configure Visual Studio NOT to change StartUp Project every time I open a file from one of the projects? Let's say that there is a solution that contains two projects (Project1 and Project2). Project1 is set as a StartUp Project (its name is displayed in a bold font). I double-click some file in Project2 to open ...
TITLE: Can I configure Visual Studio NOT to change StartUp Project every time I open a file from one of the projects? QUESTION: Let's say that there is a solution that contains two projects (Project1 and Project2). Project1 is set as a StartUp Project (its name is displayed in a bold font). I double-click some file in...
[ ".net", "visual-studio", "ide" ]
23
19
10,141
5
0
2008-08-07T05:50:57.013000
2008-08-07T05:58:25.810000
4,458
7,070
Domain Specific Language resources
I was just listening to some older.Net Rocks! episodes, and I found #329 on DSLs to be interesting. My problem is that I can't find any good online resources for people trying to learn this technology. I get the basics of the creating new designers, but the MS docs on the T4 engine used by the DSL tools and then how to...
The architects of the DSL Tools team wrote a book, Domain-Specific Development with Visual Studio DSL Tools. The book's website has some other links and resources.
Domain Specific Language resources I was just listening to some older.Net Rocks! episodes, and I found #329 on DSLs to be interesting. My problem is that I can't find any good online resources for people trying to learn this technology. I get the basics of the creating new designers, but the MS docs on the T4 engine us...
TITLE: Domain Specific Language resources QUESTION: I was just listening to some older.Net Rocks! episodes, and I found #329 on DSLs to be interesting. My problem is that I can't find any good online resources for people trying to learn this technology. I get the basics of the creating new designers, but the MS docs o...
[ "t4", "dsl", "vsx" ]
12
5
1,517
12
0
2008-08-07T06:24:33.870000
2008-08-10T06:59:42.607000
4,506
4,527
How to know when to send a 304 Not Modified response
I'm writing a resource handling method where I control access to various files, and I'd like to be able to make use of the browser's cache. My question is two-fold: Which are the definitive HTTP headers that I need to check in order to know for sure whether I should send a 304 response, and what am I looking for when I...
Here's how I implemented it. The code has been working for a bit more than a year and with multiple browsers, so I think it's pretty reliable. This is based on RFC 2616 and by observing what and when the various browsers were sending. Here's the pseudocode: server_etag = gen_etag_for_this_file(myfile) etag_from_browser...
How to know when to send a 304 Not Modified response I'm writing a resource handling method where I control access to various files, and I'd like to be able to make use of the browser's cache. My question is two-fold: Which are the definitive HTTP headers that I need to check in order to know for sure whether I should ...
TITLE: How to know when to send a 304 Not Modified response QUESTION: I'm writing a resource handling method where I control access to various files, and I'd like to be able to make use of the browser's cache. My question is two-fold: Which are the definitive HTTP headers that I need to check in order to know for sure...
[ "language-agnostic", "http" ]
12
8
5,252
5
0
2008-08-07T07:54:37.013000
2008-08-07T08:30:16.113000
4,508
38,383
MAPI and managed code experiences?
Using MAPI functions from within managed code is officially unsupported. Apparently, MAPI uses its own memory management and it crashes and burns within managed code (see here and here ) All I want to do is launch the default e-mail client with subject, body, AND one or more attachments. So I've been looking into MAPIS...
Have a separate helper EXE that takes command-line params (or pipe to its StandardInput) that does what is required and call that from your main app. This keeps the MAPI stuff outside of your main app's process space. OK, you're still mixing MAPI and.NET but in a very short-lived process. The assumption is that MAPI an...
MAPI and managed code experiences? Using MAPI functions from within managed code is officially unsupported. Apparently, MAPI uses its own memory management and it crashes and burns within managed code (see here and here ) All I want to do is launch the default e-mail client with subject, body, AND one or more attachmen...
TITLE: MAPI and managed code experiences? QUESTION: Using MAPI functions from within managed code is officially unsupported. Apparently, MAPI uses its own memory management and it crashes and burns within managed code (see here and here ) All I want to do is launch the default e-mail client with subject, body, AND one...
[ ".net", "email", "pinvoke", "mapi" ]
13
8
4,341
8
0
2008-08-07T07:56:24.327000
2008-09-01T20:26:46.720000
4,519
4,691
Using Xming X Window Server over a VPN
I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers. It works fine when I connect directly to the company network in the office. However, it does not work when I connect to the network remotely over a VPN. When I start Xming when connected remotely none ...
Chances are it's either X authentication, the X server binding to an interface, or your DISPLAY variable. I don't use Xming myself but there are some general phenomenon to check for. One test you can do to manually verify the DISPLAY variable is correct is: Start your VPN. Run ipconfig to be sure you have the two IP ad...
Using Xming X Window Server over a VPN I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers. It works fine when I connect directly to the company network in the office. However, it does not work when I connect to the network remotely over a VPN. When I st...
TITLE: Using Xming X Window Server over a VPN QUESTION: I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers. It works fine when I connect directly to the company network in the office. However, it does not work when I connect to the network remotely ove...
[ "unix", "vpn", "xming" ]
5
6
41,201
9
0
2008-08-07T08:20:47.100000
2008-08-07T13:11:03.067000
4,529
4,547
SQL Server 2005 and 2008 on same developer machine?
Has anyone tried installing SQL Server 2008 Developer on a machine that already has 2005 Developer installed? I am unsure if I should do this, and I need to keep 2005 on this machine for the foreseeable future in order to test our application easily. Since I sometimes need to take backup files of databases and make ava...
Yes this is possible. You will have to create a named instance not used by another version of SQL Server as per the previous answer and version 3.5 of.Net installed. Works great!! Here the list of prerequisites:.NET Framework 3.5 SP1 Windows Installer 4.5 Windows PowerShell 1.0
SQL Server 2005 and 2008 on same developer machine? Has anyone tried installing SQL Server 2008 Developer on a machine that already has 2005 Developer installed? I am unsure if I should do this, and I need to keep 2005 on this machine for the foreseeable future in order to test our application easily. Since I sometimes...
TITLE: SQL Server 2005 and 2008 on same developer machine? QUESTION: Has anyone tried installing SQL Server 2008 Developer on a machine that already has 2005 Developer installed? I am unsure if I should do this, and I need to keep 2005 on this machine for the foreseeable future in order to test our application easily....
[ "sql-server-2005", "sql-server-2008", "installation" ]
21
23
25,930
7
0
2008-08-07T08:35:30.753000
2008-08-07T09:30:58.253000
4,533
4,540
HTTP: Generating ETag Header
How do I generate an ETag HTTP header for a resource file?
An etag is an arbitrary string that the server sends to the client that the client will send back to the server the next time the file is requested. The etag should be computable on the server based on the file. Sort of like a checksum, but you might not want to checksum every file sending it out. server client <-----...
HTTP: Generating ETag Header How do I generate an ETag HTTP header for a resource file?
TITLE: HTTP: Generating ETag Header QUESTION: How do I generate an ETag HTTP header for a resource file? ANSWER: An etag is an arbitrary string that the server sends to the client that the client will send back to the server the next time the file is requested. The etag should be computable on the server based on the...
[ "language-agnostic", "http", "webserver", "header", "etag" ]
32
17
29,169
7
0
2008-08-07T08:45:07.300000
2008-08-07T08:57:37.993000
4,541
106,093
Simple MOLAP solution
To analyze lots of text logs I did some hackery that looks like this: Locally import logs into Access Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k) Use Excel to visualize Cube (it is not big - up to milions raw entries) My hackery is a succes and more people are demanding an access to my T...
You could also try the other free open source OLAP server, PALO from Jedox (www.palo.net)
Simple MOLAP solution To analyze lots of text logs I did some hackery that looks like this: Locally import logs into Access Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k) Use Excel to visualize Cube (it is not big - up to milions raw entries) My hackery is a succes and more people are deman...
TITLE: Simple MOLAP solution QUESTION: To analyze lots of text logs I did some hackery that looks like this: Locally import logs into Access Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k) Use Excel to visualize Cube (it is not big - up to milions raw entries) My hackery is a succes and mor...
[ "database", "logging", "text-files", "olap" ]
5
3
1,565
4
0
2008-08-07T08:58:18.460000
2008-09-19T22:16:28.277000
4,544
6,996
Http Auth in a Firefox 3 bookmarklet
I'm trying to create a bookmarklet for posting del.icio.us bookmarks to a separate account. I tested it from the command line like: wget -O - --no-check-certificate \ "https://seconduser:thepassword@api.del.icio.us/v1/posts/add?url=http://seet.dk&description=test" This works great. I then wanted to create a bookmarklet...
Can you sniff the traffic to find what's actually being sent? Is it sending any auth data at all and it's incorrect or being presented in a form the server doesn't like, or is it never being sent by firefox at all?
Http Auth in a Firefox 3 bookmarklet I'm trying to create a bookmarklet for posting del.icio.us bookmarks to a separate account. I tested it from the command line like: wget -O - --no-check-certificate \ "https://seconduser:thepassword@api.del.icio.us/v1/posts/add?url=http://seet.dk&description=test" This works great. ...
TITLE: Http Auth in a Firefox 3 bookmarklet QUESTION: I'm trying to create a bookmarklet for posting del.icio.us bookmarks to a separate account. I tested it from the command line like: wget -O - --no-check-certificate \ "https://seconduser:thepassword@api.del.icio.us/v1/posts/add?url=http://seet.dk&description=test" ...
[ "javascript", "firefox", "delicious-api" ]
18
4
1,480
4
0
2008-08-07T09:08:52.260000
2008-08-10T02:04:32.530000
4,545
4,549
What was the <XMP> tag used for?
Does anyone remember the XMP tag? What was it used for and why was it deprecated?
A quick Google search on W3C reveals that XMP was introduced for displaying preformatted text in HTML 3.2 and earlier. When W3C deprecated the XMP tag, it suggested using the PRE tag as a preferred alternative. Update: http://www.w3.org/TR/REC-html32#xmp, http://www.w3.org/MarkUp/html-spec/html-spec_5.html#SEC5.5.2.1
What was the <XMP> tag used for? Does anyone remember the XMP tag? What was it used for and why was it deprecated?
TITLE: What was the <XMP> tag used for? QUESTION: Does anyone remember the XMP tag? What was it used for and why was it deprecated? ANSWER: A quick Google search on W3C reveals that XMP was introduced for displaying preformatted text in HTML 3.2 and earlier. When W3C deprecated the XMP tag, it suggested using the PRE...
[ "html", "tags" ]
81
37
54,165
8
0
2008-08-07T09:21:41.563000
2008-08-07T09:43:28.353000
4,556
4,562
DataTable Loop Performance Comparison
Which of the following has the best performance? I have seen method two implemented in JavaScript with huge performance gains, however, I was unable to measure any gain in C# and was wondering if the compiler already does method 2 even when written like method 1. The theory behind method 2 is that the code doesn't have...
No, it can't do that since there is no way to express constant over time for a value. If the compiler should be able to do that, there would have to be a guarantee from the code returning the value that the value is constant, and for the duration of the loop won't change. But, in this case, you're free to add new rows ...
DataTable Loop Performance Comparison Which of the following has the best performance? I have seen method two implemented in JavaScript with huge performance gains, however, I was unable to measure any gain in C# and was wondering if the compiler already does method 2 even when written like method 1. The theory behind ...
TITLE: DataTable Loop Performance Comparison QUESTION: Which of the following has the best performance? I have seen method two implemented in JavaScript with huge performance gains, however, I was unable to measure any gain in C# and was wondering if the compiler already does method 2 even when written like method 1. ...
[ "c#", "performance", "loops" ]
13
6
8,063
1
0
2008-08-07T10:01:04.823000
2008-08-07T10:09:58.703000
4,610
4,615
How can I create Prototype Methods (like JavaScript) in C#.Net?
How is it possible to make prototype methods in C#.Net? In JavaScript, I can do the following to create a trim method for the string object: String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } How can I go about doing this in C#.Net?
You can't dynamically add methods to existing objects or classes in.NET, except by changing the source for that class. You can, however, in C# 3.0, use extension methods, which look like new methods, but are compile-time magic. To do this for your code: public static class StringExtensions { public static String trim(t...
How can I create Prototype Methods (like JavaScript) in C#.Net? How is it possible to make prototype methods in C#.Net? In JavaScript, I can do the following to create a trim method for the string object: String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } How can I go about doing this in C#.Ne...
TITLE: How can I create Prototype Methods (like JavaScript) in C#.Net? QUESTION: How is it possible to make prototype methods in C#.Net? In JavaScript, I can do the following to create a trim method for the string object: String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } How can I go about d...
[ "c#", ".net" ]
20
22
11,030
4
0
2008-08-07T12:00:50.540000
2008-08-07T12:04:11.907000
4,612
29,283
CSharpCodeProvider Compilation Performance
Is CompileAssemblyFromDom faster than CompileAssemblyFromSource? It should be as it presumably bypasses the compiler front-end.
CompileAssemblyFromDom compiles to a.cs file which is then run through the normal C# compiler. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.CSharp; using System.CodeDom; using System.IO; using System.CodeDom.Compiler; using System.Reflection; namespace ...
CSharpCodeProvider Compilation Performance Is CompileAssemblyFromDom faster than CompileAssemblyFromSource? It should be as it presumably bypasses the compiler front-end.
TITLE: CSharpCodeProvider Compilation Performance QUESTION: Is CompileAssemblyFromDom faster than CompileAssemblyFromSource? It should be as it presumably bypasses the compiler front-end. ANSWER: CompileAssemblyFromDom compiles to a.cs file which is then run through the normal C# compiler. Example: using System; usin...
[ "c#", "performance", "compiler-construction" ]
20
9
3,326
2
0
2008-08-07T12:01:14.503000
2008-08-27T01:03:17.197000
4,617
4,712
What is a good Mercurial usage pattern for this setup?
We've got two developers on the same closed (ugh, stupid gov) network, Another developer a couple minutes drive down the road, and a fourth developer half-way across the country. E-Mail, ftp, and removal media are all possible methods of transfer for the people not on the same network. I am one of the two closed networ...
The users outside the network can make patches, and/or use email to send the updates to the main repo or someone, like yourself to merge them. The other internal people can have local copies, like yourself and do merges --but if you are having these out of network patches, it might be better that one person deal with t...
What is a good Mercurial usage pattern for this setup? We've got two developers on the same closed (ugh, stupid gov) network, Another developer a couple minutes drive down the road, and a fourth developer half-way across the country. E-Mail, ftp, and removal media are all possible methods of transfer for the people not...
TITLE: What is a good Mercurial usage pattern for this setup? QUESTION: We've got two developers on the same closed (ugh, stupid gov) network, Another developer a couple minutes drive down the road, and a fourth developer half-way across the country. E-Mail, ftp, and removal media are all possible methods of transfer ...
[ "version-control", "mercurial", "dvcs" ]
14
1
1,180
3
0
2008-08-07T12:05:48.410000
2008-08-07T13:37:30.300000
4,622
4,626
SQL Case Expression Syntax?
What is the complete and correct syntax for the SQL Case expression?
The complete syntax depends on the database engine you're working with: For SQL Server: CASE case-expression WHEN when-expression-1 THEN value-1 [ WHEN when-expression-n THEN value-n... ] [ ELSE else-value ] END or: CASE WHEN boolean-when-expression-1 THEN value-1 [ WHEN boolean-when-expression-n THEN value-n... ] [ EL...
SQL Case Expression Syntax? What is the complete and correct syntax for the SQL Case expression?
TITLE: SQL Case Expression Syntax? QUESTION: What is the complete and correct syntax for the SQL Case expression? ANSWER: The complete syntax depends on the database engine you're working with: For SQL Server: CASE case-expression WHEN when-expression-1 THEN value-1 [ WHEN when-expression-n THEN value-n... ] [ ELSE e...
[ "sql" ]
63
82
174,529
7
0
2008-08-07T12:13:01.390000
2008-08-07T12:20:22.827000
4,627
4,649
Upgrade to ASP.NET 3.x
I am currently aware that ASP.NET 2.0 is out and about and that there are 3.x versions of the.Net Framework. Is it possible to upgrade my ASP.NET web server to version 3.x of the.Net Framework? I have tried this, however, when selecting which version of the.Net framwork to use in IIS (the ASP.NET Tab), only version 1.1...
if I install 3.5 and have IIS setup to use 2.0. I will be able to use 3.5 features? Yes, that is correct. You have IIS set to 2.0 for both 2.0 and 3.5 sites, as they both run on the same CLR. 3.5 uses a different compile method than 2.0. This is declared in the web.config for the site. See this post for more details on...
Upgrade to ASP.NET 3.x I am currently aware that ASP.NET 2.0 is out and about and that there are 3.x versions of the.Net Framework. Is it possible to upgrade my ASP.NET web server to version 3.x of the.Net Framework? I have tried this, however, when selecting which version of the.Net framwork to use in IIS (the ASP.NET...
TITLE: Upgrade to ASP.NET 3.x QUESTION: I am currently aware that ASP.NET 2.0 is out and about and that there are 3.x versions of the.Net Framework. Is it possible to upgrade my ASP.NET web server to version 3.x of the.Net Framework? I have tried this, however, when selecting which version of the.Net framwork to use i...
[ "asp.net", ".net-3.5" ]
13
5
1,424
6
0
2008-08-07T12:21:25.070000
2008-08-07T12:41:49.897000
4,629
4,637
How can I evaluate C# code dynamically?
I can do an eval("something()"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#? An example of what I am trying to do is: I have an integer variable (say i ) and I have multiple properties by the names: "Property1", "Property2", "Property3", etc. Now, I want to perform s...
DISCLAIMER: This answer was written back in 2008. The landscape has changed drastically since then. Look at the other answers on this page, especially the one detailing Microsoft.CodeAnalysis.CSharp.Scripting. Rest of answer will be left as it was originally posted but is no longer accurate. Unfortunately, C# isn't a d...
How can I evaluate C# code dynamically? I can do an eval("something()"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#? An example of what I am trying to do is: I have an integer variable (say i ) and I have multiple properties by the names: "Property1", "Property2", "P...
TITLE: How can I evaluate C# code dynamically? QUESTION: I can do an eval("something()"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#? An example of what I am trying to do is: I have an integer variable (say i ) and I have multiple properties by the names: "Property1...
[ "c#", "reflection", "properties", "c#-2.0" ]
114
51
83,535
16
0
2008-08-07T12:26:46.917000
2008-08-07T12:31:18.530000
4,630
478,658
How can I Java webstart multiple, dependent, native libraries?
Example: I have two shared objects (same should apply to.dlls). The first shared object is from a third-party library, we'll call it libA.so. I have wrapped some of this with JNI and created my own library, libB.so. Now libB depends on libA. When webstarting, both libraries are places in some webstart working area. My ...
Static compilation proved to be the only way to webstart multiple dependent native libraries.
How can I Java webstart multiple, dependent, native libraries? Example: I have two shared objects (same should apply to.dlls). The first shared object is from a third-party library, we'll call it libA.so. I have wrapped some of this with JNI and created my own library, libB.so. Now libB depends on libA. When webstartin...
TITLE: How can I Java webstart multiple, dependent, native libraries? QUESTION: Example: I have two shared objects (same should apply to.dlls). The first shared object is from a third-party library, we'll call it libA.so. I have wrapped some of this with JNI and created my own library, libB.so. Now libB depends on lib...
[ "java", "java-native-interface", "java-web-start" ]
17
5
2,743
3
0
2008-08-07T12:26:50.707000
2009-01-26T01:47:13.227000
4,638
4,650
How do you create your own moniker (URL Protocol) on Windows systems?
How do you create your own custom moniker (or URL Protocol) on Windows systems? Examples: http: mailto: service:
Take a look at Creating and Using URL Monikers, About Asynchronous Pluggable Protocols and Registering an Application to a URL Protocol from MSDN
How do you create your own moniker (URL Protocol) on Windows systems? How do you create your own custom moniker (or URL Protocol) on Windows systems? Examples: http: mailto: service:
TITLE: How do you create your own moniker (URL Protocol) on Windows systems? QUESTION: How do you create your own custom moniker (or URL Protocol) on Windows systems? Examples: http: mailto: service: ANSWER: Take a look at Creating and Using URL Monikers, About Asynchronous Pluggable Protocols and Registering an Appl...
[ "windows", "winapi", "moniker" ]
13
4
4,616
3
0
2008-08-07T12:31:42.413000
2008-08-07T12:42:06.683000
4,661
4,777
How do I use more than one OpenID?
I have more than one OpenID as I have tried out numerous. As people take up OpenID different suppliers are going to emerge I may want to switch provinders. As all IDs are me, and all are authenticated against the same email address, shouldn't I be able to log into stack overflow with any of them and be able to hit the ...
I think each site that implements OpenID would have to build their software to allow multiple entries for your OpenID credentials. However, just because a site doesn't allow you to create multiple entries doesn't mean you can't swap out OpenID suppliers. How to turn your blog into an OpenID STEP 1: Get an OpenID. There...
How do I use more than one OpenID? I have more than one OpenID as I have tried out numerous. As people take up OpenID different suppliers are going to emerge I may want to switch provinders. As all IDs are me, and all are authenticated against the same email address, shouldn't I be able to log into stack overflow with ...
TITLE: How do I use more than one OpenID? QUESTION: I have more than one OpenID as I have tried out numerous. As people take up OpenID different suppliers are going to emerge I may want to switch provinders. As all IDs are me, and all are authenticated against the same email address, shouldn't I be able to log into st...
[ "openid" ]
16
23
1,935
6
0
2008-08-07T12:51:38.910000
2008-08-07T14:36:06.890000
4,664
4,672
Should the folders in a solution match the namespace?
Should the folders in a solution match the namespace? In one of my teams projects, we have a class library that has many sub-folders in the project. Project Name and Namespace: MyCompany.Project.Section. Within this project, there are several folders that match the namespace section: Folder Vehicles has classes in the ...
Also, note that if you use the built-in templates to add classes to a folder, it will by default be put in a namespace that reflects the folder hierarchy. The classes will be easier to find and that alone should be reasons good enough. The rules we follow are: Project/assembly name is the same as the root namespace, ex...
Should the folders in a solution match the namespace? Should the folders in a solution match the namespace? In one of my teams projects, we have a class library that has many sub-folders in the project. Project Name and Namespace: MyCompany.Project.Section. Within this project, there are several folders that match the ...
TITLE: Should the folders in a solution match the namespace? QUESTION: Should the folders in a solution match the namespace? In one of my teams projects, we have a class library that has many sub-folders in the project. Project Name and Namespace: MyCompany.Project.Section. Within this project, there are several folde...
[ "c#", ".net", "namespaces" ]
166
89
63,962
7
0
2008-08-07T12:53:19.217000
2008-08-07T12:58:21.267000
4,665
4,687
Verifying files for testing
I was working with quality yesterday doing some formal testing. In their procedure they were verifying all files on the test machine were pulled from the release. The way they were verifying these files were the same was by checking the size and the date/time stamp windows put on them in Windows Explorer. These happene...
The only 100% way to figure out if two files are equal is to do a binary comparison of the two. If you can live with the risk of false positives (ie. two files which aren't 100% identical but your code says they are), then the digest and checksum algorithms can be used to lessen the work, particularly if the files live...
Verifying files for testing I was working with quality yesterday doing some formal testing. In their procedure they were verifying all files on the test machine were pulled from the release. The way they were verifying these files were the same was by checking the size and the date/time stamp windows put on them in Win...
TITLE: Verifying files for testing QUESTION: I was working with quality yesterday doing some formal testing. In their procedure they were verifying all files on the test machine were pulled from the release. The way they were verifying these files were the same was by checking the size and the date/time stamp windows ...
[ "windows", "testing" ]
7
3
824
5
0
2008-08-07T12:54:51.057000
2008-08-07T13:07:12.747000
4,677
5,453
How do I create a Class using the Singleton Design Pattern in Ruby?
The singleton pattern is a design pattern that is used to restrict instantiation of a class to one object instance. Although I know how to code the singleton pattern in C++ and Java, I was wondering if anyone know how to implement it in Ruby?
Actually, the above answer was not completely correct. require 'singleton' class Example include Singleton end You also need to include the require 'singleton' statement.
How do I create a Class using the Singleton Design Pattern in Ruby? The singleton pattern is a design pattern that is used to restrict instantiation of a class to one object instance. Although I know how to code the singleton pattern in C++ and Java, I was wondering if anyone know how to implement it in Ruby?
TITLE: How do I create a Class using the Singleton Design Pattern in Ruby? QUESTION: The singleton pattern is a design pattern that is used to restrict instantiation of a class to one object instance. Although I know how to code the singleton pattern in C++ and Java, I was wondering if anyone know how to implement it ...
[ "ruby", "design-patterns", "singleton" ]
11
10
1,640
3
0
2008-08-07T13:00:07.690000
2008-08-07T22:52:25.653000
4,684
4,706
Automating VMWare or VirtualPC
I'm currently experimenting with build script, and since I have an ASP.net Web Part under source control, my build script should do that at the end: Grab the "naked" Windows 2003 IIS VMWare or Virtual PC Image from the Network Boot it up Copy the Files from the Build Folder to the Server Install it Do whatever else is ...
With VMWare, there is the Virtual Machine Automation APIs (VIX API). You can find the reference guide here. It works with VMWare Server and WorkStation, but AFAIK it's not available for ESX Server. From the main page for VIX: The VIX API allows you to write scripts and programs that automate virtual machine operations....
Automating VMWare or VirtualPC I'm currently experimenting with build script, and since I have an ASP.net Web Part under source control, my build script should do that at the end: Grab the "naked" Windows 2003 IIS VMWare or Virtual PC Image from the Network Boot it up Copy the Files from the Build Folder to the Server ...
TITLE: Automating VMWare or VirtualPC QUESTION: I'm currently experimenting with build script, and since I have an ASP.net Web Part under source control, my build script should do that at the end: Grab the "naked" Windows 2003 IIS VMWare or Virtual PC Image from the Network Boot it up Copy the Files from the Build Fol...
[ "vmware", "virtualization" ]
21
21
3,408
5
0
2008-08-07T13:05:38.040000
2008-08-07T13:31:29.733000
4,689
4,704
Recommended Fonts for Programming?
What fonts do you use for programming, and for what language/IDE? I use Consolas for all my Visual Studio work, any other recommendations?
Either Consolas (download) or Andale Mono (download). I mostly use Andale Mono. I wrote an article about programming fonts a long time ago, I think Consolas wasn't even out yet. http://www.deadprogrammer.com/photos/fonts.gif I find that typing Illegal1 = O0 is a good test of suitability.
Recommended Fonts for Programming? What fonts do you use for programming, and for what language/IDE? I use Consolas for all my Visual Studio work, any other recommendations?
TITLE: Recommended Fonts for Programming? QUESTION: What fonts do you use for programming, and for what language/IDE? I use Consolas for all my Visual Studio work, any other recommendations? ANSWER: Either Consolas (download) or Andale Mono (download). I mostly use Andale Mono. I wrote an article about programming fo...
[ "fonts", "development-environment" ]
182
196
253,030
114
0
2008-08-07T13:08:44.070000
2008-08-07T13:28:17.040000
4,724
4,755
Why should I learn Lisp?
I really feel that I should learn Lisp and there are plenty of good resources out there to help me do it. I'm not put off by the complicated syntax, but where in "traditional commercial programming" would I find places it would make sense to use it instead of a procedural language. Is there a commercial killer-app out ...
One of the main uses for Lisp is in Artificial Intelligence. A friend of mine at college took a graduate AI course and for his main project he wrote a " Lights Out " solver in Lisp. Multiple versions of his program utilized slightly different AI routines and testing on 40 or so computers yielded some pretty neat result...
Why should I learn Lisp? I really feel that I should learn Lisp and there are plenty of good resources out there to help me do it. I'm not put off by the complicated syntax, but where in "traditional commercial programming" would I find places it would make sense to use it instead of a procedural language. Is there a c...
TITLE: Why should I learn Lisp? QUESTION: I really feel that I should learn Lisp and there are plenty of good resources out there to help me do it. I'm not put off by the complicated syntax, but where in "traditional commercial programming" would I find places it would make sense to use it instead of a procedural lang...
[ "functional-programming", "lisp" ]
133
59
61,098
29
0
2008-08-07T13:54:03.137000
2008-08-07T14:22:36.603000
4,738
4,746
Using ConfigurationManager to load config from an arbitrary location
I'm developing a data access component that will be used in a website that contains a mix of classic ASP and ASP.NET pages, and need a good way to manage its configuration settings. I'd like to use a custom ConfigurationSection, and for the ASP.NET pages this works great. But when the component is called via COM intero...
Try this: System.Configuration.ConfigurationFileMap fileMap = new ConfigurationFileMap(strConfigPath); //Path to your config file System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
Using ConfigurationManager to load config from an arbitrary location I'm developing a data access component that will be used in a website that contains a mix of classic ASP and ASP.NET pages, and need a good way to manage its configuration settings. I'd like to use a custom ConfigurationSection, and for the ASP.NET pa...
TITLE: Using ConfigurationManager to load config from an arbitrary location QUESTION: I'm developing a data access component that will be used in a website that contains a mix of classic ASP and ASP.NET pages, and need a good way to manage its configuration settings. I'd like to use a custom ConfigurationSection, and ...
[ "asp.net", "configuration", "asp-classic" ]
135
131
114,438
9
0
2008-08-07T14:07:21.033000
2008-08-07T14:14:44.187000