Dataset Viewer
Auto-converted to Parquet Duplicate
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
4
7
How to convert Decimal to Double in C#?
I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal trans = trackBar1.Value / 5000; this.Opacity = trans; When I build the app it gives the following error: Cannot implicitly convert type decimal to double
An explicit cast to double like this isn't necessary: double trans = (double) trackBar1.Value / 5000.0; Identifying the constant as 5000.0 (or as 5000d ) is sufficient: double trans = trackBar1.Value / 5000.0; double trans = trackBar1.Value / 5000d;
How to convert Decimal to Double in C#? I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal trans = trackBar1.Value / 5000; this.Opacity = trans; When I build the app it gives the following error: Cannot implicitly convert type decimal to double
TITLE: How to convert Decimal to Double in C#? QUESTION: I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal trans = trackBar1.Value / 5000; this.Opacity = trans; When I build the app it gives the following error: Cannot implicitly convert type decimal to double ANSWER: An exp...
[ "c#", "floating-point", "type-conversion", "double", "decimal" ]
806
529
76,733
13
0
2008-07-31T21:42:52.667000
2008-07-31T22:17:57.883000
6
31
Why did the width collapse in the percentage width child element in an absolutely positioned parent on Internet Explorer 7?
I have an absolutely positioned div containing several children, one of which is a relatively positioned div. When I use a percentage-based width on the child div, it collapses to 0 width on IE7, but not on Firefox or Safari. If I use pixel width, it works. If the parent is relatively positioned, the percentage width o...
The parent div needs to have a defined width, either in pixels or as a percentage. In Internet Explorer 7, the parent div needs a defined width for child percentage div s to work correctly.
Why did the width collapse in the percentage width child element in an absolutely positioned parent on Internet Explorer 7? I have an absolutely positioned div containing several children, one of which is a relatively positioned div. When I use a percentage-based width on the child div, it collapses to 0 width on IE7, ...
TITLE: Why did the width collapse in the percentage width child element in an absolutely positioned parent on Internet Explorer 7? QUESTION: I have an absolutely positioned div containing several children, one of which is a relatively positioned div. When I use a percentage-based width on the child div, it collapses t...
[ "html", "css", "internet-explorer-7" ]
320
160
24,503
7
0
2008-07-31T22:08:08.620000
2008-08-01T12:22:51.593000
9
1,404
How do I calculate someone's age based on a DateTime type birthday?
Given a DateTime representing a person's birthday, how do I calculate their age in years?
An easy to understand and simple solution. // Save today's date. var today = DateTime.Today; // Calculate the age. var age = today.Year - birthdate.Year; // Go back to the year in which the person was born in case of a leap year if (birthdate.Date > today.AddYears(-age)) age--; However, this assumes you are looking f...
How do I calculate someone's age based on a DateTime type birthday? Given a DateTime representing a person's birthday, how do I calculate their age in years?
TITLE: How do I calculate someone's age based on a DateTime type birthday? QUESTION: Given a DateTime representing a person's birthday, how do I calculate their age in years? ANSWER: An easy to understand and simple solution. // Save today's date. var today = DateTime.Today; // Calculate the age. var age = today.Yea...
[ "c#", ".net", "datetime" ]
2,248
2,417
827,598
75
0
2008-07-31T23:40:59.743000
2008-08-04T16:50:06.170000
11
1,248
Calculate relative time in C#
Given a specific DateTime value, how do I display relative time, like: 2 hours ago 3 days ago a month ago
Jeff, your code is nice but could be clearer with constants (as suggested in Code Complete). const int SECOND = 1; const int MINUTE = 60 * SECOND; const int HOUR = 60 * MINUTE; const int DAY = 24 * HOUR; const int MONTH = 30 * DAY; var ts = new TimeSpan(DateTime.UtcNow.Ticks - yourDate.Ticks); double delta = Math.Abs(...
Calculate relative time in C# Given a specific DateTime value, how do I display relative time, like: 2 hours ago 3 days ago a month ago
TITLE: Calculate relative time in C# QUESTION: Given a specific DateTime value, how do I display relative time, like: 2 hours ago 3 days ago a month ago ANSWER: Jeff, your code is nice but could be clearer with constants (as suggested in Code Complete). const int SECOND = 1; const int MINUTE = 60 * SECOND; const int ...
[ "c#", "datetime", "time", "datediff", "relative-time-span" ]
1,653
1,070
202,800
42
0
2008-07-31T23:55:37.967000
2008-08-04T13:57:26.097000
16
12,446
Filling a DataSet or a DataTable from a LINQ query result set
How do you expose a LINQ query as an ASMX web service? Usually, from the business tier, I can return a typed DataSet or a DataTable which can be serialized for transport over ASMX. How can I do the same for a LINQ query? Is there a way to populate a typed DataSet or a DataTable via a LINQ query? public static MyDataTab...
As mentioned in the question, IEnumerable has a CopyToDataTable method: IEnumerable query = from order in orders.AsEnumerable() where order.Field ("OrderDate") > new DateTime(2001, 8, 1) select order; // Create a table from the query. DataTable boundTable = query.CopyToDataTable (); Why won't that work for you?
Filling a DataSet or a DataTable from a LINQ query result set How do you expose a LINQ query as an ASMX web service? Usually, from the business tier, I can return a typed DataSet or a DataTable which can be serialized for transport over ASMX. How can I do the same for a LINQ query? Is there a way to populate a typed Da...
TITLE: Filling a DataSet or a DataTable from a LINQ query result set QUESTION: How do you expose a LINQ query as an ASMX web service? Usually, from the business tier, I can return a typed DataSet or a DataTable which can be serialized for transport over ASMX. How can I do the same for a LINQ query? Is there a way to p...
[ "c#", "linq", "web-services", ".net-3.5" ]
159
99
88,393
7
0
2008-08-01T04:59:33.643000
2008-08-15T16:27:31.600000
17
26
Binary Data in MySQL
How do I store binary data in MySQL?
The answer by phpguy is correct but I think there is a lot of confusion in the additional details there. The basic answer is in a BLOB data type / attribute domain. BLOB is short for Binary Large Object and that column data type is specific for handling binary data. See the relevant manual page for MySQL.
Binary Data in MySQL How do I store binary data in MySQL?
TITLE: Binary Data in MySQL QUESTION: How do I store binary data in MySQL? ANSWER: The answer by phpguy is correct but I think there is a lot of confusion in the additional details there. The basic answer is in a BLOB data type / attribute domain. BLOB is short for Binary Large Object and that column data type is spe...
[ "mysql", "database", "binary-data", "data-storage" ]
199
143
87,599
9
0
2008-08-01T05:09:55.993000
2008-08-01T12:16:22.167000
19
531
What is the fastest way to get the value of π?
I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using #define constants like M_PI, or hard-coding the number in. The program below tests the various ways I know of. The inline assembly version is, in theory, the fastest option, thou...
The Monte Carlo method, as mentioned, applies some great concepts but it is, clearly, not the fastest, not by a long shot, not by any reasonable measure. Also, it all depends on what kind of accuracy you are looking for. The fastest π I know of is the one with the digits hard coded. Looking at Pi and Pi[PDF], there are...
What is the fastest way to get the value of π? I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using #define constants like M_PI, or hard-coding the number in. The program below tests the various ways I know of. The inline assembly ...
TITLE: What is the fastest way to get the value of π? QUESTION: I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using #define constants like M_PI, or hard-coding the number in. The program below tests the various ways I know of. Th...
[ "performance", "algorithm", "language-agnostic", "unix", "pi" ]
352
223
70,352
23
0
2008-08-01T05:21:22.257000
2008-08-02T18:22:52.690000
24
49
Throw an error preventing a table update in a MySQL trigger
If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table?
Here is one hack that may work. It isn't clean, but it looks like it might work: Essentially, you just try to update a column that doesn't exist.
Throw an error preventing a table update in a MySQL trigger If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table?
TITLE: Throw an error preventing a table update in a MySQL trigger QUESTION: If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table? ANSWER: Here is one hack that may work. It isn't clean, but it looks like it might work: Essentially, you just try to update a...
[ "mysql", "database", "triggers" ]
195
67
105,586
7
0
2008-08-01T12:12:19.350000
2008-08-01T13:02:51.900000
25
1,443,907
How to use the C socket API in C++ on z/OS
I'm having issues getting the C sockets API to work properly in C++ on z/OS. Although I am including sys/socket.h, I still get compile time errors telling me that AF_INET is not defined. Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated? I discover...
Keep a copy of the IBM manuals handy: z/OS V1R11.0 XL C/C++ Programming Guide z/OS V1R11.0 XL C/C++ Run-Time Library Reference The IBM publications are generally very good, but you need to get used to their format, as well as knowing where to look for an answer. You'll find quite often that a feature that you want to u...
How to use the C socket API in C++ on z/OS I'm having issues getting the C sockets API to work properly in C++ on z/OS. Although I am including sys/socket.h, I still get compile time errors telling me that AF_INET is not defined. Am I missing something obvious, or is this related to the fact that being on z/OS makes my...
TITLE: How to use the C socket API in C++ on z/OS QUESTION: I'm having issues getting the C sockets API to work properly in C++ on z/OS. Although I am including sys/socket.h, I still get compile time errors telling me that AF_INET is not defined. Am I missing something obvious, or is this related to the fact that bein...
[ "c++", "c", "sockets", "mainframe", "zos" ]
176
97
16,412
9
0
2008-08-01T12:13:50.207000
2009-09-18T11:17:01.933000
36
352
Check for changes to an SQL Server table?
How can I monitor an SQL Server database for changes to a table without using triggers or modifying the structure of the database in any way? My preferred programming environment is.NET and C#. I'd like to be able to support any SQL Server 2000 SP4 or newer. My application is a bolt-on data visualization for another co...
Take a look at the CHECKSUM command: SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM sample_table WITH (NOLOCK); That will return the same number each time it's run as long as the table contents haven't changed. See my post on this for more information: CHECKSUM Here's how I used it to rebuild cache dependencies when tabl...
Check for changes to an SQL Server table? How can I monitor an SQL Server database for changes to a table without using triggers or modifying the structure of the database in any way? My preferred programming environment is.NET and C#. I'd like to be able to support any SQL Server 2000 SP4 or newer. My application is a...
TITLE: Check for changes to an SQL Server table? QUESTION: How can I monitor an SQL Server database for changes to a table without using triggers or modifying the structure of the database in any way? My preferred programming environment is.NET and C#. I'd like to be able to support any SQL Server 2000 SP4 or newer. M...
[ "sql", "sql-server", "datatable", "rdbms" ]
153
101
78,517
9
0
2008-08-01T12:35:56.917000
2008-08-02T05:20:22.397000
39
45
Reliable timer in a console application
I am aware that in.NET there are three timer types (see Comparing the Timer Classes in the.NET Framework Class Library ). I have chosen a threaded timer as the other types can drift if the main thread is busy, and I need this to be reliable. The way this timer works in the control of the timer is put on another thread ...
You can use something like Console.ReadLine() to block the main thread, so other background threads (like timer threads) will still work. You may also use an AutoResetEvent to block the execution, then (when you need to) you can call Set() method on that AutoResetEvent object to release the main thread. Also ensure tha...
Reliable timer in a console application I am aware that in.NET there are three timer types (see Comparing the Timer Classes in the.NET Framework Class Library ). I have chosen a threaded timer as the other types can drift if the main thread is busy, and I need this to be reliable. The way this timer works in the contro...
TITLE: Reliable timer in a console application QUESTION: I am aware that in.NET there are three timer types (see Comparing the Timer Classes in the.NET Framework Class Library ). I have chosen a threaded timer as the other types can drift if the main thread is busy, and I need this to be reliable. The way this timer w...
[ "c#", ".net", "vb.net", "timer" ]
114
63
8,237
3
0
2008-08-01T12:43:11.503000
2008-08-01T12:56:37.920000
42
77
Best way to allow plugins for a PHP application
I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. How does one go about writing 'hooks' into their code so that plugins can attach to specific events?
You could use an Observer pattern. A simple functional way to accomplish this: Output: This is my CRAZY application 4 + 5 = 9 4 * 5 = 20 Notes: For this example source code, you must declare all your plugins before the actual source code that you want to be extendable. I've included an example of how to handle single o...
Best way to allow plugins for a PHP application I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. How does one go about writing 'hooks' into their code so that plugins can attach to specific events?
TITLE: Best way to allow plugins for a PHP application QUESTION: I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. How does one go about writing 'hooks' into their code so that plugins can attach to specific events? ANSWER: Y...
[ "php", "plugins", "architecture", "hook" ]
293
168
40,824
8
0
2008-08-01T12:50:18.587000
2008-08-01T13:46:00.097000
48
31,910
Multiple submit buttons in an HTML form
Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the back button appears first in the markup when you press Enter, it will use that button to submit the form. Example: I would like to get to decide which button is used to submit the form when a user presses Enter. That wa...
I'm just doing the trick of float ing the buttons to the right. This way the Prev button is left of the Next button, but the Next comes first in the HTML structure:.f { float: right; }.clr { clear: both; } Benefits over other suggestions: no JavaScript code, accessible, and both buttons remain type="submit".
Multiple submit buttons in an HTML form Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the back button appears first in the markup when you press Enter, it will use that button to submit the form. Example: I would like to get to decide which button is used to submit the...
TITLE: Multiple submit buttons in an HTML form QUESTION: Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the back button appears first in the markup when you press Enter, it will use that button to submit the form. Example: I would like to get to decide which button is ...
[ "html", "forms", "form-submit", "submit-button" ]
291
152
257,419
28
0
2008-08-01T13:01:17.303000
2008-08-28T09:34:40.143000
59
43,110
How do I get a distinct, ordered list of names from a DataTable using LINQ?
I have a DataTable with a Name column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the order by clause. var names = (from DataRow dr in dataTable.Rows orderby (string)dr["Name"] select (string)dr["Name"]).Distinct(); Why does the orderby not get enforced?
To make it more readable and maintainable, you can also split it up into multiple LINQ statements. First, select your data into a new list, let's call it x1, do a projection if desired Next, create a distinct list, from x1 into x2, using whatever distinction you require Finally, create an ordered list, from x2 into x3,...
How do I get a distinct, ordered list of names from a DataTable using LINQ? I have a DataTable with a Name column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the order by clause. var names = (from DataRow dr in dataTable.Rows orderby (string)dr["Name"] select...
TITLE: How do I get a distinct, ordered list of names from a DataTable using LINQ? QUESTION: I have a DataTable with a Name column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the order by clause. var names = (from DataRow dr in dataTable.Rows orderby (string...
[ "c#", "linq", ".net-3.5" ]
117
40
27,375
7
0
2008-08-01T13:14:33.797000
2008-09-04T02:57:27.263000
66
4,521
Paging a collection with LINQ
How do you page through a collection in LINQ given that you have a startIndex and a count?
A few months back I wrote a blog post about Fluent Interfaces and LINQ which used an Extension Method on IQueryable and another class to provide the following natural way of paginating a LINQ collection. var query = from i in ideas select i; var pagedCollection = query.InPagesOf(10); var pageOfIdeas = pagedCollection.P...
Paging a collection with LINQ How do you page through a collection in LINQ given that you have a startIndex and a count?
TITLE: Paging a collection with LINQ QUESTION: How do you page through a collection in LINQ given that you have a startIndex and a count? ANSWER: A few months back I wrote a blog post about Fluent Interfaces and LINQ which used an Extension Method on IQueryable and another class to provide the following natural way o...
[ "linq", ".net-3.5" ]
89
45
6,204
4
0
2008-08-01T13:20:46.890000
2008-08-07T08:22:27.440000
79
62,853
Getting Subclipse in Aptana to work with the newest release of Subversion
The version of Subclipse (1.2.4) currently available through Aptana's automatic Plugins Manager does not work with the newest version of Subversion. I see on the Subclipse website however that they have 1.4.2 out for Eclipse. So I added a new remote update site to my Update manager. When I tried to install it, it told ...
Subclipse does not require Mylyn, but the update site includes a plugin that integrates Mylyn and Subclipse. This is intended for people that use Mylyn. In your case, you would want to just de-select Mylyn in the update dialog. Subclipse also requires Subversion 1.5 and the corresponding version of the JavaHL native li...
Getting Subclipse in Aptana to work with the newest release of Subversion The version of Subclipse (1.2.4) currently available through Aptana's automatic Plugins Manager does not work with the newest version of Subversion. I see on the Subclipse website however that they have 1.4.2 out for Eclipse. So I added a new rem...
TITLE: Getting Subclipse in Aptana to work with the newest release of Subversion QUESTION: The version of Subclipse (1.2.4) currently available through Aptana's automatic Plugins Manager does not work with the newest version of Subversion. I see on the Subclipse website however that they have 1.4.2 out for Eclipse. So...
[ "eclipse", "svn", "aptana", "subclipse" ]
50
18
11,457
4
0
2008-08-01T13:56:33.837000
2008-09-15T13:26:34.350000
80
124
SQLStatement.execute() - multiple queries in one statement
I've written a database generation script in SQL and want to execute it in my Adobe AIR application: Create Table tRole ( roleID integer Primary Key,roleName varchar(40) ); Create Table tFile ( fileID integer Primary Key,fileName varchar(50),fileDescription varchar(500),thumbnailID integer,fileFormatID integer,category...
I wound up using this. It is a kind of a hack, but it actually works pretty well. The only thing is you have to be very careful with your semicolons.: D var strSql:String = stream.readUTFBytes(stream.bytesAvailable); var i:Number = 0; var strSqlSplit:Array = strSql.split(";"); for (i = 0; i < strSqlSplit.length; i++){ ...
SQLStatement.execute() - multiple queries in one statement I've written a database generation script in SQL and want to execute it in my Adobe AIR application: Create Table tRole ( roleID integer Primary Key,roleName varchar(40) ); Create Table tFile ( fileID integer Primary Key,fileName varchar(50),fileDescription var...
TITLE: SQLStatement.execute() - multiple queries in one statement QUESTION: I've written a database generation script in SQL and want to execute it in my Adobe AIR application: Create Table tRole ( roleID integer Primary Key,roleName varchar(40) ); Create Table tFile ( fileID integer Primary Key,fileName varchar(50),f...
[ "apache-flex", "actionscript-3", "air" ]
54
20
6,683
3
0
2008-08-01T13:57:07.033000
2008-08-01T16:09:47.687000
85
154
Flat file databases
What are the best practices around creating flat file database structures in PHP? A lot of more matured PHP flat file frameworks out there which I attempt to implement SQL-like query syntax which is over the top for my purposes in most cases. (I would just use a database at that point). Are there any elegant tricks out...
Well, what is the nature of the flat databases. Are they large or small. Is it simple arrays with arrays in them? if its something simple say userprofiles built as such: $user = array("name" => "bob", "age" => 20, "websites" => array("example.com","bob.example.com","bob2.example.com"), "and_one" => "more"); and to save...
Flat file databases What are the best practices around creating flat file database structures in PHP? A lot of more matured PHP flat file frameworks out there which I attempt to implement SQL-like query syntax which is over the top for my purposes in most cases. (I would just use a database at that point). Are there an...
TITLE: Flat file databases QUESTION: What are the best practices around creating flat file database structures in PHP? A lot of more matured PHP flat file frameworks out there which I attempt to implement SQL-like query syntax which is over the top for my purposes in most cases. (I would just use a database at that po...
[ "php", "sql", "database", "flat-file" ]
132
81
69,859
11
0
2008-08-01T14:19:52.510000
2008-08-01T17:45:06.513000
88
98
Is gettimeofday() guaranteed to be of microsecond resolution?
I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux). I have implemented QueryPerformanceCounter by giving the uSeconds since the process start up: BOOL QueryPerformanceCounter(LARGE_INTEGER* performanceCount) { gettimeofday(&currentTimeVa...
Maybe. But you have bigger problems. gettimeofday() can result in incorrect timings if there are processes on your system that change the timer (ie, ntpd). On a "normal" Linux, though, I believe the resolution of gettimeofday() is 10us. It can jump forward and backward and time, consequently, based on the processes run...
Is gettimeofday() guaranteed to be of microsecond resolution? I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux). I have implemented QueryPerformanceCounter by giving the uSeconds since the process start up: BOOL QueryPerformanceCounter(...
TITLE: Is gettimeofday() guaranteed to be of microsecond resolution? QUESTION: I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux). I have implemented QueryPerformanceCounter by giving the uSeconds since the process start up: BOOL QueryP...
[ "linux", "winapi", "visual-c++", "unix", "timer" ]
106
63
45,129
10
0
2008-08-01T14:36:18.640000
2008-08-01T14:53:47.497000
90
1,466,832
How do you branch and merge with TortoiseSVN?
How do you branch and merge with Apache Subversion using the TortoiseSVN client?
My easy click-by-click instructions ( specific to TortoiseSVN ) are in Stack Overflow question What is the simplest way to do branching and merging using TortoiseSVN?.
How do you branch and merge with TortoiseSVN? How do you branch and merge with Apache Subversion using the TortoiseSVN client?
TITLE: How do you branch and merge with TortoiseSVN? QUESTION: How do you branch and merge with Apache Subversion using the TortoiseSVN client? ANSWER: My easy click-by-click instructions ( specific to TortoiseSVN ) are in Stack Overflow question What is the simplest way to do branching and merging using TortoiseSVN?...
[ "svn", "tortoisesvn", "branch", "branching-and-merging" ]
163
23
56,424
3
0
2008-08-01T14:41:24.277000
2009-09-23T15:40:46.943000
104
112
Anatomy of a "Memory Leak"
In.NET perspective: What is a memory leak? How can you determine whether your application leaks? What are the effects? How can you prevent a memory leak? If your application has memory leak, does it go away when the process exits or is killed? Or do memory leaks in your application affect other processes on the system ...
The best explanation I've seen is in Chapter 7 of the free Foundations of Programming e-book. Basically, in.NET a memory leak occurs when referenced objects are rooted and thus cannot be garbage collected. This occurs accidentally when you hold on to references beyond the intended scope. You'll know that you have leaks...
Anatomy of a "Memory Leak" In.NET perspective: What is a memory leak? How can you determine whether your application leaks? What are the effects? How can you prevent a memory leak? If your application has memory leak, does it go away when the process exits or is killed? Or do memory leaks in your application affect oth...
TITLE: Anatomy of a "Memory Leak" QUESTION: In.NET perspective: What is a memory leak? How can you determine whether your application leaks? What are the effects? How can you prevent a memory leak? If your application has memory leak, does it go away when the process exits or is killed? Or do memory leaks in your appl...
[ ".net", "performance", "memory-leaks", "com-interop" ]
181
112
15,291
15
0
2008-08-01T15:12:34.837000
2008-08-01T15:28:12.543000
108
111
Best Subversion clients for Windows Vista (64bit)
I've been using TortoiseSVN in a Windows environment for quite some time. It seems very feature-complete and nicely integrated into the Windows shell, and more importantly, it's fairly painless to teach to colleagues with little or no experience with source control. However, since we have moved to Windows Vista 64bit, ...
I have been using the 64Bit version of TortoiseSVN for ages and I have never had issues with it on Windows 64Bit or Vista 64Bit. I am currently not aware of any other similiar SVN clients that do work on Vista. Is it possible the problem could lie within the configuration of TortoiseSVN or even the installation of Vist...
Best Subversion clients for Windows Vista (64bit) I've been using TortoiseSVN in a Windows environment for quite some time. It seems very feature-complete and nicely integrated into the Windows shell, and more importantly, it's fairly painless to teach to colleagues with little or no experience with source control. How...
TITLE: Best Subversion clients for Windows Vista (64bit) QUESTION: I've been using TortoiseSVN in a Windows environment for quite some time. It seems very feature-complete and nicely integrated into the Windows shell, and more importantly, it's fairly painless to teach to colleagues with little or no experience with s...
[ "windows", "svn", "64-bit" ]
52
39
16,513
8
0
2008-08-01T15:22:29.467000
2008-08-01T15:27:23.093000
109
2,585
Decoding T-SQL CAST in C#/VB.NET
Recently our site has been deluged with the resurgence of the Asprox botnet SQL injection attack. Without going into details, the attack attempts to execute SQL code by encoding the T-SQL commands in an ASCII encoded BINARY string. It looks something like this: DECLARE%20@S%20NVARCHAR(4000);SET%20@S=CAST(0x44004500...0...
I went back to Michael's post, did some more poking and realized that I did need to do a double conversion, and eventually worked out this little nugget: Convert.ToString(Convert.ToChar(Int32.Parse(EncodedString.Substring(intParseIndex, 2), System.Globalization.NumberStyles.HexNumber))); From there I simply made a loop...
Decoding T-SQL CAST in C#/VB.NET Recently our site has been deluged with the resurgence of the Asprox botnet SQL injection attack. Without going into details, the attack attempts to execute SQL code by encoding the T-SQL commands in an ASCII encoded BINARY string. It looks something like this: DECLARE%20@S%20NVARCHAR(4...
TITLE: Decoding T-SQL CAST in C#/VB.NET QUESTION: Recently our site has been deluged with the resurgence of the Asprox botnet SQL injection attack. Without going into details, the attack attempts to execute SQL code by encoding the T-SQL commands in an ASCII encoded BINARY string. It looks something like this: DECLARE...
[ "c#", "sql", "vb.net", "ascii", "hex" ]
68
24
6,199
2
0
2008-08-01T15:23:05.190000
2008-08-05T17:02:30.870000
123
183
Java lib or app to convert CSV to XML file?
Is there an existing application or library in Java which will allow me to convert a CSV data file to XML file? The XML tags would be provided through possibly the first row containing column headings.
Maybe this might help: JSefa You can read CSV file with this tool and serialize it to XML.
Java lib or app to convert CSV to XML file? Is there an existing application or library in Java which will allow me to convert a CSV data file to XML file? The XML tags would be provided through possibly the first row containing column headings.
TITLE: Java lib or app to convert CSV to XML file? QUESTION: Is there an existing application or library in Java which will allow me to convert a CSV data file to XML file? The XML tags would be provided through possibly the first row containing column headings. ANSWER: Maybe this might help: JSefa You can read CSV f...
[ "java", "xml", "csv", "data-conversion" ]
121
70
81,172
16
0
2008-08-01T16:08:52.353000
2008-08-01T18:51:12.090000
126
127
How would you access Object properties from within an object method?
What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method? I know that from outside of the object you should use a getter/setter, but from within would you just do: Java: String property = this.property; PHP: $property = $this->property; or wo...
This has religious war potential, but it seems to me that if you're using a getter/setter, you should use it internally as well - using both will lead to maintenance problems down the road (e.g. somebody adds code to a setter that needs to run every time that property is set, and the property is being set internally w/...
How would you access Object properties from within an object method? What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method? I know that from outside of the object you should use a getter/setter, but from within would you just do: Java: Str...
TITLE: How would you access Object properties from within an object method? QUESTION: What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method? I know that from outside of the object you should use a getter/setter, but from within would you ...
[ "java", "php", "oop", "theory" ]
106
66
26,730
18
0
2008-08-01T16:10:30.337000
2008-08-01T16:13:47.600000
134
206
XSD DataSets and ignoring foreign keys
I have a pretty standard table set-up in a current application using the.NET XSD DataSet and TableAdapter features. My contracts table consists of some standard contract information, with a column for the primary department. This column is a foreign key to my Departments table, where I store the basic department name, ...
You can try turning Check-constraints off on the DataSet (it's in its properties), or altering the properties of that relationship, and change the key to a simple reference - up to you.
XSD DataSets and ignoring foreign keys I have a pretty standard table set-up in a current application using the.NET XSD DataSet and TableAdapter features. My contracts table consists of some standard contract information, with a column for the primary department. This column is a foreign key to my Departments table, wh...
TITLE: XSD DataSets and ignoring foreign keys QUESTION: I have a pretty standard table set-up in a current application using the.NET XSD DataSet and TableAdapter features. My contracts table consists of some standard contract information, with a column for the primary department. This column is a foreign key to my Dep...
[ ".net", "database", "xsd" ]
39
13
1,519
1
0
2008-08-01T16:33:38.183000
2008-08-01T19:52:14.227000
146
152
How do I track file downloads
I have a website that plays mp3s in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it. Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded? Is the play link a link to the actual mp3 file or to some javas...
The funny thing is I wrote a php media gallery for all my musics 2 days ago. I had a similar problem. I'm using http://musicplayer.sourceforge.net/ for the player. And the playlist is built via php. All music requests go to a script called xfer.php?file=WHATEVER $filename = base64_url_decode($_REQUEST['file']); header(...
How do I track file downloads I have a website that plays mp3s in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it. Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded? Is the play link a link to the ac...
TITLE: How do I track file downloads QUESTION: I have a website that plays mp3s in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it. Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded? Is the play lin...
[ "php", "apache", "logging", "download", "analytics" ]
90
42
21,872
8
0
2008-08-01T17:14:58.337000
2008-08-01T17:33:58.750000
163
170
How do I sync the SVN revision number with my ASP.NET web site?
Stack Overflow has a subversion version number at the bottom: svn revision: 679 I want to use such automatic versioning with my.NET Web Site/Application, Windows Forms, WPD projects/solutions. How do I implement this?
Looks like Jeff is using CruiseControl.NET based on some leafing through the podcast transcripts. This seems to have automated deployment capabilities from source control to production. Might this be where the insertion is happening?
How do I sync the SVN revision number with my ASP.NET web site? Stack Overflow has a subversion version number at the bottom: svn revision: 679 I want to use such automatic versioning with my.NET Web Site/Application, Windows Forms, WPD projects/solutions. How do I implement this?
TITLE: How do I sync the SVN revision number with my ASP.NET web site? QUESTION: Stack Overflow has a subversion version number at the bottom: svn revision: 679 I want to use such automatic versioning with my.NET Web Site/Application, Windows Forms, WPD projects/solutions. How do I implement this? ANSWER: Looks like ...
[ ".net", "asp.net", "svn", "versioning" ]
101
32
9,524
7
0
2008-08-01T18:00:13.830000
2008-08-01T18:24:30.550000
164
699
Embedding Windows Media Player for all browsers
Edit: This question was written in 2008, which was like 3 internet ages ago. If this question is still relevant to your environment, please accept my condolences. Everyone else should convert into a format supported by your browsers (That would be H.264 if Internet Explorer is needed, and probably AV1, VP8/VP9 if not) ...
The following works for me in Firefox and Internet Explorer:
Embedding Windows Media Player for all browsers Edit: This question was written in 2008, which was like 3 internet ages ago. If this question is still relevant to your environment, please accept my condolences. Everyone else should convert into a format supported by your browsers (That would be H.264 if Internet Explor...
TITLE: Embedding Windows Media Player for all browsers QUESTION: Edit: This question was written in 2008, which was like 3 internet ages ago. If this question is still relevant to your environment, please accept my condolences. Everyone else should convert into a format supported by your browsers (That would be H.264 ...
[ "windows", "embed", "media" ]
64
47
177,305
10
0
2008-08-01T18:02:22.797000
2008-08-03T14:27:20.967000
173
516
How to do version control for SQL Server database?
I want to get my databases under version control. I'll always want to have at least some data in there (as alumb mentions: user types and administrators). I'll also often want a large collection of generated test data for performance measurements. How would I apply version control to my database?
Martin Fowler wrote my favorite article on the subject, http://martinfowler.com/articles/evodb.html. I choose not to put schema dumps in under version control as alumb and others suggest because I want an easy way to upgrade my production database. For a web application where I'll have a single production database inst...
How to do version control for SQL Server database? I want to get my databases under version control. I'll always want to have at least some data in there (as alumb mentions: user types and administrators). I'll also often want a large collection of generated test data for performance measurements. How would I apply ver...
TITLE: How to do version control for SQL Server database? QUESTION: I want to get my databases under version control. I'll always want to have at least some data in there (as alumb mentions: user types and administrators). I'll also often want a large collection of generated test data for performance measurements. How...
[ "sql-server", "database", "svn", "version-control" ]
341
191
124,650
21
0
2008-08-01T18:33:08.333000
2008-08-02T17:33:54.927000
176
207
error_log per Virtual Host?
On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php error_log between virtual hosts. Overriding this setting in the of the httpd.conf does not seem to do anything. Is there a way to have separate php error_logs for each Virtual Host?
To set the Apache ( not the PHP ) log, the easiest way to do this would be to do: # Stuff, # More Stuff, ErrorLog /path/where/you/want/the/error.log If there is no leading "/" it is assumed to be relative. Apache Error Log Page
error_log per Virtual Host? On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php error_log between virtual hosts. Overriding this setting in the of the httpd.conf does not seem to do anything. Is there a way to have separate php error_l...
TITLE: error_log per Virtual Host? QUESTION: On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php error_log between virtual hosts. Overriding this setting in the of the httpd.conf does not seem to do anything. Is there a way to have se...
[ "linux", "apache", "virtualhost" ]
124
89
120,269
11
0
2008-08-01T18:37:40.150000
2008-08-01T19:58:45.837000
180
539
Function for creating color wheels
This is something I've pseudo-solved many times and have never quite found a solution for. The problem is to come up with a way to generate N colors, that are as distinguishable as possible where N is a parameter.
My first thought on this is "how to generate N vectors in a space that maximize distance from each other." You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at Random Point Picking. Once you have a set of vectors that are maximized apart, you can save ...
Function for creating color wheels This is something I've pseudo-solved many times and have never quite found a solution for. The problem is to come up with a way to generate N colors, that are as distinguishable as possible where N is a parameter.
TITLE: Function for creating color wheels QUESTION: This is something I've pseudo-solved many times and have never quite found a solution for. The problem is to come up with a way to generate N colors, that are as distinguishable as possible where N is a parameter. ANSWER: My first thought on this is "how to generate...
[ "algorithm", "language-agnostic", "colors", "color-space" ]
71
28
19,598
8
0
2008-08-01T18:42:19.343000
2008-08-02T19:03:52.170000
192
258
Floating Point Number parsing: Is there a Catch All algorithm?
One of the fun parts of multi-cultural programming is number formats. Americans use 10,000.50 Germans use 10.000,50 French use 10 000,50 My first approach would be to take the string, parse it backwards until I encounter a separator and use this as my decimal separator. There is an obvious flaw with that: 10.000 would ...
I think the best you can do in this case is to take their input and then show them what you think they meant. If they disagree, show them the format you're expecting and get them to enter it again.
Floating Point Number parsing: Is there a Catch All algorithm? One of the fun parts of multi-cultural programming is number formats. Americans use 10,000.50 Germans use 10.000,50 French use 10 000,50 My first approach would be to take the string, parse it backwards until I encounter a separator and use this as my decim...
TITLE: Floating Point Number parsing: Is there a Catch All algorithm? QUESTION: One of the fun parts of multi-cultural programming is number formats. Americans use 10,000.50 Germans use 10.000,50 French use 10 000,50 My first approach would be to take the string, parse it backwards until I encounter a separator and us...
[ "c#", ".net", "asp.net", "internationalization", "globalization" ]
72
32
3,583
4
0
2008-08-01T19:23:13.117000
2008-08-01T23:17:53.657000
194
197
Upgrading SQL Server 6.5
Yes, I know. The existence of a running copy of SQL Server 6.5 in 2008 is absurd. That stipulated, what is the best way to migrate from 6.5 to 2005? Is there any direct path? Most of the documentation I've found deals with upgrading 6.5 to 7. Should I forget about the native SQL Server upgrade utilities, script out all...
Hey, I'm still stuck in that camp too. The third party application we have to support is FINALLY going to 2K5, so we're almost out of the wood. But I feel your pain 8^D That said, from everything I heard from our DBA, the key is to convert the database to 8.0 format first, and then go to 2005. I believe they used the b...
Upgrading SQL Server 6.5 Yes, I know. The existence of a running copy of SQL Server 6.5 in 2008 is absurd. That stipulated, what is the best way to migrate from 6.5 to 2005? Is there any direct path? Most of the documentation I've found deals with upgrading 6.5 to 7. Should I forget about the native SQL Server upgrade ...
TITLE: Upgrading SQL Server 6.5 QUESTION: Yes, I know. The existence of a running copy of SQL Server 6.5 in 2008 is absurd. That stipulated, what is the best way to migrate from 6.5 to 2005? Is there any direct path? Most of the documentation I've found deals with upgrading 6.5 to 7. Should I forget about the native S...
[ "sql-server", "migration" ]
40
11
4,760
4
0
2008-08-01T19:26:37.883000
2008-08-01T19:34:49.067000
227
2,943,318
Create a tag cloud by wrapping array values in h1 through h6 tags based on a mapping array of weights
I have the following arrays: $artist = ["the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"]; $count = [5, 3, 9, 1, 1, 3]; I want to generate a tag cloud that will have artists with a higher number in $count enclosed in h6 tags and the lowest enclosed h1 tags.
You will want to add a logarithmic function to it too. (taken from tagadelic, my Drupal module to create tag clouds http://drupal.org/project/tagadelic ): db_query('SELECT COUNT(*) AS count, id, name FROM... ORDER BY count DESC'); $steps = 6; $tags = array(); $min = 1e9; $max = -1e9; while ($tag = db_fetch_object($re...
Create a tag cloud by wrapping array values in h1 through h6 tags based on a mapping array of weights I have the following arrays: $artist = ["the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"]; $count = [5, 3, 9, 1, 1, 3]; I want to generate a tag cloud that will have artists with a highe...
TITLE: Create a tag cloud by wrapping array values in h1 through h6 tags based on a mapping array of weights QUESTION: I have the following arrays: $artist = ["the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"]; $count = [5, 3, 9, 1, 1, 3]; I want to generate a tag cloud that will have ar...
[ "php", "arrays", "mapping", "tag-cloud" ]
79
43
9,776
9
0
2008-08-01T21:40:55.833000
2010-05-31T11:53:57.940000
231
1,812
Register Windows program with the mailto protocol programmatically
How do I make it so mailto: links will be registered with my program? How would I then handle that event in my program? Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automatically for users of my program if they click a button, such as "set as default email ...
@Dillie-O: Your answer put me in the right direction (I should have expected it to just be a registry change) and I got this working. But I'm going to mark this as the answer because I'm going to put some additional information that I found while working on this. The solution to this question really doesn't depend on w...
Register Windows program with the mailto protocol programmatically How do I make it so mailto: links will be registered with my program? How would I then handle that event in my program? Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automatically for users o...
TITLE: Register Windows program with the mailto protocol programmatically QUESTION: How do I make it so mailto: links will be registered with my program? How would I then handle that event in my program? Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automat...
[ "windows", "mailto" ]
43
19
31,416
2
0
2008-08-01T22:08:14.453000
2008-08-05T01:49:25.940000
234
12,202
SQL Server 2005 implementation of MySQL REPLACE INTO?
MySQL has this incredibly useful yet proprietary REPLACE INTO SQL Command. Can this easily be emulated in SQL Server 2005? Starting a new Transaction, doing a Select() and then either UPDATE or INSERT and COMMIT is always a little bit of a pain, especially when doing it in the application and therefore always keeping 2...
This is something that annoys me about MSSQL ( rant on my blog ). I wish MSSQL supported upsert. @Dillie-O's code is a good way in older SQL versions (+1 vote), but it still is basically two IO operations (the exists and then the update or insert ) There's a slightly better way on this post, basically: --try an update ...
SQL Server 2005 implementation of MySQL REPLACE INTO? MySQL has this incredibly useful yet proprietary REPLACE INTO SQL Command. Can this easily be emulated in SQL Server 2005? Starting a new Transaction, doing a Select() and then either UPDATE or INSERT and COMMIT is always a little bit of a pain, especially when doin...
TITLE: SQL Server 2005 implementation of MySQL REPLACE INTO? QUESTION: MySQL has this incredibly useful yet proprietary REPLACE INTO SQL Command. Can this easily be emulated in SQL Server 2005? Starting a new Transaction, doing a Select() and then either UPDATE or INSERT and COMMIT is always a little bit of a pain, es...
[ "mysql", "sql-server", "sql-server-2005" ]
89
63
51,546
4
0
2008-08-01T22:13:34.100000
2008-08-15T12:50:22.350000
246
176,741
Create a SQLite database based on an XSD Data Set
Does anybody know if there is a way to create an SQLite database based on an XSD DataSet? In the past, I've just used a basic SQLite manager, but I want to fuse things a bit more with my.NET development if possible.
I suspect in the general case this is hard; XML Schema allows for some quite bizarre type constructions. I'm not sure how you would do substitution groups, or extensions to restrictions of types for example. However it should be possible to knock something together quite quickly (especially mapping from the classes in ...
Create a SQLite database based on an XSD Data Set Does anybody know if there is a way to create an SQLite database based on an XSD DataSet? In the past, I've just used a basic SQLite manager, but I want to fuse things a bit more with my.NET development if possible.
TITLE: Create a SQLite database based on an XSD Data Set QUESTION: Does anybody know if there is a way to create an SQLite database based on an XSD DataSet? In the past, I've just used a basic SQLite manager, but I want to fuse things a bit more with my.NET development if possible. ANSWER: I suspect in the general ca...
[ ".net", "database", "sqlite" ]
45
19
3,283
3
0
2008-08-01T22:34:42.853000
2008-10-06T23:58:50.823000
260
307
Adding scripting functionality to .NET applications
I have a little game written in C#. It uses a database as back-end. It's a trading card game, and I wanted to implement the function of the cards as a script. What I mean is that I essentially have an interface, ICard, which a card class implements ( public class Card056: ICard ) and which contains a function that is c...
Oleg Shilo's C# Script solution (at The Code Project ) really is a great introduction to providing script abilities in your application. A different approach would be to consider a language that is specifically built for scripting, such as IronRuby, IronPython, or Lua. IronPython and IronRuby are both available today. ...
Adding scripting functionality to .NET applications I have a little game written in C#. It uses a database as back-end. It's a trading card game, and I wanted to implement the function of the cards as a script. What I mean is that I essentially have an interface, ICard, which a card class implements ( public class Card...
TITLE: Adding scripting functionality to .NET applications QUESTION: I have a little game written in C#. It uses a database as back-end. It's a trading card game, and I wanted to implement the function of the cards as a script. What I mean is that I essentially have an interface, ICard, which a card class implements (...
[ "c#", ".net", "scripting", "compiler-construction" ]
83
44
22,879
9
0
2008-08-01T23:22:08.983000
2008-08-02T01:49:46.220000
263
607
GTK implementation of MessageBox
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL, so this isn't a GTK app. I handle the initialization ( gtk_init ) sort of stuff inside the MessageBox function as follows: int MessageBox(HWND hwnd, const char* text, const char* caption, UINT type) { GtkWidget *window = NULL; GtkWid...
Hmm, ok. I'd suggest code like this, then: typedef struct { int type; int result; } DialogData; static gboolean display_dialog(gpointer user_data) { DialogData *dialog_data = user_data; GtkWidget *dialog; if (dialog_data->type & MB_YESNO) dialog = gtk_message_dialog_new(...); else dialog = gtk_message_dialog_new(...)...
GTK implementation of MessageBox I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL, so this isn't a GTK app. I handle the initialization ( gtk_init ) sort of stuff inside the MessageBox function as follows: int MessageBox(HWND hwnd, const char* text, const char* caption, UINT type) {...
TITLE: GTK implementation of MessageBox QUESTION: I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL, so this isn't a GTK app. I handle the initialization ( gtk_init ) sort of stuff inside the MessageBox function as follows: int MessageBox(HWND hwnd, const char* text, const char* cap...
[ "c", "linux", "gtk", "x11" ]
42
18
11,832
3
0
2008-08-01T23:27:24.993000
2008-08-03T02:30:05.907000
265
266
Best Practice: Collaborative Environment, Bin Directory, SVN
What are the best practices for checking in BIN directories in a collaborative development environment using SVN? Should project level references be excluded from checkin? Is it easier to just add all bin directories? I develop a lot of DotNetNuke sites and it seems that in a multi-developer environment, it's always a ...
Any assemblies that are expected to be in the GAC should stay in the GAC. This includes System.web.dll or any other 3rd party dll that you'll deploy to the GAC in production. This means a new developer would have to install these assemblies. All other 3rd party assemblies should be references through a relative path. M...
Best Practice: Collaborative Environment, Bin Directory, SVN What are the best practices for checking in BIN directories in a collaborative development environment using SVN? Should project level references be excluded from checkin? Is it easier to just add all bin directories? I develop a lot of DotNetNuke sites and i...
TITLE: Best Practice: Collaborative Environment, Bin Directory, SVN QUESTION: What are the best practices for checking in BIN directories in a collaborative development environment using SVN? Should project level references be excluded from checkin? Is it easier to just add all bin directories? I develop a lot of DotN...
[ "svn", "collaboration" ]
38
19
3,296
5
0
2008-08-01T23:29:32.853000
2008-08-01T23:40:28.463000
289
298
How do you sort a dictionary by value?
I often have to sort a dictionary (consisting of keys & values) by value. For example, I have a hash of words and respective frequencies that I want to order by frequency. There is a SortedList which is good for a single value (say frequency), that I want to map back to the word. SortedDictionary orders by key, not val...
Use: using System.Linq.Enumerable;... List > myList = aDictionary.ToList(); myList.Sort( delegate(KeyValuePair pair1, KeyValuePair pair2) { return pair1.Value.CompareTo(pair2.Value); } ); Since you're targeting.NET 2.0 or above, you can simplify this into lambda syntax -- it's equivalent, but shorter. If you're target...
How do you sort a dictionary by value? I often have to sort a dictionary (consisting of keys & values) by value. For example, I have a hash of words and respective frequencies that I want to order by frequency. There is a SortedList which is good for a single value (say frequency), that I want to map back to the word. ...
TITLE: How do you sort a dictionary by value? QUESTION: I often have to sort a dictionary (consisting of keys & values) by value. For example, I have a hash of words and respective frequencies that I want to order by frequency. There is a SortedList which is good for a single value (say frequency), that I want to map ...
[ "c#", ".net", "sorting", "dictionary" ]
955
572
825,359
21
0
2008-08-02T00:40:58.200000
2008-08-02T01:15:42.123000
308
360
Is there a version control system for database structure changes?
I often run into the following problem. I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so that they can be replicated on the live system. However, I don't always remember what I...
In Ruby on Rails, there's a concept of a migration -- a quick script to change the database. You generate a migration file, which has rules to increase the db version (such as adding a column) and rules to downgrade the version (such as removing a column). Each migration is numbered, and a table keeps track of your cur...
Is there a version control system for database structure changes? I often run into the following problem. I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so that they can be repl...
TITLE: Is there a version control system for database structure changes? QUESTION: I often run into the following problem. I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so tha...
[ "sql", "database", "oracle", "version-control" ]
133
66
38,383
22
0
2008-08-02T01:52:54.653000
2008-08-02T06:23:33.737000
328
7,488
PHP Session Security
What are some guidelines for maintaining responsible session security with PHP? There's information all over the web and it's about time it all landed in one place!
There are a couple of things to do in order to keep your session secure: Use SSL when authenticating users or performing sensitive operations. Regenerate the session id whenever the security level changes (such as logging in). You can even regenerate the session id every request if you wish. Have sessions time out Don'...
PHP Session Security What are some guidelines for maintaining responsible session security with PHP? There's information all over the web and it's about time it all landed in one place!
TITLE: PHP Session Security QUESTION: What are some guidelines for maintaining responsible session security with PHP? There's information all over the web and it's about time it all landed in one place! ANSWER: There are a couple of things to do in order to keep your session secure: Use SSL when authenticating users ...
[ "security", "php" ]
125
88
85,917
13
0
2008-08-02T02:41:34.493000
2008-08-11T02:38:06.737000
330
332
Should I use nested classes in this case?
I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like play(), stop(), pause(), record() etc... Then I have workhorse classes that do the video decoding and video encoding. I just learned about the existence of nested ...
I would be a bit reluctant to use nested classes here. What if you created an abstract base class for a "multimedia driver" to handle the back-end stuff (workhorse), and a separate class for the front-end work? The front-end class could take a pointer/reference to an implemented driver class (for the appropriate media ...
Should I use nested classes in this case? I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like play(), stop(), pause(), record() etc... Then I have workhorse classes that do the video decoding and video encoding. I j...
TITLE: Should I use nested classes in this case? QUESTION: I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like play(), stop(), pause(), record() etc... Then I have workhorse classes that do the video decoding and v...
[ "c++", "class", "oop", "inner-classes" ]
58
30
5,019
10
0
2008-08-02T02:51:36.470000
2008-08-02T03:00:24.613000
336
339
When to use unsigned values over signed ones?
When is it appropriate to use an unsigned variable over a signed one? What about in a for loop? I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. for (unsigned int i = 0; i < someThing.length(); i++) { SomeThing var = someThing.at(i); // You get the idea. } I know Jav...
I was glad to find a good conversation on this subject, as I hadn't really given it much thought before. In summary, signed is a good general choice - even when you're dead sure all the numbers are positive - if you're going to do arithmetic on the variable (like in a typical for loop case). unsigned starts to make mor...
When to use unsigned values over signed ones? When is it appropriate to use an unsigned variable over a signed one? What about in a for loop? I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. for (unsigned int i = 0; i < someThing.length(); i++) { SomeThing var = some...
TITLE: When to use unsigned values over signed ones? QUESTION: When is it appropriate to use an unsigned variable over a signed one? What about in a for loop? I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. for (unsigned int i = 0; i < someThing.length(); i++) { So...
[ "language-agnostic", "types" ]
93
82
29,448
5
0
2008-08-02T03:34:44.763000
2008-08-02T03:49:21.987000
337
342
XML Processing in Python
I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. Unfortunately, whilst I know the XML model fairly well in.NET, I'm uncertain what the pros and cons are of the XML models in Python. Anyon...
Personally, I've played with several of the built-in options on an XML-heavy project and have settled on pulldom as the best choice for less complex documents. Especially for small simple stuff, I like the event-driven theory of parsing rather than setting up a whole slew of callbacks for a relatively simple structure....
XML Processing in Python I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. Unfortunately, whilst I know the XML model fairly well in.NET, I'm uncertain what the pros and cons are of the XM...
TITLE: XML Processing in Python QUESTION: I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. Unfortunately, whilst I know the XML model fairly well in.NET, I'm uncertain what the pros and ...
[ "python", "xml" ]
82
36
10,595
12
0
2008-08-02T03:35:55.697000
2008-08-02T04:01:34.600000
361
362
Generate list of all possible permutations of a string
How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters. Any language would work, but it should be portable.
There are several ways to do this. Common methods use recursion, memoization, or dynamic programming. The basic idea is that you produce a list of all strings of length 1, then in each iteration, for all strings produced in the last iteration, add that string concatenated with each character in the string individually....
Generate list of all possible permutations of a string How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters. Any language would work, but it should be portable.
TITLE: Generate list of all possible permutations of a string QUESTION: How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters. Any language would work, but it should be portable. ANSWER: There are several ways to ...
[ "string", "language-agnostic", "cross-platform", "permutation", "combinatorics" ]
166
69
214,067
36
0
2008-08-02T06:57:57.957000
2008-08-02T07:48:07.607000
371
396
How do you make sure email you send programmatically is not automatically marked as spam?
This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly spamish terminology. Of late, some of the emails I send out programmatically have started being shuffled into people's spam folder automatically...
Use email authentication methods, such as SPF, and DKIM to prove that your emails and your domain name belong together, and to prevent spoofing of your domain name. The SPF website includes a wizard to generate the DNS information for your site. Check your reverse DNS to make sure the IP address of your mail server poi...
How do you make sure email you send programmatically is not automatically marked as spam? This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly spamish terminology. Of late, some of the emails I sen...
TITLE: How do you make sure email you send programmatically is not automatically marked as spam? QUESTION: This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly spamish terminology. Of late, some o...
[ "email", "email-spam" ]
464
354
119,005
24
0
2008-08-02T08:19:18.260000
2008-08-02T10:21:54.300000
382
384
What is the meaning of the type safety warning in certain Java generics casts?
What is the meaning of the Java warning? Type safety: The cast from Object to List is actually checking against the erased type List I get this warning when I try to cast an Object to a type with generic information, such as in the following code: Object object = getMyList(); List list = (List ) object;
This warning is there because Java is not actually storing type information at run-time in an object that uses generics. Thus, if object is actually a List, there will be no ClassCastException at run-time except until an item is accessed from the list that doesn't match the generic type defined in the variable. This ca...
What is the meaning of the type safety warning in certain Java generics casts? What is the meaning of the Java warning? Type safety: The cast from Object to List is actually checking against the erased type List I get this warning when I try to cast an Object to a type with generic information, such as in the following...
TITLE: What is the meaning of the type safety warning in certain Java generics casts? QUESTION: What is the meaning of the Java warning? Type safety: The cast from Object to List is actually checking against the erased type List I get this warning when I try to cast an Object to a type with generic information, such a...
[ "java", "generics", "warnings", "casting", "type-safety" ]
81
53
10,291
1
0
2008-08-02T08:58:27.540000
2008-08-02T08:58:48.430000
End of preview. Expand in Data Studio

StackOverflow QA Dataset for RAG

Description

This dataset contains question–answer pairs extracted from the public StackOverflow data dump.

Each example consists of a question with its accepted answer, along with metadata such as tags, scores, and engagement statistics. The dataset is designed for retrieval-augmented generation (RAG), semantic search, and information retrieval tasks.


Dataset Structure

Each row is a JSON object with the following fields:

  • question_id — unique ID of the question
  • answer_id — unique ID of the accepted answer
  • title — question title
  • question_body — cleaned text of the question
  • answer_body — cleaned text of the accepted answer
  • question_text — title + question body
  • combined_text — title + question + answer (used for retrieval)
  • tags — list of StackOverflow tags
  • question_score — score of the question
  • answer_score — score of the answer
  • view_count — number of views
  • answer_count — number of answers
  • favorite_count — number of favorites
  • question_creation_date — timestamp
  • answer_creation_date — timestamp
Downloads last month
37