question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,007
10,383
Log4Net configuring log level
How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold? This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?
Within the definition of the appender, I believe you can do something like this:...
Log4Net configuring log level How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold? This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?
TITLE: Log4Net configuring log level QUESTION: How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold? This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info? ANSWER: Within the definition of the appender, I b...
[ "log4net" ]
67
100
116,544
5
0
2008-08-08T14:43:11.877000
2008-08-13T21:18:38.423000
6,009
6,017
How do you deal with configuration files in source control?
Let's say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be a dev, prod and stage versions. How do you deal with this in source control? Not check in this file at all, check it with different names or do som...
What I've done in the past is to have a default config file which is checked in to source control. Then, each developer has their own override config file which is excluded from source control. The app first loads the default, and then if the override file is present, loads that and uses any settings from the override ...
How do you deal with configuration files in source control? Let's say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be a dev, prod and stage versions. How do you deal with this in source control? Not check ...
TITLE: How do you deal with configuration files in source control? QUESTION: Let's say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be a dev, prod and stage versions. How do you deal with this in source c...
[ "svn", "git", "version-control", "cvs" ]
103
73
22,810
19
0
2008-08-08T14:44:25.570000
2008-08-08T14:50:00.287000
6,076
7,740
Default Form Button in FireFox
I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id. On the Panel: MyPanel.DefaultButton = SearchButton.ID On the Control: Me.Pa...
Ends up this resolved my issue: SearchButton.UseSubmitBehavior = False
Default Form Button in FireFox I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id. On the Panel: MyPanel.DefaultButton = Search...
TITLE: Default Form Button in FireFox QUESTION: I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id. On the Panel: MyPanel.Defa...
[ "asp.net", "vb.net" ]
7
2
1,686
3
0
2008-08-08T15:32:15.787000
2008-08-11T12:51:23.970000
6,080
6,088
What to use for login ID?
We are in the early design stages of a major rewrite of our product. Right now our customers are mostly businesses. We manage accounts. User names for an account are each on their own namespace but it means that we can't move assets between servers. We want to move to a single namespace. But that brings the problem of ...
EMAIL ADDRESS Rational Users don't change emails very often Removes the step of asking for username and email address, which you'll need anyway Users don't often forget their email address (see number one) Email will be unique unless the user already registered for the site, in which case forward them to a forgot your ...
What to use for login ID? We are in the early design stages of a major rewrite of our product. Right now our customers are mostly businesses. We manage accounts. User names for an account are each on their own namespace but it means that we can't move assets between servers. We want to move to a single namespace. But t...
TITLE: What to use for login ID? QUESTION: We are in the early design stages of a major rewrite of our product. Right now our customers are mostly businesses. We manage accounts. User names for an account are each on their own namespace but it means that we can't move assets between servers. We want to move to a singl...
[ "authentication", "web-applications", "account" ]
17
42
7,246
10
0
2008-08-08T15:40:58.903000
2008-08-08T15:46:12.187000
6,085
6,514
Gathering OS and tool version numbers for build archive purposes
Our automated build machine needs to archive the version numbers of the OS plus various tools used during each build. (In case we ever need to replicate exactly the same build later on, perhaps when the machine is long dead.) I see the command "msinfo32.exe" can be used to dump a whole load of system version informatio...
Sorry, but what could lead for a need to replicated the exact same build in the future? In my experience, either you keep your product installers safe or start a new build from scratch. Also IMO the only way to replicated the exact same build in the future is to run your build machine on a Virtual Machine and keep the ...
Gathering OS and tool version numbers for build archive purposes Our automated build machine needs to archive the version numbers of the OS plus various tools used during each build. (In case we ever need to replicate exactly the same build later on, perhaps when the machine is long dead.) I see the command "msinfo32.e...
TITLE: Gathering OS and tool version numbers for build archive purposes QUESTION: Our automated build machine needs to archive the version numbers of the OS plus various tools used during each build. (In case we ever need to replicate exactly the same build later on, perhaps when the machine is long dead.) I see the c...
[ "build-automation", "versions", "archive" ]
6
0
431
3
0
2008-08-08T15:44:25.823000
2008-08-09T01:28:45.113000
6,110
6,120
Normalizing a Table with Low Integrity
I've been handed a table with about 18000 rows. Each record describes the location of one customer. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations. For example, here are some records that describe the same ...
Please update the question, do you have a list of CompanyNames available to you? I ask because you maybe able to use Levenshtein algo to find a relationship between your list of CompanyNames and LocationNames. Update There is not a list of Company Names, I will have to generate the company name from the most descriptiv...
Normalizing a Table with Low Integrity I've been handed a table with about 18000 rows. Each record describes the location of one customer. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations. For example, here a...
TITLE: Normalizing a Table with Low Integrity QUESTION: I've been handed a table with about 18000 rows. Each record describes the location of one customer. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations. F...
[ "database" ]
6
1
866
5
0
2008-08-08T16:19:20.607000
2008-08-08T16:41:29.623000
6,113
6,117
What is the best way to store connection string in .NET DLLs?
The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears that the connection string needs to have a DB username and password. The DLL curre...
I'm not certain, but I believe you can put it in a config file and encrypt the config file. Update: See Jon Galloway's post here.
What is the best way to store connection string in .NET DLLs? The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears that the connection ...
TITLE: What is the best way to store connection string in .NET DLLs? QUESTION: The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears th...
[ ".net", "sql-server", "connection-string" ]
17
10
15,659
8
0
2008-08-08T16:32:30.440000
2008-08-08T16:38:34.513000
6,126
6,140
How do you handle huge if-conditions?
It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement or just accept that it's ugly and move on with my life. Are there any other methods that you've found that might be of us...
Separate the condition in several booleans and then use a master boolean as the condition. bool isOpaque = object.Alpha == 1.0f; bool isDrawable = object.CanDraw && object.Layer == currentLayer; bool isHidden = hideList.Find(object); bool isVisible = isOpaque && isDrawable &&! isHidden; if(isVisible) { //... } Better...
How do you handle huge if-conditions? It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement or just accept that it's ugly and move on with my life. Are there any other methods...
TITLE: How do you handle huge if-conditions? QUESTION: It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement or just accept that it's ugly and move on with my life. Are there...
[ "language-agnostic", "if-statement" ]
29
62
7,038
21
0
2008-08-08T16:45:58.540000
2008-08-08T16:54:30.143000
6,130
6,144
Repair SVN Checksum
I'm using subclipse in Flex Builder 3, and recently received this error when trying to commit: svn: Checksum mismatch for '/Users/redacted/Documents/Flex Builder 3/path/to/my/file.mxml'; expected: 'f8cb275de72776657406154dd3c10348', actual: 'null' I worked around it by: Committing all the other changed files, omitting ...
The file in the.svn directory that keeps track of what you have checked out, when, what revision, and from where, has gotten corrupted somehow, for that particular file. This is no more dangerous or critical than the normal odd file problem, and can be because of various problems, like a subversion program dying mid-ch...
Repair SVN Checksum I'm using subclipse in Flex Builder 3, and recently received this error when trying to commit: svn: Checksum mismatch for '/Users/redacted/Documents/Flex Builder 3/path/to/my/file.mxml'; expected: 'f8cb275de72776657406154dd3c10348', actual: 'null' I worked around it by: Committing all the other chan...
TITLE: Repair SVN Checksum QUESTION: I'm using subclipse in Flex Builder 3, and recently received this error when trying to commit: svn: Checksum mismatch for '/Users/redacted/Documents/Flex Builder 3/path/to/my/file.mxml'; expected: 'f8cb275de72776657406154dd3c10348', actual: 'null' I worked around it by: Committing ...
[ "svn", "subclipse" ]
68
38
84,281
21
0
2008-08-08T16:49:17.377000
2008-08-08T16:56:13.027000
6,151
6,200
How do I edit work items in the Visual Studio 2008 xml editor?
I'm trying to customize some TFS work items via the VS2008 xml editor, but every time I open a work item xml file it jumps to the graphical designer. All that gives me is a "View XML" button that doesn't let you edit the xml directly.
I don't have TFS but I know in regular VS there is an Open With... option in most items' contextual menu that even let you change the default editor. Very useful when you are tired of the Designer opening instead of the Code file on Windows forms.
How do I edit work items in the Visual Studio 2008 xml editor? I'm trying to customize some TFS work items via the VS2008 xml editor, but every time I open a work item xml file it jumps to the graphical designer. All that gives me is a "View XML" button that doesn't let you edit the xml directly.
TITLE: How do I edit work items in the Visual Studio 2008 xml editor? QUESTION: I'm trying to customize some TFS work items via the VS2008 xml editor, but every time I open a work item xml file it jumps to the graphical designer. All that gives me is a "View XML" button that doesn't let you edit the xml directly. ANS...
[ "windows", "visual-studio", "tfs" ]
7
1
1,182
4
0
2008-08-08T17:04:25.973000
2008-08-08T17:52:07.783000
6,173
6,183
Regular expression for parsing links from a webpage?
I'm looking for a.NET regular expression extract all the URLs from a webpage but haven't found one to be comprehensive enough to cover all the different ways you can specify a link. And a side question: Is there one regex to rule them all? Or am I better off using a series of less complicated regular expressions and ju...
((mailto\:|(news|(ht|f)tp(s?))\://){1}\S+) I took this from regexlib.com [editor's note: the {1} has no real function in this regex; see this post ]
Regular expression for parsing links from a webpage? I'm looking for a.NET regular expression extract all the URLs from a webpage but haven't found one to be comprehensive enough to cover all the different ways you can specify a link. And a side question: Is there one regex to rule them all? Or am I better off using a ...
TITLE: Regular expression for parsing links from a webpage? QUESTION: I'm looking for a.NET regular expression extract all the URLs from a webpage but haven't found one to be comprehensive enough to cover all the different ways you can specify a link. And a side question: Is there one regex to rule them all? Or am I b...
[ ".net", "html", "regex" ]
17
12
12,361
9
0
2008-08-08T17:24:19.100000
2008-08-08T17:32:12.253000
6,184
6,211
How do I make event callbacks into my win forms thread safe?
When you subscribe to an event on an object from within a form, you are essentially handing over control of your callback method to the event source. You have no idea whether that event source will choose to trigger the event on a different thread. The problem is that when the callback is invoked, you cannot assume tha...
To simplify Simon's code a bit, you could use the built in generic Action delegate. It saves peppering your code with a bunch of delegate types you don't really need. Also, in.NET 3.5 they added a params parameter to the Invoke method so you don't have to define a temporary array. void SomethingHappened(object sender, ...
How do I make event callbacks into my win forms thread safe? When you subscribe to an event on an object from within a form, you are essentially handing over control of your callback method to the event source. You have no idea whether that event source will choose to trigger the event on a different thread. The proble...
TITLE: How do I make event callbacks into my win forms thread safe? QUESTION: When you subscribe to an event on an object from within a form, you are essentially handing over control of your callback method to the event source. You have no idea whether that event source will choose to trigger the event on a different ...
[ "c#", ".net", "winforms", "multithreading", "events" ]
39
35
33,935
6
0
2008-08-08T17:32:41.783000
2008-08-08T18:05:24.493000
6,207
281,143
Experiences of the Smart Client Software Factory
Has anyone had any experience in building a 'real world' application with the Smart Client Software Factory, from Microsofts Patterns and Practices group? I'm looking for advice on how difficult it was to master, whether it decreased your time to market and any other general pitfalls.
We used SCSF for a real world app with about 10 developers. It was a steep learning curve to set up and develop a pattern of usage, but once it was set up, introducing new developers to the project was VERY easy. Using CAB and SCSF was very beneficial to our project especially getting each developer up to speed and pro...
Experiences of the Smart Client Software Factory Has anyone had any experience in building a 'real world' application with the Smart Client Software Factory, from Microsofts Patterns and Practices group? I'm looking for advice on how difficult it was to master, whether it decreased your time to market and any other gen...
TITLE: Experiences of the Smart Client Software Factory QUESTION: Has anyone had any experience in building a 'real world' application with the Smart Client Software Factory, from Microsofts Patterns and Practices group? I'm looking for advice on how difficult it was to master, whether it decreased your time to market...
[ ".net", "scsf" ]
16
16
4,594
5
0
2008-08-08T17:59:41.230000
2008-11-11T15:07:06.753000
6,208
6,258
FF3 WinXP != FF3 Ubuntu - why?
I've got a website that I've just uploaded onto the interwebs, and it's displaying differently using Firefox 3.0.1 on Ubuntu and WinXP. Two things I've noticed on Ubuntu: The favicon is missing The background color isn't displaying (it's set in the stylesheet) What have I done wrong? The CSS file is being fetched under...
I would first suggesting getting you html and css code validated. If there are any errors in your markup, these can cause errors in the rendering. CSS Validator HTML Validator
FF3 WinXP != FF3 Ubuntu - why? I've got a website that I've just uploaded onto the interwebs, and it's displaying differently using Firefox 3.0.1 on Ubuntu and WinXP. Two things I've noticed on Ubuntu: The favicon is missing The background color isn't displaying (it's set in the stylesheet) What have I done wrong? The ...
TITLE: FF3 WinXP != FF3 Ubuntu - why? QUESTION: I've got a website that I've just uploaded onto the interwebs, and it's displaying differently using Firefox 3.0.1 on Ubuntu and WinXP. Two things I've noticed on Ubuntu: The favicon is missing The background color isn't displaying (it's set in the stylesheet) What have ...
[ "css", "firefox", "ubuntu" ]
14
10
1,020
7
0
2008-08-08T18:03:26.230000
2008-08-08T18:54:41.010000
6,209
6,223
Split a string ignoring quoted sections
Given a string like this: a,"string, with",various,"values, and some",quoted What is a good algorithm to split this based on commas while ignoring the commas inside the quoted sections? The output should be an array: [ "a", "string, with", "various", "values, and some", "quoted" ]
If my language of choice didn't offer a way to do this without thinking then I would initially consider two options as the easy way out: Pre-parse and replace the commas within the string with another control character then split them, followed by a post-parse on the array to replace the control character used previous...
Split a string ignoring quoted sections Given a string like this: a,"string, with",various,"values, and some",quoted What is a good algorithm to split this based on commas while ignoring the commas inside the quoted sections? The output should be an array: [ "a", "string, with", "various", "values, and some", "quoted" ...
TITLE: Split a string ignoring quoted sections QUESTION: Given a string like this: a,"string, with",various,"values, and some",quoted What is a good algorithm to split this based on commas while ignoring the commas inside the quoted sections? The output should be an array: [ "a", "string, with", "various", "values, an...
[ "language-agnostic", "parsing", "csv" ]
22
2
10,281
13
0
2008-08-08T18:04:03.653000
2008-08-08T18:18:34.577000
6,210
6,213
E-mail Notifications
In a.net system I'm building, there is a need for automated e-mail notifications. These should be editable by an admin. What's the easiest way to do this? SQL table and WYSIWIG for editing? The queue is a great idea. I've been throwing around that type of process for awhile with my old company.
From a high level, yes.:D The main thing is some place to store the templates. A database is a great option unless you're not already using one, then file systems work fine. WSIWIG editors (such as fckeditor) work well and give you some good options regarding the features that you allow. Some sort of token replacement ...
E-mail Notifications In a.net system I'm building, there is a need for automated e-mail notifications. These should be editable by an admin. What's the easiest way to do this? SQL table and WYSIWIG for editing? The queue is a great idea. I've been throwing around that type of process for awhile with my old company.
TITLE: E-mail Notifications QUESTION: In a.net system I'm building, there is a need for automated e-mail notifications. These should be editable by an admin. What's the easiest way to do this? SQL table and WYSIWIG for editing? The queue is a great idea. I've been throwing around that type of process for awhile with m...
[ ".net", "email" ]
4
3
977
5
0
2008-08-08T18:04:24.950000
2008-08-08T18:09:55.017000
6,222
7,877
Eclipse on win64
Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit? Currently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch & compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse distro is unstable for us, so I'm curious if...
I'm using Eclipse with a 64bit VM. However I have to use Java 1.5, because with Java 1.6, even 1.6.0_10ea, Eclipse crashed when changing the.classpath-file. On Linux I had the same problems and could only get the 64bit Eclipse to work with 64bit Java 1.5. The problem seems to be with the just in time compilation, since...
Eclipse on win64 Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit? Currently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch & compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse distro is unstable for us, ...
TITLE: Eclipse on win64 QUESTION: Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit? Currently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch & compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse distro is...
[ "java", "eclipse", "eclipse-3.4", "ganymede" ]
16
7
4,438
2
0
2008-08-08T18:17:50.460000
2008-08-11T15:42:36.747000
6,284
7,167
VS 2008 - Objects disappearing?
I've only been using VS 2008 Team Foundation for a few weeks. Over the last few days, I've noticed that sometimes one of my objects/controls on my page just disappears from intellisense. The project builds perfectly and the objects are still in the HTML, but I still can't find the object. Any one else notice this? Edit...
I am also having a number of problems with VS 2008. Who would guess that I don't ever need to select multiple controls on a web form... Anyway, a lot has been fixed in Service Pack 1, which is in Beta currently. Might be worth installing that. It has gone a little way to fixing absolute positioning. This isn't your pro...
VS 2008 - Objects disappearing? I've only been using VS 2008 Team Foundation for a few weeks. Over the last few days, I've noticed that sometimes one of my objects/controls on my page just disappears from intellisense. The project builds perfectly and the objects are still in the HTML, but I still can't find the object...
TITLE: VS 2008 - Objects disappearing? QUESTION: I've only been using VS 2008 Team Foundation for a few weeks. Over the last few days, I've noticed that sometimes one of my objects/controls on my page just disappears from intellisense. The project builds perfectly and the objects are still in the HTML, but I still can...
[ ".net", "visual-studio", "tfs" ]
8
2
864
3
0
2008-08-08T19:24:43.710000
2008-08-10T11:53:28.923000
6,301
6,320
Why is Array.Length an int, and not an uint
Why is Array.Length an int, and not a uint. This bothers me (just a bit) because a length value can never be negative. This also forced me to use an int for a length-property on my own class, because when you specify an int-value, this needs to be cast explicitly... So the ultimate question is: is there any use for an ...
Unsigned int isn't CLS compliant and would therefore restrict usage of the property to those languages that do implement a UInt. See here: Framework 1.1 Introduction to the.NET Framework Class Library Framework 2.0.NET Framework Class Library Overview
Why is Array.Length an int, and not an uint Why is Array.Length an int, and not a uint. This bothers me (just a bit) because a length value can never be negative. This also forced me to use an int for a length-property on my own class, because when you specify an int-value, this needs to be cast explicitly... So the ul...
TITLE: Why is Array.Length an int, and not an uint QUESTION: Why is Array.Length an int, and not a uint. This bothers me (just a bit) because a length value can never be negative. This also forced me to use an int for a length-property on my own class, because when you specify an int-value, this needs to be cast expli...
[ "c#", ".net", "int", "uint" ]
109
68
18,294
5
0
2008-08-08T19:34:13.503000
2008-08-08T19:50:14.987000
6,325
6,333
Why are unsigned int's not CLS compliant?
Why are unsigned integers not CLS compliant? I am starting to think the type specification is just for performance and not for correctness.
Not all languages have the concept of unsigned ints. For example VB 6 had no concept of unsigned ints which I suspect drove the decision of the designers of VB7/7.1 not to implement as well (it's implemented now in VB8). To quote: http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx The CLS was designed to be large en...
Why are unsigned int's not CLS compliant? Why are unsigned integers not CLS compliant? I am starting to think the type specification is just for performance and not for correctness.
TITLE: Why are unsigned int's not CLS compliant? QUESTION: Why are unsigned integers not CLS compliant? I am starting to think the type specification is just for performance and not for correctness. ANSWER: Not all languages have the concept of unsigned ints. For example VB 6 had no concept of unsigned ints which I s...
[ "c#", ".net", "unsigned-integer", "cls-compliant" ]
123
102
22,478
4
0
2008-08-08T19:55:39.920000
2008-08-08T20:01:53.497000
6,326
6,355
Haml: how do I set a dynamic class value?
I have the following html.erb code that I'm looking to move to Haml: <%= item.dashboardstatus.status %> What it does is associate the CSS class of the currently assigned status to the span. How is this done in Haml? I'm sure I'm missing something really simple.
Not sure. Maybe: %span{:class => item.dashboardstatus.cssclass }= item.dashboardstatus.status
Haml: how do I set a dynamic class value? I have the following html.erb code that I'm looking to move to Haml: <%= item.dashboardstatus.status %> What it does is associate the CSS class of the currently assigned status to the span. How is this done in Haml? I'm sure I'm missing something really simple.
TITLE: Haml: how do I set a dynamic class value? QUESTION: I have the following html.erb code that I'm looking to move to Haml: <%= item.dashboardstatus.status %> What it does is associate the CSS class of the currently assigned status to the span. How is this done in Haml? I'm sure I'm missing something really simple...
[ "css", "ruby-on-rails", "haml" ]
20
21
7,166
3
0
2008-08-08T19:56:42.787000
2008-08-08T20:28:18.387000
6,340
6,349
Multiple foreign keys?
I've got a table that is supposed to track days and costs for shipping product from one vendor to another. We (brilliantly:p) stored both the shipping vendors (FedEx, UPS) with the product handling vendors (Think... Dunder Mifflin) in a "VENDOR" table. So, I have three columns in my SHIPPING_DETAILS table that all refe...
You defined the primary key twice. Try: CREATE TABLE SHIPPING_GRID( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Unique ID for each row', shipping_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to VENDOR.no for the shipping vendor (vendors_type must be 3)', start_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to...
Multiple foreign keys? I've got a table that is supposed to track days and costs for shipping product from one vendor to another. We (brilliantly:p) stored both the shipping vendors (FedEx, UPS) with the product handling vendors (Think... Dunder Mifflin) in a "VENDOR" table. So, I have three columns in my SHIPPING_DETA...
TITLE: Multiple foreign keys? QUESTION: I've got a table that is supposed to track days and costs for shipping product from one vendor to another. We (brilliantly:p) stored both the shipping vendors (FedEx, UPS) with the product handling vendors (Think... Dunder Mifflin) in a "VENDOR" table. So, I have three columns i...
[ "sql", "mysql", "foreign-keys" ]
18
13
98,266
3
0
2008-08-08T20:07:43.390000
2008-08-08T20:18:25.553000
6,369
10,838
How to pass a comma separated list to a stored procedure?
So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause: CREATE PROCEDURE getSomething @keyList varchar(4096) AS SELECT * FROM mytbl WHERE name IN (@keyList) How do I call my stored proc with more than 1 value in the list? So far I've tri...
If you're using Sybase 12.5 or earlier then you can't use functions. A workaround might be to populate a temporary table with the values and read them from there.
How to pass a comma separated list to a stored procedure? So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause: CREATE PROCEDURE getSomething @keyList varchar(4096) AS SELECT * FROM mytbl WHERE name IN (@keyList) How do I call my store...
TITLE: How to pass a comma separated list to a stored procedure? QUESTION: So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause: CREATE PROCEDURE getSomething @keyList varchar(4096) AS SELECT * FROM mytbl WHERE name IN (@keyList) How ...
[ "sql", "sap-ase" ]
19
4
52,340
11
0
2008-08-08T20:48:29.377000
2008-08-14T09:27:30.793000
6,371
6,380
How do you manage databases in development, test, and production?
I've had a hard time trying to find good examples of how to manage database schemas and data between development, test, and production servers. Here's our setup. Each developer has a virtual machine running our app and the MySQL database. It is their personal sandbox to do whatever they want. Currently, developers will...
There are a couple of good options. I wouldn't use the "restore a backup" strategy. Script all your schema changes, and have your CI server run those scripts on the database. Have a version table to keep track of the current database version, and only execute the scripts if they are for a newer version. Use a migration...
How do you manage databases in development, test, and production? I've had a hard time trying to find good examples of how to manage database schemas and data between development, test, and production servers. Here's our setup. Each developer has a virtual machine running our app and the MySQL database. It is their per...
TITLE: How do you manage databases in development, test, and production? QUESTION: I've had a hard time trying to find good examples of how to manage database schemas and data between development, test, and production servers. Here's our setup. Each developer has a virtual machine running our app and the MySQL databas...
[ "mysql", "svn" ]
185
58
43,195
14
0
2008-08-08T20:50:02.930000
2008-08-08T21:01:09.490000
6,373
6,424
What's the difference in closure style
There are two popular closure styles in javascript. The first I call anonymous constructor: new function() { var code... } and the inline executed function: (function() { var code... })(); are there differences in behaviour between those two? Is one "better" over the other?
Both cases will execute the function, the only real difference is what the return value of the expression may be, and what the value of "this" will be inside the function. Basically behaviour of new expression Is effectively equivalent to var tempObject = {}; var result = expression.call(tempObject); if (result is not ...
What's the difference in closure style There are two popular closure styles in javascript. The first I call anonymous constructor: new function() { var code... } and the inline executed function: (function() { var code... })(); are there differences in behaviour between those two? Is one "better" over the other?
TITLE: What's the difference in closure style QUESTION: There are two popular closure styles in javascript. The first I call anonymous constructor: new function() { var code... } and the inline executed function: (function() { var code... })(); are there differences in behaviour between those two? Is one "better" over...
[ "javascript" ]
23
12
1,793
5
0
2008-08-08T20:53:21.393000
2008-08-08T22:02:14.830000
6,378
8,431
What client(s) should be targeted in implementing an ICalendar export for events?
http://en.wikipedia.org/wiki/ICalendar I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal, Microsoft's Outlook, and Google's Gmail. I'm starting to get the feeling that each of these client ...
I have to say that I don't use the hourly recurrence feature as really how many people have events that repeat in the same day? I could see if someone however was to schedule when they needed to take a particular medicine at recurring times throughout the day. I would say support full features in the application itself...
What client(s) should be targeted in implementing an ICalendar export for events? http://en.wikipedia.org/wiki/ICalendar I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal, Microsoft's Outlo...
TITLE: What client(s) should be targeted in implementing an ICalendar export for events? QUESTION: http://en.wikipedia.org/wiki/ICalendar I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal,...
[ "outlook", "gmail", "icalendar", "recurrence" ]
5
2
772
2
0
2008-08-08T20:58:11.103000
2008-08-12T03:10:43.130000
6,392
6,496
Java Time Zone is messed up
I am running a Tomcat application, and I need to display some time values. Unfortunately, the time is coming up an hour off. I looked into it and discovered that my default TimeZone is being set to: sun.util.calendar.ZoneInfo[id="GMT-08:00", offset=-28800000, dstSavings=0, useDaylight=false, transitions=0, lastRule=nul...
It's a "quirk" in the way the JVM looks up the zoneinfo file. See Bug ID 6456628. The easiest workaround is to make /etc/localtime a symlink to the correct zoneinfo file. For Pacific time, the following commands should work: # sudo cp /etc/localtime /etc/localtime.dist # sudo ln -fs /usr/share/zoneinfo/America/Los_Ange...
Java Time Zone is messed up I am running a Tomcat application, and I need to display some time values. Unfortunately, the time is coming up an hour off. I looked into it and discovered that my default TimeZone is being set to: sun.util.calendar.ZoneInfo[id="GMT-08:00", offset=-28800000, dstSavings=0, useDaylight=false,...
TITLE: Java Time Zone is messed up QUESTION: I am running a Tomcat application, and I need to display some time values. Unfortunately, the time is coming up an hour off. I looked into it and discovered that my default TimeZone is being set to: sun.util.calendar.ZoneInfo[id="GMT-08:00", offset=-28800000, dstSavings=0, ...
[ "java", "linux", "timezone" ]
34
30
45,722
5
0
2008-08-08T21:24:01.490000
2008-08-09T00:46:46.260000
6,406
6,412
How to access .Net element on Master page from a Content page?
Is it possible to access an element on a Master page from the page loaded within the ContentPlaceHolder for the master? I have a ListView that lists people's names in a navigation area on the Master page. I would like to update the ListView after a person has been added to the table that the ListView is data bound to. ...
I believe you could do this by using this.Master.FindControl or something similar, but you probably shouldn't - it requires the content page to know too much about the structure of the master page. I would suggest another method, such as firing an event in the content area that the master could listen for and re-bind w...
How to access .Net element on Master page from a Content page? Is it possible to access an element on a Master page from the page loaded within the ContentPlaceHolder for the master? I have a ListView that lists people's names in a navigation area on the Master page. I would like to update the ListView after a person h...
TITLE: How to access .Net element on Master page from a Content page? QUESTION: Is it possible to access an element on a Master page from the page loaded within the ContentPlaceHolder for the master? I have a ListView that lists people's names in a navigation area on the Master page. I would like to update the ListVie...
[ "c#", ".net" ]
15
17
11,714
6
0
2008-08-08T21:39:04.283000
2008-08-08T21:46:22.053000
6,414
6,417
C# loop — break vs. continue
In a C# (feel free to answer for other languages) loop, what's the difference between break and continue as a means to leave the structure of the loop, and go to the next iteration? Example: foreach (DataRow row in myTable.Rows) { if (someConditionEvalsToTrue) { break; //what's the difference between this and continue?...
break will exit the loop completely, continue will just skip the current iteration. For example: for (int i = 0; i < 10; i++) { if (i == 0) { break; } DoSomeThingWith(i); } The break will cause the loop to exit on the first iteration — DoSomeThingWith will never be executed. While: for (int i = 0; i < 10; i++) { if (i...
C# loop — break vs. continue In a C# (feel free to answer for other languages) loop, what's the difference between break and continue as a means to leave the structure of the loop, and go to the next iteration? Example: foreach (DataRow row in myTable.Rows) { if (someConditionEvalsToTrue) { break; //what's the differen...
TITLE: C# loop — break vs. continue QUESTION: In a C# (feel free to answer for other languages) loop, what's the difference between break and continue as a means to leave the structure of the loop, and go to the next iteration? Example: foreach (DataRow row in myTable.Rows) { if (someConditionEvalsToTrue) { break; //w...
[ "c#", "loops", "break", "enumeration", "continue" ]
878
1,614
862,830
16
0
2008-08-08T21:49:01.127000
2008-08-08T21:51:35.397000
6,430
6,435
How to programmatically iterate datagrid rows?
I'm suddenly back to WinForms, after years of web development, and am having trouble with something that should be simple. I have an ArrayList of business objects bound to a Windows Forms DataGrid. I'd like the user to be able to edit the cells, and when finished, press a Save button. At that point I'd like to iterate ...
foreach(var row in DataGrid1.Rows) { DoStuff(row); } //Or --------------------------------------------- foreach(DataGridRow row in DataGrid1.Rows) { DoStuff(row); } //Or --------------------------------------------- for(int i = 0; i< DataGrid1.Rows.Count - 1; i++) { DoStuff(DataGrid1.Rows[i]); }
How to programmatically iterate datagrid rows? I'm suddenly back to WinForms, after years of web development, and am having trouble with something that should be simple. I have an ArrayList of business objects bound to a Windows Forms DataGrid. I'd like the user to be able to edit the cells, and when finished, press a ...
TITLE: How to programmatically iterate datagrid rows? QUESTION: I'm suddenly back to WinForms, after years of web development, and am having trouble with something that should be simple. I have an ArrayList of business objects bound to a Windows Forms DataGrid. I'd like the user to be able to edit the cells, and when ...
[ "winforms" ]
4
5
9,121
4
0
2008-08-08T22:08:29.980000
2008-08-08T22:20:28.973000
6,440
6,445
.NET 3.5 Redistributable -- 200 MB? Other options?
I've been using a lot of new.NET 3.5 features in the work that I've been doing, lately. The application that I'm building is intended for distribution among consumers who will probably not have the latest version (or perhaps any version ) of the.NET framework on their machines. I went to go download the.NET 3.5 redistr...
That's one of the sad reasons i'm still targeting.net 2.0 whenever possible:/ But people don't neccessarily need the full 200 MB Package. There is a 3 MB Bootstrapper which will only download the required components:.net 3.5 SP1 Bootstrapper However, the worst case scenario is still a pretty hefty download. Also, see t...
.NET 3.5 Redistributable -- 200 MB? Other options? I've been using a lot of new.NET 3.5 features in the work that I've been doing, lately. The application that I'm building is intended for distribution among consumers who will probably not have the latest version (or perhaps any version ) of the.NET framework on their ...
TITLE: .NET 3.5 Redistributable -- 200 MB? Other options? QUESTION: I've been using a lot of new.NET 3.5 features in the work that I've been doing, lately. The application that I'm building is intended for distribution among consumers who will probably not have the latest version (or perhaps any version ) of the.NET f...
[ ".net", "redistributable" ]
19
21
12,024
6
0
2008-08-08T22:32:01.243000
2008-08-08T22:35:06.417000
6,441
6,868
How can I enable disabled radio buttons?
The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is supposed to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enable both radio buttons" option. These both work... However, i...
To get FF to mimic IE's behavior when using the keyboard, you can use the keyup event on the select box. In your example (I am not a fan of attaching event handlers this way, but that's another topic), it would be like this:
How can I enable disabled radio buttons? The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is supposed to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enable both radio butto...
TITLE: How can I enable disabled radio buttons? QUESTION: The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is supposed to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enabl...
[ "javascript", "html", "radio-button" ]
19
6
3,675
3
0
2008-08-08T22:33:19.960000
2008-08-09T18:15:12.900000
6,467
3,125,174
Date arithmetic in Unix shell scripts
I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. I'm using a function to increment a day and another to decrement: IncrementaDia(){ echo $1 | awk ' BEGIN { diasDelMes[1] = 31 diasDelMes[2] = 28 diasDelMes[3] = 31 diasDelMes[4] = 30 diasDelMes[5] = 31 diasDe...
I have written a bash script for converting dates expressed in English into conventional mm/dd/yyyy dates. It is called ComputeDate. Here are some examples of its use. For brevity I have placed the output of each invocation on the same line as the invocation, separarted by a colon (:). The quotes shown below are not ne...
Date arithmetic in Unix shell scripts I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. I'm using a function to increment a day and another to decrement: IncrementaDia(){ echo $1 | awk ' BEGIN { diasDelMes[1] = 31 diasDelMes[2] = 28 diasDelMes[3] = 31 diasDe...
TITLE: Date arithmetic in Unix shell scripts QUESTION: I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. I'm using a function to increment a day and another to decrement: IncrementaDia(){ echo $1 | awk ' BEGIN { diasDelMes[1] = 31 diasDelMes[2] = 28 diasDel...
[ "unix", "shell", "date", "math", "scripting" ]
24
17
80,147
13
0
2008-08-08T23:24:02.933000
2010-06-26T19:04:41.087000
6,484
6,716
How do you mock a Sealed class?
Mocking sealed classes can be quite a pain. I currently favor an Adapter pattern to handle this, but something about just keeps feels weird. So, What is the best way you mock sealed classes? Java answers are more than welcome. In fact, I would anticipate that the Java community has been dealing with this longer and has...
My general rule of thumb is that objects that I need to mock should have a common interface too. I think this is right design-wise and makes tests a lot easier (and is usually what you get if you do TDD). More about this can be read in the Google Testing Blog latest post (See point 9). Also, I've been working mainly in...
How do you mock a Sealed class? Mocking sealed classes can be quite a pain. I currently favor an Adapter pattern to handle this, but something about just keeps feels weird. So, What is the best way you mock sealed classes? Java answers are more than welcome. In fact, I would anticipate that the Java community has been ...
TITLE: How do you mock a Sealed class? QUESTION: Mocking sealed classes can be quite a pain. I currently favor an Adapter pattern to handle this, but something about just keeps feels weird. So, What is the best way you mock sealed classes? Java answers are more than welcome. In fact, I would anticipate that the Java c...
[ "unit-testing", "language-agnostic", "tdd", "mocking" ]
78
14
59,907
10
0
2008-08-09T00:14:22.143000
2008-08-09T09:40:37.727000
6,499
6,531
What style do you use for creating a "class"?
There are a few ways to get class-like behavior in javascript, the most common seem to be prototype based like this: function Vector(x, y, x) { this.x = x; this.y = y; this.z = z; return this; } Vector.prototype.length = function () { return Math.sqrt(this.x * this.x... ); } and closure based approaches similar to fun...
Assigning functions to the prototype is better (for public methods) because all instances of the class will share the same copy of the method. If you assign the function inside the constructor as in the second example, every time you create a new instance, the constructor creates a new copy of the length function and a...
What style do you use for creating a "class"? There are a few ways to get class-like behavior in javascript, the most common seem to be prototype based like this: function Vector(x, y, x) { this.x = x; this.y = y; this.z = z; return this; } Vector.prototype.length = function () { return Math.sqrt(this.x * this.x... );...
TITLE: What style do you use for creating a "class"? QUESTION: There are a few ways to get class-like behavior in javascript, the most common seem to be prototype based like this: function Vector(x, y, x) { this.x = x; this.y = y; this.z = z; return this; } Vector.prototype.length = function () { return Math.sqrt(thi...
[ "javascript" ]
24
12
1,037
7
0
2008-08-09T00:56:15.040000
2008-08-09T02:05:33.840000
6,512
6,566
How to implement continuations?
I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not being standard C, this solution...
I remember reading an article that may be of help to you: Cheney on the M.T.A.:-) Some implementations of Scheme I know of, such as SISC, allocate their call frames on the heap. @ollie: You don't need to do the hoisting if all your call frames are on the heap. There's a tradeoff in performance, of course: the time to h...
How to implement continuations? I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not...
TITLE: How to implement continuations? QUESTION: I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when need...
[ "c", "lisp", "scheme", "continuations" ]
54
19
10,784
12
0
2008-08-09T01:18:37.943000
2008-08-09T02:49:25.903000
6,530
6,534
Where should I put my log file for an asp.net application?
I have a ASP.NET application that we've written our own logging module for. My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a place where I know it'll have permission to write to. Cheers,
App_Data folder on the root of the project. It isn't served to web requests; so other people can't snoop for it.
Where should I put my log file for an asp.net application? I have a ASP.NET application that we've written our own logging module for. My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a place where I know i...
TITLE: Where should I put my log file for an asp.net application? QUESTION: I have a ASP.NET application that we've written our own logging module for. My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a pl...
[ "asp.net", "logging", "permissions" ]
11
7
4,696
6
0
2008-08-09T02:03:52.033000
2008-08-09T02:10:12.800000
6,547
6,565
Two marbles and a 100 story building
One of those classic programming interview questions... You are given two marbles, and told that they will break when dropped from some certain height (and presumably suffer no damage if dropped from below that height). You’re then taken to a 100 story building (presumably higher than the certain height), and asked to ...
The interesting thing here is how you can do it in the least amount of drops possible. Going to the 50th floor and dropping the first would be disastrous if the breaking floor is the 49th, resulting in us having to do 50 drops. We should drop the first marble at floor n, where n is the max amount of drops required. If ...
Two marbles and a 100 story building One of those classic programming interview questions... You are given two marbles, and told that they will break when dropped from some certain height (and presumably suffer no damage if dropped from below that height). You’re then taken to a 100 story building (presumably higher th...
TITLE: Two marbles and a 100 story building QUESTION: One of those classic programming interview questions... You are given two marbles, and told that they will break when dropped from some certain height (and presumably suffer no damage if dropped from below that height). You’re then taken to a 100 story building (pr...
[ "algorithm", "puzzle" ]
40
55
21,719
10
0
2008-08-09T02:23:27.890000
2008-08-09T02:45:43.070000
6,557
6,567
In C#, why can't a List<string> object be stored in a List<object> variable
It seems that a List object cannot be stored in a List variable in C#, and can't even be explicitly cast that way. List sl = new List (); List ol; ol = sl; results in Cannot implicitly convert type System.Collections.Generic.List to System.Collections.Generic.List And then... List sl = new List (); List ol; ol = (List ...
Think of it this way, if you were to do such a cast, and then add an object of type Foo to the list, the list of strings is no longer consistent. If you were to iterate the first reference, you would get a class cast exception because once you hit the Foo instance, the Foo could not be converted to string! As a side no...
In C#, why can't a List<string> object be stored in a List<object> variable It seems that a List object cannot be stored in a List variable in C#, and can't even be explicitly cast that way. List sl = new List (); List ol; ol = sl; results in Cannot implicitly convert type System.Collections.Generic.List to System.Coll...
TITLE: In C#, why can't a List<string> object be stored in a List<object> variable QUESTION: It seems that a List object cannot be stored in a List variable in C#, and can't even be explicitly cast that way. List sl = new List (); List ol; ol = sl; results in Cannot implicitly convert type System.Collections.Generic.L...
[ "c#", ".net", "generics", "covariance", "type-safety" ]
86
39
77,817
14
0
2008-08-09T02:32:01.507000
2008-08-09T02:50:14.903000
6,578
6,614
Understanding reference counting with Cocoa and Objective-C
I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just not over the hump yet. How do...
Let's start with retain and release; autorelease is really just a special case once you understand the basic concepts. In Cocoa, each object keeps track of how many times it is being referenced (specifically, the NSObject base class implements this). By calling retain on an object, you are telling it that you want to u...
Understanding reference counting with Cocoa and Objective-C I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once y...
TITLE: Understanding reference counting with Cocoa and Objective-C QUESTION: I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting scheme has me rather confused. I'm told it's v...
[ "iphone", "objective-c", "cocoa", "memory" ]
125
151
36,506
15
0
2008-08-09T03:13:04
2008-08-09T04:40:49.250000
6,579
6,588
Which Agile software development methods have you had the most success with?
There are numerous Agile software development methods. Which ones have you used in practice to deliver a successful project, and how did the method contribute to that success?
I've been involved with quite a few organisations which claimed to work in an 'agile' way, and their processed usually seemed to be base on XP (extreme programming), but none of them ever followed anywhere near all the practices. That said, I can probably comment on a few of the XP practices Unit testing seems to prove...
Which Agile software development methods have you had the most success with? There are numerous Agile software development methods. Which ones have you used in practice to deliver a successful project, and how did the method contribute to that success?
TITLE: Which Agile software development methods have you had the most success with? QUESTION: There are numerous Agile software development methods. Which ones have you used in practice to deliver a successful project, and how did the method contribute to that success? ANSWER: I've been involved with quite a few orga...
[ "methods", "agile" ]
3
7
856
5
0
2008-08-09T03:19:59.117000
2008-08-09T03:39:44.600000
6,594
6,617
PHP4 to PHP5 Migration
What are some good steps to follow for a smooth migration from PHP4 to PHP5. What are some types of code that are likely to break?
I also once worked on an app which used PHP4's XML support quite heavily, and would have required quite a bit of work to move to PHP5. One of the other significant changes I was looking at at the time was the change of the default handling of function parameters. In PHP4 if I remember, they were pass-by-copy unless you...
PHP4 to PHP5 Migration What are some good steps to follow for a smooth migration from PHP4 to PHP5. What are some types of code that are likely to break?
TITLE: PHP4 to PHP5 Migration QUESTION: What are some good steps to follow for a smooth migration from PHP4 to PHP5. What are some types of code that are likely to break? ANSWER: I also once worked on an app which used PHP4's XML support quite heavily, and would have required quite a bit of work to move to PHP5. One ...
[ "php", "migration" ]
11
8
2,251
4
0
2008-08-09T03:49:36.017000
2008-08-09T04:44:49.710000
6,607
6,620
Registry vs. INI file for storing user configurable application settings
I'm a new Windows programmer and I'm not sure where I should store user configurable application settings. I understand the need to provide a user friendly means for the user to change application settings, like an Edit | Settings form or similar. But where should I store the values after the user hits the Apply button...
Pros of config file: Easy to do. Don't need to know any Windows API calls. You just need to know the file I/O interface of your programming language. Portable. If you port your application to another OS, you don't need to change your settings format. User-editable. The user can edit the config file outside of the progr...
Registry vs. INI file for storing user configurable application settings I'm a new Windows programmer and I'm not sure where I should store user configurable application settings. I understand the need to provide a user friendly means for the user to change application settings, like an Edit | Settings form or similar....
TITLE: Registry vs. INI file for storing user configurable application settings QUESTION: I'm a new Windows programmer and I'm not sure where I should store user configurable application settings. I understand the need to provide a user friendly means for the user to change application settings, like an Edit | Setting...
[ "windows", "registry", "settings", "configuration-files", "ini" ]
55
45
26,415
13
0
2008-08-09T04:13:02.740000
2008-08-09T04:51:59.773000
6,612
6,655
Are there any decent free Java data plotting libraries out there?
On a recent Java project, we needed a free Java based real-time data plotting utility. After much searching, we found this tool called the Scientific Graphics Toolkit or SGT from NOAA. It seemed pretty robust, but we found out that it wasn't terribly configurable. Or at least not configurable enough to meet our needs. ...
I've had success using JFreeChart on multiple projects. It is very configurable. JFreeChart is open source, but they charge for the developer guide. If you're doing something simple, the sample code is probably good enough. Otherwise, $50 for the developer guide is a pretty good bargain. With respect to "real-time" dat...
Are there any decent free Java data plotting libraries out there? On a recent Java project, we needed a free Java based real-time data plotting utility. After much searching, we found this tool called the Scientific Graphics Toolkit or SGT from NOAA. It seemed pretty robust, but we found out that it wasn't terribly con...
TITLE: Are there any decent free Java data plotting libraries out there? QUESTION: On a recent Java project, we needed a free Java based real-time data plotting utility. After much searching, we found this tool called the Scientific Graphics Toolkit or SGT from NOAA. It seemed pretty robust, but we found out that it w...
[ "java", "plot", "configuration" ]
45
18
32,553
16
0
2008-08-09T04:29:42.190000
2008-08-09T06:23:19.140000
6,613
15,811
What rule engine should I use?
What are some of the best or most popular rule engines? I haven't settled on a programming language, so tell me the rule engine and what programming languages it supports.
I am one of the authors of Drools, I will avoid pimping my wares. But some other options are Jess (not open source) but uses the clips syntax (which we also support a subset of) - which is kinda a lisp dialect. It really depends what you want it for, Haley have strong Natural language tech (and they recently aquired Ru...
What rule engine should I use? What are some of the best or most popular rule engines? I haven't settled on a programming language, so tell me the rule engine and what programming languages it supports.
TITLE: What rule engine should I use? QUESTION: What are some of the best or most popular rule engines? I haven't settled on a programming language, so tell me the rule engine and what programming languages it supports. ANSWER: I am one of the authors of Drools, I will avoid pimping my wares. But some other options a...
[ "language-agnostic", "rule-engine" ]
18
10
24,997
8
0
2008-08-09T04:34:29.467000
2008-08-19T06:51:46.643000
6,623
27,317
sgen.exe fails during build
After changing the output directory of a visual studio project it started to fail to build with an error very much like: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryCaseManagement\obj\Release\EASDiscoveryCaseManagement.dll /proxytypes /refer...
see msdn for the options to sgen.exe [you have the command line, you can play with it manually... delete your.XmlSerializers.dll or use /force though] Today I also ran across how to more manually specify the sgen options. I wanted this to not use the /proxy switch, but it appears it can let you specify the output direc...
sgen.exe fails during build After changing the output directory of a visual studio project it started to fail to build with an error very much like: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryCaseManagement\obj\Release\EASDiscoveryCaseManag...
TITLE: sgen.exe fails during build QUESTION: After changing the output directory of a visual studio project it started to fail to build with an error very much like: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryCaseManagement\obj\Release\EAS...
[ "c#", "visual-studio", "msbuild" ]
18
9
29,113
4
0
2008-08-09T04:57:00.577000
2008-08-26T02:49:28.977000
6,628
6,649
PHP array indexing: $array[$index] vs $array["$index"] vs $array["{$index}"]
What is the difference, if any, between these methods of indexing into a PHP array: $array[$index] $array["$index"] $array["{$index}"] I'm interested in both the performance and functional differences. Update: (In response to @Jeremy) I'm not sure that's right. I ran this code: $array = array(100, 200, 300); print_r($a...
see @svec and @jeremy above. All array indices are of type 'int' first, then type 'string', and will be cast to that as PHP sees fit. Performance wise, $index should be faster than "$index" and "{$index}" (which are the same). Once you start a double-quote string, PHP will go into interpolation mode and treat it as a s...
PHP array indexing: $array[$index] vs $array["$index"] vs $array["{$index}"] What is the difference, if any, between these methods of indexing into a PHP array: $array[$index] $array["$index"] $array["{$index}"] I'm interested in both the performance and functional differences. Update: (In response to @Jeremy) I'm not ...
TITLE: PHP array indexing: $array[$index] vs $array["$index"] vs $array["{$index}"] QUESTION: What is the difference, if any, between these methods of indexing into a PHP array: $array[$index] $array["$index"] $array["{$index}"] I'm interested in both the performance and functional differences. Update: (In response to...
[ "php", "syntax" ]
34
34
87,726
7
0
2008-08-09T05:01:38.867000
2008-08-09T05:55:24.187000
6,633
6,694
Making code work with register_globals turned off
I have inherited some legacy PHP code what was written back when it was standard practice to use register_globals (As of PHP 4.2.0, this directive defaults to off, released 22. Apr 2002). We know now that it is bad for security to have it enabled. The problem is how do I find all the places in the code where I need to ...
If you set error reporting to E_ALL, it warns in the error log about undefined variables complete with filename and line number (assuming you are logging to a file). However, it will warn only if when it comes across an undefined variable, so I think you will have to test each code path. Running php from the command li...
Making code work with register_globals turned off I have inherited some legacy PHP code what was written back when it was standard practice to use register_globals (As of PHP 4.2.0, this directive defaults to off, released 22. Apr 2002). We know now that it is bad for security to have it enabled. The problem is how do ...
TITLE: Making code work with register_globals turned off QUESTION: I have inherited some legacy PHP code what was written back when it was standard practice to use register_globals (As of PHP 4.2.0, this directive defaults to off, released 22. Apr 2002). We know now that it is bad for security to have it enabled. The ...
[ "php", "register-globals" ]
13
6
2,324
4
0
2008-08-09T05:13:55.877000
2008-08-09T08:11:55.487000
6,642
6,645
Preferred way to use favicons?
I was trying to add a favicon to a website earlier and looked for a better way to implement this than to dump a favicon.ico file in the root of the website. I found this nice little guide: How to Add a Favicon. However, the preferred method did not work in IE (7) and the second method is the old fashioned way (which I ...
This is what I always use: The second one is for IE. The first one is for other browsers.
Preferred way to use favicons? I was trying to add a favicon to a website earlier and looked for a better way to implement this than to dump a favicon.ico file in the root of the website. I found this nice little guide: How to Add a Favicon. However, the preferred method did not work in IE (7) and the second method is ...
TITLE: Preferred way to use favicons? QUESTION: I was trying to add a favicon to a website earlier and looked for a better way to implement this than to dump a favicon.ico file in the root of the website. I found this nice little guide: How to Add a Favicon. However, the preferred method did not work in IE (7) and the...
[ "browser", "compatibility" ]
9
15
4,341
6
0
2008-08-09T05:41:40.830000
2008-08-09T05:48:15.433000
6,658
6,671
JUnit vs TestNG
At work we are currently still using JUnit 3 to run our tests. We have been considering switching over to JUnit 4 for new tests being written but I have been keeping an eye on TestNG for a while now. What experiences have you all had with either JUnit 4 or TestNG, and which seems to work better for very large numbers o...
I've used both, but I have to agree with Justin Standard that you shouldn't really consider rewriting your existing tests to any new format. Regardless of the decision, it is pretty trivial to run both. TestNG strives to be much more configurable than JUnit, but in the end they both work equally well. TestNG has a neat...
JUnit vs TestNG At work we are currently still using JUnit 3 to run our tests. We have been considering switching over to JUnit 4 for new tests being written but I have been keeping an eye on TestNG for a while now. What experiences have you all had with either JUnit 4 or TestNG, and which seems to work better for very...
TITLE: JUnit vs TestNG QUESTION: At work we are currently still using JUnit 3 to run our tests. We have been considering switching over to JUnit 4 for new tests being written but I have been keeping an eye on TestNG for a while now. What experiences have you all had with either JUnit 4 or TestNG, and which seems to wo...
[ "java", "testing", "junit", "testng" ]
126
67
40,956
12
0
2008-08-09T06:31:25.283000
2008-08-09T07:00:34.087000
6,661
6,662
Reference that lists available JavaScript events?
I'm aware of things like onchange, onmousedown and onmouseup but is there a good reference somewhere that lists all of them complete with possibly a list of the elements that they cover?
W3Schools seems to have a good Javascript events reference: HTML DOM Events
Reference that lists available JavaScript events? I'm aware of things like onchange, onmousedown and onmouseup but is there a good reference somewhere that lists all of them complete with possibly a list of the elements that they cover?
TITLE: Reference that lists available JavaScript events? QUESTION: I'm aware of things like onchange, onmousedown and onmouseup but is there a good reference somewhere that lists all of them complete with possibly a list of the elements that they cover? ANSWER: W3Schools seems to have a good Javascript events referen...
[ "javascript", "browser", "client-side" ]
24
11
2,911
5
0
2008-08-09T06:40:52.987000
2008-08-09T06:42:20.003000
6,666
7,005
Web Services -- WCF vs. ASMX ("Standard")
I am working on a new project. Is there any benefit with going with a WCF web service over a regular old fashion web service? Visual Studio offers templates for both. What are the differences? Pros and cons?
What is a "regular old fashioned web service?" An ASMX service, or are you using WSE as well? ASMX services are not naturally interoperable, don't support WS-* specs, and ASMX is a technology that is aging very quickly. WSE (Web Service Enhancements) services DO add support for WS-* and can be made to be interoperable,...
Web Services -- WCF vs. ASMX ("Standard") I am working on a new project. Is there any benefit with going with a WCF web service over a regular old fashion web service? Visual Studio offers templates for both. What are the differences? Pros and cons?
TITLE: Web Services -- WCF vs. ASMX ("Standard") QUESTION: I am working on a new project. Is there any benefit with going with a WCF web service over a regular old fashion web service? Visual Studio offers templates for both. What are the differences? Pros and cons? ANSWER: What is a "regular old fashioned web servic...
[ ".net", "wcf", "web-services", "visual-studio", "asmx" ]
34
33
11,870
7
0
2008-08-09T06:50:22.703000
2008-08-10T02:28:42.683000
6,681
6,704
ASP.NET Web Service Results, Proxy Classes and Type Conversion
I'm still new to the ASP.NET world, so I could be way off base here, but so far this is to the best of my (limited) knowledge! Let's say I have a standard business object "Contact" in the Business namespace. I write a Web Service to retrieve a Contact's info from a database and return it. I then write a client applicat...
You are on the right track. To get the data from the proxy object back into one of your own objects, you have to do left-hand-right-hand code. i.e. copy property values. I'll bet you that there is already a generic method out there that uses reflection. Some people will use something other than a web service (.net remo...
ASP.NET Web Service Results, Proxy Classes and Type Conversion I'm still new to the ASP.NET world, so I could be way off base here, but so far this is to the best of my (limited) knowledge! Let's say I have a standard business object "Contact" in the Business namespace. I write a Web Service to retrieve a Contact's inf...
TITLE: ASP.NET Web Service Results, Proxy Classes and Type Conversion QUESTION: I'm still new to the ASP.NET world, so I could be way off base here, but so far this is to the best of my (limited) knowledge! Let's say I have a standard business object "Contact" in the Business namespace. I write a Web Service to retrie...
[ "c#", "asp.net", "web-services" ]
12
5
4,986
3
0
2008-08-09T07:34:01.523000
2008-08-09T08:58:24.707000
6,703
6,748
When is OOP better suited for?
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better, or not all problems should be modeled as objects. From your personal programming adventures, when do you think a problem is better solved by OOP?
There is no hard and fast rule. A problem is better solved with OOP when you are better at solving problems and thinking in an OO mentality. Object Orientation is just another tool which has come along through trying to make computing a better tool for solving problems. However, it can allow for better code reuse, and ...
When is OOP better suited for? Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better, or not all problems should be modeled as objects. From your personal programming adventures, when do you think a problem is better solved by OOP?
TITLE: When is OOP better suited for? QUESTION: Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better, or not all problems should be modeled as objects. From your personal programming adventures, when do you think a problem is better solved by OOP? ANSWER: ...
[ "oop" ]
30
31
18,170
16
0
2008-08-09T08:51:27.107000
2008-08-09T12:44:59.070000
6,719
6,720
Master Pages for large web sites
I've just been learning about master pages in ASP.NET 2.0. They sound great, but how well do they work in practice? Does anybody have experience of using them for a large web site?
I'm pretty sure I've only used master pages in the context of ASP.NET MVC so I'm not sure if it differs from web forms but in my experience they are not only excellent but I couldn't imagine not using them. Master pages are code inheritance to web pages.
Master Pages for large web sites I've just been learning about master pages in ASP.NET 2.0. They sound great, but how well do they work in practice? Does anybody have experience of using them for a large web site?
TITLE: Master Pages for large web sites QUESTION: I've just been learning about master pages in ASP.NET 2.0. They sound great, but how well do they work in practice? Does anybody have experience of using them for a large web site? ANSWER: I'm pretty sure I've only used master pages in the context of ASP.NET MVC so I'...
[ "asp.net", ".net", "master-pages", "asp.net-2.0" ]
5
6
1,322
6
0
2008-08-09T09:51:37.533000
2008-08-09T09:55:02.660000
6,729
6,738
Icons: How does a developer with no design skill make his/her application icons look pretty?
I probably spend far too much time trying to make my visual interfaces look good, and while I'm pretty adept at finding the right match between usability and style one area I am hopeless at is making nice looking icons. How do you people overcome this (I'm sure common) problem? I'm thinking of things like images on but...
Good icons are hard to design. I have tried to design my own, and have used in-house graphics designers as well. However, building a good icon set takes a lot of work, even for the graphic designer. I believe your best solution is to buy/find a set of icons for use in your projects. The silk icon set is a good, free se...
Icons: How does a developer with no design skill make his/her application icons look pretty? I probably spend far too much time trying to make my visual interfaces look good, and while I'm pretty adept at finding the right match between usability and style one area I am hopeless at is making nice looking icons. How do ...
TITLE: Icons: How does a developer with no design skill make his/her application icons look pretty? QUESTION: I probably spend far too much time trying to make my visual interfaces look good, and while I'm pretty adept at finding the right match between usability and style one area I am hopeless at is making nice look...
[ "user-interface", "icons" ]
60
47
5,933
19
0
2008-08-09T11:18:58.527000
2008-08-09T12:04:18.780000
6,732
6,766
Why doesn't my favicon display for my web site?
I have a website that I've just uploaded onto the Internet. When I browse to the site using Firefox 3.0.1 on Ubuntu I don't see the favicon; Firefox 3.0.1 on WinXP does display it. Why isn't the favicon displaying under Ubuntu? It's a favicon.ico file in the root directory, not referenced in the meta tags; would it wor...
Previously, there was no favicon. The browser cached the lack of favicon. Clear the Firefox cache, and all is well.
Why doesn't my favicon display for my web site? I have a website that I've just uploaded onto the Internet. When I browse to the site using Firefox 3.0.1 on Ubuntu I don't see the favicon; Firefox 3.0.1 on WinXP does display it. Why isn't the favicon displaying under Ubuntu? It's a favicon.ico file in the root director...
TITLE: Why doesn't my favicon display for my web site? QUESTION: I have a website that I've just uploaded onto the Internet. When I browse to the site using Firefox 3.0.1 on Ubuntu I don't see the favicon; Firefox 3.0.1 on WinXP does display it. Why isn't the favicon displaying under Ubuntu? It's a favicon.ico file in...
[ "firefox", "ubuntu", "favicon" ]
1
8
3,889
2
0
2008-08-09T11:30:09.520000
2008-08-09T13:24:01.067000
6,765
6,902
Java + SQL Server - a viable solution?
I'm going to start a new project - rewriting an existing system (PHP + SQL Server) from scratch because of some very serious limitations by design. We have some quite good knowledge of SQL Server (currently we're using SQL Server 2000 in existing system) and we would like to employ its newer version (2008 I guess) in o...
I've worked on a project using MSQL Server in conjunction with a Java Stack. It works very well and as long, since JDBC shouldn't really care about your database. We used ehcache together with Hibernate and had problems with the MS JDBC Driver, so we switched to jtds and it works really good. It's quite a while ago, so...
Java + SQL Server - a viable solution? I'm going to start a new project - rewriting an existing system (PHP + SQL Server) from scratch because of some very serious limitations by design. We have some quite good knowledge of SQL Server (currently we're using SQL Server 2000 in existing system) and we would like to emplo...
TITLE: Java + SQL Server - a viable solution? QUESTION: I'm going to start a new project - rewriting an existing system (PHP + SQL Server) from scratch because of some very serious limitations by design. We have some quite good knowledge of SQL Server (currently we're using SQL Server 2000 in existing system) and we w...
[ "java", "sql-server" ]
12
8
3,031
6
0
2008-08-09T13:23:40.617000
2008-08-09T20:18:15.240000
6,778
26,040
How to make a Flash movie with a transparent background
This page from Adobe says to add a "wmode" parameter and set its value to "transparent": http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_1420 This works flawlessly in IE. The background renders correctly in Firefox and Safari, however as soon as you use the browser's scroll bar then mouse over the Flash co...
You know you can set the background color when you're embedding? The following attributes are optional when defining the object and/or embed tags. For object, all attributes are defined in param tags unless otherwise specified: bgcolor - [ hexadecimal RGB value] in the format #RRGGBB. Specifies the background color of ...
How to make a Flash movie with a transparent background This page from Adobe says to add a "wmode" parameter and set its value to "transparent": http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_1420 This works flawlessly in IE. The background renders correctly in Firefox and Safari, however as soon as you u...
TITLE: How to make a Flash movie with a transparent background QUESTION: This page from Adobe says to add a "wmode" parameter and set its value to "transparent": http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_1420 This works flawlessly in IE. The background renders correctly in Firefox and Safari, howeve...
[ "flash", "firefox", "safari" ]
4
1
4,181
5
0
2008-08-09T13:54:29.837000
2008-08-25T13:38:11.063000
6,785
6,824
Is String.Format as efficient as StringBuilder
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new StringBuilder(); string cat = "cat"; sb.Append("the ").Append(cat).(" in the hat"); string s = sb.ToString(); would that be as efficient or any more efficient as having: string cat = "cat"; string s = String.Format("The {0} in the hat", cat); I...
NOTE: This answer was written when.NET 2.0 was the current version. This may no longer apply to later versions. String.Format uses a StringBuilder internally: public static string Format(IFormatProvider provider, string format, params object[] args) { if ((format == null) || (args == null)) { throw new ArgumentNullExce...
Is String.Format as efficient as StringBuilder Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new StringBuilder(); string cat = "cat"; sb.Append("the ").Append(cat).(" in the hat"); string s = sb.ToString(); would that be as efficient or any more efficient as having: string cat = "cat"; string ...
TITLE: Is String.Format as efficient as StringBuilder QUESTION: Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new StringBuilder(); string cat = "cat"; sb.Append("the ").Append(cat).(" in the hat"); string s = sb.ToString(); would that be as efficient or any more efficient as having: string ca...
[ "c#", "vb.net", "performance", "stringbuilder", "string.format" ]
165
148
74,490
12
0
2008-08-09T14:24:05.703000
2008-08-09T15:57:15.970000
6,812
6,821
Mapping my custom keys in Debian
I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search", "Web/Home" etc. It would be nice to be able to bind these keys so they execute arbitrary programs. Does anybody know how to do this in Debian Etch?
I can't say for certain because I'm not using Debian but if you're using Gnome the easiest way is to run gnome-keybinding-properties (System > Preferences > Keyboard Shortcuts) Instead of typing a shortcut such as Ctrl + M, hit the button on your keyboard. If you would prefer to do this via command line or with a diffe...
Mapping my custom keys in Debian I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search", "Web/Home" etc. It would be nice to be able to bind these keys so they execute arbitrary programs. Does anybody know how to do this in Debian Etch?
TITLE: Mapping my custom keys in Debian QUESTION: I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search", "Web/Home" etc. It would be nice to be able to bind these keys so they execute arbitrary programs. Does anybody know how to do this in Debian Etch? ANSWER: I can't say for cert...
[ "linux", "keyboard", "debian" ]
3
2
6,170
5
0
2008-08-09T15:23:13.620000
2008-08-09T15:52:39.443000
6,816
6,840
Class file name must end with .class exception in Java search
I have a problem using the Java search function in Eclipse on a particular project. When using the Java search on one particular project, I get an error message saying Class file name must end with.class (see stack trace below). This does not seem to be happening on all projects, just one particular one, so perhaps the...
Two more general-purpose mechanisms for fixing some of Eclipse's idiosyncrasies: Close and open the project Delete the project (but not from disk!) and reimport it as an existing project Failing that, bugs.eclipse.org might provide the answer. If the workspace is caching something broken, you may be able to delete it b...
Class file name must end with .class exception in Java search I have a problem using the Java search function in Eclipse on a particular project. When using the Java search on one particular project, I get an error message saying Class file name must end with.class (see stack trace below). This does not seem to be happ...
TITLE: Class file name must end with .class exception in Java search QUESTION: I have a problem using the Java search function in Eclipse on a particular project. When using the Java search on one particular project, I get an error message saying Class file name must end with.class (see stack trace below). This does n...
[ "java", "eclipse", "search" ]
67
62
26,455
6
0
2008-08-09T15:40:30.357000
2008-08-09T16:31:32.623000
6,817
6,929
Scaling multithreaded applications on multicored machines
I'm working on a project were we need more performance. Over time we've continued to evolve the design to work more in parallel(both threaded and distributed). Then latest step has been to move part of it onto a new machine with 16 cores. I'm finding that we need to rethink how we do things to scale to that many cores ...
A couple of other books that are going to be helpful are: Synchronization Algorithms and Concurrent Programming Patterns for Parallel Programming Communicating Sequential Processes by C. A. R. Hoare (a classic, free PDF at that link) Also, consider relying less on sharing state between concurrent processes. You'll scal...
Scaling multithreaded applications on multicored machines I'm working on a project were we need more performance. Over time we've continued to evolve the design to work more in parallel(both threaded and distributed). Then latest step has been to move part of it onto a new machine with 16 cores. I'm finding that we nee...
TITLE: Scaling multithreaded applications on multicored machines QUESTION: I'm working on a project were we need more performance. Over time we've continued to evolve the design to work more in parallel(both threaded and distributed). Then latest step has been to move part of it onto a new machine with 16 cores. I'm f...
[ "performance", "multithreading", "scalability", "malloc" ]
6
6
1,579
8
0
2008-08-09T15:42:17.840000
2008-08-09T22:13:12.233000
6,847
6,862
Defensive programming
When writing code do you consciously program defensively to ensure high program quality and to avoid the possibility of your code being exploited maliciously, e.g. through buffer overflow exploits or code injection? What's the "minimum" level of quality you'll always apply to your code?
In my line of work, our code has to be top quality. So, we focus on two main things: Testing Code reviews Those bring home the money.
Defensive programming When writing code do you consciously program defensively to ensure high program quality and to avoid the possibility of your code being exploited maliciously, e.g. through buffer overflow exploits or code injection? What's the "minimum" level of quality you'll always apply to your code?
TITLE: Defensive programming QUESTION: When writing code do you consciously program defensively to ensure high program quality and to avoid the possibility of your code being exploited maliciously, e.g. through buffer overflow exploits or code injection? What's the "minimum" level of quality you'll always apply to you...
[ "security", "defensive-programming" ]
11
12
2,777
14
0
2008-08-09T17:02:56.663000
2008-08-09T18:00:26.907000
6,859
6,863
Developing addins for World of Warcraft - Getting started?
As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn something new. Does anyone have any advice on how to go about starting out? Is ther...
This article explains how to start pretty well. Your first bookmark is possibly the US Interface Forum, especially the Stickies for that: http://us.battle.net/wow/en/forum/1011693/ Then, grab some simple addons to learn how XML and LUA interacts. The WoWWiki HOWTO List is a good point here as well. One important thing ...
Developing addins for World of Warcraft - Getting started? As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn something new. Does anyo...
TITLE: Developing addins for World of Warcraft - Getting started? QUESTION: As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn someth...
[ "plugins", "lua", "add-on", "world-of-warcraft" ]
18
28
2,430
4
0
2008-08-09T17:51:09.313000
2008-08-09T18:01:57.497000
6,890
7,101
How to wait for thread complete before continuing?
I have some code for starting a thread on the.NET CF 2.0: ThreadStart tStart = new ThreadStart(MyMethod); Thread t = new Thread(tStart); t.Start(); If I call this inside a loop the items completely out of order. How do introduce a wait after t.Start(), so that the work on the thread completes before the code continues?...
How much order do you need to impose on the threads? If you just need all of the work started in the loop to finish before the code continues, but you don't care about the order the work within the loop finishes, then calling Join is the answer. To add more detail to Kevin Kenny's answer, you should call Join outside t...
How to wait for thread complete before continuing? I have some code for starting a thread on the.NET CF 2.0: ThreadStart tStart = new ThreadStart(MyMethod); Thread t = new Thread(tStart); t.Start(); If I call this inside a loop the items completely out of order. How do introduce a wait after t.Start(), so that the work...
TITLE: How to wait for thread complete before continuing? QUESTION: I have some code for starting a thread on the.NET CF 2.0: ThreadStart tStart = new ThreadStart(MyMethod); Thread t = new Thread(tStart); t.Start(); If I call this inside a loop the items completely out of order. How do introduce a wait after t.Start()...
[ "c#", "multithreading", "compact-framework" ]
13
16
19,738
3
0
2008-08-09T20:00:37.647000
2008-08-10T08:37:28.383000
6,891
6,916
Performance Considerations for throwing Exceptions
I have come across the following type of code many a times, and I wonder if this is a good practice (from Performance perspective) or not: try {... // some code } catch (Exception ex) {... // Do something throw new CustomException(ex); } Basically, what the coder is doing is that they are encompassing the exception in ...
@Brad Tutterow The exception is not being lost in the first case, it is being passed in to the constructor. I will agree with you on the rest though, the second approach is a very bad idea because of the loss of stack trace. When I worked with.NET, I ran into many cases where other programmers did just that, and it fru...
Performance Considerations for throwing Exceptions I have come across the following type of code many a times, and I wonder if this is a good practice (from Performance perspective) or not: try {... // some code } catch (Exception ex) {... // Do something throw new CustomException(ex); } Basically, what the coder is do...
TITLE: Performance Considerations for throwing Exceptions QUESTION: I have come across the following type of code many a times, and I wonder if this is a good practice (from Performance perspective) or not: try {... // some code } catch (Exception ex) {... // Do something throw new CustomException(ex); } Basically, wh...
[ ".net", "exception", "optimization", "performance" ]
9
11
2,163
8
0
2008-08-09T20:01:09.050000
2008-08-09T21:17:35.057000
6,899
6,980
How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field?
To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck 2 Larry LocationID VehicleID City 1 1 New York 2 1 Seattle 3 1 Vancouver 4 2 Los Angeles 5 2 Houston I want to write a query to return the following results: VehicleID Name Locations 1 Chuck New York, Seattle, Vancouver 2 Larry Los Angeles...
If you're using SQL Server 2005, you could use the FOR XML PATH command. SELECT [VehicleID], [Name], (STUFF((SELECT CAST(', ' + [City] AS VARCHAR(MAX)) FROM [Location] WHERE (VehicleID = Vehicle.VehicleID) FOR XML PATH ('')), 1, 2, '')) AS Locations FROM [Vehicle] It's a lot easier than using a cursor, and seems to wor...
How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field? To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck 2 Larry LocationID VehicleID City 1 1 New York 2 1 Seattle 3 1 Vancouver 4 2 Los Angeles 5 2 Houston I want to write a query to retu...
TITLE: How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field? QUESTION: To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck 2 Larry LocationID VehicleID City 1 1 New York 2 1 Seattle 3 1 Vancouver 4 2 Los Angeles 5 2 Houston I want to wri...
[ "sql", "sql-server", "string-concatenation" ]
214
282
173,541
13
0
2008-08-09T20:11:18.467000
2008-08-10T01:05:00.980000
6,904
2,401,184
Getting DirectoryNotFoundException when trying to Connect to Device with CoreCon API
I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch device emulators. When I call device.Connect(), I inexplicably get a DirectoryNotFoundException. I get it if I try it in PowerShell or in C# Console Application. Here's the code I'm using: static void Main(string[] args) { DatastoreManag...
It can be found at:\Program files\Common Files\Microsoft Shared\CoreCon\1.0\Bin. This is the path where you can get this dll, so add this dll to your project.
Getting DirectoryNotFoundException when trying to Connect to Device with CoreCon API I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch device emulators. When I call device.Connect(), I inexplicably get a DirectoryNotFoundException. I get it if I try it in PowerShell or in C# Console App...
TITLE: Getting DirectoryNotFoundException when trying to Connect to Device with CoreCon API QUESTION: I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch device emulators. When I call device.Connect(), I inexplicably get a DirectoryNotFoundException. I get it if I try it in PowerShell or...
[ "c#", "visual-studio", "windows-mobile", "compact-framework", "corecon" ]
4
1
1,898
4
0
2008-08-09T20:22:19.490000
2010-03-08T12:20:52.483000
6,913
6,981
How do I best share an embeddable form in VB6?
Is there a good way to create a form in VB6 that can easily be embedded inside other forms? On a few occasions recently, I've wanted to design and code a Form object that I could plug into several other "parent" forms. My goal is to create a centralized piece of code for managing several UI components in a particular w...
Take a look at VB6 UserControls; I think they are exactly what you need. You can create a UserControl within your project, add controls and code to that control, and then insert it onto a form just like standard VB6 controls. I've used UserControls to share UI layouts on many occasions and it works great.
How do I best share an embeddable form in VB6? Is there a good way to create a form in VB6 that can easily be embedded inside other forms? On a few occasions recently, I've wanted to design and code a Form object that I could plug into several other "parent" forms. My goal is to create a centralized piece of code for m...
TITLE: How do I best share an embeddable form in VB6? QUESTION: Is there a good way to create a form in VB6 that can easily be embedded inside other forms? On a few occasions recently, I've wanted to design and code a Form object that I could plug into several other "parent" forms. My goal is to create a centralized p...
[ "forms", "vb6", "code-reuse" ]
6
9
629
1
0
2008-08-09T21:05:40.027000
2008-08-10T01:05:59.560000
6,915
6,955
How do you lazily construct a singleton object thread-safely?
Is there a way to implement a singleton object in C++ that is: Lazily constructed in a thread-safe manner (two threads might simultaneously be the first user of the singleton - it should still only be constructed once). Doesn't rely on static variables being constructed beforehand (so the singleton object is itself saf...
Basically, you're asking for synchronized creation of a singleton, without using any synchronization (previously-constructed variables). In general, no, this is not possible. You need something available for synchronization. As for your other question, yes, static variables which can be statically initialized (i.e. no ...
How do you lazily construct a singleton object thread-safely? Is there a way to implement a singleton object in C++ that is: Lazily constructed in a thread-safe manner (two threads might simultaneously be the first user of the singleton - it should still only be constructed once). Doesn't rely on static variables being...
TITLE: How do you lazily construct a singleton object thread-safely? QUESTION: Is there a way to implement a singleton object in C++ that is: Lazily constructed in a thread-safe manner (two threads might simultaneously be the first user of the singleton - it should still only be constructed once). Doesn't rely on stat...
[ "c++", "multithreading", "thread-safety", "singleton", "lazy-initialization" ]
38
14
28,110
9
0
2008-08-09T21:16:29.193000
2008-08-09T23:52:40.253000
6,926
7,039
Beginning Shader Development
I want to get started doing some game development using Microsoft's XNA. Part of that is Shader development, but I have no idea how to get started. I know that nVidia's FX Composer is a great tool to develop shaders, but I did not find much useful and updated content on how to actually get started. What tutorials would...
Development of shaders in XNA (which obviously uses DirectX) requires knowledge of HLSL or shader assembly. I'd recommend getting familiar with the former before diving into the latter. Before writing any shaders, it's a good idea to get solid understanding of the shader pipeline, and attempt to get your mind around wh...
Beginning Shader Development I want to get started doing some game development using Microsoft's XNA. Part of that is Shader development, but I have no idea how to get started. I know that nVidia's FX Composer is a great tool to develop shaders, but I did not find much useful and updated content on how to actually get ...
TITLE: Beginning Shader Development QUESTION: I want to get started doing some game development using Microsoft's XNA. Part of that is Shader development, but I have no idea how to get started. I know that nVidia's FX Composer is a great tool to develop shaders, but I did not find much useful and updated content on ho...
[ "shader" ]
19
31
5,893
9
0
2008-08-09T21:57:07.427000
2008-08-10T04:21:32.333000
6,932
3,011,043
Transcoding audio and video
What is the best way to transcode audio and video to show on the web? I need to do it programmatically. I'd like to do something like YouTube or Google Video where users can upload whatever format they want, and I encode it to flv, mp3, and/or mp4. I could do it on our server, but I would rather use an EC2 instance or ...
I strongly recommend ffmpeg. On Windows, I have found this site to host good binaries.
Transcoding audio and video What is the best way to transcode audio and video to show on the web? I need to do it programmatically. I'd like to do something like YouTube or Google Video where users can upload whatever format they want, and I encode it to flv, mp3, and/or mp4. I could do it on our server, but I would ra...
TITLE: Transcoding audio and video QUESTION: What is the best way to transcode audio and video to show on the web? I need to do it programmatically. I'd like to do something like YouTube or Google Video where users can upload whatever format they want, and I encode it to flv, mp3, and/or mp4. I could do it on our serv...
[ "audio", "video", "mp3", "flv", "mp4" ]
4
3
2,775
8
0
2008-08-09T22:19:59.580000
2010-06-10T01:13:18.793000
6,937
6,940
Visual Studio and dual/multiple monitors: how do I get optimized use out of my monitors?
Ultramon is a great program for dual monitors (stretching screen across monitors), but I was wondering if there is any way do to something in Visual Studio like have one tab of code open on one monitor and a second tab of code open on the second monitor with only one instance of Visual Studio running? Or are there any ...
Personally, I have my windows set up so that one my main monitor, I have the main visual studio monitor, so therefore my code window, maximized, with only the toolbox docked, on the left. This means the code window takes up as much space as possible, while keeping the left hand edge of the code close to the middle of t...
Visual Studio and dual/multiple monitors: how do I get optimized use out of my monitors? Ultramon is a great program for dual monitors (stretching screen across monitors), but I was wondering if there is any way do to something in Visual Studio like have one tab of code open on one monitor and a second tab of code open...
TITLE: Visual Studio and dual/multiple monitors: how do I get optimized use out of my monitors? QUESTION: Ultramon is a great program for dual monitors (stretching screen across monitors), but I was wondering if there is any way do to something in Visual Studio like have one tab of code open on one monitor and a secon...
[ "visual-studio", "monitor", "multiple-monitors" ]
48
60
92,053
11
0
2008-08-09T22:55:26.857000
2008-08-09T23:00:20.670000
6,957
7,458
Has anybody used Google Performance Tools?
Looking for feedback on: http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools
There's a pretty good post that I read a while back that outlines some testing and analysis of GPT in a variety of scenarios
Has anybody used Google Performance Tools? Looking for feedback on: http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools
TITLE: Has anybody used Google Performance Tools? QUESTION: Looking for feedback on: http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools ANSWER: There's a pretty good post that I read a while back that outlines some testing and analysis of GPT in a variety of scenarios
[ "performance", "multithreading", "malloc", "google-perftools" ]
5
4
1,732
2
0
2008-08-10T00:01:18.770000
2008-08-11T00:53:54.403000
6,973
6,987
Invalid Resource File
When attempting to compile my C# project, I get the following error: 'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file. Having gone through many Google searches, I have determined that this is usually caused by a 256x256 image inside ...
I don't know if this will help, but from this forum: Add an.ico file to the application section of the properties page, and recieved the error thats been described, when I checked the Icon file with an icon editor, it turn out that the file had more than one version of the image ie (16 x 16, 24 x 24, 32 x 32, 48 x 48 v...
Invalid Resource File When attempting to compile my C# project, I get the following error: 'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file. Having gone through many Google searches, I have determined that this is usually caused by a...
TITLE: Invalid Resource File QUESTION: When attempting to compile my C# project, I get the following error: 'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file. Having gone through many Google searches, I have determined that this is u...
[ "c#", "visual-studio", "resources" ]
12
6
14,241
5
0
2008-08-10T00:50:16.283000
2008-08-10T01:32:19.740000
7,015
7,020
Multicore Text File Parsing
I have a quad core machine and would like to write some code to parse a text file that takes advantage of all four cores. The text file basically contains one record per line. Multithreading isn't my forte so I'm wondering if anyone could give me some patterns that I might be able to use to parse the file in an optimal...
I'd go with your original idea. If you are concerned that the queue might get too large implement a buffer-zone for it (i.e. If is gets above 100 lines the stop reading the file and if it gets below 20 then start reading again. You'd need to do some testing to find the optimal barriers). Make it so that any of the thre...
Multicore Text File Parsing I have a quad core machine and would like to write some code to parse a text file that takes advantage of all four cores. The text file basically contains one record per line. Multithreading isn't my forte so I'm wondering if anyone could give me some patterns that I might be able to use to ...
TITLE: Multicore Text File Parsing QUESTION: I have a quad core machine and would like to write some code to parse a text file that takes advantage of all four cores. The text file basically contains one record per line. Multithreading isn't my forte so I'm wondering if anyone could give me some patterns that I might ...
[ "c#", "multithreading" ]
10
9
2,995
7
0
2008-08-10T03:07:39.157000
2008-08-10T03:19:36.623000
7,031
7,087
Login Script with hidden buttons
I have been using PHP and JavaScript for building my dad's website. He wants to incorporate a login system into his website, and I have the design for the system using PHP. My problem is how do I show buttons if the person is logged in?­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­...
Regarding security, you cannot trust what comes from the client: The visitor can see all your code (HTML and Javascript, not PHP) and try stuff The visitor may not even use a browser; it's trivially easy to send a request with a script This means hiding the buttons is good User Interface design (because you can't use t...
Login Script with hidden buttons I have been using PHP and JavaScript for building my dad's website. He wants to incorporate a login system into his website, and I have the design for the system using PHP. My problem is how do I show buttons if the person is logged in?­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­...
TITLE: Login Script with hidden buttons QUESTION: I have been using PHP and JavaScript for building my dad's website. He wants to incorporate a login system into his website, and I have the design for the system using PHP. My problem is how do I show buttons if the person is logged in?­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­...
[ "javascript", "php" ]
24
20
6,009
6
0
2008-08-10T04:00:06.773000
2008-08-10T07:59:22.890000
7,034
2,366,237
Graph visualization library in JavaScript
I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideally, I'd like to be able to hook it in with jQuery so that us...
I've just put together what you may be looking for: http://www.graphdracula.net It's JavaScript with directed graph layouting, SVG and you can even drag the nodes around. Still needs some tweaking, but is totally usable. You create nodes and edges easily with JavaScript code like this: var g = new Graph(); g.addEdge("s...
Graph visualization library in JavaScript I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideally, I'd like to be...
TITLE: Graph visualization library in JavaScript QUESTION: I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideal...
[ "javascript", "jquery", "data-structures", "graph-layout" ]
523
1,004
502,741
4
0
2008-08-10T04:07:52.423000
2010-03-02T19:48:15.093000
7,035
7,068
How to show a GUI message box from a bash script in linux?
I'm writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output. So far the only input required is a password for sudo - and gksudo handles that fine. But I haven't found an easy way to show a message box yet. I...
I believe Zenity will do what you want. It's specifically designed for displaying GTK dialogs from the command line, and it's available as an Ubuntu package.
How to show a GUI message box from a bash script in linux? I'm writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output. So far the only input required is a password for sudo - and gksudo handles that fine. B...
TITLE: How to show a GUI message box from a bash script in linux? QUESTION: I'm writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output. So far the only input required is a password for sudo - and gksudo ha...
[ "linux", "bash", "scripting", "ubuntu", "gtk" ]
184
168
224,245
14
0
2008-08-10T04:07:55.043000
2008-08-10T06:40:47.603000
7,074
7,077
What is the difference between String and string in C#?
What are the differences between these two, and which one should I use? string s = "Hello world!"; String s = "Hello world!";
string is an alias in C# for System.String. So technically, there is no difference. It's like int vs. System.Int32. As far as guidelines, it's generally recommended to use string any time you're referring to an object. e.g. string place = "world"; Likewise, I think it's generally recommended to use String if you need t...
What is the difference between String and string in C#? What are the differences between these two, and which one should I use? string s = "Hello world!"; String s = "Hello world!";
TITLE: What is the difference between String and string in C#? QUESTION: What are the differences between these two, and which one should I use? string s = "Hello world!"; String s = "Hello world!"; ANSWER: string is an alias in C# for System.String. So technically, there is no difference. It's like int vs. System.In...
[ "c#", ".net", "string", "types", "alias" ]
7,529
7,062
1,308,690
68
0
2008-08-10T07:18:02.320000
2008-08-10T07:22:02.030000
7,084
13,858
When should I use type abstraction in embedded systems
I've worked on a number of different embedded systems. They have all used typedef s (or #defines ) for types such as UINT32. This is a good technique as it drives home the size of the type to the programmer and makes you more conscious of chances for overflow etc. But on some systems you know that the compiler and proc...
I use type abstraction very rarely. Here are my arguments, sorted in increasing order of subjectivity: Local variables are different from struct members and arrays in the sense that you want them to fit in a register. On a 32b/64b target, a local int16_t can make code slower compared to a local int since the compiler w...
When should I use type abstraction in embedded systems I've worked on a number of different embedded systems. They have all used typedef s (or #defines ) for types such as UINT32. This is a good technique as it drives home the size of the type to the programmer and makes you more conscious of chances for overflow etc. ...
TITLE: When should I use type abstraction in embedded systems QUESTION: I've worked on a number of different embedded systems. They have all used typedef s (or #defines ) for types such as UINT32. This is a good technique as it drives home the size of the type to the programmer and makes you more conscious of chances ...
[ "c", "embedded" ]
22
18
2,634
9
0
2008-08-10T07:50:54.250000
2008-08-17T19:15:31.027000
7,089
7,098
Creating rounded corners using CSS
How can I create rounded corners using CSS?
Since CSS3 was introduced, the best way to add rounded corners using CSS is by using the border-radius property. You can read the spec on the property, or get some useful implementation information on MDN: If you are using a browser that doesn't implement border-radius (Chrome pre-v4, Firefox pre-v4, IE8, Opera pre-v10...
Creating rounded corners using CSS How can I create rounded corners using CSS?
TITLE: Creating rounded corners using CSS QUESTION: How can I create rounded corners using CSS? ANSWER: Since CSS3 was introduced, the best way to add rounded corners using CSS is by using the border-radius property. You can read the spec on the property, or get some useful implementation information on MDN: If you a...
[ "cross-browser", "rounded-corners", "css" ]
257
105
73,904
21
0
2008-08-10T08:08:21.657000
2008-08-10T08:27:50.540000
7,095
7,105
Is the C# static constructor thread safe?
In other words, is this Singleton implementation thread safe: public class Singleton { private static Singleton instance; private Singleton() { } static Singleton() { instance = new Singleton(); } public static Singleton Instance { get { return instance; } } }
Static constructors are guaranteed to be run only once per application domain, before any instances of a class are created or any static members are accessed. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-constructors The implementation shown is thread safe for the initial...
Is the C# static constructor thread safe? In other words, is this Singleton implementation thread safe: public class Singleton { private static Singleton instance; private Singleton() { } static Singleton() { instance = new Singleton(); } public static Singleton Instance { get { return instance; } } }
TITLE: Is the C# static constructor thread safe? QUESTION: In other words, is this Singleton implementation thread safe: public class Singleton { private static Singleton instance; private Singleton() { } static Singleton() { instance = new Singleton(); } public static Singleton Instance { get { return instance; } ...
[ "c#", "multithreading", "singleton" ]
265
201
70,246
11
0
2008-08-10T08:23:55.573000
2008-08-10T08:46:48.413000
7,118
7,129
Debugging JavaScript in Internet Explorer and Safari
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and Safari. In Firefox, you can use Firebug's logging feature and command Line functions. However, this doesn't help me when I move to other browsers.
For Safari you need to enable the "Develop" menu via Preferences (in Safari 3.1; see the entry in Apple's Safari development FAQ ) or via $ defaults write com.apple.Safari IncludeDebugMenu 1 at the terminal in Mac OS X. Then from the Develop menu choose Show Web Inspector and click on the Console link. Your script can ...
Debugging JavaScript in Internet Explorer and Safari Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and Safari. In Firefox, you can use Firebug's logging feature and command Line functions. However, this doesn't help me when I move to other browsers.
TITLE: Debugging JavaScript in Internet Explorer and Safari QUESTION: Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and Safari. In Firefox, you can use Firebug's logging feature and command Line functions. However, this doesn't help me when I move to other browsers. ANSWER:...
[ "javascript", "internet-explorer", "safari" ]
18
13
7,100
9
0
2008-08-10T09:07:19.853000
2008-08-10T09:24:56.197000
7,174
7,303
How can I improve the edit-compile-test loop when developing a SharePoint workflow?
Recently I had to develop a SharePoint workflow, and I found the experience quite honestly the most painful programming task I've ever had to tackle. One big problem I had was the problems I encountered when I had to step through it in the debugger. There's an article on how to debug a SharePoint workflow here that tel...
The SharePoint team is currently working on MOSS extensions for VS 2008 which will allow this type of functionality. This was available in VS 2005 with MOSS extensions, but has to be run off Windows Server with a full MOSS installation and the correct permissions set.
How can I improve the edit-compile-test loop when developing a SharePoint workflow? Recently I had to develop a SharePoint workflow, and I found the experience quite honestly the most painful programming task I've ever had to tackle. One big problem I had was the problems I encountered when I had to step through it in ...
TITLE: How can I improve the edit-compile-test loop when developing a SharePoint workflow? QUESTION: Recently I had to develop a SharePoint workflow, and I found the experience quite honestly the most painful programming task I've ever had to tackle. One big problem I had was the problems I encountered when I had to s...
[ "sharepoint", "workflow" ]
4
2
1,174
6
0
2008-08-10T12:12:09.213000
2008-08-10T19:41:26.890000
7,180
7,188
Animation in .NET
What is a good way to perform animation using.NET? I would prefer not to use Flash if possible, so am looking for suggestions of ways which will work to implement different types of animation on a new site I am producing. The new site is for a magician, so I want to provide animated buttons (Cards turning over, etc.) a...
Silverlight springs to mind as an obvious choice if you want to do animation using.NET on the web. It may not cover all platforms but will work in IE and FireFox and on the Mac.
Animation in .NET What is a good way to perform animation using.NET? I would prefer not to use Flash if possible, so am looking for suggestions of ways which will work to implement different types of animation on a new site I am producing. The new site is for a magician, so I want to provide animated buttons (Cards tur...
TITLE: Animation in .NET QUESTION: What is a good way to perform animation using.NET? I would prefer not to use Flash if possible, so am looking for suggestions of ways which will work to implement different types of animation on a new site I am producing. The new site is for a magician, so I want to provide animated ...
[ ".net", "animation" ]
6
4
1,037
4
0
2008-08-10T12:39:20.830000
2008-08-10T13:01:37.680000
7,190
7,221
Setting up Continuous Integration with SVN
What tools would you recommend for setting up CI for build and deployment of multiple websites built on DotNetNuke using SVN for source control? We are currently looking at configuring Cruise Control to work with NAnt, NUnit, NCover and Trac as a test case. What other combinations would worth investigating? We have ful...
We use CruiseControl with NUnit, NCover, FxCop, SVN and some custom tools we wrote ourselves to produce the reports. In my opinion it has proven (over the last few years) to be an excellent combination. It's frustrating that MS restricts all of its integration tools to VSTS. Its test framework is as good as NUnit, but ...
Setting up Continuous Integration with SVN What tools would you recommend for setting up CI for build and deployment of multiple websites built on DotNetNuke using SVN for source control? We are currently looking at configuring Cruise Control to work with NAnt, NUnit, NCover and Trac as a test case. What other combinat...
TITLE: Setting up Continuous Integration with SVN QUESTION: What tools would you recommend for setting up CI for build and deployment of multiple websites built on DotNetNuke using SVN for source control? We are currently looking at configuring Cruise Control to work with NAnt, NUnit, NCover and Trac as a test case. W...
[ "svn", "continuous-integration" ]
10
3
8,588
6
0
2008-08-10T13:09:13.780000
2008-08-10T15:34:37.620000
7,209
119,880
Alpha blending sprites in Nintendo DS Homebrew
I'm trying to alpha blend sprites and backgrounds with devkitPro (including libnds, libarm, etc). Does anyone know how to do this?
As a generic reference, i once wrote a small blog entry about that issue. Basically, you first have to define which layer is alpha-blended against which other layer(s). Afaik, the source layer(s) must be over destination layer(s) to have some blending displayed. that means the priority of source layers should be numeri...
Alpha blending sprites in Nintendo DS Homebrew I'm trying to alpha blend sprites and backgrounds with devkitPro (including libnds, libarm, etc). Does anyone know how to do this?
TITLE: Alpha blending sprites in Nintendo DS Homebrew QUESTION: I'm trying to alpha blend sprites and backgrounds with devkitPro (including libnds, libarm, etc). Does anyone know how to do this? ANSWER: As a generic reference, i once wrote a small blog entry about that issue. Basically, you first have to define which...
[ "c++", "c", "nintendo-ds" ]
9
6
2,174
3
0
2008-08-10T14:49:10.723000
2008-09-23T08:39:44.120000
7,212
8,886
Is it possible to add behavior to a non-dynamic ActionScript 3 class without inheriting the class?
What I'd like to do is something like the following: FooClass.prototype.method = function():String { return "Something"; } var foo:FooClass = new FooClass(); foo.method(); Which is to say, I'd like to extend a generated class with a single method, not via inheritance but via the prototype. The class is generated from ...
Yes, such a thing is possible. In fact, your example is very close to the solution. Try foo["method"](); instead of foo.method();
Is it possible to add behavior to a non-dynamic ActionScript 3 class without inheriting the class? What I'd like to do is something like the following: FooClass.prototype.method = function():String { return "Something"; } var foo:FooClass = new FooClass(); foo.method(); Which is to say, I'd like to extend a generated ...
TITLE: Is it possible to add behavior to a non-dynamic ActionScript 3 class without inheriting the class? QUESTION: What I'd like to do is something like the following: FooClass.prototype.method = function():String { return "Something"; } var foo:FooClass = new FooClass(); foo.method(); Which is to say, I'd like to e...
[ "apache-flex", "actionscript-3", "extension-methods" ]
5
3
1,363
5
0
2008-08-10T15:05:33.140000
2008-08-12T14:31:44.300000
7,214
7,235
User authentication on Resin webserver
I'm currently tasked with replacing an Apache + Resin Java web server with a Resin-only configuration. Currently in our apache setup, we use.htaccess and a small user database to provide passwording at a directory level. Does anyone know the equivalent setup when using just Resin as the web server?
See " Authentication on Resin " The closest you'll come to.htaccess with apache is configuring for Basic auth using an XmlAuthenticator. You'll need to convert your htpasswd file into the XML format that resin uses. Follow the "Quick Start" section and you'll get what you want.
User authentication on Resin webserver I'm currently tasked with replacing an Apache + Resin Java web server with a Resin-only configuration. Currently in our apache setup, we use.htaccess and a small user database to provide passwording at a directory level. Does anyone know the equivalent setup when using just Resin ...
TITLE: User authentication on Resin webserver QUESTION: I'm currently tasked with replacing an Apache + Resin Java web server with a Resin-only configuration. Currently in our apache setup, we use.htaccess and a small user database to provide passwording at a directory level. Does anyone know the equivalent setup when...
[ "apache", "configuration", "webserver", "resin", "caucho" ]
2
1
1,012
1
0
2008-08-10T15:10:41.820000
2008-08-10T16:41:23.897000
7,224
7,225
Change the width of a scrollbar
Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow.
The width of the scrollbars is controlled by Windows. You can adjust the scrollbar width in Display Properties and it will affect all windows on the terminal.
Change the width of a scrollbar Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow.
TITLE: Change the width of a scrollbar QUESTION: Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow. ANSWER: The width of the scrollbars is controlled by Windows. You can adjust the scrollbar width in Display Properties and it will affect all window...
[ "vb.net", "scrollbar" ]
8
3
17,083
2
0
2008-08-10T15:48:24.083000
2008-08-10T15:48:41.070000
7,231
7,499
Automatically check bounced emails via POP3?
Can anyone recommend software or a.NET library that will check for bounced emails and the reason for the bounce? I get bounced emails into a pop3 account that I can read then. I need it to keep my user database clean from invalid email addresses and want to automate this (mark user as invalid email).
I have done a great deal of work handling bounce emails and there different types. If you want to be absolutely sure that the email your looking at is indeed a bounce of a specific kind I highly recommend getting a good filter. I have worked with Boogie Tools and it has worked very well. It lets you know what kind of b...
Automatically check bounced emails via POP3? Can anyone recommend software or a.NET library that will check for bounced emails and the reason for the bounce? I get bounced emails into a pop3 account that I can read then. I need it to keep my user database clean from invalid email addresses and want to automate this (ma...
TITLE: Automatically check bounced emails via POP3? QUESTION: Can anyone recommend software or a.NET library that will check for bounced emails and the reason for the bounce? I get bounced emails into a pop3 account that I can read then. I need it to keep my user database clean from invalid email addresses and want to...
[ ".net", "email", "pop3", "email-bounces" ]
10
6
5,344
5
0
2008-08-10T16:16:15.370000
2008-08-11T03:38:55.647000
7,237
178,509
Does running a SQL Server 2005 database in compatibility level 80 have a negative impact on performance?
Our software must be able to run on SQL Server 2000 and 2005. To simplify development, we're running our SQL Server 2005 databases in compatibility level 80. However, database performance seems slower on SQL 2005 than on SQL 2000 in some cases (we have not confirmed this using benchmarks yet). Would upgrading the compa...
I think i read somewhere, that the SQL Server 2005 database engine should be about 30% faster than the SQL Server 2000 engine. It might be, that you have to run your database in compatibility mode 90 to get these benefits. But i stumbled on two scenarios, where performance can drop dramatically when using mssql 2005 co...
Does running a SQL Server 2005 database in compatibility level 80 have a negative impact on performance? Our software must be able to run on SQL Server 2000 and 2005. To simplify development, we're running our SQL Server 2005 databases in compatibility level 80. However, database performance seems slower on SQL 2005 th...
TITLE: Does running a SQL Server 2005 database in compatibility level 80 have a negative impact on performance? QUESTION: Our software must be able to run on SQL Server 2000 and 2005. To simplify development, we're running our SQL Server 2005 databases in compatibility level 80. However, database performance seems slo...
[ "sql-server", "database" ]
11
5
5,951
4
0
2008-08-10T16:46:12.640000
2008-10-07T13:46:25.677000
7,244
1,409,873
Anyone know a good workaround for the lack of an enum generic constraint?
What I want to do is something like this: I have enums with combined flagged values. public static class EnumExtension { public static bool IsSet ( this T input, T matchTo ) where T:enum //the constraint I want that doesn't exist in C#3 { return (input & matchTo)!= 0; } } So then I could do: MyEnum tester = MyEnum.Flag...
EDIT: This is now live in version 0.0.0.2 of UnconstrainedMelody. (As requested on my blog post about enum constraints. I've included the basic facts below for the sake of a standalone answer.) The best solution is to wait for me to include it in UnconstrainedMelody 1. This is a library which takes C# code with "fake" ...
Anyone know a good workaround for the lack of an enum generic constraint? What I want to do is something like this: I have enums with combined flagged values. public static class EnumExtension { public static bool IsSet ( this T input, T matchTo ) where T:enum //the constraint I want that doesn't exist in C#3 { return ...
TITLE: Anyone know a good workaround for the lack of an enum generic constraint? QUESTION: What I want to do is something like this: I have enums with combined flagged values. public static class EnumExtension { public static bool IsSet ( this T input, T matchTo ) where T:enum //the constraint I want that doesn't exis...
[ "c#", ".net", "enums", "flags" ]
97
52
23,748
12
0
2008-08-10T17:14:10.260000
2009-09-11T09:12:34.137000
7,245
7,258
Puzzle: Find largest rectangle (maximal rectangle problem)
What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space? Let's say the screen looks like this ('#' represents filled area):..................................###### ##...................................###.................### #####............... #####..............
@lassevk I found the referenced article, from DDJ: The Maximal Rectangle Problem
Puzzle: Find largest rectangle (maximal rectangle problem) What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space? Let's say the screen looks like this ('#' represents filled area):..................................###### ##...................................##...
TITLE: Puzzle: Find largest rectangle (maximal rectangle problem) QUESTION: What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space? Let's say the screen looks like this ('#' represents filled area):..................................###### ##......................
[ "algorithm", "language-agnostic", "math", "geometry" ]
45
23
33,708
6
0
2008-08-10T17:16:55.137000
2008-08-10T17:44:35.237000
7,252
7,274
How to make junior programmers write tests?
We have a junior programmer that simply doesn't write enough tests. I have to nag him every two hours, "have you written tests?" We've tried: Showing that the design becomes simpler Showing it prevents defects Making it an ego thing saying only bad programmers don't This weekend 2 team members had to come to work becau...
This is one of the hardest things to do. Getting your people to get it. Sometimes one of the best ways to help junior level programmers 'get it' and learn the right techniques from the seniors is to do a bit of pair programming. Try this: on an upcoming project, pair the junior guy up with yourself or another senior pr...
How to make junior programmers write tests? We have a junior programmer that simply doesn't write enough tests. I have to nag him every two hours, "have you written tests?" We've tried: Showing that the design becomes simpler Showing it prevents defects Making it an ego thing saying only bad programmers don't This week...
TITLE: How to make junior programmers write tests? QUESTION: We have a junior programmer that simply doesn't write enough tests. I have to nag him every two hours, "have you written tests?" We've tried: Showing that the design becomes simpler Showing it prevents defects Making it an ego thing saying only bad programme...
[ "unit-testing", "testing" ]
109
128
10,576
24
0
2008-08-10T17:34:46.630000
2008-08-10T18:17:34.983000
7,260
9,095
How do I setup Public-Key Authentication?
How do I setup Public-Key Authentication for SSH?
If you have SSH installed, you should be able to run.. ssh-keygen Then go through the steps, you'll have two files, id_rsa and id_rsa.pub (the first is your private key, the second is your public key - the one you copy to remote machines) Then, connect to the remote machine you want to login to, to the file ~/.ssh/auth...
How do I setup Public-Key Authentication? How do I setup Public-Key Authentication for SSH?
TITLE: How do I setup Public-Key Authentication? QUESTION: How do I setup Public-Key Authentication for SSH? ANSWER: If you have SSH installed, you should be able to run.. ssh-keygen Then go through the steps, you'll have two files, id_rsa and id_rsa.pub (the first is your private key, the second is your public key -...
[ "linux", "ssh", "private-key", "public-key" ]
63
108
101,717
2
0
2008-08-10T17:50:11.467000
2008-08-12T18:13:37.127000
7,269
46,902
How can I identify in which Java Applet context running without passing an ID?
I'm part of a team that develops a pretty big Swing Java Applet. Most of our code are legacy and there are tons of singleton references. We've bunched all of them to a single "Application Context" singleton. What we now need is to create some way to separate the shared context (shared across all applets currently showi...
Singletons are evil, what do you expect?;) Perhaps the most comprehensive approach would be to load the bulk of the applet in a different class loader (use java.net.URLClassLoader.newInstance). Then use a WeakHashMap to associate class loader with an applet. If you could split most of the code into a common class loade...
How can I identify in which Java Applet context running without passing an ID? I'm part of a team that develops a pretty big Swing Java Applet. Most of our code are legacy and there are tons of singleton references. We've bunched all of them to a single "Application Context" singleton. What we now need is to create som...
TITLE: How can I identify in which Java Applet context running without passing an ID? QUESTION: I'm part of a team that develops a pretty big Swing Java Applet. Most of our code are legacy and there are tons of singleton references. We've bunched all of them to a single "Application Context" singleton. What we now nee...
[ "java", "swing", "applet" ]
8
3
2,140
3
0
2008-08-10T18:06:04.820000
2008-09-05T21:13:10.303000
7,277
7,292
Is it "bad practice" to be sensitive to linebreaks in XML documents?
I'm generating some XML documents and when it comes to the address part I have fragments that look like this: 15 Sample St Example Bay Some Country The XSLT that I have for converting this to XHTML has some funky recursive template to convert newline characters within strings to tags. This is all working fine; but is i...
It's generally considered bad practice to rely on linebreaks, since it's a fragile way to differentiate data. While most XML processors will preserve any whitespace you put in your XML, it's not guaranteed. The real problem is that most applications that output your XML into a readable format consider all whitespace in...
Is it "bad practice" to be sensitive to linebreaks in XML documents? I'm generating some XML documents and when it comes to the address part I have fragments that look like this: 15 Sample St Example Bay Some Country The XSLT that I have for converting this to XHTML has some funky recursive template to convert newline ...
TITLE: Is it "bad practice" to be sensitive to linebreaks in XML documents? QUESTION: I'm generating some XML documents and when it comes to the address part I have fragments that look like this: 15 Sample St Example Bay Some Country The XSLT that I have for converting this to XHTML has some funky recursive template t...
[ "xml", "xslt", "xhtml", "whitespace", "line-breaks" ]
8
9
4,600
12
0
2008-08-10T18:20:38.130000
2008-08-10T19:05:08.930000