PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
44,007
09/04/2008 15:22:18
3,182
08/27/2008 09:11:40
199
7
ncover with nunit2 task in NAnt
Is there any chance to get this work? I want my tests to be run by nunit2 task in NAnt. In addition I want to run NCover without running tests again.
nant
nunit
tasks
ncover
null
null
open
ncover with nunit2 task in NAnt === Is there any chance to get this work? I want my tests to be run by nunit2 task in NAnt. In addition I want to run NCover without running tests again.
0
44,019
09/04/2008 15:33:35
4,061
09/01/2008 15:48:37
1
1
An easy way to diff log files, ignoring the time stamps?
I need to diff two log files but ignore the time stamp part of each line (the first 12 characters to be exact). Is there a good tool, or a clever awk command, that could help me out?
diff
logging
parse
compare
null
null
open
An easy way to diff log files, ignoring the time stamps? === I need to diff two log files but ignore the time stamp part of each line (the first 12 characters to be exact). Is there a good tool, or a clever awk command, that could help me out?
0
44,034
09/04/2008 15:46:07
4,525
09/04/2008 15:36:18
1
0
How can I get the definition (body) of a trigger in SQL Server?
Unable to find a SQL diff tool that meets my needs, I am writing my own. Between the INFORMATION_SCHEMA and sys tables, I have a mostly-complete working version. But one thing I can't find in the metadata is the <em>definition</em> of a trigger, you know, the actual SQL code. Am I overlooking something? Thanks.
sql-server
triggers
metadata
null
null
null
open
How can I get the definition (body) of a trigger in SQL Server? === Unable to find a SQL diff tool that meets my needs, I am writing my own. Between the INFORMATION_SCHEMA and sys tables, I have a mostly-complete working version. But one thing I can't find in the metadata is the <em>definition</em> of a trigger, you know, the actual SQL code. Am I overlooking something? Thanks.
0
44,046
09/04/2008 15:50:41
105
08/01/2008 23:29:32
63
8
Truncate (not round) decimal places in SQL Server
I'm trying to determine the best way to truncate or drop extra decimal places in SQL without rounding. For example: declare @value decimal(18,2) set @value = 123.456 This will auto round @Value to be 123.46....which in most cases is good. However, for this project I don't need that. Is there a simple way to truncate the decimals I don't need? I know I can use the left() function and convert back to a decimal...any other ways?
t-sql
sql-server
null
null
null
null
open
Truncate (not round) decimal places in SQL Server === I'm trying to determine the best way to truncate or drop extra decimal places in SQL without rounding. For example: declare @value decimal(18,2) set @value = 123.456 This will auto round @Value to be 123.46....which in most cases is good. However, for this project I don't need that. Is there a simple way to truncate the decimals I don't need? I know I can use the left() function and convert back to a decimal...any other ways?
0
44,048
09/04/2008 15:51:59
2,863
08/25/2008 16:09:56
70
8
Best way to rotate Apache log files
I've got an Apache server that has one access log file that is topping 600MB. This makes it really hard to search the file or parse it. What software or modules for Apache are available that will make a daily copy of my access file to make it more manageable?
apache
logging
null
null
null
null
open
Best way to rotate Apache log files === I've got an Apache server that has one access log file that is topping 600MB. This makes it really hard to search the file or parse it. What software or modules for Apache are available that will make a daily copy of my access file to make it more manageable?
0
44,066
09/04/2008 15:59:36
2,270
08/21/2008 12:32:26
1
0
Pass functions in F#
Is it possible to pass a reference to a function to another function in F#? Specifically, I'd like to pass lambda functions like foo(fun x -> x ** 3)
f#
null
null
null
null
null
open
Pass functions in F# === Is it possible to pass a reference to a function to another function in F#? Specifically, I'd like to pass lambda functions like foo(fun x -> x ** 3)
0
44,078
09/04/2008 16:04:57
1,306
08/14/2008 13:22:40
91
9
strip all html tags except links
I am trying to write a regex to strip all HTML with the exception of links (the `<a href` and `</a>` tags respectively. It does not have to be 100% secure (I am not worried about injection attacks or anything as I am parsing content that has already been approved and published into a SWF movie. The original "strip tags" RegEx I'm using was `<(.|\n)+?>`, and I tried to modify it to `<([^a]|\n)+?>`, but that of course will allow any tag that has an **a** In it rather than one that has it in the beginning, with a space. Not that it should really matter, but in case anyone cares to know I am writing this in AS3 for a Flash movie.
html
regex
actionscript-3
string
tags
null
open
strip all html tags except links === I am trying to write a regex to strip all HTML with the exception of links (the `<a href` and `</a>` tags respectively. It does not have to be 100% secure (I am not worried about injection attacks or anything as I am parsing content that has already been approved and published into a SWF movie. The original "strip tags" RegEx I'm using was `<(.|\n)+?>`, and I tried to modify it to `<([^a]|\n)+?>`, but that of course will allow any tag that has an **a** In it rather than one that has it in the beginning, with a space. Not that it should really matter, but in case anyone cares to know I am writing this in AS3 for a Flash movie.
0
44,080
09/04/2008 16:05:57
3,244
08/27/2008 14:29:50
1
0
Does Microsoft ASP.NET Ajax Cause DOM Object Leaks?
We've been using "Drip" to try and identify why pages with UpdatePanels in them tend to use a lot of client-side memory. With a page with a regular postback, we are seeing 0 leaks detected by Drip. However, when we add an update panel to the mix, every single DOM object that is inside of the update panel appears to leak (according to Drip). I am not certain is Drip is reliable enough to report these kinds of things - the reported leaks do seem to indicate Drip is modifying the page slightly. Does anyone have any experience with this? Should I panic and stop using Microsoft Ajax? I'm not above doubting Microsoft, but it seems fishy to me that it could be *this* bad.
asp.net
ajax
null
null
null
null
open
Does Microsoft ASP.NET Ajax Cause DOM Object Leaks? === We've been using "Drip" to try and identify why pages with UpdatePanels in them tend to use a lot of client-side memory. With a page with a regular postback, we are seeing 0 leaks detected by Drip. However, when we add an update panel to the mix, every single DOM object that is inside of the update panel appears to leak (according to Drip). I am not certain is Drip is reliable enough to report these kinds of things - the reported leaks do seem to indicate Drip is modifying the page slightly. Does anyone have any experience with this? Should I panic and stop using Microsoft Ajax? I'm not above doubting Microsoft, but it seems fishy to me that it could be *this* bad.
0
44,084
09/04/2008 16:06:48
1,679
08/17/2008 23:32:44
23
5
How do I document a module in Python?
That's it. If you want to document a function or a class, you put a string just after the definition. For instance: def foo(): """This function does nothing.""" pass But what about a module? How can I document what a *file.py* does?
python
documentation
module
null
null
null
open
How do I document a module in Python? === That's it. If you want to document a function or a class, you put a string just after the definition. For instance: def foo(): """This function does nothing.""" pass But what about a module? How can I document what a *file.py* does?
0
44,087
09/04/2008 16:08:43
3,635
08/29/2008 16:13:11
38
3
IE6 and XML prolog
With an XML prolog like <?xml version="1.0" encoding="iso-8859-1"?> and a Doctype like <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> I can get my page to render as expected. However, in IE7 the same page does not render correctly. (a span inside a div does not align vertically) Articles on the web suggest that XML prolog + doctype will throw IE6 into quirks mode. However the article below seems to suggest otherwise, although it does not mention the version (is it 6 or 7) it applies to http://blogs.msdn.com/ie/archive/2005/09/15/467901.aspx The article is dated sep 2005 which makes me believe it applies to IE6 Question: Does XML Prolog + doc type throw IE6 into quirks mode? What about IE7? Any recommendations on for or against using the prolog + doctype TIA
internet-explorer-6
standards
null
null
null
null
open
IE6 and XML prolog === With an XML prolog like <?xml version="1.0" encoding="iso-8859-1"?> and a Doctype like <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> I can get my page to render as expected. However, in IE7 the same page does not render correctly. (a span inside a div does not align vertically) Articles on the web suggest that XML prolog + doctype will throw IE6 into quirks mode. However the article below seems to suggest otherwise, although it does not mention the version (is it 6 or 7) it applies to http://blogs.msdn.com/ie/archive/2005/09/15/467901.aspx The article is dated sep 2005 which makes me believe it applies to IE6 Question: Does XML Prolog + doc type throw IE6 into quirks mode? What about IE7? Any recommendations on for or against using the prolog + doctype TIA
0
44,089
09/04/2008 16:09:20
4,311
09/02/2008 19:43:37
1
2
How To Extract SFTP SSH Key From Key Cache in FileZilla FTP Client
I have connected to a server via SFTP using FileZilla and accepted adding the server's SSH key to the key cache in FileZilla. How can I extract this cached key to a keyfile so that may use it through other SFTP applications that require a keyfile be made available? I have not been able to find anything in the FileZilla documentation related to this.
ftp
sftp
filezilla
null
null
null
open
How To Extract SFTP SSH Key From Key Cache in FileZilla FTP Client === I have connected to a server via SFTP using FileZilla and accepted adding the server's SSH key to the key cache in FileZilla. How can I extract this cached key to a keyfile so that may use it through other SFTP applications that require a keyfile be made available? I have not been able to find anything in the FileZilla documentation related to this.
0
44,090
09/04/2008 16:10:12
3,666
08/29/2008 18:55:25
141
12
Do you know any graph visualization libraries for .NET?
Do you know any libraries that would handle displaying of graph structures in .NET? I'm looking for something similar to java libraries: [jgraph](http://www.jgraph.com/) or [Netbeans Visual Library](http://graph.netbeans.org/). I'd like to display objects as nodes in the graph.
.net
java
graph
visualization
null
null
open
Do you know any graph visualization libraries for .NET? === Do you know any libraries that would handle displaying of graph structures in .NET? I'm looking for something similar to java libraries: [jgraph](http://www.jgraph.com/) or [Netbeans Visual Library](http://graph.netbeans.org/). I'd like to display objects as nodes in the graph.
0
44,100
09/04/2008 16:15:13
1,512
08/16/2008 03:17:59
42
1
Best way to use a property to reference a Key-Value pair in a dictionary
This is a fairly trivial matter, but I'm curious to hear people's opinions on it. If I have a Dictionary<string, string> which I'm access through properties, which of these formats would you prefer for the property? /// <summary> /// This class's FirstProperty property /// </summary> [DefaultValue("myValue")] public string FirstProperty { get { return Dictionary["myKey"]; } set { Dictionary["myKey"] = value; } This is probably the typical way of doing it. It's fairly efficient, easy to understand, etc. The only disadvantage is with a longer or more complex key it would be possible to misspell it or change only one instance or something, leading me to this: /// <summary> /// This class's SecondProperty property /// </summary> [DefaultValue("myValue")] private const string DICT_MYKEY = "myKey" public string SecondProperty { get { return Dictionary[DICT_MYKEY]; } set { Dictionary[DICT_MYKEY] = value; } Which is marginally more complicated, but seems to offer additional safety, and is closer to what I would think of as the "Code Complete" solution. The downside is that when you also have a /// <summary> block and a [DefaultValue()] block above the property already, it starts getting a bit crowded up there. So which do you like better, and why? Does anybody have any better ideas?
dictionary
null
null
null
null
null
open
Best way to use a property to reference a Key-Value pair in a dictionary === This is a fairly trivial matter, but I'm curious to hear people's opinions on it. If I have a Dictionary<string, string> which I'm access through properties, which of these formats would you prefer for the property? /// <summary> /// This class's FirstProperty property /// </summary> [DefaultValue("myValue")] public string FirstProperty { get { return Dictionary["myKey"]; } set { Dictionary["myKey"] = value; } This is probably the typical way of doing it. It's fairly efficient, easy to understand, etc. The only disadvantage is with a longer or more complex key it would be possible to misspell it or change only one instance or something, leading me to this: /// <summary> /// This class's SecondProperty property /// </summary> [DefaultValue("myValue")] private const string DICT_MYKEY = "myKey" public string SecondProperty { get { return Dictionary[DICT_MYKEY]; } set { Dictionary[DICT_MYKEY] = value; } Which is marginally more complicated, but seems to offer additional safety, and is closer to what I would think of as the "Code Complete" solution. The downside is that when you also have a /// <summary> block and a [DefaultValue()] block above the property already, it starts getting a bit crowded up there. So which do you like better, and why? Does anybody have any better ideas?
0
44,101
09/04/2008 16:15:42
1,044
08/11/2008 18:59:21
16
2
invisible watermarks in images
How do you insert invisible watermarks in images for copyright purposes? I'm looking for a python library. What algorithm do you use? What about performance and efficiency?
python
image
copyright
watermark
invisible
null
open
invisible watermarks in images === How do you insert invisible watermarks in images for copyright purposes? I'm looking for a python library. What algorithm do you use? What about performance and efficiency?
0
44,102
09/04/2008 16:15:48
2,496
08/22/2008 14:30:33
1
0
NT authentication login
I have a site I am working on, on this site users can login to get more private information. My client has another site elseware that uses nt authentication for accessing it. What they want to do is have a button on the site I am working on under the private area that will send them to the ntauthenticated site, but not require them to log on to that site instead passing the username and password that they used to log into my site to the other site for them. Is it possible to do this? and how would I accomplish it? Is there a better way to do this?
authentication
login
ntlm
null
null
null
open
NT authentication login === I have a site I am working on, on this site users can login to get more private information. My client has another site elseware that uses nt authentication for accessing it. What they want to do is have a button on the site I am working on under the private area that will send them to the ntauthenticated site, but not require them to log on to that site instead passing the username and password that they used to log into my site to the other site for them. Is it possible to do this? and how would I accomplish it? Is there a better way to do this?
0
44,109
09/04/2008 16:19:49
2,841
08/25/2008 13:38:48
131
10
Extending the User model with custom fields in Django
What's the best way to extend the User model (bundled with Django's authentication app) with custom fields? I would also possibly like to use the email as the username (for authentication purposes). I've already seen a [few][1] [ways][2] to do it, but can't decide on which one is the best. [1]: http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/ [2]: http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
authentication
django
null
null
null
null
open
Extending the User model with custom fields in Django === What's the best way to extend the User model (bundled with Django's authentication app) with custom fields? I would also possibly like to use the email as the username (for authentication purposes). I've already seen a [few][1] [ways][2] to do it, but can't decide on which one is the best. [1]: http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/ [2]: http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
0
44,118
09/04/2008 16:25:17
3,821
08/31/2008 02:41:10
36
4
SQL Server Alter Computed Column
Does anyone know of a way to alter a computed column without dropping the column in SQL Server. I want to stop using the column as a computed column and start storing data directly in the column, but would like to retain the current values. Is this even possible?
sql-server
computed-column
null
null
null
null
open
SQL Server Alter Computed Column === Does anyone know of a way to alter a computed column without dropping the column in SQL Server. I want to stop using the column as a computed column and start storing data directly in the column, but would like to retain the current values. Is this even possible?
0
44,131
09/04/2008 16:32:37
1,042
08/11/2008 18:02:48
357
43
How do I hide the input caret in a System.Windows.Forms.TextBox?
I need to display a variable-length message and allow the text to be selectable. The blinking input caret is confusing. How do I hide it?
winforms
textbox
null
null
null
null
open
How do I hide the input caret in a System.Windows.Forms.TextBox? === I need to display a variable-length message and allow the text to be selectable. The blinking input caret is confusing. How do I hide it?
0
44,135
09/04/2008 16:36:12
3,446
08/28/2008 15:47:28
86
8
Project design / FS layout for large django projects
What is the best way to layout a large django project? The tutuorials provide simple instructions for setting up apps, models, and views, but there is less information about how apps and projects should be broken down, how much sharing is allowable/necessary between apps in a typical project (obviously that is largely dependent on the project) and how/where general templates should be kept. Does anyone have examples, suggestions, and *explanations* as to why a certain project layout is better than another? I am particularly interested in the incorporation of large numbers of unit tests (2-5x the size of the actual code base) and string externalization / templates.
python
django
project-design
null
null
null
open
Project design / FS layout for large django projects === What is the best way to layout a large django project? The tutuorials provide simple instructions for setting up apps, models, and views, but there is less information about how apps and projects should be broken down, how much sharing is allowable/necessary between apps in a typical project (obviously that is largely dependent on the project) and how/where general templates should be kept. Does anyone have examples, suggestions, and *explanations* as to why a certain project layout is better than another? I am particularly interested in the incorporation of large numbers of unit tests (2-5x the size of the actual code base) and string externalization / templates.
0
44,143
09/04/2008 16:39:07
4,269
09/02/2008 15:26:27
58
4
Publishing Flash video
What options do I have to publish Flash video from webcams other than Adobe's Media Server and Red5? I would prefer a solution in .NET, Python or PHP but can't find anything.
flash
video
webcam
null
null
null
open
Publishing Flash video === What options do I have to publish Flash video from webcams other than Adobe's Media Server and Red5? I would prefer a solution in .NET, Python or PHP but can't find anything.
0
44,144
09/04/2008 16:39:56
2,455
08/22/2008 11:29:07
96
4
Hudson can't build my Maven 2 project because it says artifacts are missing from the repository? (they aren't)
I'm using Hudson and Maven 2 for my automated build/CI. I can build fine with maven from the command line, but when I run the same goal with Hudson, the build fails complaining of missing artifacts. I'm running Hudson as a windows XP service.
continuous-integration
maven-2
hudson
mvn
null
null
open
Hudson can't build my Maven 2 project because it says artifacts are missing from the repository? (they aren't) === I'm using Hudson and Maven 2 for my automated build/CI. I can build fine with maven from the command line, but when I run the same goal with Hudson, the build fails complaining of missing artifacts. I'm running Hudson as a windows XP service.
0
44,145
09/04/2008 16:40:10
4,061
09/01/2008 15:48:37
13
1
Database sharding and Rails
What's the best way to deal with a sharded database in Rails? Should the sharding be handled at the application layer, the active record layer, the database driver layer, a proxy layer, or something else altogether? What are the pros and cons of each?
database
ruby-on-rails
activerecord
sharding
shards
null
open
Database sharding and Rails === What's the best way to deal with a sharded database in Rails? Should the sharding be handled at the application layer, the active record layer, the database driver layer, a proxy layer, or something else altogether? What are the pros and cons of each?
0
44,153
09/04/2008 16:45:35
3,043
08/26/2008 13:24:14
939
104
Can you use reflection to find the name of the currently executing method?
Like the title says: Can reflection give you the name of the currently executing method. I'm inclined to guess not, because of the Heisenberg problem. How do you call a method that will tell you the current method without changing what the current method is? But I'm hoping someone can prove me wrong there.
.net
reflection
null
null
null
null
open
Can you use reflection to find the name of the currently executing method? === Like the title says: Can reflection give you the name of the currently executing method. I'm inclined to guess not, because of the Heisenberg problem. How do you call a method that will tell you the current method without changing what the current method is? But I'm hoping someone can prove me wrong there.
0
44,159
09/04/2008 16:48:54
39,040
11/19/2008 17:53:34
20
4
Software Testing Books
So I've recently read [Test Driven Development][1] by Kent Beck, which I found interesting (although it felt a bit light on details) and I've started using unit tests in my programming which I'm really enjoying the added peace of mind about code quality versus ad hoc testing, although I'm not at the stage of doing full fledged TDD (yet). I'd like a more in depth text on software testing specifically on writing useful tests and how to make sure that as much of the code as possible is being exercised by the automated tests. [1]: http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1?ie=UTF8&s=books&qid=1220546554&sr=1-1
testing
book
null
null
null
09/30/2011 00:51:06
not constructive
Software Testing Books === So I've recently read [Test Driven Development][1] by Kent Beck, which I found interesting (although it felt a bit light on details) and I've started using unit tests in my programming which I'm really enjoying the added peace of mind about code quality versus ad hoc testing, although I'm not at the stage of doing full fledged TDD (yet). I'd like a more in depth text on software testing specifically on writing useful tests and how to make sure that as much of the code as possible is being exercised by the automated tests. [1]: http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1?ie=UTF8&s=books&qid=1220546554&sr=1-1
4
44,161
09/04/2008 16:49:38
4,269
09/02/2008 15:26:27
58
4
Real-time wmv video encoding in C#
How to encode video on the fly and send it trough the network from C#? Can't find a suitable library. I need to encode in WMV and don't mind if the actual encoding is made in C++ as long as the library has a .NET dll available. Thanks
video
encoding
.net
null
null
null
open
Real-time wmv video encoding in C# === How to encode video on the fly and send it trough the network from C#? Can't find a suitable library. I need to encode in WMV and don't mind if the actual encoding is made in C++ as long as the library has a .NET dll available. Thanks
0
44,176
09/04/2008 17:00:59
3,408
08/28/2008 13:20:22
41
4
Searching subversion history (full text)
Is there a way to perform a full text search of a subversion repository, including all the history? For example, I've written a feature that I used somewhere, but then it wasn't needed, so I svn rm'd the files, but now I need to find it again to use it for something else. The svn log probably says something like "removed unused stuff", and there's loads of checkins like that.
full-text-search
subversion
null
null
null
null
open
Searching subversion history (full text) === Is there a way to perform a full text search of a subversion repository, including all the history? For example, I've written a feature that I used somewhere, but then it wasn't needed, so I svn rm'd the files, but now I need to find it again to use it for something else. The svn log probably says something like "removed unused stuff", and there's loads of checkins like that.
0
44,177
09/04/2008 17:01:13
4,269
09/02/2008 15:26:27
58
4
Connecting private IPs
A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth. Is this true? How's this technique named? Thanks
ip
private-ips
null
null
null
null
open
Connecting private IPs === A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth. Is this true? How's this technique named? Thanks
0
44,181
09/04/2008 17:03:25
1,980
08/19/2008 16:40:39
8
1
SQL: Select like column from two tables
I have a database with two tables (Table1 and Table2). They both have a common column [ColumnA] which is an nvarchar. How can I select this column from both tables and return it as a single column in my result set? So I'm looking for something like: ColumnA in Table1: a b c ColumnA in Table2: d e f Result set should be: a b c d e f
sql
query
null
null
null
null
open
SQL: Select like column from two tables === I have a database with two tables (Table1 and Table2). They both have a common column [ColumnA] which is an nvarchar. How can I select this column from both tables and return it as a single column in my result set? So I'm looking for something like: ColumnA in Table1: a b c ColumnA in Table2: d e f Result set should be: a b c d e f
0
44,190
09/04/2008 17:06:32
370,899
08/22/2008 12:32:04
40
6
Looking for a simple JavaScript example that updates DOM.
The question says it all. :)
javascript
null
null
null
null
null
open
Looking for a simple JavaScript example that updates DOM. === The question says it all. :)
0
44,194
09/04/2008 17:07:17
83
08/01/2008 16:31:56
1,120
82
How do I best generate a CSV (comma-delimited text file) for download with ASP.NET?
This is what I've got. It works. But, is there a simpler or better way? One an ASPX page, I've got the download link... <asp:HyperLink ID="HyperLinkDownload" runat="server" NavigateUrl="~/Download.aspx">Download as CSV file</asp:HyperLink> And then I've got the Download.aspx.vb Code Behind... Public Partial Class Download Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'set header Response.Clear() Response.ContentType = "text/csv" Dim FileName As String = "books.csv" Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName) 'generate file content Dim db As New bookDevelopmentDataContext Dim Allbooks = From b In db.books _ Order By b.Added _ Select b Dim CsvFile As New StringBuilder CsvFile.AppendLine(CsvHeader()) For Each b As Book In Allbooks CsvFile.AppendLine(bookString(b)) Next 'write the file Response.Write(CsvFile.ToString) Response.End() End Sub Function CsvHeader() As String Dim CsvLine As New StringBuilder CsvLine.Append("Published,") CsvLine.Append("Title,") CsvLine.Append("Author,") CsvLine.Append("Price") Return CsvLine.ToString End Function Function bookString(ByVal b As Book) As String Dim CsvLine As New StringBuilder CsvLine.Append(b.Published.ToShortDateString + ",") CsvLine.Append(b.Title.Replace(",", "") + ",") CsvLine.Append(b.Author.Replace(",", "") + ",") CsvLine.Append(Format(b.Price, "c").Replace(",", "")) Return CsvLine.ToString End Function End Class
asp.net
vb.net
file-io
csv
null
null
open
How do I best generate a CSV (comma-delimited text file) for download with ASP.NET? === This is what I've got. It works. But, is there a simpler or better way? One an ASPX page, I've got the download link... <asp:HyperLink ID="HyperLinkDownload" runat="server" NavigateUrl="~/Download.aspx">Download as CSV file</asp:HyperLink> And then I've got the Download.aspx.vb Code Behind... Public Partial Class Download Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'set header Response.Clear() Response.ContentType = "text/csv" Dim FileName As String = "books.csv" Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName) 'generate file content Dim db As New bookDevelopmentDataContext Dim Allbooks = From b In db.books _ Order By b.Added _ Select b Dim CsvFile As New StringBuilder CsvFile.AppendLine(CsvHeader()) For Each b As Book In Allbooks CsvFile.AppendLine(bookString(b)) Next 'write the file Response.Write(CsvFile.ToString) Response.End() End Sub Function CsvHeader() As String Dim CsvLine As New StringBuilder CsvLine.Append("Published,") CsvLine.Append("Title,") CsvLine.Append("Author,") CsvLine.Append("Price") Return CsvLine.ToString End Function Function bookString(ByVal b As Book) As String Dim CsvLine As New StringBuilder CsvLine.Append(b.Published.ToShortDateString + ",") CsvLine.Append(b.Title.Replace(",", "") + ",") CsvLine.Append(b.Author.Replace(",", "") + ",") CsvLine.Append(Format(b.Price, "c").Replace(",", "")) Return CsvLine.ToString End Function End Class
0
44,205
09/04/2008 17:13:59
4,269
09/02/2008 15:26:27
68
5
Direct connections.
From a [Joel's post on Copilot][1]: > Direct Connect! We’ve always done > everything we can to make sure that > Fog Creek Copilot can connect in any > networking situation, no matter what > firewalls or NATs are in place. To > make this happen, both parties make > outbound connections to our server, > which relays traffic on their behalf. > Well, in many cases, this isn’t > necessary. So version 2.0 does > something rather clever: it sets up > the initial connection through our > servers, so you get connected right > away with 100% reliability. But then > once you’re all connected, it quietly, > in the background, looks for a way to > make a direct connection. If it can’t, > no big deal: you just keep relaying > through our server. If you can make a > direct peer-to-peer connection, it > silently shifts your data onto the > direct connection. You won’t notice > anything except, probably, much faster > communication. How do they change the server connection to a P2P connection? [1]: http://www.joelonsoftware.com/items/2007/01/26.html
ip
private-ips
p2p
null
null
null
open
Direct connections. === From a [Joel's post on Copilot][1]: > Direct Connect! We’ve always done > everything we can to make sure that > Fog Creek Copilot can connect in any > networking situation, no matter what > firewalls or NATs are in place. To > make this happen, both parties make > outbound connections to our server, > which relays traffic on their behalf. > Well, in many cases, this isn’t > necessary. So version 2.0 does > something rather clever: it sets up > the initial connection through our > servers, so you get connected right > away with 100% reliability. But then > once you’re all connected, it quietly, > in the background, looks for a way to > make a direct connection. If it can’t, > no big deal: you just keep relaying > through our server. If you can make a > direct peer-to-peer connection, it > silently shifts your data onto the > direct connection. You won’t notice > anything except, probably, much faster > communication. How do they change the server connection to a P2P connection? [1]: http://www.joelonsoftware.com/items/2007/01/26.html
0
44,207
09/04/2008 17:15:13
3,233
08/27/2008 13:54:44
62
7
What are good alternative data formats to XML?
XML, granted, is very useful, but can be quite verbose. What alternatives are there and are they specialised for any particular purpose? Library support to interrogate the contents easily is a big plus point.
xml
data-structures
serialization
null
null
null
open
What are good alternative data formats to XML? === XML, granted, is very useful, but can be quite verbose. What alternatives are there and are they specialised for any particular purpose? Library support to interrogate the contents easily is a big plus point.
0
44,211
09/04/2008 17:16:43
4,530
09/04/2008 17:16:43
1
0
Code Review Collaboration
My teams develop in C# and Java using Perforce for source control. Our two teams are spread out geographically and we are wanting to implement code reviews accross those teams. I have been looking for a tool to assist us with these reviews and I have narrowed my search to SmartBear's Code Collaborator and Cenqua's Crucible. Can anyone provide some insight into experience's with either/both tools and what your preference would be for geographically seperated teams? Also, if there is another product that I have overlooked, I would gladly accept other suggestions. Thanks.
code-review
code-collaborator
null
null
null
null
open
Code Review Collaboration === My teams develop in C# and Java using Perforce for source control. Our two teams are spread out geographically and we are wanting to implement code reviews accross those teams. I have been looking for a tool to assist us with these reviews and I have narrowed my search to SmartBear's Code Collaborator and Cenqua's Crucible. Can anyone provide some insight into experience's with either/both tools and what your preference would be for geographically seperated teams? Also, if there is another product that I have overlooked, I would gladly accept other suggestions. Thanks.
0
44,220
09/04/2008 17:20:16
2,894
08/25/2008 20:06:55
371
42
Difference between foreach and for loops over an IEnumerable class in C#
I have been told that there is a performance difference between the following code blocks. foreach (Entity e in entityList) { .... } and for (int i=0; i<entityList.Count; i++) { Entity e = (Entity)entityList[i]; ... } where List<Entity> entityList; I am no CLR expect but from what I can tell they should boil down to basically the same code. Does anybody have concrete (heck, I'd take packed dirt) evidence one way or the other?
c#
performance
loops
null
null
null
open
Difference between foreach and for loops over an IEnumerable class in C# === I have been told that there is a performance difference between the following code blocks. foreach (Entity e in entityList) { .... } and for (int i=0; i<entityList.Count; i++) { Entity e = (Entity)entityList[i]; ... } where List<Entity> entityList; I am no CLR expect but from what I can tell they should boil down to basically the same code. Does anybody have concrete (heck, I'd take packed dirt) evidence one way or the other?
0
44,223
09/04/2008 17:21:44
3,233
08/27/2008 13:54:44
67
7
What are the best liberal software licenses (i.e. non viral/GPL)?
There are lots of difference software licenses. The GPL is pretty strict and aims to keep software "free". Many projects use more liberal license, e.g. that are more "business friendly". - Are there any good resources for people to read to decide what is a good license to use? - If you have released licensed software, what license(s) do you use and why?
licensing
gpl
null
null
null
null
open
What are the best liberal software licenses (i.e. non viral/GPL)? === There are lots of difference software licenses. The GPL is pretty strict and aims to keep software "free". Many projects use more liberal license, e.g. that are more "business friendly". - Are there any good resources for people to read to decide what is a good license to use? - If you have released licensed software, what license(s) do you use and why?
0
44,224
09/04/2008 17:21:54
3,515
08/28/2008 22:05:40
10
2
How to start learning JAVA for use with Oracle RDBMS?
I am looking for some advice on what should I concentrate my efforts to get the needed skills to become a Java developer for Oracle applications. I'm bit confused as there are lot of technologies in the Java world. Where should I start? What to avoid? Is JDeveloper a good IDE for a beginner?
java
oracle
null
null
null
null
open
How to start learning JAVA for use with Oracle RDBMS? === I am looking for some advice on what should I concentrate my efforts to get the needed skills to become a Java developer for Oracle applications. I'm bit confused as there are lot of technologies in the Java world. Where should I start? What to avoid? Is JDeveloper a good IDE for a beginner?
0
44,241
09/04/2008 17:27:35
2,768
08/24/2008 23:52:54
156
8
How Can I Monitor Which Window Currently Has Keyboard Focus
Is there a way to track which window currently has keyboard focus. I could handle WM_SETFOCUS for every window but I'm wondering if there's an alternative, simpler method (i.e. a single message handler somewhere). I could use OnIdle() in MFC and call GetFocus() but that seems a little hacky.
winapi
mfc
null
null
null
null
open
How Can I Monitor Which Window Currently Has Keyboard Focus === Is there a way to track which window currently has keyboard focus. I could handle WM_SETFOCUS for every window but I'm wondering if there's an alternative, simpler method (i.e. a single message handler somewhere). I could use OnIdle() in MFC and call GetFocus() but that seems a little hacky.
0
44,247
09/04/2008 17:30:58
4,298
09/02/2008 18:17:28
8
0
What is the best practice for estimating required time for development of the SDLC phases?
As project manager, your required to organize your time so that the project meets a deadline. Is there some sort of equation to use for estimating how long development will take for let's say the database (like time = sql storeprecedures * tables manipulated or something similar) or are you just stuck having to get the experience to get adequate estimations?
project-management
time-management
null
null
null
null
open
What is the best practice for estimating required time for development of the SDLC phases? === As project manager, your required to organize your time so that the project meets a deadline. Is there some sort of equation to use for estimating how long development will take for let's say the database (like time = sql storeprecedures * tables manipulated or something similar) or are you just stuck having to get the experience to get adequate estimations?
0
44,260
09/04/2008 17:34:27
4,539
09/04/2008 17:34:26
1
0
Can .NET check other running programs command line parameters?
We've got an interesting case where we are trying to determine how different instances of our app were launched. Is there any way for .NET to be able to query another running instance and get the command line parameters passed to that instance? I've not been able to find any way to do it in .NET so far, so I thought I'd check here to see if anyone had done anything like this before.
.net
command
parameters
line
null
null
open
Can .NET check other running programs command line parameters? === We've got an interesting case where we are trying to determine how different instances of our app were launched. Is there any way for .NET to be able to query another running instance and get the command line parameters passed to that instance? I've not been able to find any way to do it in .NET so far, so I thought I'd check here to see if anyone had done anything like this before.
0
44,261
09/04/2008 17:34:28
4,491
09/04/2008 06:44:23
28
0
cmd defaults to F: drive
When I open cmd on my laptop it is defaulting to the F: drive. This is troubling me does anyone know how it got that way or how to get it back to where it opens to the C: drive by default?
windows
cmd
cmd.exe
null
null
null
open
cmd defaults to F: drive === When I open cmd on my laptop it is defaulting to the F: drive. This is troubling me does anyone know how it got that way or how to get it back to where it opens to the C: drive by default?
0
44,270
09/04/2008 17:37:04
4,541
09/04/2008 17:37:04
1
0
Order an Array like another Array in C#
I'm looking for the best algorithm to take array A {0,1,2,3} and make order it like array B {3,1,0,2}. Any ideas?
c#
array
null
null
null
null
open
Order an Array like another Array in C# === I'm looking for the best algorithm to take array A {0,1,2,3} and make order it like array B {3,1,0,2}. Any ideas?
0
44,272
09/04/2008 17:38:40
1,797
08/18/2008 15:46:11
947
51
Given that I have a hash of id(key) and countries(values) sorted alphabetically, what is the best way to bubble up an entry to the top of the stack?
This is a php example, but an algorithm for any language would do. What I specifically want to do is bubble up the United States and Canada to the top of the list. Here is an example of the array shortened for brevity. array( 0 => '-- SELECT --', 1 => 'Afghanistan', 2 => 'Albania', 3 => 'Algeria', 4 => 'American Samoa', 5 => 'Andorra',)
php
algorithm
null
null
null
null
open
Given that I have a hash of id(key) and countries(values) sorted alphabetically, what is the best way to bubble up an entry to the top of the stack? === This is a php example, but an algorithm for any language would do. What I specifically want to do is bubble up the United States and Canada to the top of the list. Here is an example of the array shortened for brevity. array( 0 => '-- SELECT --', 1 => 'Afghanistan', 2 => 'Albania', 3 => 'Algeria', 4 => 'American Samoa', 5 => 'Andorra',)
0
44,281
09/04/2008 17:42:13
2,820
08/25/2008 11:37:16
109
9
Database Patterns
Does anyone know of papers/books/etc. that document patterns for databases? For example, one common rule of thumb is that every table should have a primary key and that the key should be [devoid of information content][1]. So I was wondering if anyone had written a book or published papers regarding design patterns for designing relational databases? [1]: http://en.wikipedia.org/wiki/Surrogate_key
design-patterns
database-design
null
null
null
null
open
Database Patterns === Does anyone know of papers/books/etc. that document patterns for databases? For example, one common rule of thumb is that every table should have a primary key and that the key should be [devoid of information content][1]. So I was wondering if anyone had written a book or published papers regarding design patterns for designing relational databases? [1]: http://en.wikipedia.org/wiki/Surrogate_key
0
44,286
09/04/2008 17:42:59
1,862
08/18/2008 23:53:20
1,433
113
Program for working with large CSV Files
Are there any good programs for dealing with reading large CSV files? Some of the datafiles I deal with are in the 1 GB range. They have too many lines for Excel to even deal with. Using Access can be a little slow, as you have to actually import them into a database to work with them directly. Is there a program that can open large CSV files and give you a simple spreadsheet layout to help you easily and quickly scan through the data?
data
csv
null
null
null
null
open
Program for working with large CSV Files === Are there any good programs for dealing with reading large CSV files? Some of the datafiles I deal with are in the 1 GB range. They have too many lines for Excel to even deal with. Using Access can be a little slow, as you have to actually import them into a database to work with them directly. Is there a program that can open large CSV files and give you a simple spreadsheet layout to help you easily and quickly scan through the data?
0
44,288
09/04/2008 17:44:10
2,894
08/25/2008 20:06:55
381
42
Differences in string compare methods in C#
Comparing string in C# is pretty simple. In fact there are several ways to do it. I have listed some in the block below. What I am curious about are the differences between them and when one should be used over the others? Should one be avoided at all costs? Are there more I haven't listed? string testString = "Test"; string anotherString = "Another"; if (testString.CompareTo(anotherString) == 0) {} if (testString.Equals(anotherString)) {} if (testString == anotherStirng) {} (Note: I am looking for equality in this example, not less than or greater than but feel free to comment on that as well)
c#
string
comparison
null
null
null
open
Differences in string compare methods in C# === Comparing string in C# is pretty simple. In fact there are several ways to do it. I have listed some in the block below. What I am curious about are the differences between them and when one should be used over the others? Should one be avoided at all costs? Are there more I haven't listed? string testString = "Test"; string anotherString = "Another"; if (testString.CompareTo(anotherString) == 0) {} if (testString.Equals(anotherString)) {} if (testString == anotherStirng) {} (Note: I am looking for equality in this example, not less than or greater than but feel free to comment on that as well)
0
44,294
09/04/2008 17:45:59
1,154
08/12/2008 23:39:07
342
37
Enabled Brigded Network in Vmware Server
I have the vmware server with this error, anyone knows how to fix it?![VMware Server Error][1] [1]: http://soporte.cardinalsystems.com.ar/errorvmwareserver.jpg
vmware
virtualization
vmware-server
null
null
null
open
Enabled Brigded Network in Vmware Server === I have the vmware server with this error, anyone knows how to fix it?![VMware Server Error][1] [1]: http://soporte.cardinalsystems.com.ar/errorvmwareserver.jpg
0
44,298
09/04/2008 17:47:48
317
08/04/2008 15:43:28
337
17
Strong Validation in WPF
I have a databound TextBox in my application like so: (The type of `Height` is `decimal?`) <TextBox Text="{Binding Height, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, Converter={StaticResource NullConverter}}" /> public class NullableConverter : IValueConverter { public object Convert(object o, Type type, object parameter, CultureInfo culture) { return o; } public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) { if (o as string == null || (o as string).Trim() == string.Empty) return null; return o; } } Configured this way, any non-empty strings which cannot be converted to decimal result in a validation error which will immediately highlight the textbox. However, the TextBox can still lose focus and remain in an invalid state. What I would like to do is either: 1. Not allow the TextBox to lose focus until it contains a valid value. 2. Revert the value in the TextBox to the last valid value. What is the best way to do this?
wpf
validation
data-binding
null
null
null
open
Strong Validation in WPF === I have a databound TextBox in my application like so: (The type of `Height` is `decimal?`) <TextBox Text="{Binding Height, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, Converter={StaticResource NullConverter}}" /> public class NullableConverter : IValueConverter { public object Convert(object o, Type type, object parameter, CultureInfo culture) { return o; } public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) { if (o as string == null || (o as string).Trim() == string.Empty) return null; return o; } } Configured this way, any non-empty strings which cannot be converted to decimal result in a validation error which will immediately highlight the textbox. However, the TextBox can still lose focus and remain in an invalid state. What I would like to do is either: 1. Not allow the TextBox to lose focus until it contains a valid value. 2. Revert the value in the TextBox to the last valid value. What is the best way to do this?
0
44,337
09/04/2008 17:59:52
4,540
09/04/2008 17:35:05
11
1
preferred way to implement visitor pattern in dynamic languages?
As an exercise for myself, I was translating a sample program into various languages. Starting in C#, I had a visitor-pattern interface like so: interface Visitor { void Accept(Bedroom x); void Accept(Bathroom x); void Accept(Kitchen x); void Accept(LivingRoom x); } Moving to ruby (or python, or whatever), I no longer get dispatch from the compiler based on type. Should I do the dispatch in the visitor itself? class Cleaner def accept(x) acceptBedroom(x) if Bedroom === x acceptBathroom(x) if Bathroom === x acceptKitchen(x) if Kitchen===x acceptLivingRoom(x) if LivingRoom===x end ... Or should I do the dispatch in the different specializaions of the room: class Bathroom<Room def initialize(name) super(name) end def accept(visitor) visitor.acceptBathroom(self) end end Or is there another preferred idiom that is used in dynamic languages? Full samples are at: <a>http://lostbearlabs.googlecode.com/svn/trunk/codex/Visitor/CSharp/Visitor/VisitorExample.cs</a> <a>http://lostbearlabs.googlecode.com/svn/trunk/codex/Visitor/Ruby/Visitor.rb</a>
c#
ruby
design-patterns
dynamic-languages
null
null
open
preferred way to implement visitor pattern in dynamic languages? === As an exercise for myself, I was translating a sample program into various languages. Starting in C#, I had a visitor-pattern interface like so: interface Visitor { void Accept(Bedroom x); void Accept(Bathroom x); void Accept(Kitchen x); void Accept(LivingRoom x); } Moving to ruby (or python, or whatever), I no longer get dispatch from the compiler based on type. Should I do the dispatch in the visitor itself? class Cleaner def accept(x) acceptBedroom(x) if Bedroom === x acceptBathroom(x) if Bathroom === x acceptKitchen(x) if Kitchen===x acceptLivingRoom(x) if LivingRoom===x end ... Or should I do the dispatch in the different specializaions of the room: class Bathroom<Room def initialize(name) super(name) end def accept(visitor) visitor.acceptBathroom(self) end end Or is there another preferred idiom that is used in dynamic languages? Full samples are at: <a>http://lostbearlabs.googlecode.com/svn/trunk/codex/Visitor/CSharp/Visitor/VisitorExample.cs</a> <a>http://lostbearlabs.googlecode.com/svn/trunk/codex/Visitor/Ruby/Visitor.rb</a>
0
44,338
09/04/2008 18:00:02
4,550
09/04/2008 17:50:43
1
1
Unit testing with network-reliant code
I'm trying to be better about unit testing my code, but right now I'm writing a lot of code that deals with remote systems. SNMP, WMI, that sort of thing. With most classes I can mock up objects to test them, but how do you deal with unit testing a real system? For example, if my class goes out and gets the Win32_LogicalDisk object for a server, how could I possibly unit test it?
unit-testing
testing
wmi
null
null
null
open
Unit testing with network-reliant code === I'm trying to be better about unit testing my code, but right now I'm writing a lot of code that deals with remote systems. SNMP, WMI, that sort of thing. With most classes I can mock up objects to test them, but how do you deal with unit testing a real system? For example, if my class goes out and gets the Win32_LogicalDisk object for a server, how could I possibly unit test it?
0
44,343
09/04/2008 18:00:37
1,782
08/18/2008 14:30:58
1,196
87
Which Oracle version supports cube and rollup?
Particularly, Does it work with 9i Standard? Do you have some easy example that'd allow me to check it?
oracle
cube
rollup
versions
null
null
open
Which Oracle version supports cube and rollup? === Particularly, Does it work with 9i Standard? Do you have some easy example that'd allow me to check it?
0
44,350
09/04/2008 18:04:01
4,473
09/04/2008 01:17:18
37
6
What are the best keyboard macros for programming in windows?
I like putting shortcuts of the form "g - google.lnk" in my start menu so google is two keystrokes away. Win, g. My eight or so most frequent applications go there. I also make links to my solution files I am always opening "x - Popular Project.lnk" Are there any better ways to automate opening frequently used applications?
keyboard
macros
performance
null
null
null
open
What are the best keyboard macros for programming in windows? === I like putting shortcuts of the form "g - google.lnk" in my start menu so google is two keystrokes away. Win, g. My eight or so most frequent applications go there. I also make links to my solution files I am always opening "x - Popular Project.lnk" Are there any better ways to automate opening frequently used applications?
0
44,359
09/04/2008 18:07:48
4,568
09/04/2008 18:07:47
1
0
How do I get the current location of an iframe?
I have built a basic data entry application allowing users to browse external content in iframe and enter data quickly from the same page. One of the data variables is the URL. Ideally I would like to be able to load the iframes current url into a textbox with javascript. I realize now that this is not going to happen due to security issues. Has anyone done anything on the server side? or know of any .Net browser in browser controls. The ultimate goal is to just give the user an easy method of extracting the url of the page they are viewing in the iframe It doesn't necessarily HAVE to be an iframe, a browser in the browser would be ideal. Thanks, Adam
asp.net
javascript
dom
iframe
null
null
open
How do I get the current location of an iframe? === I have built a basic data entry application allowing users to browse external content in iframe and enter data quickly from the same page. One of the data variables is the URL. Ideally I would like to be able to load the iframes current url into a textbox with javascript. I realize now that this is not going to happen due to security issues. Has anyone done anything on the server side? or know of any .Net browser in browser controls. The ultimate goal is to just give the user an easy method of extracting the url of the page they are viewing in the iframe It doesn't necessarily HAVE to be an iframe, a browser in the browser would be ideal. Thanks, Adam
0
44,364
09/04/2008 18:11:29
681
08/07/2008 17:38:09
1
0
How can I avoid global state?
So, I was reading the Google testing blog, and it says that global state is bad and makes it hard to write tests. I believe it--my code is difficult to test right now. So how do I avoid global state? The biggest things I use global state (as I understand it) for is managing key pieces of information between our development, acceptance, and production environments. For example, I have a static class named "Globals" with a static member called "DBConnectionString." When the application loads, it determines which connection string to load, and populates Globals.DBConnectionString. I load file paths, server names, and other information in the Globals class. Some of my functions rely on the global variables. So, when I test my functions, I have to remember to set certain globals first or else the tests will fail. I'd like to avoid this. Is there a good way to manage state information? (Or am I understanding global state incorrectly?) thanks, Jim
testing
state
global
null
null
null
open
How can I avoid global state? === So, I was reading the Google testing blog, and it says that global state is bad and makes it hard to write tests. I believe it--my code is difficult to test right now. So how do I avoid global state? The biggest things I use global state (as I understand it) for is managing key pieces of information between our development, acceptance, and production environments. For example, I have a static class named "Globals" with a static member called "DBConnectionString." When the application loads, it determines which connection string to load, and populates Globals.DBConnectionString. I load file paths, server names, and other information in the Globals class. Some of my functions rely on the global variables. So, when I test my functions, I have to remember to set certain globals first or else the tests will fail. I'd like to avoid this. Is there a good way to manage state information? (Or am I understanding global state incorrectly?) thanks, Jim
0
44,370
09/04/2008 18:12:29
3,556
08/29/2008 04:58:15
31
1
Best Language for an AJAX-driven "Reputation Index"
I'd like to produce a fun AJAX-driven "Reputation Index" taking from Cory Doctorow's book "Down an Out in the Magic Kingdom" where "Whuffie" is a measurement of reputation/currency. I'd like to allow people to create accounts, login, see other people and assign positive or negative amounts of "whuffie" to them. There would then be an "overview" of sorts, or the actual "index" (like a stock market) that would list the whuffie scores sorted by whatever means. Obviously I'll need a database, and I have easy access to mySQL (as I lease a dedicated server used for webhosting). I'm curious as to what everyone thinks would be a better language for this. It's web-based, therefore I'm thinking either PHP or Rails (since I've got books on Rails). Any suggestions?
ajax
fun
null
null
null
07/22/2011 22:46:52
not constructive
Best Language for an AJAX-driven "Reputation Index" === I'd like to produce a fun AJAX-driven "Reputation Index" taking from Cory Doctorow's book "Down an Out in the Magic Kingdom" where "Whuffie" is a measurement of reputation/currency. I'd like to allow people to create accounts, login, see other people and assign positive or negative amounts of "whuffie" to them. There would then be an "overview" of sorts, or the actual "index" (like a stock market) that would list the whuffie scores sorted by whatever means. Obviously I'll need a database, and I have easy access to mySQL (as I lease a dedicated server used for webhosting). I'm curious as to what everyone thinks would be a better language for this. It's web-based, therefore I'm thinking either PHP or Rails (since I've got books on Rails). Any suggestions?
4
44,372
09/04/2008 18:14:43
4,527
09/04/2008 16:03:56
11
3
BLOB Storage - 100+ GB, MySQL, SQLLite, or PostgreSQL + Python
I have an idea for a simple application which will monitor a group of folders, index any files it finds. A gui will allow me quickly tag new files and move them into a single database for storage and also provide an easy mechanism for querying the db by tag, name, file type and date. At the moment I have about 100+ GB of files on a couple removable hard drives, the database will be at least that big. If possible I would like to support full text search of the embedded binary and text documents. This will be a single user application. Not trying to start a DB war, but what open source DB is going to work best for me? I am pretty sure SQLLite is off the table but I could be wrong.
databases
null
null
null
null
null
open
BLOB Storage - 100+ GB, MySQL, SQLLite, or PostgreSQL + Python === I have an idea for a simple application which will monitor a group of folders, index any files it finds. A gui will allow me quickly tag new files and move them into a single database for storage and also provide an easy mechanism for querying the db by tag, name, file type and date. At the moment I have about 100+ GB of files on a couple removable hard drives, the database will be at least that big. If possible I would like to support full text search of the embedded binary and text documents. This will be a single user application. Not trying to start a DB war, but what open source DB is going to work best for me? I am pretty sure SQLLite is off the table but I could be wrong.
0
44,376
09/04/2008 18:18:32
29
08/01/2008 12:24:53
336
43
Add alternating row color to SQL Server Reporting services report
How do you shade alternating rows in a SQL Server Reporting Services report?
sql-server
reporting-services
formatting
null
null
null
open
Add alternating row color to SQL Server Reporting services report === How do you shade alternating rows in a SQL Server Reporting Services report?
0
44,383
09/04/2008 18:21:06
889
08/10/2008 08:04:03
213
12
Reading Email using Pop3 in C#
I am looking for a method of reading emails using Pop3 in C# 2.0. Currently, I am using code found in [CodeProject][1]. However, this solution is less than ideal. The biggest problem is that it doesn't support emails written in unicode. [1]: http://www.codeproject.com/KB/IP/Pop3MimeClient.aspx?fid=341657
c#
unicode
pop3
null
null
null
open
Reading Email using Pop3 in C# === I am looking for a method of reading emails using Pop3 in C# 2.0. Currently, I am using code found in [CodeProject][1]. However, this solution is less than ideal. The biggest problem is that it doesn't support emails written in unicode. [1]: http://www.codeproject.com/KB/IP/Pop3MimeClient.aspx?fid=341657
0
44,391
09/04/2008 18:23:22
2,527
08/22/2008 16:35:28
148
15
How do I prevent replay attacks?
This is related to [another question I asked](/questions/43324/can-i-put-an-aspnet-session-id-in-a-hidden-form-field). In summary, I have a special case of a URL where, when a form is POSTed to it, I can't rely on cookies for authentication or to maintain the user's session, but I somehow need to know who they are, and I need to know they're logged in! I think I came up with a solution to my problem, but it needs fleshing out. Here's what I'm thinking. I create a hidden form field called "username", and place within it the user's username, encrypted. Then, when the form POSTs, even though I don't receive any cookies from the browser, I know they're logged in because I can decrypt the hidden form field and get the username. The major security flaw I can see is replay attacks. How do I prevent someone from getting ahold of that encrypted string, and POSTing as that user? I know I can use SSL to make it harder to steal that string, and maybe I can rotate the encryption key on a regular basis to limit the amount of time that the string is good for, but I'd really like to find a bulletproof solution. Anybody have any ideas? Does the ASP.Net ViewState prevent replay? If so, how do they do it?
asp.net
encryption
hacking
null
null
null
open
How do I prevent replay attacks? === This is related to [another question I asked](/questions/43324/can-i-put-an-aspnet-session-id-in-a-hidden-form-field). In summary, I have a special case of a URL where, when a form is POSTed to it, I can't rely on cookies for authentication or to maintain the user's session, but I somehow need to know who they are, and I need to know they're logged in! I think I came up with a solution to my problem, but it needs fleshing out. Here's what I'm thinking. I create a hidden form field called "username", and place within it the user's username, encrypted. Then, when the form POSTs, even though I don't receive any cookies from the browser, I know they're logged in because I can decrypt the hidden form field and get the username. The major security flaw I can see is replay attacks. How do I prevent someone from getting ahold of that encrypted string, and POSTing as that user? I know I can use SSL to make it harder to steal that string, and maybe I can rotate the encryption key on a regular basis to limit the amount of time that the string is good for, but I'd really like to find a bulletproof solution. Anybody have any ideas? Does the ASP.Net ViewState prevent replay? If so, how do they do it?
0
44,394
09/04/2008 18:25:22
4,572
09/04/2008 18:12:04
1
1
WPF - Load Font from Stream?
I have a MemoryStream with the contents of a Font File (.ttf) and I would like to be able to create a FontFamily WPF object from that stream **WITHOUT** writing the contents of the stream to disk. I know this is possible with a System.Drawing.FontFamily but I cannot find out how to do it with System.Windows.Media.FontFamily. Note: I will only have the stream, so I can't pack it as a resource in the application and because of disk permissions issues, will not be able to write the font file to disk for reference as "content"
wpf
fonts
stream
null
null
null
open
WPF - Load Font from Stream? === I have a MemoryStream with the contents of a Font File (.ttf) and I would like to be able to create a FontFamily WPF object from that stream **WITHOUT** writing the contents of the stream to disk. I know this is possible with a System.Drawing.FontFamily but I cannot find out how to do it with System.Windows.Media.FontFamily. Note: I will only have the stream, so I can't pack it as a resource in the application and because of disk permissions issues, will not be able to write the font file to disk for reference as "content"
0
44,396
09/04/2008 18:25:44
4,476
09/04/2008 02:14:40
1
0
How to reference javadocs to dependencies in Maven's eclipse plugin when javadoc not attached to dependency
I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in the .classpath file so that I can see the javadoc for the dependency in Eclipse. Then when I run Maven's eclipse plugin to regenerate the .classpath file it of course wipes out that change. Is there a way to configure Maven's eclipse plug-in to automatically add classpath attributes for javadoc when running Maven's eclipse plug-in?
eclipse
maven-2
eclipse-plugin
maven-eclipse-plugin
null
null
open
How to reference javadocs to dependencies in Maven's eclipse plugin when javadoc not attached to dependency === I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in the .classpath file so that I can see the javadoc for the dependency in Eclipse. Then when I run Maven's eclipse plugin to regenerate the .classpath file it of course wipes out that change. Is there a way to configure Maven's eclipse plug-in to automatically add classpath attributes for javadoc when running Maven's eclipse plug-in?
0
44,401
09/04/2008 18:28:39
750
08/08/2008 14:24:17
273
8
catching button clicks in javascript without server interaction
I've got a sign up form that requires the user to enter their email and password, both are in two separate text boxes. I want to provide a button that the user can click so that the password (which is masked) will appear in a popup when the user clicks the button. currently my JS code for this is as follows: function toggleShowPassword() { var button = $get('PASSWORD_TEXTBOX_ID'); var password; if (button) { password = button.value; alert(password); button.value = password; } } The problem is that every time the user clicks the button, the password is cleared in both firefox and IE. I want them to be able to see their password in clear text to verify without having to retype their password. My questions are: 1) why does the password field keep getting reset with each button click 2) how can I make it so the password field is NOT cleared once the user has seen his/her password in clear text?
javascript
ajax
null
null
null
null
open
catching button clicks in javascript without server interaction === I've got a sign up form that requires the user to enter their email and password, both are in two separate text boxes. I want to provide a button that the user can click so that the password (which is masked) will appear in a popup when the user clicks the button. currently my JS code for this is as follows: function toggleShowPassword() { var button = $get('PASSWORD_TEXTBOX_ID'); var password; if (button) { password = button.value; alert(password); button.value = password; } } The problem is that every time the user clicks the button, the password is cleared in both firefox and IE. I want them to be able to see their password in clear text to verify without having to retype their password. My questions are: 1) why does the password field keep getting reset with each button click 2) how can I make it so the password field is NOT cleared once the user has seen his/her password in clear text?
0
44,404
09/04/2008 18:30:18
1,463
08/15/2008 17:26:44
392
31
C# .Net 3.5 Code to replace a file extension using LINQ
I've written this very simple function to replace a file extension using LINQ in C#.NET 3.5 however I have a feeling that there's a more elegant way to do this. (I'm not committed to using LINQ here - just looking for a more elegant approach.) Ideas? private string ReplaceFileExtension(string fileName, string newExtension) { string[] dotSplit = fileName.Split('.'); return String.Join(".", dotSplit.Take(dotSplit.Length - 1).ToArray()) + "." + newExtension; } (I'm aware of the fact that this won't work if the original file name doesn't have a dot.)
c#
linq
.net-3.5
null
null
null
open
C# .Net 3.5 Code to replace a file extension using LINQ === I've written this very simple function to replace a file extension using LINQ in C#.NET 3.5 however I have a feeling that there's a more elegant way to do this. (I'm not committed to using LINQ here - just looking for a more elegant approach.) Ideas? private string ReplaceFileExtension(string fileName, string newExtension) { string[] dotSplit = fileName.Split('.'); return String.Join(".", dotSplit.Take(dotSplit.Length - 1).ToArray()) + "." + newExtension; } (I'm aware of the fact that this won't work if the original file name doesn't have a dot.)
0
44,408
09/04/2008 18:30:57
2,064
08/20/2008 03:39:44
28
0
How do you generate a random number in C#?
I would like to generate a random floating point number between 2 values. What is the best way to do this in C#?
c#
random-number
null
null
null
null
open
How do you generate a random number in C#? === I would like to generate a random floating point number between 2 values. What is the best way to do this in C#?
0
44,421
09/04/2008 18:34:16
730
08/08/2008 12:40:04
134
21
Outlook Email via a Webpage
I have a web application developed with ASP.net and C# that is running on my companies' intranet. Because all the users for this application are all using Microsoft Outlook without exception, I would like for the the application to open up an Outlook message on the client-side. I understand that Office is designed to be run on the desktop and not from a server, however I have no trouble creating a Word or Excel document on the client-side. I have code that instantiates the Outlook object using the Microsoft.Office.Interop.Outlook namespace and Outlook installed on the server. When I try to run the code from the server, I get a DCOM source error message that states "The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {000C101C-0000-0000-C000-000000000046} to the user This security permission can be modified using the Component Services administrative tool." I have modified the permissions using the Component Services tool, but still get this same error. Is there a way to overcome this or is this a fruitless exercise because Outlook cannot be opened on the client side from the server-side code?
asp.net
outlook
c#
microsoftoffice
null
null
open
Outlook Email via a Webpage === I have a web application developed with ASP.net and C# that is running on my companies' intranet. Because all the users for this application are all using Microsoft Outlook without exception, I would like for the the application to open up an Outlook message on the client-side. I understand that Office is designed to be run on the desktop and not from a server, however I have no trouble creating a Word or Excel document on the client-side. I have code that instantiates the Outlook object using the Microsoft.Office.Interop.Outlook namespace and Outlook installed on the server. When I try to run the code from the server, I get a DCOM source error message that states "The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {000C101C-0000-0000-C000-000000000046} to the user This security permission can be modified using the Component Services administrative tool." I have modified the permissions using the Component Services tool, but still get this same error. Is there a way to overcome this or is this a fruitless exercise because Outlook cannot be opened on the client side from the server-side code?
0
44,467
09/04/2008 18:53:00
3,575
08/29/2008 06:54:39
31
3
What can cause .NET assembly registration to fail?
We've seen an issue where one of our installers (msi) returns the error code 2908, which is used to indicate that an assembly failed to register. Later in the installation, we get the following (sanitized) error: > MyAssemblyName, version="1.0.1.1", > culture="neutral", > publicKeyToken="119EFC79848A50". > Please refer to Help and Support for > more information. HRESULT: 0x8002802F. The assembly registers properly on most systems. Has anyone else encountered this issue? How did you solve it?
.net
windows
msi
windows-installer
null
null
open
What can cause .NET assembly registration to fail? === We've seen an issue where one of our installers (msi) returns the error code 2908, which is used to indicate that an assembly failed to register. Later in the installation, we get the following (sanitized) error: > MyAssemblyName, version="1.0.1.1", > culture="neutral", > publicKeyToken="119EFC79848A50". > Please refer to Help and Support for > more information. HRESULT: 0x8002802F. The assembly registers properly on most systems. Has anyone else encountered this issue? How did you solve it?
0
44,469
09/04/2008 18:53:56
767
08/08/2008 17:04:18
76
3
What's the best way to insert/update/delete multiple records in a database from an application?
Given a set of entities to insert, delete, or update in an application, what is the best way to perform the necessary database operations? Should multiple queries be issued, one for each entity to be affected? Or should some sort of XML construct that can be parsed by the database engine be used, so that only one command needs to be issued? Or something other method that I'm not aware of?
sql
database
null
null
null
null
open
What's the best way to insert/update/delete multiple records in a database from an application? === Given a set of entities to insert, delete, or update in an application, what is the best way to perform the necessary database operations? Should multiple queries be issued, one for each entity to be affected? Or should some sort of XML construct that can be parsed by the database engine be used, so that only one command needs to be issued? Or something other method that I'm not aware of?
0
44,470
09/04/2008 18:54:01
3,798
08/30/2008 22:09:59
25
8
How do I get the Click Once Publish version to match the AssemblyInfo.cs File Version.
Every time I publish the Application in Click Once I get get it to update the revision number by one. Is there any way to get this change automatically to change the version number in AssemblyInfo.cs file (all our error reporting looks at the Assembly Version).
visual-studio
versioning
null
null
null
null
open
How do I get the Click Once Publish version to match the AssemblyInfo.cs File Version. === Every time I publish the Application in Click Once I get get it to update the revision number by one. Is there any way to get this change automatically to change the version number in AssemblyInfo.cs file (all our error reporting looks at the Assembly Version).
0
44,476
09/04/2008 18:55:37
178
08/03/2008 02:21:57
13
9
Compressing a TIF file
I'm trying to convert a multipage color tif file to a c# CompressionCCITT3 tif in C#. I realize that I need to make sure that all pixels are 1 bit. I have not found a useful example of this online. thanks.
c#
tiff
null
null
null
null
open
Compressing a TIF file === I'm trying to convert a multipage color tif file to a c# CompressionCCITT3 tif in C#. I realize that I need to make sure that all pixels are 1 bit. I have not found a useful example of this online. thanks.
0
44,481
09/04/2008 18:58:16
3,624
08/29/2008 15:49:07
202
3
Is it possible to craft a glob that matches files in the current directory and all subdirectoies?
For this directory structure: . |-- README.txt |-- firstlevel.rb `-- lib |-- models | |-- foo | | `-- fourthlevel.rb | `-- thirdlevel.rb `-- secondlevel.rb 3 directories, 5 files The glob would match: firstlevel.rb lib/secondlevel.rb lib/models/thirdlevel.rb lib/models/foo/fourthlevel.rb
shell
glob
null
null
null
null
open
Is it possible to craft a glob that matches files in the current directory and all subdirectoies? === For this directory structure: . |-- README.txt |-- firstlevel.rb `-- lib |-- models | |-- foo | | `-- fourthlevel.rb | `-- thirdlevel.rb `-- secondlevel.rb 3 directories, 5 files The glob would match: firstlevel.rb lib/secondlevel.rb lib/models/thirdlevel.rb lib/models/foo/fourthlevel.rb
0
44,485
09/04/2008 18:59:36
4,140
09/02/2008 01:10:54
88
12
Arbitrary Naming Convention Question About Business Objects
Ok, do you do Business.Name or Business.BusinessName SubCategory.ID or SubCategory.SubCategoryID What about in your database? Why? I'm torn with both. Would love there to be a "right answer"
c#
oop
naming
object
null
null
open
Arbitrary Naming Convention Question About Business Objects === Ok, do you do Business.Name or Business.BusinessName SubCategory.ID or SubCategory.SubCategoryID What about in your database? Why? I'm torn with both. Would love there to be a "right answer"
0
44,504
09/04/2008 19:04:05
4,550
09/04/2008 17:50:43
11
3
Is there a way to generate WMI code/classes?
How do you generate C# classes for accessing WMI?
c#
code-generation
wmi
null
null
null
open
Is there a way to generate WMI code/classes? === How do you generate C# classes for accessing WMI?
0
44,509
09/04/2008 19:06:23
1,311
08/14/2008 13:43:09
843
47
Single Sign On across multiple domains
Our company has multiple domains set up with one website hosted on each of the domains. At this time, each domain has its own authentication which is done via cookies. When someone logged on to one domain needs to access anything from the other, the user needs to log in again using different credentials on the other website, located on the other domain. I was thinking of moving towards single sign on (SSO), so that this hassle can be eliminated. I would appreciate any ideas on how this could be achieved, as I do not have any experience in this regard. Thanks.
authentication
sso
null
null
null
null
open
Single Sign On across multiple domains === Our company has multiple domains set up with one website hosted on each of the domains. At this time, each domain has its own authentication which is done via cookies. When someone logged on to one domain needs to access anything from the other, the user needs to log in again using different credentials on the other website, located on the other domain. I was thinking of moving towards single sign on (SSO), so that this hassle can be eliminated. I would appreciate any ideas on how this could be achieved, as I do not have any experience in this regard. Thanks.
0
44,516
09/04/2008 19:10:11
2,148
08/20/2008 15:20:13
382
24
JavaFX video encoding
On [JavaFX's Wikipedia][1] > In May 2008 (...) Sun Also announced a > multi-year agreement with On2 > Technologies to bring comprehensive > video capabilities to the JavaFX > product family using the company's > TrueMotion Video codec. Do you know if it will include encoding capabilities like Flash or just playback? Thanks [1]: http://en.wikipedia.org/wiki/Javafx
video
encoding
javafx
null
null
null
open
JavaFX video encoding === On [JavaFX's Wikipedia][1] > In May 2008 (...) Sun Also announced a > multi-year agreement with On2 > Technologies to bring comprehensive > video capabilities to the JavaFX > product family using the company's > TrueMotion Video codec. Do you know if it will include encoding capabilities like Flash or just playback? Thanks [1]: http://en.wikipedia.org/wiki/Javafx
0
44,517
09/04/2008 19:10:14
2,847
08/25/2008 14:12:52
175
10
Tools to convert asp.net dynamic site into static site
Are there any tools that will spider an asp.net website and create a static site?
asp.net
spider
null
null
null
null
open
Tools to convert asp.net dynamic site into static site === Are there any tools that will spider an asp.net website and create a static site?
0
44,522
09/04/2008 19:11:19
2,835
08/25/2008 13:00:16
1
0
How to ensure that the same thread is used to execute code in IIS?
We have a third party dll that is used in our web service hosted in IIS6. The problem is that once this dll is loaded into memory, the exception <a href="http://msdn.microsoft.com/en-us/library/system.accessviolationexception.aspx">AccessViolationException</a> gets thrown if a thread different then the one that created it tries to execute any code within the dll. The worker process is multi threaded and each call to the web service will get a random thread from the pool. We tried to unload it from memory and reload it each time we needed it, but I guess only the front end is .Net and the rest is unmanaged so it never actually gets completely unloaded from memory. We are using VB and .Net 2.0. Any suggestions?
vb.net
iis
dll
multithreading
null
null
open
How to ensure that the same thread is used to execute code in IIS? === We have a third party dll that is used in our web service hosted in IIS6. The problem is that once this dll is loaded into memory, the exception <a href="http://msdn.microsoft.com/en-us/library/system.accessviolationexception.aspx">AccessViolationException</a> gets thrown if a thread different then the one that created it tries to execute any code within the dll. The worker process is multi threaded and each call to the web service will get a random thread from the pool. We tried to unload it from memory and reload it each time we needed it, but I guess only the front end is .Net and the rest is unmanaged so it never actually gets completely unloaded from memory. We are using VB and .Net 2.0. Any suggestions?
0
44,532
09/04/2008 19:17:46
1,797
08/18/2008 15:46:11
947
52
What is the best way to send html/image email?
Do you attach the images? Use absolute urls? How do you best avoid getting flagged as spam?
html
email
null
null
null
null
open
What is the best way to send html/image email? === Do you attach the images? Use absolute urls? How do you best avoid getting flagged as spam?
0
44,533
09/04/2008 19:17:51
2,603
08/23/2008 13:46:11
199
15
Your Favorite Code Kata
What are your favorite code [kata](http://codekata.pragprog.com/)? * What do you do to practice software development? * Where do you go to find new small projects to practice? We already know [Jeff's answers](http://www.codinghorror.com/blog/archives/001138.html).
professional-development
code-kata
null
null
null
09/19/2011 06:55:03
not constructive
Your Favorite Code Kata === What are your favorite code [kata](http://codekata.pragprog.com/)? * What do you do to practice software development? * Where do you go to find new small projects to practice? We already know [Jeff's answers](http://www.codinghorror.com/blog/archives/001138.html).
4
44,542
09/04/2008 19:20:15
1,097
08/12/2008 11:40:09
436
28
what algorithm/pseudo-code is used to create the paging links for stackoverflow
Can someome provide code or pseudo-code for how the paging links in stackoverflow are generated? I keep racking my brain but can't think of a decent way to build the dynamic links that always shows the 2 pages around the current, plus the first and last. Example: 1 .. 5 6 7 .. 593
stackoverflow
algorithm
paging
null
null
null
open
what algorithm/pseudo-code is used to create the paging links for stackoverflow === Can someome provide code or pseudo-code for how the paging links in stackoverflow are generated? I keep racking my brain but can't think of a decent way to build the dynamic links that always shows the 2 pages around the current, plus the first and last. Example: 1 .. 5 6 7 .. 593
0
44,554
09/04/2008 19:24:54
672
08/07/2008 16:18:07
152
25
What’s your logging philosophy?
As [Jeff Atwood asked][1]: "What’s your logging philosophy? Should all code be littered with .logthis() and .logthat() calls? Or do you inject logging after the fact somehow?" [1]: http://blog.stackoverflow.com/2008/09/podcast-20/
logging
null
null
null
null
null
open
What’s your logging philosophy? === As [Jeff Atwood asked][1]: "What’s your logging philosophy? Should all code be littered with .logthis() and .logthat() calls? Or do you inject logging after the fact somehow?" [1]: http://blog.stackoverflow.com/2008/09/podcast-20/
0
44,566
09/04/2008 19:28:52
3,434
08/28/2008 15:06:22
435
23
How do I simultaneously work on version 1.1 and version 2.0?
The situation: We're out of beta and version 1.0 has been released to several customer sites. Team A is already busy working on version 1.1 that will have incremental bugfixes and usability tweaks, while another team works on version 2.0 with large-scale changes, where the core of the product may have been completely redesigned. Now, most of the changes made for 1.1 will have to make their way into 2.0 at some point, and some of the bug fixes made in the 2.0 branch might in fact need to be scheduled for an earlier release. The problem is that since 2.0 has fundamental differences, no changes from 1.1 can be merged in without manual conversion, nor vice versa. My question: What are the best revision control practises to minimise merge conflicts and duplicate work in this kind of situation? How can I ensure that my teams spend as little time and effort as possible on revision control issues, while still providing regular patches to customers?
svn
build-process
development-practice
revision
releasing
null
open
How do I simultaneously work on version 1.1 and version 2.0? === The situation: We're out of beta and version 1.0 has been released to several customer sites. Team A is already busy working on version 1.1 that will have incremental bugfixes and usability tweaks, while another team works on version 2.0 with large-scale changes, where the core of the product may have been completely redesigned. Now, most of the changes made for 1.1 will have to make their way into 2.0 at some point, and some of the bug fixes made in the 2.0 branch might in fact need to be scheduled for an earlier release. The problem is that since 2.0 has fundamental differences, no changes from 1.1 can be merged in without manual conversion, nor vice versa. My question: What are the best revision control practises to minimise merge conflicts and duplicate work in this kind of situation? How can I ensure that my teams spend as little time and effort as possible on revision control issues, while still providing regular patches to customers?
0
44,569
09/04/2008 19:29:33
2,543
08/22/2008 18:27:05
216
44
Octal number literals: when? why? ever?
I have never used octal numbers in my code nor come across any code that used it (hexadecimal and bit twiddling notwithstanding). I started programming in C/C++ about 1994 so maybe I'm too young for this? Does older code use octal? C includes support for these by prepending a 0, but where is the code that uses these base 8 number literals?
c
numbers
old-school
null
null
null
open
Octal number literals: when? why? ever? === I have never used octal numbers in my code nor come across any code that used it (hexadecimal and bit twiddling notwithstanding). I started programming in C/C++ about 1994 so maybe I'm too young for this? Does older code use octal? C includes support for these by prepending a 0, but where is the code that uses these base 8 number literals?
0
44,588
09/04/2008 19:34:09
567
08/06/2008 19:14:16
320
22
How to convince a company to switch their Source Control.
My current place of employment is currently in a transition, new ownership has taken over, things are finally getting standardized and proper guidelines are being enforced. But we are still using VSS, there really isn't any reason for using it other then that's what whats initially setup. We don't use Visual Studio, or any tool really that specifically requires it. What would be the absolute best argument I can bring up to help convince them that going to something like Subversion would be a much better solution, in the long run.
version-control
subversion
visual-sourcesafe
null
null
null
open
How to convince a company to switch their Source Control. === My current place of employment is currently in a transition, new ownership has taken over, things are finally getting standardized and proper guidelines are being enforced. But we are still using VSS, there really isn't any reason for using it other then that's what whats initially setup. We don't use Visual Studio, or any tool really that specifically requires it. What would be the absolute best argument I can bring up to help convince them that going to something like Subversion would be a much better solution, in the long run.
0
44,601
09/04/2008 19:38:53
3,683
08/29/2008 21:24:01
11
6
.NET Development on a Mac Tips
I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to [Hidden Features of C#](http://stackoverflow.com/questions/9033/hidden-features-of-c#35342); to become a how-to of tips and trick for windows development on a mac. My environment is as follows * MacBook Pro 15" 2.4Ghz 2GB RAM (Going to upgrade to 4GB soon) * VMWare Fusion 2.0 Beta * Windows XP Pro SP3 (Slipstreamed BEFORE install) Tips: * Use Windows Steady State to keep OS consistent * Use svn+ssh to connect to the mac for small repositories then use time machine to backup. * Use spaces.
osx
.net
vmware
null
null
null
open
.NET Development on a Mac Tips === I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to [Hidden Features of C#](http://stackoverflow.com/questions/9033/hidden-features-of-c#35342); to become a how-to of tips and trick for windows development on a mac. My environment is as follows * MacBook Pro 15" 2.4Ghz 2GB RAM (Going to upgrade to 4GB soon) * VMWare Fusion 2.0 Beta * Windows XP Pro SP3 (Slipstreamed BEFORE install) Tips: * Use Windows Steady State to keep OS consistent * Use svn+ssh to connect to the mac for small repositories then use time machine to backup. * Use spaces.
0
44,608
09/04/2008 19:42:19
4,282
09/02/2008 16:21:51
3
2
Good place for a week of training?
I am a junior developer in Philadelphia, my company is letting me pick somewhere to go for a week of training. Anyone have any good recommendations? I am into web development, design, usability. Anything from PHP to .NET to Scala to Ruby. Thanks!
trainingrecommendations
null
null
null
null
null
open
Good place for a week of training? === I am a junior developer in Philadelphia, my company is letting me pick somewhere to go for a week of training. Anyone have any good recommendations? I am into web development, design, usability. Anything from PHP to .NET to Scala to Ruby. Thanks!
0
44,617
09/04/2008 19:45:06
2,696
08/24/2008 15:31:08
241
17
Adding more information to TestResult.xml file from NUnit
I would like to be able to add a "message" to a unit test, such that it actually appears within the TestResult.xml file generated by NUnit. For example, this is currently generated: <results> <test-case name="MyNamespace.Tests.MyTest" executed="True" success="True" time="0.203" asserts="4" /> </results> I would like to be able to have an additional attribute (or node as the case may be), such as: <results> <test-case name="MyNamespace.Tests.MyTest" executed="True" success="True" time="0.203" asserts="4" message="Tested that some condition was met." /> </results> The idea is that "message" above would somehow be defined within the test method itself (in my case, generated at run-time). Is there a property somewhere that I'm missing to be able to do something like this?
unit-testing
nunit
null
null
null
null
open
Adding more information to TestResult.xml file from NUnit === I would like to be able to add a "message" to a unit test, such that it actually appears within the TestResult.xml file generated by NUnit. For example, this is currently generated: <results> <test-case name="MyNamespace.Tests.MyTest" executed="True" success="True" time="0.203" asserts="4" /> </results> I would like to be able to have an additional attribute (or node as the case may be), such as: <results> <test-case name="MyNamespace.Tests.MyTest" executed="True" success="True" time="0.203" asserts="4" message="Tested that some condition was met." /> </results> The idea is that "message" above would somehow be defined within the test method itself (in my case, generated at run-time). Is there a property somewhere that I'm missing to be able to do something like this?
0
44,619
09/04/2008 19:45:31
4,322
09/02/2008 20:31:47
10
4
How Do I Test Rails Logging In from the Console?
I was having a heck of a time figuring out how to login and logout using response objects from Rails. The standard blogs were ok, but I finally diagnosed it, and I wanted to record it here. app.get '/' assert_response :success app.get '/auth_only_url' assert_response 302 user = User.find(:user_to_login) app.post '/signin_url', :user_email => user.email, :user_password => '<password in clear>' assert_response 302 app.follow_redirect! assert_response :success app.get '/auth_only_url' assert_response :success Note, the above implies that you redirect after a failed auth request, and also that you redirect after logging in. To ensure that you load the fixtures into your test environment DB (which normally occurs during rake test), make sure you execute the following: rake db:fixtures:load RAILS_ENV=test Also, haven't figured out why the default URL always lists as 'http://www.example.com/' ... any thoughts there?
ruby
ruby-on-rails
null
null
null
null
open
How Do I Test Rails Logging In from the Console? === I was having a heck of a time figuring out how to login and logout using response objects from Rails. The standard blogs were ok, but I finally diagnosed it, and I wanted to record it here. app.get '/' assert_response :success app.get '/auth_only_url' assert_response 302 user = User.find(:user_to_login) app.post '/signin_url', :user_email => user.email, :user_password => '<password in clear>' assert_response 302 app.follow_redirect! assert_response :success app.get '/auth_only_url' assert_response :success Note, the above implies that you redirect after a failed auth request, and also that you redirect after logging in. To ensure that you load the fixtures into your test environment DB (which normally occurs during rake test), make sure you execute the following: rake db:fixtures:load RAILS_ENV=test Also, haven't figured out why the default URL always lists as 'http://www.example.com/' ... any thoughts there?
0
44,629
09/04/2008 19:50:54
2,147
08/20/2008 15:14:13
906
67
Why continue writing legacy systems?
I have a student position working on some websites for my school. Everything my school does is in VBScript/ASP Classic. I'm a bit confused about something. I can understand that my school as a LOT of code written in VBScript, and that migrating it would be a phenomenal task. But is it just me, or is it kinda stupid that they make us write **new** programs in vbscript? I mean, I can understand why they wouldn't want to try to keep up with the latest and greatest technology. And I can understand how much of a pain it would be to maintain a whole bunch of programs written in widely varying programming languages. But at a certain point, don't you have to move to a newer technology for new stuff? Am I missing something here?
vbscript
asp-classic
legacy
null
null
null
open
Why continue writing legacy systems? === I have a student position working on some websites for my school. Everything my school does is in VBScript/ASP Classic. I'm a bit confused about something. I can understand that my school as a LOT of code written in VBScript, and that migrating it would be a phenomenal task. But is it just me, or is it kinda stupid that they make us write **new** programs in vbscript? I mean, I can understand why they wouldn't want to try to keep up with the latest and greatest technology. And I can understand how much of a pain it would be to maintain a whole bunch of programs written in widely varying programming languages. But at a certain point, don't you have to move to a newer technology for new stuff? Am I missing something here?
0
44,630
09/04/2008 19:51:26
2,357
08/21/2008 20:18:05
8
3
version control practice
In my current job the supervisor's practice is to only check in production ready code. Most recently the project I was on involved work by 3 different developers with some file overlap. This meant manually integrating changes despite the fact that some changes took a day and then it was done. I wanted to see if this was a common practice and get suggestions on how to change this practice with the knowledge that many times my opinion means little in the grand scheme of things.
version-control
null
null
null
null
null
open
version control practice === In my current job the supervisor's practice is to only check in production ready code. Most recently the project I was on involved work by 3 different developers with some file overlap. This meant manually integrating changes despite the fact that some changes took a day and then it was done. I wanted to see if this was a common practice and get suggestions on how to change this practice with the knowledge that many times my opinion means little in the grand scheme of things.
0
44,637
09/04/2008 19:54:37
1,583
08/16/2008 20:54:12
195
7
How to start using ndepend?
I recently downloaded ndepend and ran an analysis on an open source project I participate in. I did not now where to look next - a bit of visual and information overload and it turned out I don't even know where to start. Can anyone suggest starting points? - What information should I look for first? - What points out problems in the code (in a BIG way)? - What would the low hanging fruit that can immediately seen?
.net
static-analysis
ndepend
null
null
null
open
How to start using ndepend? === I recently downloaded ndepend and ran an analysis on an open source project I participate in. I did not now where to look next - a bit of visual and information overload and it turned out I don't even know where to start. Can anyone suggest starting points? - What information should I look for first? - What points out problems in the code (in a BIG way)? - What would the low hanging fruit that can immediately seen?
0
44,644
09/04/2008 19:58:27
3,262
08/27/2008 15:30:29
97
7
Identifying ASP.NET web service references
At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We probably have about 20-30 different web applications and corresponding services. Unfortunately, given that we have no centralized control over this due to competing priorities, org structures, project timelines, financial buckets, etc., it is quite a mess. We have a variety of services that are reused, but a bunch that are specific to a front-end. Ideally we would have better control over this situation, and we are trying to get control over it, but that is taking a while. One thing we would like to do is find out more about what all of the inter-relationships between web sites and the app servers. I have used Reflector to find dependencies among assemblies, but would like to be able to see the traffic patterns between services. What are the options for trying to map out web service relationships? For the most part, we are mainly talking about internal services (web to app, app to app, batch to app, etc.). Off the top of my head, I can think of two ways to approach it: - Analyze assemblies for any web references. The drawback here is that not everything is a web reference and I'm not sure how WCF connections are listed. However, this would at least be a start for finding 80% of the connections. Does anyone know of any tools that can do that analysis? Like I said, I've used Reflector for assembly references but can't find anything for web references. - Possibly tap into IIS and passively monitor the traffic coming in and out and somehow figure out what is being called and where from. We are looking at enterprise tools that could help but it would be a while before they are implemented (and cost a lot). But is there anything out there that could help out quickly and cheaply? One tool in particular (AmberPoint) can tap into IIS on the servers and monitor inbound and outbound traffic, adds a little special sauce and begin to build a map of the traffic. Very nice, but costs a bundle. I know, I know, how the heck did you get into this mess in the first place? Beats me, just trying to help us get control of it and get out of it. Thanks, Matt
web-services
iis
reflection
esb
null
null
open
Identifying ASP.NET web service references === At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We probably have about 20-30 different web applications and corresponding services. Unfortunately, given that we have no centralized control over this due to competing priorities, org structures, project timelines, financial buckets, etc., it is quite a mess. We have a variety of services that are reused, but a bunch that are specific to a front-end. Ideally we would have better control over this situation, and we are trying to get control over it, but that is taking a while. One thing we would like to do is find out more about what all of the inter-relationships between web sites and the app servers. I have used Reflector to find dependencies among assemblies, but would like to be able to see the traffic patterns between services. What are the options for trying to map out web service relationships? For the most part, we are mainly talking about internal services (web to app, app to app, batch to app, etc.). Off the top of my head, I can think of two ways to approach it: - Analyze assemblies for any web references. The drawback here is that not everything is a web reference and I'm not sure how WCF connections are listed. However, this would at least be a start for finding 80% of the connections. Does anyone know of any tools that can do that analysis? Like I said, I've used Reflector for assembly references but can't find anything for web references. - Possibly tap into IIS and passively monitor the traffic coming in and out and somehow figure out what is being called and where from. We are looking at enterprise tools that could help but it would be a while before they are implemented (and cost a lot). But is there anything out there that could help out quickly and cheaply? One tool in particular (AmberPoint) can tap into IIS on the servers and monitor inbound and outbound traffic, adds a little special sauce and begin to build a map of the traffic. Very nice, but costs a bundle. I know, I know, how the heck did you get into this mess in the first place? Beats me, just trying to help us get control of it and get out of it. Thanks, Matt
0
44,656
09/04/2008 20:03:50
4,592
09/04/2008 19:01:53
21
2
Is there a good method in C# for throwing an exception on a given thread
The code that I want to write is like this: void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff } } catch (MyException ex) { // Do the right thing for this exception. } } I know I can have thread B periodically check, in thread safe way, to see if a flag has been set by thread A, but that makes the code more complicated. Is there a better mechanism that I can use? Here is a more fleshed out example of periodically checking: Dictionary<Thread, Exception> exceptionDictionary = new Dictionary<Thread, Exception>(); void ThrowOnThread(Thread thread, Exception ex) { // the exception passed in is going to be handed off to another thread, // so it needs to be thread safe. lock (exceptionDictionary) { exceptionDictionary[thread] = ex; } } void ExceptionCheck() { lock (exceptionDictionary) { Exception ex; if (exceptionDictionary.TryGetValue(Thread.CurrentThread, out ex)) throw ex; } } void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff ExceptionCheck(); } } catch (MyException ex) { // Do the right thing for this exception. } }
c#
exception
multithreading
null
null
null
open
Is there a good method in C# for throwing an exception on a given thread === The code that I want to write is like this: void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff } } catch (MyException ex) { // Do the right thing for this exception. } } I know I can have thread B periodically check, in thread safe way, to see if a flag has been set by thread A, but that makes the code more complicated. Is there a better mechanism that I can use? Here is a more fleshed out example of periodically checking: Dictionary<Thread, Exception> exceptionDictionary = new Dictionary<Thread, Exception>(); void ThrowOnThread(Thread thread, Exception ex) { // the exception passed in is going to be handed off to another thread, // so it needs to be thread safe. lock (exceptionDictionary) { exceptionDictionary[thread] = ex; } } void ExceptionCheck() { lock (exceptionDictionary) { Exception ex; if (exceptionDictionary.TryGetValue(Thread.CurrentThread, out ex)) throw ex; } } void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff ExceptionCheck(); } } catch (MyException ex) { // Do the right thing for this exception. } }
0
44,660
09/04/2008 20:07:28
4,602
09/04/2008 19:36:26
1
0
Regex in VB6?
I need to write a program that can sift through specially-formatted text files (essentially CSV files with a fixed set of column types that have different delimiters for some columns ... comma in most places, colons in others) to search for formatting errors. I figure regular expressions will be the way to go. The question: Is there a good regex library for VB6? Thank you!
regex
vb6
null
null
null
null
open
Regex in VB6? === I need to write a program that can sift through specially-formatted text files (essentially CSV files with a fixed set of column types that have different delimiters for some columns ... comma in most places, colons in others) to search for formatting errors. I figure regular expressions will be the way to go. The question: Is there a good regex library for VB6? Thank you!
0
44,692
09/04/2008 20:22:11
374,643
08/28/2008 22:08:15
1
1
dotNetNuke/Moodle integration
anyone out there have a moodle module for dotnetnuke, or some kind of integration setup that at least allows SSO?
moodle
dotnetnuke
null
null
null
null
open
dotNetNuke/Moodle integration === anyone out there have a moodle module for dotnetnuke, or some kind of integration setup that at least allows SSO?
0
44,693
09/04/2008 20:22:18
3,081
08/26/2008 14:51:58
11
5
In C++, what alternatives do I have for exposing a collection, from the point of view of performance and data integrity.
My problem is that I want to return an internal list of data to the caller, but I don't want to generate a copy. Thant leaves me with either returning a reference to the list, or a pointer to the list. However, I'm not crazy about letting the caller change the data, I just want to let it read the data. - Do I have to choose between performance and data integrity? - If so, is in general better to go one way or is it particular to the case? - Are there other alternatives?
c++
null
null
null
null
null
open
In C++, what alternatives do I have for exposing a collection, from the point of view of performance and data integrity. === My problem is that I want to return an internal list of data to the caller, but I don't want to generate a copy. Thant leaves me with either returning a reference to the list, or a pointer to the list. However, I'm not crazy about letting the caller change the data, I just want to let it read the data. - Do I have to choose between performance and data integrity? - If so, is in general better to go one way or is it particular to the case? - Are there other alternatives?
0
44,713
09/04/2008 20:35:54
3,821
08/31/2008 02:41:10
36
5
VB.NET Empty String Array
How can I create an empty one-dimensional string array?
.net
vb.net
string
null
null
null
open
VB.NET Empty String Array === How can I create an empty one-dimensional string array?
0
44,714
09/04/2008 20:36:15
370,899
08/22/2008 12:32:04
52
7
How to have to remote orgins for Git?
My company is a small one where we would be using Git for version control. The main server will be local. But we do want an server where our local repo is kept online to give access to our clients so that they can have assurance that we are doing the right thing and to allow them to check out from there if needed. So if I simply wish to push only to the one outside, and will never pull from it, what is the best Git way to do this?
git
null
null
null
null
null
open
How to have to remote orgins for Git? === My company is a small one where we would be using Git for version control. The main server will be local. But we do want an server where our local repo is kept online to give access to our clients so that they can have assurance that we are doing the right thing and to allow them to check out from there if needed. So if I simply wish to push only to the one outside, and will never pull from it, what is the best Git way to do this?
0
402,440
12/31/2008 06:56:57
36,831
11/12/2008 08:17:04
6
0
About "AUTOMATIC TEXT SUMMARIZER (lingustic based)"
I am having **"AUTOMATIC TEXT SUMMARIZER (linguistic approach)"** as my final year project. I have collected enough research papers and gone through them. Still i am not very clear about the ***'how-to-go-for-it'*** thing. Basically i found **"AUTOMATIC TEXT SUMMARIZER (statistical based)"** and found that it is much easier compared to my project. My project guide told me not to opt this (statistical based) and to go for linguistic based. Anyone who has ever worked upon or even heard of this sort of project would be knowing that summarizing any document means nothing but SCORING each sentence (by some approach involving some specific algos) and then selecting sentences having score more than threshold score. Now the **most difficult part of this project is choosing the appropriate algorithm for scoring and later implementing it**. I have moderate programming skills and would like to code in JAVA (beacuase there i`ll get lots of APIs resulting in lesser overheads). Now i want to know that for my project, **what should be my approach and algos used. Also how to implement them.** Note that i have to complete it in 3 months. Please help me. Its urgent. Thanks in anticipation.
linguistic
null
null
null
null
null
open
About "AUTOMATIC TEXT SUMMARIZER (lingustic based)" === I am having **"AUTOMATIC TEXT SUMMARIZER (linguistic approach)"** as my final year project. I have collected enough research papers and gone through them. Still i am not very clear about the ***'how-to-go-for-it'*** thing. Basically i found **"AUTOMATIC TEXT SUMMARIZER (statistical based)"** and found that it is much easier compared to my project. My project guide told me not to opt this (statistical based) and to go for linguistic based. Anyone who has ever worked upon or even heard of this sort of project would be knowing that summarizing any document means nothing but SCORING each sentence (by some approach involving some specific algos) and then selecting sentences having score more than threshold score. Now the **most difficult part of this project is choosing the appropriate algorithm for scoring and later implementing it**. I have moderate programming skills and would like to code in JAVA (beacuase there i`ll get lots of APIs resulting in lesser overheads). Now i want to know that for my project, **what should be my approach and algos used. Also how to implement them.** Note that i have to complete it in 3 months. Please help me. Its urgent. Thanks in anticipation.
0
402,605
12/31/2008 09:34:48
50,136
12/30/2008 11:02:07
11
1
Create an ActionLink with HTML elements in the link text
In an ASP.NET MVC view I'd like to include a link of the form: `<a href="blah">Link text <span>with further descriptive text</span></a>` Trying to include the <span> element in the linkText field of a call to Html.ActionLink ends up with it being encoded (as would be expected). Are there any recommended ways of achieving this?
asp.net-mvc
actionlink
null
null
null
null
open
Create an ActionLink with HTML elements in the link text === In an ASP.NET MVC view I'd like to include a link of the form: `<a href="blah">Link text <span>with further descriptive text</span></a>` Trying to include the <span> element in the linkText field of a call to Html.ActionLink ends up with it being encoded (as would be expected). Are there any recommended ways of achieving this?
0
44,715
09/04/2008 20:36:16
4,615
09/04/2008 20:36:16
1
0
Why do ruby setters need "self." qualification within the class?
Ruby setters -- whether created by (c)attr_accessor or manually -- seem to be the only methods that need "self." qualification when accessed within the class itself. This seems to put Ruby alone the world of languages: * all methods need self/this (like perl, and I think Javascript) * no methods require self/this is (C#, Java) * only setters need self/this (ruby??) The best comparison is C# vs ruby, because both languages support accessor methods which work syntactically just like class instance variables: foo.x = y, y = foo.x . C# calls them properties. Here's a simple example; the same program in ruby then C# #!/usr/bin/ruby class A def qwerty; @q; end # manual getter def qwerty=(value); @q = value; end # manual setter, but attr_accessor is same def asdf; self.qwerty = 4; end # "self." is necessary in ruby? def xxx; asdf; end # we can invoke nonsetters w/o "self." def dump; puts "qwerty = #{qwerty}"; end end a = A.new a.xxx a.dump take away the self.qwerty =() and it fails (ruby 1.8.6 on linux & osx). Now C#, using System; public class A { public A() {} int q; public int qwerty { get { return q; } set { q = value; } } public void asdf() { qwerty = 4; } // C# setters work w/o "this." public void xxx() { asdf(); } // are just like other methods public void dump() { Console.WriteLine("qwerty = {0}", qwerty); } } public class Test { public static void Main() { A a = new A(); a.xxx(); a.dump(); } } Question: Is this true? Are there other occasions besides setters where self is necessary?
c#
ruby
null
null
null
null
open
Why do ruby setters need "self." qualification within the class? === Ruby setters -- whether created by (c)attr_accessor or manually -- seem to be the only methods that need "self." qualification when accessed within the class itself. This seems to put Ruby alone the world of languages: * all methods need self/this (like perl, and I think Javascript) * no methods require self/this is (C#, Java) * only setters need self/this (ruby??) The best comparison is C# vs ruby, because both languages support accessor methods which work syntactically just like class instance variables: foo.x = y, y = foo.x . C# calls them properties. Here's a simple example; the same program in ruby then C# #!/usr/bin/ruby class A def qwerty; @q; end # manual getter def qwerty=(value); @q = value; end # manual setter, but attr_accessor is same def asdf; self.qwerty = 4; end # "self." is necessary in ruby? def xxx; asdf; end # we can invoke nonsetters w/o "self." def dump; puts "qwerty = #{qwerty}"; end end a = A.new a.xxx a.dump take away the self.qwerty =() and it fails (ruby 1.8.6 on linux & osx). Now C#, using System; public class A { public A() {} int q; public int qwerty { get { return q; } set { q = value; } } public void asdf() { qwerty = 4; } // C# setters work w/o "this." public void xxx() { asdf(); } // are just like other methods public void dump() { Console.WriteLine("qwerty = {0}", qwerty); } } public class Test { public static void Main() { A a = new A(); a.xxx(); a.dump(); } } Question: Is this true? Are there other occasions besides setters where self is necessary?
0
44,737
09/04/2008 20:46:51
1,782
08/18/2008 14:30:58
1,194
89
Is there a plugin for targetting .NET 1.1 with VS 2008?
Question in the title...
.net
visual-studio-2008
multi-targetting
null
null
null
open
Is there a plugin for targetting .NET 1.1 with VS 2008? === Question in the title...
0