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
58,384
58,462
Saving an open generic type in an array?
I am facing a problem with.NET generics. The thing I want to do is saving an array of generics types (GraphicsItem): public class GraphicsItem { private T _item; public void Load(T item) { _item = item; } } How can I save such open generic type in an array?
Implement a non-generic interface and use that: public class GraphicsItem: IGraphicsItem { private T _item; public void Load(T item) { _item = item; } public void SomethingWhichIsNotGeneric(int i) { // Code goes here... } } public interface IGraphicsItem { void SomethingWhichIsNotGeneric(int i); } Then use that inte...
Saving an open generic type in an array? I am facing a problem with.NET generics. The thing I want to do is saving an array of generics types (GraphicsItem): public class GraphicsItem { private T _item; public void Load(T item) { _item = item; } } How can I save such open generic type in an array?
TITLE: Saving an open generic type in an array? QUESTION: I am facing a problem with.NET generics. The thing I want to do is saving an array of generics types (GraphicsItem): public class GraphicsItem { private T _item; public void Load(T item) { _item = item; } } How can I save such open generic type in an array? A...
[ ".net", "generics" ]
2
4
872
3
0
2008-09-12T05:52:05.043000
2008-09-12T07:50:38.567000
58,425
58,464
WPF Application fails on startup with TypeInitializationException
I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices "Composite Application Guidance for WPF". I've followed their instructions however my WPF application fails immediately with a "TypeInitializationException". The InnerException property reveals that "The type...
Thanks @ima, your answer pointed me in the right direction. I was using an app.config file and it contained this: It seems the problem was the element because when I removed it the application ran fine. I was confused because Visual Studio 2008 added that when I checked the box to utilise the "Client Profile" available...
WPF Application fails on startup with TypeInitializationException I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices "Composite Application Guidance for WPF". I've followed their instructions however my WPF application fails immediately with a "TypeInitializa...
TITLE: WPF Application fails on startup with TypeInitializationException QUESTION: I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices "Composite Application Guidance for WPF". I've followed their instructions however my WPF application fails immediately with...
[ ".net", "wpf", "prism" ]
23
37
29,424
11
0
2008-09-12T07:06:37.627000
2008-09-12T07:51:05.803000
58,429
59,314
SQL set-based range
How can I have SQL repeat some set-based operation an arbitrary number of times without looping? How can I have SQL perform an operation against a range of numbers? I'm basically looking for a way to do a set-based for loop. I know I can just create a small table with integers in it, say from 1 to 1000 and then use it ...
I think the very short answer to your question is to use WITH clauses to generate your own. Unfortunately, the big names in databases don't have built-in queryable number-range pseudo-tables. Or, more generally, easy pure-SQL data generation features. Personally, I think this is a huge failing, because if they did it w...
SQL set-based range How can I have SQL repeat some set-based operation an arbitrary number of times without looping? How can I have SQL perform an operation against a range of numbers? I'm basically looking for a way to do a set-based for loop. I know I can just create a small table with integers in it, say from 1 to 1...
TITLE: SQL set-based range QUESTION: How can I have SQL repeat some set-based operation an arbitrary number of times without looping? How can I have SQL perform an operation against a range of numbers? I'm basically looking for a way to do a set-based for loop. I know I can just create a small table with integers in i...
[ "sql", "sql-server" ]
3
5
5,878
6
0
2008-09-12T07:09:22.800000
2008-09-12T15:30:35.840000
58,457
454,454
Random Weighted Choice in T-SQL
How do you randomly select a table row in T-SQL based on an applied weight for all candidate rows? For example, I have a set of rows in a table weighted at 50, 25, and 25 (which adds up to 100 but does not need to), and I want to select one of them randomly with a statistical outcome equivalent to the respective weight...
Dane's answer includes a self joins in a way that introduces a square law. (n*n/2) rows after the join where there are n rows in the table. What would be more ideal is to be able to just parse the table once. DECLARE @id int, @weight_sum int, @weight_point int DECLARE @table TABLE (id int, weight int) INSERT INTO @tab...
Random Weighted Choice in T-SQL How do you randomly select a table row in T-SQL based on an applied weight for all candidate rows? For example, I have a set of rows in a table weighted at 50, 25, and 25 (which adds up to 100 but does not need to), and I want to select one of them randomly with a statistical outcome equ...
TITLE: Random Weighted Choice in T-SQL QUESTION: How do you randomly select a table row in T-SQL based on an applied weight for all candidate rows? For example, I have a set of rows in a table weighted at 50, 25, and 25 (which adds up to 100 but does not need to), and I want to select one of them randomly with a stati...
[ "sql-server", "t-sql", "random" ]
27
19
10,037
5
0
2008-09-12T07:44:16.740000
2009-01-18T01:26:24.850000
58,478
58,505
How do I send mail from a Ruby program?
I want to send email from a Ruby application. Is there a call in the core language to do this or is there a library I should use? What's the best way to do this?
If you don't want to use ActionMailer you can use Net::SMTP (for the actual sending) together with tmail for easily creating emails (with multiple parts, etc.).
How do I send mail from a Ruby program? I want to send email from a Ruby application. Is there a call in the core language to do this or is there a library I should use? What's the best way to do this?
TITLE: How do I send mail from a Ruby program? QUESTION: I want to send email from a Ruby application. Is there a call in the core language to do this or is there a library I should use? What's the best way to do this? ANSWER: If you don't want to use ActionMailer you can use Net::SMTP (for the actual sending) togeth...
[ "ruby", "email" ]
10
6
3,964
6
0
2008-09-12T08:02:55.730000
2008-09-12T08:28:51.500000
58,482
63,523
Access variables programmatically by name in Ruby
I'm not entirely sure if this is possible in Ruby, but hopefully there's an easy way to do this. I want to declare a variable and later find out the name of the variable. That is, for this simple snippet: foo = ["goo", "baz"] How can I get the name of the array (here, "foo") back? If it is indeed possible, does this wo...
What if you turn your problem around? Instead of trying to get names from variables, get the variables from the names: ["foo", "goo", "bar"].each { |param_name| param = eval(param_name) if param.class!= Array puts "#{param_name} wasn't an Array. It was a/an #{param.class}" return "Error: #{param_name} wasn't an Array" ...
Access variables programmatically by name in Ruby I'm not entirely sure if this is possible in Ruby, but hopefully there's an easy way to do this. I want to declare a variable and later find out the name of the variable. That is, for this simple snippet: foo = ["goo", "baz"] How can I get the name of the array (here, "...
TITLE: Access variables programmatically by name in Ruby QUESTION: I'm not entirely sure if this is possible in Ruby, but hopefully there's an easy way to do this. I want to declare a variable and later find out the name of the variable. That is, for this simple snippet: foo = ["goo", "baz"] How can I get the name of ...
[ "ruby", "variables" ]
24
40
29,890
11
0
2008-09-12T08:08:40.927000
2008-09-15T14:41:51.843000
58,484
58,486
Getting Good Google PageRank
In SEO people talk a lot about Google PageRank. It's kind of a catch 22 because until your site is actually big and you don't really need search engines as much, it's unlikely that big sites will link to you and increase your PageRank! I've been told that it's easiest to simply get a couple high quality links to point ...
Have great content Nothing helps your google rank more than having content or offering a service people are interested in. If your web site is better than the competition and solves a real need you will naturally generate more traffic and inbound links. Keep your content fresh Use friendly url's that contain keywords G...
Getting Good Google PageRank In SEO people talk a lot about Google PageRank. It's kind of a catch 22 because until your site is actually big and you don't really need search engines as much, it's unlikely that big sites will link to you and increase your PageRank! I've been told that it's easiest to simply get a couple...
TITLE: Getting Good Google PageRank QUESTION: In SEO people talk a lot about Google PageRank. It's kind of a catch 22 because until your site is actually big and you don't really need search engines as much, it's unlikely that big sites will link to you and increase your PageRank! I've been told that it's easiest to s...
[ "seo", "google-search", "pagerank" ]
11
29
2,528
5
0
2008-09-12T08:10:47.753000
2008-09-12T08:12:04.863000
58,493
58,497
Algorithm to find a common multiplier to convert decimal numbers to whole numbers
I have an array of numbers that potentially have up to 8 decimal places and I need to find the smallest common number I can multiply them by so that they are all whole numbers. I need this so all the original numbers can all be multiplied out to the same scale and be processed by a sealed system that will only deal wit...
I'd multiply by something sufficiently large (100,000,000 for 8 decimal places), then divide by the GCD of the resulting numbers. You'll end up with a pile of smallest integers that you can feed to the other algorithm. After getting the result, reverse the process to recover your original range.
Algorithm to find a common multiplier to convert decimal numbers to whole numbers I have an array of numbers that potentially have up to 8 decimal places and I need to find the smallest common number I can multiply them by so that they are all whole numbers. I need this so all the original numbers can all be multiplied...
TITLE: Algorithm to find a common multiplier to convert decimal numbers to whole numbers QUESTION: I have an array of numbers that potentially have up to 8 decimal places and I need to find the smallest common number I can multiply them by so that they are all whole numbers. I need this so all the original numbers can...
[ "algorithm", "math" ]
5
6
6,401
7
0
2008-09-12T08:18:38.373000
2008-09-12T08:21:43.077000
58,510
58,570
Using .NET, how can you find the mime type of a file based on the file signature not the extension
I am looking for a simple way to get a mime type where the file extension is incorrect or not given, something similar to this question only in.Net.
In Urlmon.dll, there's a function called FindMimeFromData. From the documentation MIME type detection, or "data sniffing," refers to the process of determining an appropriate MIME type from binary data. The final result depends on a combination of server-supplied MIME type headers, file extension, and/or the data itsel...
Using .NET, how can you find the mime type of a file based on the file signature not the extension I am looking for a simple way to get a mime type where the file extension is incorrect or not given, something similar to this question only in.Net.
TITLE: Using .NET, how can you find the mime type of a file based on the file signature not the extension QUESTION: I am looking for a simple way to get a mime type where the file extension is incorrect or not given, something similar to this question only in.Net. ANSWER: In Urlmon.dll, there's a function called Find...
[ "c#", "mime", "mime-types" ]
270
85
291,298
19
0
2008-09-12T08:35:39.347000
2008-09-12T09:44:11.070000
58,513
58,818
Unit testing ASP.NET MVC redirection
How do I Unit Test a MVC redirection? public ActionResult Create(Product product) { _productTask.Save(product); return RedirectToAction("Success"); } public ActionResult Success() { return View(); } Is Ayende's approach still the best way to go, with preview 5: public static void RenderView(this Controller self, strin...
[TestFixture] public class RedirectTester { [Test] public void Should_redirect_to_success_action() { var controller = new RedirectController(); var result = controller.Index() as RedirectToRouteResult; Assert.That(result, Is.Not.Null); Assert.That(result.Values["action"], Is.EqualTo("success")); } } public class Redir...
Unit testing ASP.NET MVC redirection How do I Unit Test a MVC redirection? public ActionResult Create(Product product) { _productTask.Save(product); return RedirectToAction("Success"); } public ActionResult Success() { return View(); } Is Ayende's approach still the best way to go, with preview 5: public static void R...
TITLE: Unit testing ASP.NET MVC redirection QUESTION: How do I Unit Test a MVC redirection? public ActionResult Create(Product product) { _productTask.Save(product); return RedirectToAction("Success"); } public ActionResult Success() { return View(); } Is Ayende's approach still the best way to go, with preview 5: pu...
[ "asp.net", "asp.net-mvc", "unit-testing" ]
17
29
8,760
4
0
2008-09-12T08:38:29.043000
2008-09-12T12:29:02.860000
58,517
58,527
Combining Enums
Is there a way to combine Enums in VB.net?
I believe what you want is a flag type enum. You need to add the Flags attribute to the top of the enum, and then you can combine enums with the 'Or' keyword. Like this: _ Enum CombinationEnums As Integer HasButton = 1 TitleBar = 2 [ReadOnly] = 4 ETC = 8 End Enum Note: The numbers to the right are always twice as big (...
Combining Enums Is there a way to combine Enums in VB.net?
TITLE: Combining Enums QUESTION: Is there a way to combine Enums in VB.net? ANSWER: I believe what you want is a flag type enum. You need to add the Flags attribute to the top of the enum, and then you can combine enums with the 'Or' keyword. Like this: _ Enum CombinationEnums As Integer HasButton = 1 TitleBar = 2 [R...
[ ".net", "vb.net", "enums" ]
32
52
24,114
5
0
2008-09-12T08:42:07.583000
2008-09-12T08:54:08.600000
58,538
58,686
How do you create an event log source using WiX
I'm creating an installer for a website that uses a custom event log source. I would like our WiX based installer to create that event log source during installation. Does anyone know the best way to do this using the WiX framework.
Wix has out-of-the-box support for creating event log sources. Assuming you use Wix 3, you first need to add a reference to WixUtilExtension to either your Votive project or the command line. You can then add an EventSource element under a component:...... If this is a.NET project, you can use EventLogMessages.dll in t...
How do you create an event log source using WiX I'm creating an installer for a website that uses a custom event log source. I would like our WiX based installer to create that event log source during installation. Does anyone know the best way to do this using the WiX framework.
TITLE: How do you create an event log source using WiX QUESTION: I'm creating an installer for a website that uses a custom event log source. I would like our WiX based installer to create that event log source during installation. Does anyone know the best way to do this using the WiX framework. ANSWER: Wix has out-...
[ "wix", "event-log", "eventlog-source" ]
64
59
21,745
3
0
2008-09-12T09:09:47.177000
2008-09-12T11:01:18.797000
58,540
59,116
How to resolve SQL query parameters mapping issues while using Oracle OLE DB provider?
When trying to enter a SQL query with parameters using the Oracle OLE DB provider I get the following error: Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command from variable" access mode, in which the entir...
To expand on the link given in the question: Create a package variable Double click on the package variable name. (This allows you to access the properties of the variable) Set the property 'EvaluateAsExpression' to true Enter the query in the expression builder. Set the OLE DB source query to SQL Command from Variable...
How to resolve SQL query parameters mapping issues while using Oracle OLE DB provider? When trying to enter a SQL query with parameters using the Oracle OLE DB provider I get the following error: Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the com...
TITLE: How to resolve SQL query parameters mapping issues while using Oracle OLE DB provider? QUESTION: When trying to enter a SQL query with parameters using the Oracle OLE DB provider I get the following error: Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter inform...
[ "oracle", "ssis" ]
10
18
53,032
3
0
2008-09-12T09:12:56.870000
2008-09-12T14:24:12.083000
58,543
58,553
<iframe> - How to show the whole height of referenced page?
I have an application that I would like to embed inside our companies CMS. The only way to do that (I am told), is to load it in an. Easy: just set height and width to 100%! Except, it doesn't work. I did find out about setting frameborder to 0, so it at least looks like part of the site, but I'd prefer not to have an ...
You could either just use a scripting language to include the page into the parent page, other wise, you might want to try one of these javascript methods: http://brondsema.net/blog/index.php/2007/06/06/100_height_iframe http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_22840093.html
<iframe> - How to show the whole height of referenced page? I have an application that I would like to embed inside our companies CMS. The only way to do that (I am told), is to load it in an. Easy: just set height and width to 100%! Except, it doesn't work. I did find out about setting frameborder to 0, so it at least...
TITLE: <iframe> - How to show the whole height of referenced page? QUESTION: I have an application that I would like to embed inside our companies CMS. The only way to do that (I am told), is to load it in an. Easy: just set height and width to 100%! Except, it doesn't work. I did find out about setting frameborder to...
[ "html", "iframe" ]
8
4
12,562
3
0
2008-09-12T09:18:11.210000
2008-09-12T09:28:50.500000
58,547
58,552
Painless resource management in java
In C++ we acquiring a resource in a constructor and release it in a destructor. So when an exception rises in a middle of a function there will be no resource leak or locked mutexes or whatever. AFAIK java classes don't have destructors. So how does one do the resource management in Java. For example: public int foo() ...
Yes you can and should put try/catch/finally block around your code. In C# there is a shorthand "using" statement, but in Java you are stuck with: public int foo() { Resource f = new Resource(); try { DoSomething(f); } finally { f.Release(); } }
Painless resource management in java In C++ we acquiring a resource in a constructor and release it in a destructor. So when an exception rises in a middle of a function there will be no resource leak or locked mutexes or whatever. AFAIK java classes don't have destructors. So how does one do the resource management in...
TITLE: Painless resource management in java QUESTION: In C++ we acquiring a resource in a constructor and release it in a destructor. So when an exception rises in a middle of a function there will be no resource leak or locked mutexes or whatever. AFAIK java classes don't have destructors. So how does one do the reso...
[ "java", "resources" ]
6
4
2,049
5
0
2008-09-12T09:24:49.603000
2008-09-12T09:27:57.007000
58,558
58,565
How do I remotely get a checksum for a file on a Windows machine?
I'm trying to check, using an automated discovery tool, when JAR files in remote J2EE application servers have changed content. Currently, the system downloads the whole JAR using WMI to checksum it locally, which is slow for large JARs. For UNIXy servers (and Windows servers with Cygwin), I can just log in over SSH an...
You could try the Sysinternals PSExec tool. You would need a checksum utility available on the remote machine. Unfortunately since they became part of Microsoft they don't make any source code available. Alternatively, you could install the Cygwin SSH daemon on the remote machines and use ssh but that's a bit more invo...
How do I remotely get a checksum for a file on a Windows machine? I'm trying to check, using an automated discovery tool, when JAR files in remote J2EE application servers have changed content. Currently, the system downloads the whole JAR using WMI to checksum it locally, which is slow for large JARs. For UNIXy server...
TITLE: How do I remotely get a checksum for a file on a Windows machine? QUESTION: I'm trying to check, using an automated discovery tool, when JAR files in remote J2EE application servers have changed content. Currently, the system downloads the whole JAR using WMI to checksum it locally, which is slow for large JARs...
[ "windows", "jakarta-ee", "wmi", "checksum" ]
0
1
1,767
2
0
2008-09-12T09:31:40.163000
2008-09-12T09:39:57.820000
58,584
58,588
In Vim, what is the best way to select, delete, or comment out large portions of multi-screen text?
Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and delete multiscreen blocks of text or write e.g. three large methods out to another file and then delete them for testing purposes in Vim when usi...
Well, first of all, you can set vim to work with the mouse, which would allow you to select text just like you would in Eclipse. You can also use the Visual selection - v, by default. Once selected, you can yank, cut, etc. As far as commenting out the block, I usually select it with VISUAL, then do:'<,'>s/^/# / Replaci...
In Vim, what is the best way to select, delete, or comment out large portions of multi-screen text? Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and delete multiscreen blocks of text or write e....
TITLE: In Vim, what is the best way to select, delete, or comment out large portions of multi-screen text? QUESTION: Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and delete multiscreen blocks o...
[ "vim", "vi" ]
25
24
33,720
16
0
2008-09-12T09:56:51.447000
2008-09-12T10:02:39.373000
58,618
58,635
Delphi Network programming
I have a classic client/server (fat client and database) program written in Delphi 2006. When certain conditions are met in the client, I need to notify all the other clients very quickly. Up until now this has been done using UDP broadcasts, but this is no longer viable as clients now connect from outside the LAN and ...
The simple answer is that the standard protocols available in Delphi (and other tools) don't allow for notification in reverse. I looked into this for a project where I wanted to use SOAP. They all assume client asks server, server responds and that's it. For me, the solution was the RemObjects SDK. This allows you to ...
Delphi Network programming I have a classic client/server (fat client and database) program written in Delphi 2006. When certain conditions are met in the client, I need to notify all the other clients very quickly. Up until now this has been done using UDP broadcasts, but this is no longer viable as clients now connec...
TITLE: Delphi Network programming QUESTION: I have a classic client/server (fat client and database) program written in Delphi 2006. When certain conditions are met in the client, I need to notify all the other clients very quickly. Up until now this has been done using UDP broadcasts, but this is no longer viable as ...
[ "delphi", "network-programming", "udp" ]
4
4
5,457
7
0
2008-09-12T10:23:30.680000
2008-09-12T10:36:00.727000
58,620
58,689
Default button size?
How do I create a button control (with CreateWindow of a BUTTON window class) that has a standard system-wide size (especially height) that's consistent with the rest of Windows applications? I should of course take DPI into account and probably other settings. Remark: Using USE_CW_DEFAULT for width and height results ...
In the perfect, hassle-free world... To create a standard size button we would have to do this: LONG units = GetDialogBaseUnits(); m_hButton = CreateWindow(TEXT("BUTTON"), TEXT("Close"), WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 0, 0, MulDiv(LOWORD(units), 50, 4), MulDiv(HIWORD(units), 14, 8), hwnd, NULL, hInst, NULL);...
Default button size? How do I create a button control (with CreateWindow of a BUTTON window class) that has a standard system-wide size (especially height) that's consistent with the rest of Windows applications? I should of course take DPI into account and probably other settings. Remark: Using USE_CW_DEFAULT for widt...
TITLE: Default button size? QUESTION: How do I create a button control (with CreateWindow of a BUTTON window class) that has a standard system-wide size (especially height) that's consistent with the rest of Windows applications? I should of course take DPI into account and probably other settings. Remark: Using USE_C...
[ "winapi" ]
11
13
13,930
3
0
2008-09-12T10:25:32.330000
2008-09-12T11:03:03.470000
58,622
58,701
How to document Python code using Doxygen
I like Doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have /*.. */ comments, and also has its own self-documentation facility which seems to be the pythonic way to document. Since I'm familiar with Doxygen, how can I use it to produce my Py...
This is documented on the doxygen website, but to summarize here: You can use doxygen to document your Python code. You can either use the Python documentation string syntax: """@package docstring Documentation for this module. More details. """ def func(): """Documentation for a function. More details. """ pass In ...
How to document Python code using Doxygen I like Doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have /*.. */ comments, and also has its own self-documentation facility which seems to be the pythonic way to document. Since I'm familiar with ...
TITLE: How to document Python code using Doxygen QUESTION: I like Doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have /*.. */ comments, and also has its own self-documentation facility which seems to be the pythonic way to document. Since ...
[ "python", "documentation", "python-sphinx", "doxygen", "docstring" ]
105
76
169,417
5
0
2008-09-12T10:26:40.033000
2008-09-12T11:11:03.123000
58,630
58,667
"Quoted-printable line longer than 76 chars" warning when sending HTML E-Mail
I have written some code in my VB.NET application to send an HTML e-mail (in this case, a lost password reminder). When I test the e-mail, it gets eaten by my spam filter. One of the things that it's scoring badly on is because of the following problem: MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars ...
Quoted printable expands 8 bit characters to "={HEX-Code}", thus making the messages longer. Maybe you are just hitting this limit? Have you tried to break the message at, say, 70 characters? That should provide space for a couple of characters per line. Or you just encode the email with Base64 - all mail client can ha...
"Quoted-printable line longer than 76 chars" warning when sending HTML E-Mail I have written some code in my VB.NET application to send an HTML e-mail (in this case, a lost password reminder). When I test the e-mail, it gets eaten by my spam filter. One of the things that it's scoring badly on is because of the followi...
TITLE: "Quoted-printable line longer than 76 chars" warning when sending HTML E-Mail QUESTION: I have written some code in my VB.NET application to send an HTML e-mail (in this case, a lost password reminder). When I test the e-mail, it gets eaten by my spam filter. One of the things that it's scoring badly on is beca...
[ ".net", "html", "email" ]
7
5
7,680
2
0
2008-09-12T10:31:35.543000
2008-09-12T10:52:52.777000
58,638
58,835
How do I convert a set of polygons into a bitmap
How do I take a set of polygons which contain arbitrary values and create a corresponding bitmap where each pixel contains the value of the polygon at that location? To put the question into context, my polygons contain information about the average number of people per square kilometre within the polygon. I need to cr...
@Nick R I was originally using ArcGIS 9.2, but that doesn't work well with C# and 64 bit, so I am now using GDAL ( http://www.gdal.org ). Doesn't gdal_rasterize do exactly what you want?
How do I convert a set of polygons into a bitmap How do I take a set of polygons which contain arbitrary values and create a corresponding bitmap where each pixel contains the value of the polygon at that location? To put the question into context, my polygons contain information about the average number of people per ...
TITLE: How do I convert a set of polygons into a bitmap QUESTION: How do I take a set of polygons which contain arbitrary values and create a corresponding bitmap where each pixel contains the value of the polygon at that location? To put the question into context, my polygons contain information about the average num...
[ "algorithm", "gis", "arcgis", "arcgis-js-api" ]
3
1
2,485
5
0
2008-09-12T10:36:38.807000
2008-09-12T12:38:34.210000
58,649
156,640
How to get the EXIF data from a file using C#
I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...). Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or Exposure programatically? Thanks!
Check out this metadata extractor. It is written in Java but has also been ported to C#. I have used the Java version to write a small utility to rename my jpeg files based on the date and model tags. Very easy to use. EDIT metadata-extractor supports.NET too. It's a very fast and simple library for accessing metadata ...
How to get the EXIF data from a file using C# I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...). Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or Exposure programat...
TITLE: How to get the EXIF data from a file using C# QUESTION: I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...). Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or ...
[ "c#", "exif", "photography" ]
86
29
146,255
9
0
2008-09-12T10:43:49.070000
2008-10-01T08:00:51.110000
58,670
58,725
Windows CDROM Eject
Does anyone know a method to programmatically close the CD tray on Windows 2000 or higher? Open CD tray exists, but I can't seem to make it close especially under W2k. I am especially looking for a method to do this from a batch file, if possible, but API calls would be OK.
Here is an easy way using the Win32 API: [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi)] protected static extern int mciSendString(string lpstrCommand,StringBuilder lpstrReturnString,int uReturnLength,IntPtr hwndCallback); public void OpenCloseCD(bool Open) { if (Open) { mciSendString("...
Windows CDROM Eject Does anyone know a method to programmatically close the CD tray on Windows 2000 or higher? Open CD tray exists, but I can't seem to make it close especially under W2k. I am especially looking for a method to do this from a batch file, if possible, but API calls would be OK.
TITLE: Windows CDROM Eject QUESTION: Does anyone know a method to programmatically close the CD tray on Windows 2000 or higher? Open CD tray exists, but I can't seem to make it close especially under W2k. I am especially looking for a method to do this from a batch file, if possible, but API calls would be OK. ANSWER...
[ "windows", "winapi" ]
12
8
12,407
5
0
2008-09-12T10:53:52.540000
2008-09-12T11:28:03.583000
58,679
58,684
Visual Studio 2008 complains about trusted locations. What to do?
I was messing around with RhinoMocks this morning and couldn't run my tests because RhinoMocks.dll was not in a "trusted location". The assembly is in my c:\documents and settings\\My Documents\Visual Studio 2008\Projects (and so on) folder. What's the deal?
Did you download a zip file from the internet and then extract it using the standard explorer tools. I think this marks the directory as untrusted and Visual studio detects this.
Visual Studio 2008 complains about trusted locations. What to do? I was messing around with RhinoMocks this morning and couldn't run my tests because RhinoMocks.dll was not in a "trusted location". The assembly is in my c:\documents and settings\\My Documents\Visual Studio 2008\Projects (and so on) folder. What's the d...
TITLE: Visual Studio 2008 complains about trusted locations. What to do? QUESTION: I was messing around with RhinoMocks this morning and couldn't run my tests because RhinoMocks.dll was not in a "trusted location". The assembly is in my c:\documents and settings\\My Documents\Visual Studio 2008\Projects (and so on) fo...
[ "visual-studio", "security", "assemblies" ]
0
1
1,416
3
0
2008-09-12T10:58:23.483000
2008-09-12T10:59:44.603000
58,694
58,731
How do I HTML Encode all the output in a web application?
I want to prevent XSS attacks in my web application. I found that HTML Encoding the output can really prevent XSS attacks. Now the problem is that how do I HTML encode every single output in my application? I there a way to automate this? I appreciate answers for JSP, ASP.net and PHP.
You don't want to encode all HTML, you only want to HTML-encode any user input that you're outputting. For PHP: htmlentities and htmlspecialchars
How do I HTML Encode all the output in a web application? I want to prevent XSS attacks in my web application. I found that HTML Encoding the output can really prevent XSS attacks. Now the problem is that how do I HTML encode every single output in my application? I there a way to automate this? I appreciate answers fo...
TITLE: How do I HTML Encode all the output in a web application? QUESTION: I want to prevent XSS attacks in my web application. I found that HTML Encoding the output can really prevent XSS attacks. Now the problem is that how do I HTML encode every single output in my application? I there a way to automate this? I app...
[ "php", "asp.net", "jsp" ]
6
5
10,667
11
0
2008-09-12T11:05:57.363000
2008-09-12T11:31:31.390000
58,697
58,729
Alternatives to XCopy for copying lots of files?
The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort. I recently received a non-pieceofcrapuous laptop, and I am in the process of copying everything from old to new. I'm trying to xcopy c...
/D may be what you are looking for. I find it works quite fast for backing-up as existing files are not copied. xcopy "O:\*.*" N:\Whatever /C /D /S /H /C Continues copying even if errors occur. /D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time ...
Alternatives to XCopy for copying lots of files? The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort. I recently received a non-pieceofcrapuous laptop, and I am in the process of copying ...
TITLE: Alternatives to XCopy for copying lots of files? QUESTION: The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort. I recently received a non-pieceofcrapuous laptop, and I am in the p...
[ "xcopy" ]
5
7
22,000
9
0
2008-09-12T11:07:18.423000
2008-09-12T11:31:19.533000
58,709
545,415
How to log in T-SQL
I'm using ADO.NET to access SQL Server 2005 and would like to be able to log from inside the T-SQL stored procedures that I'm calling. Is that somehow possible? I'm unable to see output from the 'print'-statement when using ADO.NET and since I want to use logging just for debuging the ideal solution would be to emit me...
I solved this by writing a SQLCLR-procedure as Eric Z Beard suggested. The assembly must be signed with a strong name key file. using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; public partial class StoredProcedures { [Microsoft.SqlServer.Server...
How to log in T-SQL I'm using ADO.NET to access SQL Server 2005 and would like to be able to log from inside the T-SQL stored procedures that I'm calling. Is that somehow possible? I'm unable to see output from the 'print'-statement when using ADO.NET and since I want to use logging just for debuging the ideal solution...
TITLE: How to log in T-SQL QUESTION: I'm using ADO.NET to access SQL Server 2005 and would like to be able to log from inside the T-SQL stored procedures that I'm calling. Is that somehow possible? I'm unable to see output from the 'print'-statement when using ADO.NET and since I want to use logging just for debuging ...
[ "sql-server", "t-sql", "logging", "ado.net", "sql" ]
15
10
25,733
11
0
2008-09-12T11:17:23.937000
2009-02-13T10:00:18.107000
58,711
58,917
How would you design a very "Pythonic" UI framework?
I have been playing with the Ruby library "shoes". Basically you can write a GUI application in the following way: Shoes.app do t = para "Not clicked!" button "The Label" do alert "You clicked the button!" # when clicked, make an alert t.replace "Clicked!" #..and replace the label's text end end This made me think - ho...
You could actually pull this off, but it would require using metaclasses, which are deep magic (there be dragons). If you want an intro to metaclasses, there's a series of articles from IBM which manage to introduce the ideas without melting your brain. The source code from an ORM like SQLObject might help, too, since ...
How would you design a very "Pythonic" UI framework? I have been playing with the Ruby library "shoes". Basically you can write a GUI application in the following way: Shoes.app do t = para "Not clicked!" button "The Label" do alert "You clicked the button!" # when clicked, make an alert t.replace "Clicked!" #..and rep...
TITLE: How would you design a very "Pythonic" UI framework? QUESTION: I have been playing with the Ruby library "shoes". Basically you can write a GUI application in the following way: Shoes.app do t = para "Not clicked!" button "The Label" do alert "You clicked the button!" # when clicked, make an alert t.replace "Cl...
[ "python", "user-interface", "frameworks" ]
13
7
2,878
15
0
2008-09-12T11:18:04.293000
2008-09-12T13:13:57.947000
58,730
58,737
Open source PDF library for C/C++ application?
I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this? I looked at the answers to this question, but they mostly relate to.Net.
LibHaru Haru is a free, cross platform, open-sourced software library for generating PDF written in ANSI-C. It can work as both a static-library (.a,.lib) and a shared-library (.so,.dll). Didn't try it myself, but maybe it can help you
Open source PDF library for C/C++ application? I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this? I looked at the answers to this question, but they mostly relate to.Net.
TITLE: Open source PDF library for C/C++ application? QUESTION: I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this? I looked at the answers to this question, but they mostly relate to.Net. ANSWER: LibHaru Haru is a free, cro...
[ "c++", "c", "pdf", "open-source" ]
100
68
218,569
10
0
2008-09-12T11:31:20.190000
2008-09-12T11:35:25.373000
58,744
3,822,913
Copy the entire contents of a directory in C#
I want to copy the entire contents of a directory from one location to another in C#. There doesn't appear to be a way to do this using System.IO classes without lots of recursion. There is a method in VB that we can use if we add a reference to Microsoft.VisualBasic: new Microsoft.VisualBasic.Devices.Computer(). FileS...
Much easier private static void CopyFilesRecursively(string sourcePath, string targetPath) { //Now Create all of the directories foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories)) { Directory.CreateDirectory(dirPath.Replace(sourcePath, targetPath)); } //Copy all the file...
Copy the entire contents of a directory in C# I want to copy the entire contents of a directory from one location to another in C#. There doesn't appear to be a way to do this using System.IO classes without lots of recursion. There is a method in VB that we can use if we add a reference to Microsoft.VisualBasic: new M...
TITLE: Copy the entire contents of a directory in C# QUESTION: I want to copy the entire contents of a directory from one location to another in C#. There doesn't appear to be a way to do this using System.IO classes without lots of recursion. There is a method in VB that we can use if we add a reference to Microsoft....
[ "c#", ".net", "directory", "copy" ]
629
662
498,674
29
0
2008-09-12T11:38:52.607000
2010-09-29T15:03:50.057000
58,750
68,766
How do I get raw logs from Google Analytics?
Is it possible to obtain raw logs from Google Analytic? Is there any tool that can generate the raw logs from GA?
No you can't get the raw logs, but there's nothing stopping you from getting the exact same data logged to your own web server logs. Have a look at the Urchin code and borrow that, changing the following two lines to point to your web server instead. var _ugifpath2="http://www.google-analytics.com/__utm.gif"; if (_udl....
How do I get raw logs from Google Analytics? Is it possible to obtain raw logs from Google Analytic? Is there any tool that can generate the raw logs from GA?
TITLE: How do I get raw logs from Google Analytics? QUESTION: Is it possible to obtain raw logs from Google Analytic? Is there any tool that can generate the raw logs from GA? ANSWER: No you can't get the raw logs, but there's nothing stopping you from getting the exact same data logged to your own web server logs. H...
[ "google-analytics" ]
12
16
22,799
6
0
2008-09-12T11:42:11.833000
2008-09-16T02:05:40.470000
58,755
59,063
What is the best way to do per-user database connections in Rails
What is the best way to do per-user database connections in Rails? I realize this is a poor Rails design practice, but we're gradually replacing an existing web application that uses one database per user. A complete redesign/rewrite is not feasible.
Put something like this in your application controller. I'm using the subdomain plus "_clientdb" to pick the name of the database. I have all the databases using the same username and password, so I can grab that from the db config file. Hope this helps! class ApplicationController < ActionController::Base before_filt...
What is the best way to do per-user database connections in Rails What is the best way to do per-user database connections in Rails? I realize this is a poor Rails design practice, but we're gradually replacing an existing web application that uses one database per user. A complete redesign/rewrite is not feasible.
TITLE: What is the best way to do per-user database connections in Rails QUESTION: What is the best way to do per-user database connections in Rails? I realize this is a poor Rails design practice, but we're gradually replacing an existing web application that uses one database per user. A complete redesign/rewrite is...
[ "ruby-on-rails" ]
6
10
1,153
2
0
2008-09-12T11:44:14.980000
2008-09-12T14:01:09.207000
58,757
58,775
Push or Pull for a near real time automation server?
We are currently developing a server whereby a client requests interest in changes to specific data elements and when that data changes the server pushes the data back to the client. There has vigorous debate at work about whether or not it would be better for the client to poll for this data. What is considered to be ...
There's probably no ideal method for every situation, but push is usually better and used more often. It allows to optimize server caching and data transfers, which helps performance and scalability, and cuts network traffic a bit by avoiding client requests and empty responses. It can be important advantage for a serv...
Push or Pull for a near real time automation server? We are currently developing a server whereby a client requests interest in changes to specific data elements and when that data changes the server pushes the data back to the client. There has vigorous debate at work about whether or not it would be better for the cl...
TITLE: Push or Pull for a near real time automation server? QUESTION: We are currently developing a server whereby a client requests interest in changes to specific data elements and when that data changes the server pushes the data back to the client. There has vigorous debate at work about whether or not it would be...
[ "performance", "automation", "networking" ]
4
3
810
3
0
2008-09-12T11:45:38.830000
2008-09-12T11:59:16.050000
58,774
58,794
How do you paste multiple tabbed lines into Vi?
I want to paste something I have cut from my desktop into a file open in Vi. But if I paste the tabs embed on top of each other across the page. I think it is some sort of visual mode change but can't find the command.
If you're using plain vi: You probably have autoindent on. To turn it off while pasting::set noai:set ai I have in my.exrc the following shortcuts: map ^P:set noai^M map ^N:set ai^M Note that these have to be the actual control characters - insert them using Ctrl - V Ctrl - P and so on. If you're using vim: Use the pas...
How do you paste multiple tabbed lines into Vi? I want to paste something I have cut from my desktop into a file open in Vi. But if I paste the tabs embed on top of each other across the page. I think it is some sort of visual mode change but can't find the command.
TITLE: How do you paste multiple tabbed lines into Vi? QUESTION: I want to paste something I have cut from my desktop into a file open in Vi. But if I paste the tabs embed on top of each other across the page. I think it is some sort of visual mode change but can't find the command. ANSWER: If you're using plain vi: ...
[ "vim", "vi" ]
24
52
8,335
3
0
2008-09-12T11:59:15.817000
2008-09-12T12:14:02.100000
58,783
58,786
What tool do you use for counting lines of source code in Visual Studio Projects?
I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use?
Slick Edit Gadgets has a nice report breaking it down by lines of code, whitespace and comments. The plug-in is free and relatively small.
What tool do you use for counting lines of source code in Visual Studio Projects? I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use?
TITLE: What tool do you use for counting lines of source code in Visual Studio Projects? QUESTION: I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use? ANSWER: Slick Edit Gadgets has a nice report breaking it down by lines of code, whit...
[ "visual-studio", "code-analysis" ]
7
8
8,808
10
0
2008-09-12T12:05:01.823000
2008-09-12T12:08:24.343000
58,809
62,470
Retrieving the associated shared service provider's name?
How do you programmatically retrieve the name of a shared services provider that's associated with a specific Sharepoint web application? I have a custom solution that needs to: Enumerate all web applications that it's deployed to Figure out the Shared Services provider that each of the web applications is associated w...
Unfortunately there is no supported way I know of that this can be done. The relevant class is SharedResourceProvider in the Microsoft.Office.Server.Administration namespace, in the Microsoft.Office.Server DLL. It's marked internal so pre-reflection: SharedResourceProvider sharedResourceProvider = ServerContext.GetCont...
Retrieving the associated shared service provider's name? How do you programmatically retrieve the name of a shared services provider that's associated with a specific Sharepoint web application? I have a custom solution that needs to: Enumerate all web applications that it's deployed to Figure out the Shared Services ...
TITLE: Retrieving the associated shared service provider's name? QUESTION: How do you programmatically retrieve the name of a shared services provider that's associated with a specific Sharepoint web application? I have a custom solution that needs to: Enumerate all web applications that it's deployed to Figure out th...
[ "sharepoint", "moss", "sharedservicesprovider" ]
2
1
1,671
1
0
2008-09-12T12:24:39.563000
2008-09-15T12:46:45.427000
58,825
58,953
Javascript syntax highlighting in vim
Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting. Are there any work-arounds or ways to fix this? I'm using vim 7.1.
You might like to try this improved Javascript syntax highlighter rather than the one that ships with VIMRUNTIME.
Javascript syntax highlighting in vim Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting. Are there any work-arounds or ways to fix this? I'm u...
TITLE: Javascript syntax highlighting in vim QUESTION: Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting. Are there any work-arounds or ways ...
[ "javascript", "vim", "editing", "vim-syntax-highlighting" ]
51
32
47,064
5
0
2008-09-12T12:32:33.257000
2008-09-12T13:28:16.133000
58,827
113,639
ASP.NET Custom Controls and "Dynamic" Event Model
OK, I am not sure if the title it completely accurate, open to suggestions! I am in the process of creating an ASP.NET custom control, this is something that is still relatively new to me, so please bear with me. I am thinking about the event model. Since we are not using Web Controls there are no events being fired fr...
I have been doing some more digging on this, and came across how to inject Javascript in to the client when required. This will obviously play a huge part in making the controls more responsive and less round-trips to the server. For example: RegisterClientScriptBlock. Look forward to playing with this more, feel free ...
ASP.NET Custom Controls and "Dynamic" Event Model OK, I am not sure if the title it completely accurate, open to suggestions! I am in the process of creating an ASP.NET custom control, this is something that is still relatively new to me, so please bear with me. I am thinking about the event model. Since we are not usi...
TITLE: ASP.NET Custom Controls and "Dynamic" Event Model QUESTION: OK, I am not sure if the title it completely accurate, open to suggestions! I am in the process of creating an ASP.NET custom control, this is something that is still relatively new to me, so please bear with me. I am thinking about the event model. Si...
[ "asp.net", "events", "custom-server-controls" ]
2
1
1,470
2
0
2008-09-12T12:33:49.417000
2008-09-22T07:35:06.343000
58,831
59,733
Ambiguity in Left joins (oracle only?)
My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix: select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD); and here it is after the fix: sele...
I'm afraid I can't tell you why you're not getting an exception, but I can postulate as to why it chose CATEGORIES' version of the column over PARTS' version. As far as I understood, in the case of left joins, the "main" table in the query (PARTS) has precedence in ambiguity It's not clear whether by "main" you mean si...
Ambiguity in Left joins (oracle only?) My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix: select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CAT...
TITLE: Ambiguity in Left joins (oracle only?) QUESTION: My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix: select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORI...
[ "sql", "oracle", "join" ]
4
1
4,381
12
0
2008-09-12T12:37:34.977000
2008-09-12T18:44:39.867000
58,851
59,146
Can I set a breakpoint on 'memory access' in GDB?
I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see if/when it changes.
watch only breaks on write, rwatch let you break on read, and awatch let you break on read/write. You can set read watchpoints on memory locations: gdb$ rwatch *0xfeedface Hardware read watchpoint 2: *0xfeedface but one limitation applies to the rwatch and awatch commands; you can't use gdb variables in expressions: gd...
Can I set a breakpoint on 'memory access' in GDB? I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see if/when it changes.
TITLE: Can I set a breakpoint on 'memory access' in GDB? QUESTION: I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see if/when...
[ "c++", "debugging", "gdb", "breakpoints", "memory-access" ]
272
321
206,063
6
0
2008-09-12T12:46:28.200000
2008-09-12T14:35:50.667000
58,872
58,885
Rectangle functions in emacs
I've read in several places that the rectangle functions in emacs are very useful. I've read a bit about them, and I can't quite figure why. I mean, when you want to kill a paragraph, you mark the first row/column and then the last one, and that's actually a rectangle, right? But you can still use the normal kill... So...
If you have data in columns in a text file with M-x delete-rectangle or M-x kill-rectangle you can delete a single column of data. Similarly, M-x yank-rectangle will paste in a column of text. For example, take the following text: 1. alligator alphorn 2. baboon bugle 3. crocodile cornet 4. dog didgeridoo 5. elephant eu...
Rectangle functions in emacs I've read in several places that the rectangle functions in emacs are very useful. I've read a bit about them, and I can't quite figure why. I mean, when you want to kill a paragraph, you mark the first row/column and then the last one, and that's actually a rectangle, right? But you can st...
TITLE: Rectangle functions in emacs QUESTION: I've read in several places that the rectangle functions in emacs are very useful. I've read a bit about them, and I can't quite figure why. I mean, when you want to kill a paragraph, you mark the first row/column and then the last one, and that's actually a rectangle, rig...
[ "emacs" ]
16
23
7,643
3
0
2008-09-12T12:53:35.560000
2008-09-12T12:57:50.560000
58,874
58,875
How do I enable line numbers in VS2008?
I can't seem to find that option. Surely it's in there?
That would be Tools > Options Text Editor > All Languages > Line Numbers (at the bottom right)
How do I enable line numbers in VS2008? I can't seem to find that option. Surely it's in there?
TITLE: How do I enable line numbers in VS2008? QUESTION: I can't seem to find that option. Surely it's in there? ANSWER: That would be Tools > Options Text Editor > All Languages > Line Numbers (at the bottom right)
[ "visual-studio-2008" ]
24
52
22,634
5
0
2008-09-12T12:54:01.660000
2008-09-12T12:55:04.153000
58,878
58,895
Should I use multiple assemblies for an isolated ASP.NET web application?
Coming from a corporate IT environment, the standard was always creating a class library project for each layer, Business Logic, Data Access, and sometimes greater isolation of specific types. Now that I am working on my own web application project, I don't see a real need to isolate my code in this fashion. I don't ha...
Start with the simplest thing possible and add complexity if and when required. Sounds as though a single assembly would work just fine for your case. However, do take care not to violate the layers by having layer A access an internal member of layer B. That would make it harder to pull the layers into separate assemb...
Should I use multiple assemblies for an isolated ASP.NET web application? Coming from a corporate IT environment, the standard was always creating a class library project for each layer, Business Logic, Data Access, and sometimes greater isolation of specific types. Now that I am working on my own web application proje...
TITLE: Should I use multiple assemblies for an isolated ASP.NET web application? QUESTION: Coming from a corporate IT environment, the standard was always creating a class library project for each layer, Business Logic, Data Access, and sometimes greater isolation of specific types. Now that I am working on my own web...
[ ".net", "asp.net", "web-applications", "coding-style" ]
4
1
404
3
0
2008-09-12T12:55:34.853000
2008-09-12T13:00:28.260000
58,886
187,021
Drilling down in VisualVM
I just installed Java 1.6_07 so I could try profiling with VisualVM. It tells me that my app is spending 60% of its time in sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run How do I find out what it was doing during that time? How much of the time was it waiting for something to call it, or doing something else...
I don't have experience with VisualVM -- but JRockit's profiler does provide this information; you may consider using it instead. Update: a question with a list of java profilers can be found here, for users with sufficient rep to view deleted questions.
Drilling down in VisualVM I just installed Java 1.6_07 so I could try profiling with VisualVM. It tells me that my app is spending 60% of its time in sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run How do I find out what it was doing during that time? How much of the time was it waiting for something to call i...
TITLE: Drilling down in VisualVM QUESTION: I just installed Java 1.6_07 so I could try profiling with VisualVM. It tells me that my app is spending 60% of its time in sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run How do I find out what it was doing during that time? How much of the time was it waiting for s...
[ "java", "visualvm" ]
9
5
3,932
4
0
2008-09-12T12:57:55.787000
2008-10-09T12:25:23.657000
58,910
58,912
Converting SVG to PNG using C#
I've been trying to convert SVG images to PNG using C#, without having to write too much code. Can anyone recommend a library or example code for doing this?
You can call the command-line version of inkscape to do this: http://harriyott.com/2008/05/converting-svg-images-to-png-in-c.aspx Also there is a C# SVG rendering engine, primarily designed to allow SVG files to be used on the web on codeplex that might suit your needs if that is your problem: Original Project http://w...
Converting SVG to PNG using C# I've been trying to convert SVG images to PNG using C#, without having to write too much code. Can anyone recommend a library or example code for doing this?
TITLE: Converting SVG to PNG using C# QUESTION: I've been trying to convert SVG images to PNG using C#, without having to write too much code. Can anyone recommend a library or example code for doing this? ANSWER: You can call the command-line version of inkscape to do this: http://harriyott.com/2008/05/converting-sv...
[ "c#", ".net", "png", "svg" ]
119
72
140,951
6
0
2008-09-12T13:09:44.820000
2008-09-12T13:11:39.043000
58,916
58,974
Nested SQL Server transaction performing cascade delete
Suppose I have a table called Companies that has a DepartmentID column. There's also a Departaments table that has as EmployeeID column. Of course I have an Employee table as well. The problem is that I want to delete a company, so first i have to delete all the employees for every departament and then all the departam...
I'm not sure why you need nested transactions here. You only need one actual transaction: BEGIN TRAN DELETE FROM Employee FROM Employee INNER JOIN Department ON Employee.DepartmentID = Department.DepartmentID INNER JOIN Company ON Department.CompanyID = Company.CompanyID WHERE Company.CompanyID = @CompanyID DELETE FR...
Nested SQL Server transaction performing cascade delete Suppose I have a table called Companies that has a DepartmentID column. There's also a Departaments table that has as EmployeeID column. Of course I have an Employee table as well. The problem is that I want to delete a company, so first i have to delete all the e...
TITLE: Nested SQL Server transaction performing cascade delete QUESTION: Suppose I have a table called Companies that has a DepartmentID column. There's also a Departaments table that has as EmployeeID column. Of course I have an Employee table as well. The problem is that I want to delete a company, so first i have t...
[ "sql-server", "transactions", "nested", "cascade" ]
0
4
3,504
2
0
2008-09-12T13:12:59.760000
2008-09-12T13:36:48.750000
58,925
58,931
ASP.NET how to Render a control to HTML?
I have any ASP.NET control. I want the HTML string how to do I get the HTML string of the control?
This appears to work. public string RenderControlToHtml(Control ControlToRender) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter stWriter = new System.IO.StringWriter(sb); System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(stWriter); ControlToRender.Rende...
ASP.NET how to Render a control to HTML? I have any ASP.NET control. I want the HTML string how to do I get the HTML string of the control?
TITLE: ASP.NET how to Render a control to HTML? QUESTION: I have any ASP.NET control. I want the HTML string how to do I get the HTML string of the control? ANSWER: This appears to work. public string RenderControlToHtml(Control ControlToRender) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); System...
[ ".net", "asp.net" ]
31
44
33,621
3
0
2008-09-12T13:17:46.393000
2008-09-12T13:19:54.750000
58,937
58,941
How do I toggle Caps Lock in VB.NET?
Using VB.NET, how do I toggle the state of Caps Lock?
From: http://www.vbforums.com/showthread.php?referrerid=61394&t=537891 Imports System.Runtime.InteropServices Public Class Form2 Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, _ ByVal bScan As Byte, _ ByVal dwFlags As Integer, _ ByVal dwExtraInfo As Integer _ ) Private Const VK_CAPITAL As Integer...
How do I toggle Caps Lock in VB.NET? Using VB.NET, how do I toggle the state of Caps Lock?
TITLE: How do I toggle Caps Lock in VB.NET? QUESTION: Using VB.NET, how do I toggle the state of Caps Lock? ANSWER: From: http://www.vbforums.com/showthread.php?referrerid=61394&t=537891 Imports System.Runtime.InteropServices Public Class Form2 Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, _ B...
[ ".net", "windows", "vb.net" ]
5
5
9,732
3
0
2008-09-12T13:22:03.200000
2008-09-12T13:24:33.193000
58,939
58,963
JComboBox Selection Change Listener?
I'm trying to get an event to fire whenever a choice is made from a JComboBox. The problem I'm having is that there is no obvious addSelectionListener() method. I've tried to use actionPerformed(), but it never fires. Short of overriding the model for the JComboBox, I'm out of ideas. How do I get notified of a selectio...
It should respond to ActionListeners, like this: combo.addActionListener (new ActionListener () { public void actionPerformed(ActionEvent e) { doSomething(); } }); @John Calsbeek rightly points out that addItemListener() will work, too. You may get 2 ItemEvents, though, one for the deselection of the previously selecte...
JComboBox Selection Change Listener? I'm trying to get an event to fire whenever a choice is made from a JComboBox. The problem I'm having is that there is no obvious addSelectionListener() method. I've tried to use actionPerformed(), but it never fires. Short of overriding the model for the JComboBox, I'm out of ideas...
TITLE: JComboBox Selection Change Listener? QUESTION: I'm trying to get an event to fire whenever a choice is made from a JComboBox. The problem I'm having is that there is no obvious addSelectionListener() method. I've tried to use actionPerformed(), but it never fires. Short of overriding the model for the JComboBox...
[ "java", "swing", "jcombobox", "itemlistener" ]
173
196
389,158
8
0
2008-09-12T13:24:16.580000
2008-09-12T13:32:22.160000
58,940
59,015
Access to Result sets from within Stored procedures Transact-SQL SQL Server
I'm using SQL Server 2005, and I would like to know how to access different result sets from within transact-sql. The following stored procedure returns two result sets, how do I access them from, for example, another stored procedure? CREATE PROCEDURE getOrder (@orderId as numeric) AS BEGIN select order_address, order...
The short answer is: you can't do it. From T-SQL there is no way to access multiple results of a nested stored procedure call, without changing the stored procedure as others have suggested. To be complete, if the procedure were returning a single result, you could insert it into a temp table or table variable with the...
Access to Result sets from within Stored procedures Transact-SQL SQL Server I'm using SQL Server 2005, and I would like to know how to access different result sets from within transact-sql. The following stored procedure returns two result sets, how do I access them from, for example, another stored procedure? CREATE P...
TITLE: Access to Result sets from within Stored procedures Transact-SQL SQL Server QUESTION: I'm using SQL Server 2005, and I would like to know how to access different result sets from within transact-sql. The following stored procedure returns two result sets, how do I access them from, for example, another stored p...
[ "sql", "sql-server", "t-sql" ]
37
34
60,230
7
0
2008-09-12T13:24:24.630000
2008-09-12T13:48:13.370000
58,969
63,442
Best Way to Unit Test a Website With Multiple User Types with PHPUnit
I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I currently have a user class and I would like to pass this to each function but I can't figure o...
If your various user classes inherit from a parent user class, then I recommend you use the same inheritance structure for your test case classes. Consider the following sample classes: class User { public function commonFunctionality() { return 'Something'; } public function modifiedFunctionality() { return 'One Thin...
Best Way to Unit Test a Website With Multiple User Types with PHPUnit I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I currently have a user cla...
TITLE: Best Way to Unit Test a Website With Multiple User Types with PHPUnit QUESTION: I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I current...
[ "unit-testing", "types", "phpunit" ]
3
2
1,307
3
0
2008-09-12T13:35:08.567000
2008-09-15T14:33:08.073000
58,976
58,993
How do I get the current state of Caps Lock in VB.NET?
How do I find out whether or not Caps Lock is activated, using VB.NET? This is a follow-up to my earlier question.
Control.IsKeyLocked(Keys) Method - MSDN Imports System Imports System.Windows.Forms Imports Microsoft.VisualBasic Public Class CapsLockIndicator Public Shared Sub Main() if Control.IsKeyLocked(Keys.CapsLock) Then MessageBox.Show("The Caps Lock key is ON.") Else MessageBox.Show("The Caps Lock key is OFF.") End If End ...
How do I get the current state of Caps Lock in VB.NET? How do I find out whether or not Caps Lock is activated, using VB.NET? This is a follow-up to my earlier question.
TITLE: How do I get the current state of Caps Lock in VB.NET? QUESTION: How do I find out whether or not Caps Lock is activated, using VB.NET? This is a follow-up to my earlier question. ANSWER: Control.IsKeyLocked(Keys) Method - MSDN Imports System Imports System.Windows.Forms Imports Microsoft.VisualBasic Public C...
[ ".net", "windows", "vb.net" ]
11
17
17,108
4
0
2008-09-12T13:37:16.347000
2008-09-12T13:41:04.043000
58,988
59,008
What is the reasoning behind the Interface Segregation Principle?
The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why is this important?
ISP states that: Clients should not be forced to depend on methods that they do not use. ISP relates to important characteristics - cohesion and coupling. Ideally your components must be highly tailored. It improves code robustness and maintainability. Enforcing ISP gives you following bonuses: High cohesion - better u...
What is the reasoning behind the Interface Segregation Principle? The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why is this important?
TITLE: What is the reasoning behind the Interface Segregation Principle? QUESTION: The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why is this important? ANSWER: ISP states that: Clients should not be forced to depend on methods that t...
[ "java", "oop", "solid-principles", "design-principles", "interface-segregation-principle" ]
27
34
9,796
7
0
2008-09-12T13:40:17.947000
2008-09-12T13:45:54.407000
59,000
59,011
Enforce SSL in code in an ashx handler
I have a site, which contains several ashx handlers, on a couple of the handlers I want to reject non-SSL requests. Is there a way that I can do this in code?
If you must do it programmatically, a way I've done it in the past is to inspect the url and look for "https" in it. Redirect if you don't see that. Request.IsSecureConnection should be the preferred method, however. You may have to add additional logic to handle a loopback address.
Enforce SSL in code in an ashx handler I have a site, which contains several ashx handlers, on a couple of the handlers I want to reject non-SSL requests. Is there a way that I can do this in code?
TITLE: Enforce SSL in code in an ashx handler QUESTION: I have a site, which contains several ashx handlers, on a couple of the handlers I want to reject non-SSL requests. Is there a way that I can do this in code? ANSWER: If you must do it programmatically, a way I've done it in the past is to inspect the url and lo...
[ "asp.net", "ssl" ]
3
5
1,367
3
0
2008-09-12T13:42:29.127000
2008-09-12T13:47:03.360000
59,007
59,349
How do I use a start commit hook in TortoiseSVN to setup a custom log entry?
I'd like to automate TortoiseSVN as part of a commit process. Specifically I'd like to dynamically create a log entry for the commit dialog. I know that I can launch the commit dialog either from the commandline or by right clicking on a folder and selecting svncommit. I'd like to use the start commit hook to setup a l...
Looks like it was my own misunderstanding of the the API that caused by a problem. Solution: 1) I've added a start commit hook script to TortoiseSVN using the hooks gui in the settings area of the right click menu. 2) The script receive 3 pieces of information: PATH MESSAGEFILE CWD For details see: Manual These are pas...
How do I use a start commit hook in TortoiseSVN to setup a custom log entry? I'd like to automate TortoiseSVN as part of a commit process. Specifically I'd like to dynamically create a log entry for the commit dialog. I know that I can launch the commit dialog either from the commandline or by right clicking on a folde...
TITLE: How do I use a start commit hook in TortoiseSVN to setup a custom log entry? QUESTION: I'd like to automate TortoiseSVN as part of a commit process. Specifically I'd like to dynamically create a log entry for the commit dialog. I know that I can launch the commit dialog either from the commandline or by right c...
[ "tortoisesvn" ]
2
2
3,208
2
0
2008-09-12T13:45:27.170000
2008-09-12T15:40:52.820000
59,013
59,071
How to check which locale is a .NET application running under, without having access to its sourcecode?
Context: I'm in charge of running a service written in.NET. Proprietary application. It uses a SQL Server database. It ran as a user member of the Administrators group in the local machine. It worked alright before I added the machine to a domain. So, I added the machine to a domain (Win 2003) and changed the user to a...
There are two types of localisation in.NET, both the settings for the cultures can be found in these variables (fire up a.NET command line app on the machine to see what it says): System.Thread.CurrentThread.CurrentCulture & System.Thread.CurrentThread.CurrentUICulture http://msdn.microsoft.com/en-us/library/system.thr...
How to check which locale is a .NET application running under, without having access to its sourcecode? Context: I'm in charge of running a service written in.NET. Proprietary application. It uses a SQL Server database. It ran as a user member of the Administrators group in the local machine. It worked alright before I...
TITLE: How to check which locale is a .NET application running under, without having access to its sourcecode? QUESTION: Context: I'm in charge of running a service written in.NET. Proprietary application. It uses a SQL Server database. It ran as a user member of the Administrators group in the local machine. It worke...
[ ".net", "sql-server", "windows", "locale" ]
0
3
2,709
5
0
2008-09-12T13:47:34.310000
2008-09-12T14:02:34.070000
59,016
59,427
What is the meaning and reasoning behind the Open/Closed Principle?
The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design?
Specifically, it is about a "Holy Grail" of design in OOP of making an entity extensible enough (through its individual design or through its participation in the architecture) to support future unforseen changes without rewriting its code (and sometimes even without re-compiling **). Some ways to do this include Polym...
What is the meaning and reasoning behind the Open/Closed Principle? The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design?
TITLE: What is the meaning and reasoning behind the Open/Closed Principle? QUESTION: The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design? ANS...
[ "oop", "definition", "solid-principles", "design-principles", "open-closed-principle" ]
63
32
14,029
14
0
2008-09-12T13:48:42.403000
2008-09-12T16:21:56.823000
59,022
59,035
Replacing plain text password for app
We are currently storing plain text passwords for a web app that we have. I keep advocating moving to a password hash but another developer said that this would be less secure -- more passwords could match the hash and a dictionary/hash attack would be faster. Is there any truth to this argument?
Absolutely none. But it doesn't matter. I've posted a similar response before: It's unfortunate, but people, even programmers, are just too emotional to be easily be swayed by argument. Once he's invested in his position (and, if you're posting here, he is) you're not likely to convince him with facts alone. What you n...
Replacing plain text password for app We are currently storing plain text passwords for a web app that we have. I keep advocating moving to a password hash but another developer said that this would be less secure -- more passwords could match the hash and a dictionary/hash attack would be faster. Is there any truth to...
TITLE: Replacing plain text password for app QUESTION: We are currently storing plain text passwords for a web app that we have. I keep advocating moving to a password hash but another developer said that this would be less secure -- more passwords could match the hash and a dictionary/hash attack would be faster. Is ...
[ "passwords" ]
6
15
1,262
14
0
2008-09-12T13:50:42.990000
2008-09-12T13:54:20.160000
59,044
59,055
How do I do a simple 'Find and Replace" in MsSQL?
Question is pretty self explanitory. I want to do a simple find and replace, like you would in a text editor on the data in a column of my database (which is MsSQL on MS Windows server 2003)
The following query replace each and every a character with a b character. UPDATE YourTable SET Column1 = REPLACE(Column1,'a','b') WHERE Column1 LIKE '%a%' This will not work on SQL server 2003.
How do I do a simple 'Find and Replace" in MsSQL? Question is pretty self explanitory. I want to do a simple find and replace, like you would in a text editor on the data in a column of my database (which is MsSQL on MS Windows server 2003)
TITLE: How do I do a simple 'Find and Replace" in MsSQL? QUESTION: Question is pretty self explanitory. I want to do a simple find and replace, like you would in a text editor on the data in a column of my database (which is MsSQL on MS Windows server 2003) ANSWER: The following query replace each and every a charact...
[ "sql", "sql-server" ]
91
167
194,678
5
0
2008-09-12T13:56:30.357000
2008-09-12T13:59:36.777000
59,075
59,114
Save each sheet in a workbook to separate CSV files
How do I save each sheet in an Excel workbook to separate CSV files with a macro? I have an excel with multiple sheets and I was looking for a macro that will save each sheet to a separate CSV (comma separated file). Excel will not allow you to save all sheets to different CSV files.
Here is one that will give you a visual file chooser to pick the folder you want to save the files to and also lets you choose the CSV delimiter (I use pipes '|' because my fields contain commas and I don't want to deal with quotes): ' ---------------------- Directory Choosing Helper Functions ----------------------- '...
Save each sheet in a workbook to separate CSV files How do I save each sheet in an Excel workbook to separate CSV files with a macro? I have an excel with multiple sheets and I was looking for a macro that will save each sheet to a separate CSV (comma separated file). Excel will not allow you to save all sheets to diff...
TITLE: Save each sheet in a workbook to separate CSV files QUESTION: How do I save each sheet in an Excel workbook to separate CSV files with a macro? I have an excel with multiple sheets and I was looking for a macro that will save each sheet to a separate CSV (comma separated file). Excel will not allow you to save ...
[ "excel", "vba", "csv" ]
85
66
152,971
9
0
2008-09-12T14:04:02.600000
2008-09-12T14:23:23.693000
59,080
59,109
SqlServer Express slow performance
I am stress testing a.NET web application. I did this for 2 reasons: I wanted to see what performance was like under real world conditions and also to make sure we hadn't missed any problems during testing. We had 30 concurrent users in the application using it as they would during the normal course of their jobs. Most...
This is just something that I thought of, but check to see how much memory SQL Server is using when you have 20+ users - one of the limitations of the Express version is that it is limited to 1GB of RAM. So it might just be a simple matter of there not being enough memory available to to server due to the limitations o...
SqlServer Express slow performance I am stress testing a.NET web application. I did this for 2 reasons: I wanted to see what performance was like under real world conditions and also to make sure we hadn't missed any problems during testing. We had 30 concurrent users in the application using it as they would during th...
TITLE: SqlServer Express slow performance QUESTION: I am stress testing a.NET web application. I did this for 2 reasons: I wanted to see what performance was like under real world conditions and also to make sure we hadn't missed any problems during testing. We had 30 concurrent users in the application using it as th...
[ "asp.net", "performance", "subsonic", "sql-server-express" ]
0
3
3,177
6
0
2008-09-12T14:05:35.717000
2008-09-12T14:22:24.070000
59,083
59,086
What is Adobe Flex? Is it just Flash II?
Question Alright, I'm confused by all the buzzwords and press release bingo going on. What is the relationship between flash and flex: Replace flash (not really compatible) Enhance flash The next version of flash but still basically compatible Separate technology altogether??? If I'm starting out in Flash now, should I...
Adobe Flex Builder is Adobe's IDE for developing applications that will run in the Flash plugin. The Flex SDK refers to the libraries that developers uses to write the applications. Essentially, the term 'Flex' is the development side and 'Flash' is the run time side of Adobe's technology. Correction: The term 'Flash' ...
What is Adobe Flex? Is it just Flash II? Question Alright, I'm confused by all the buzzwords and press release bingo going on. What is the relationship between flash and flex: Replace flash (not really compatible) Enhance flash The next version of flash but still basically compatible Separate technology altogether??? I...
TITLE: What is Adobe Flex? Is it just Flash II? QUESTION: Question Alright, I'm confused by all the buzzwords and press release bingo going on. What is the relationship between flash and flex: Replace flash (not really compatible) Enhance flash The next version of flash but still basically compatible Separate technolo...
[ "apache-flex", "flash" ]
82
34
40,909
22
0
2008-09-12T14:06:10.833000
2008-09-12T14:08:11.483000
59,099
59,629
What is the difference between the WPF TextBlock element and Label control?
Visually both of the following snippets produce the same UI. So why are there 2 controls.. Snippet1 Name: Snippet2 Name: ( Well I am gonna answer this myself... thought this is a useful tidbit I learnt today from Programming WPF )
The WPF Textblock inherits from FrameworkElement instead of deriving from System.Windows.Control like the Label Control. This means that the Textblock is much more lightweight. The downside of using a textblock is no support for Access/Accerelator Keys and there is no link to other controls as target. When you want to ...
What is the difference between the WPF TextBlock element and Label control? Visually both of the following snippets produce the same UI. So why are there 2 controls.. Snippet1 Name: Snippet2 Name: ( Well I am gonna answer this myself... thought this is a useful tidbit I learnt today from Programming WPF )
TITLE: What is the difference between the WPF TextBlock element and Label control? QUESTION: Visually both of the following snippets produce the same UI. So why are there 2 controls.. Snippet1 Name: Snippet2 Name: ( Well I am gonna answer this myself... thought this is a useful tidbit I learnt today from Programming W...
[ "wpf" ]
107
118
67,676
6
0
2008-09-12T14:17:11.493000
2008-09-12T17:58:17.653000
59,102
59,108
Best way to write a conversion function
Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined parameter? Example 1 - separate parameters: function convertTem...
Go with the first option, but rather than allow literal strings (which are error prone), take constant values or an enumeration if your language supports it, like this: convertTemperature (TempScale.CELSIUS, TempScale.FAHRENHEIT, 22)
Best way to write a conversion function Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined parameter? Example 1 - ...
TITLE: Best way to write a conversion function QUESTION: Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined param...
[ "coding-style" ]
9
15
3,193
18
0
2008-09-12T14:19:29.537000
2008-09-12T14:21:43.150000
59,105
59,150
Are you fluent in Unicode yet?
Almost 5 years ago Joel Spolsky wrote this article, "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)". Like many, I read it carefully, realizing it was high-time I got to grips with this "replacement for ASCII". Unfortunately, 5 years later I...
Since I read the Joel article and some other I18n articles I always kept a close eye to my character encoding; And it actually works if you do it consistantly. If you work in a company where it is standard to use UTF-8 and everybody knows this / does this it will work. Here some interesting articles (besides Joel's art...
Are you fluent in Unicode yet? Almost 5 years ago Joel Spolsky wrote this article, "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)". Like many, I read it carefully, realizing it was high-time I got to grips with this "replacement for ASCII"....
TITLE: Are you fluent in Unicode yet? QUESTION: Almost 5 years ago Joel Spolsky wrote this article, "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)". Like many, I read it carefully, realizing it was high-time I got to grips with this "repla...
[ "language-agnostic", "unicode", "internationalization", "ascii" ]
12
9
861
4
0
2008-09-12T14:21:25.757000
2008-09-12T14:38:56.557000
59,107
59,119
Can I convert the following code to use generics?
I'm converting an application to use Java 1.5 and have found the following method: /** * Compare two Comparables, treat nulls as -infinity. * @param o1 * @param o2 * @return -1 if o1<o2, 0 if o1==o2, 1 if o1>o2 */ protected static int nullCompare(Comparable o1, Comparable o2) { if (o1 == null) { if (o2 == null) { retur...
Change it to: protected static > int nullCompare(T o1, T o2) { You need that because Comparable is itself a generic type.
Can I convert the following code to use generics? I'm converting an application to use Java 1.5 and have found the following method: /** * Compare two Comparables, treat nulls as -infinity. * @param o1 * @param o2 * @return -1 if o1<o2, 0 if o1==o2, 1 if o1>o2 */ protected static int nullCompare(Comparable o1, Comparab...
TITLE: Can I convert the following code to use generics? QUESTION: I'm converting an application to use Java 1.5 and have found the following method: /** * Compare two Comparables, treat nulls as -infinity. * @param o1 * @param o2 * @return -1 if o1<o2, 0 if o1==o2, 1 if o1>o2 */ protected static int nullCompare(Compa...
[ "java", "generics", "comparison" ]
18
21
1,124
5
0
2008-09-12T14:21:39.483000
2008-09-12T14:24:53.267000
59,120
59,208
VS 2005 Installer Project Version Number
I am getting this error now that I hit version number 1.256.0: Error 4 Invalid product version '1.256.0'. Must be of format '##.##.####' The installer was fine with 1.255.0 but something with 256 (2^8) it doesn't like. I found this stated on msdn.com: The Version property must be formatted as N.N.N, where each N repres...
This article says there is a major and minor max of 255. http://msdn.microsoft.com/en-us/library/aa370859(VS.85).aspx
VS 2005 Installer Project Version Number I am getting this error now that I hit version number 1.256.0: Error 4 Invalid product version '1.256.0'. Must be of format '##.##.####' The installer was fine with 1.255.0 but something with 256 (2^8) it doesn't like. I found this stated on msdn.com: The Version property must b...
TITLE: VS 2005 Installer Project Version Number QUESTION: I am getting this error now that I hit version number 1.256.0: Error 4 Invalid product version '1.256.0'. Must be of format '##.##.####' The installer was fine with 1.255.0 but something with 256 (2^8) it doesn't like. I found this stated on msdn.com: The Versi...
[ "visual-studio-2005", "installation" ]
2
0
1,073
2
0
2008-09-12T14:25:08.697000
2008-09-12T15:03:30.930000
59,128
59,256
What GUI should I run with JUnit(similar to NUnit gui)
What GUI should use to run my JUnit tests, and how exactly do I do that? My entire background is in.NET, so I'm used to just firing up my NUnit gui and running my unit tests. If the lights are green, I'm clean. Now, I have to write some Java code and want to run something similar using JUnit. The JUnit documentation is...
Eclipse is by-far the best I've used. Couple JUnit with a code coverage plug-in and Eclipse will probably be the best unit-tester.
What GUI should I run with JUnit(similar to NUnit gui) What GUI should use to run my JUnit tests, and how exactly do I do that? My entire background is in.NET, so I'm used to just firing up my NUnit gui and running my unit tests. If the lights are green, I'm clean. Now, I have to write some Java code and want to run so...
TITLE: What GUI should I run with JUnit(similar to NUnit gui) QUESTION: What GUI should use to run my JUnit tests, and how exactly do I do that? My entire background is in.NET, so I'm used to just firing up my NUnit gui and running my unit tests. If the lights are green, I'm clean. Now, I have to write some Java code ...
[ "java", "ide", "junit" ]
10
4
13,590
5
0
2008-09-12T14:27:53.823000
2008-09-12T15:17:20.380000
59,129
75,506
What platforms JavaFX is/will be supported on?
I have read about JavaFX, and like all new technologies I wanted to get my hands "dirty" with it. However, although it talks of multiplatform support, I can't find specifics on this. What platforms support a JavaFX application? All those with Java SE? ME? Does it depend upon the APIs in JavaFX that I use?
JavaFX has three planned distributions. JavaFX Desktop will run on Windows, Mac, Linux, and Solaris at FCS and will require Java SE. Support for Linux and Solaris will be forthcoming. JavaFX TV and JavaFX Mobile have no announce target platforms. Also unannounced is whether they will run on ME or SE, and if ME which pr...
What platforms JavaFX is/will be supported on? I have read about JavaFX, and like all new technologies I wanted to get my hands "dirty" with it. However, although it talks of multiplatform support, I can't find specifics on this. What platforms support a JavaFX application? All those with Java SE? ME? Does it depend up...
TITLE: What platforms JavaFX is/will be supported on? QUESTION: I have read about JavaFX, and like all new technologies I wanted to get my hands "dirty" with it. However, although it talks of multiplatform support, I can't find specifics on this. What platforms support a JavaFX application? All those with Java SE? ME?...
[ "java", "javafx" ]
4
3
1,087
3
0
2008-09-12T14:28:14.647000
2008-09-16T18:34:02.933000
59,133
74,579
Bug template in Bugzilla
Is there any way to enforce a template in Bugzilla to guide users fill in bugs descriptions? Actually, i'd like to put some markup texts in the bug description field and avoid the creation of custom fields. I've installed version 3.2rc1.
Indeed, just check../enter_bug.cgi?format=guided, which forms an example of the template feature. Half the work is already done for you.
Bug template in Bugzilla Is there any way to enforce a template in Bugzilla to guide users fill in bugs descriptions? Actually, i'd like to put some markup texts in the bug description field and avoid the creation of custom fields. I've installed version 3.2rc1.
TITLE: Bug template in Bugzilla QUESTION: Is there any way to enforce a template in Bugzilla to guide users fill in bugs descriptions? Actually, i'd like to put some markup texts in the bug description field and avoid the creation of custom fields. I've installed version 3.2rc1. ANSWER: Indeed, just check../enter_bug...
[ "bug-tracking", "bugzilla" ]
4
2
4,208
2
0
2008-09-12T14:30:09.120000
2008-09-16T17:03:00.437000
59,148
59,171
Subversion Client-Side application
Which standalone Windows GUI application do you recommend for use for accessing a Subversion repository? Edit: A lot of people are mentioning Tortoise, however I am looking for an application not a shell extension. Also people are questioning my reasoning behind not wanting to use a shell extension. In our environment ...
Standalone Clients For total stand alone Synchro SVN is a powerful and cross platform solution. It looks like the most native application on each of the platforms. The Subversion website includes a listing of other standalone SVN Clients (most are cross platform). [Copied list below from http://subversion.tigris.org/li...
Subversion Client-Side application Which standalone Windows GUI application do you recommend for use for accessing a Subversion repository? Edit: A lot of people are mentioning Tortoise, however I am looking for an application not a shell extension. Also people are questioning my reasoning behind not wanting to use a s...
TITLE: Subversion Client-Side application QUESTION: Which standalone Windows GUI application do you recommend for use for accessing a Subversion repository? Edit: A lot of people are mentioning Tortoise, however I am looking for an application not a shell extension. Also people are questioning my reasoning behind not ...
[ "windows", "svn" ]
11
29
8,430
12
0
2008-09-12T14:38:02.520000
2008-09-12T14:48:07.673000
59,154
59,161
Set Google Chrome as the debugging browser in Visual Studio
When I press F5 in Visual Studio 2008, I want Google Chrome launched as the browser that my ASP.NET app runs in. May I know how this can be done?
Right click on an.aspx file and click "Browse with..." then select Chrome and click "Set as Default." You can select more than one browser in the list if you want. There's also this really great WoVS Default Browser Switcher Visual Studio extension.
Set Google Chrome as the debugging browser in Visual Studio When I press F5 in Visual Studio 2008, I want Google Chrome launched as the browser that my ASP.NET app runs in. May I know how this can be done?
TITLE: Set Google Chrome as the debugging browser in Visual Studio QUESTION: When I press F5 in Visual Studio 2008, I want Google Chrome launched as the browser that my ASP.NET app runs in. May I know how this can be done? ANSWER: Right click on an.aspx file and click "Browse with..." then select Chrome and click "Se...
[ "visual-studio-2008", "google-chrome" ]
87
80
163,120
11
0
2008-09-12T14:39:54.340000
2008-09-12T14:42:25.113000
59,166
59,172
How do you declare a Predicate Delegate inline?
So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects. List myObjects = new List (); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myObject3); So I want to remove objects from my list based on some criteria. For instance, myObject.X >= 10. I wo...
There's two options, an explicit delegate or a delegate disguised as a lamba construct: explicit delegate myObjects.RemoveAll(delegate (MyObject m) { return m.X >= 10; }); lambda myObjects.RemoveAll(m => m.X >= 10); Performance wise both are equal. As a matter of fact, both language constructs generate the same IL when...
How do you declare a Predicate Delegate inline? So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects. List myObjects = new List (); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myObject3); So I want to remove objects from my list based on som...
TITLE: How do you declare a Predicate Delegate inline? QUESTION: So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects. List myObjects = new List (); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myObject3); So I want to remove objects from my...
[ "c#", "delegates" ]
43
58
34,336
4
0
2008-09-12T14:45:45.697000
2008-09-12T14:48:08.563000
59,180
59,190
How do I disable validation in Web Data Administrator?
I'm trying to run some queries to get rid of XSS in our database using Web Data Administrator but I keep running into this Potentially Dangerous Request crap. How do I disable validation of the query in Web Data Administrator?
Go into the install directory of web data admin, usually: C:\Program Files\Microsoft SQL Server Tools\Microsoft SQL Web Data Administrator Then in the "Web" folder open the file "QueryDatabase.aspx" and edit the following line: <%@ Page language="c#" Codebehind="QueryDatabase.aspx.cs" AutoEventWireup="false" Inherits="...
How do I disable validation in Web Data Administrator? I'm trying to run some queries to get rid of XSS in our database using Web Data Administrator but I keep running into this Potentially Dangerous Request crap. How do I disable validation of the query in Web Data Administrator?
TITLE: How do I disable validation in Web Data Administrator? QUESTION: I'm trying to run some queries to get rid of XSS in our database using Web Data Administrator but I keep running into this Potentially Dangerous Request crap. How do I disable validation of the query in Web Data Administrator? ANSWER: Go into the...
[ "sql", "sql-server" ]
0
1
164
1
0
2008-09-12T14:53:04.930000
2008-09-12T14:56:54.703000
59,181
59,764
WCF Service support file jsdebug fails to load
I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. Restarting IIS or clearing out the Temp ASP.Net files or setting batch="fa...
Figured it out! Here is the services configuration section from web.config Look at the bindingConfiguration attribute on the endpoint. The value "webBinding" points to the binding name="webBinding" tag in the bindings and that is what tells the service to use Transport level security it HTTPS. In my case the attribute ...
WCF Service support file jsdebug fails to load I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. Restarting IIS or clearing ...
TITLE: WCF Service support file jsdebug fails to load QUESTION: I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. Restartin...
[ "asp.net", "wcf", "javascript-debugger" ]
4
12
10,452
3
0
2008-09-12T14:53:19.597000
2008-09-12T19:01:57.953000
59,182
59,189
What is the best way to keep an asp:button from displaying it's URL on the status bar?
What is the best way to keep an asp:button from displaying it's URL on the status bar of the browser? The button is currently defines like this: Update: This appears to be specific to IE7, IE6 and FF do not show the URL in the status bar.
I use FF so never noticed this, but the link does in fact appear in the status bar in IE.. I dont think you can overwrite it:( I initially thought maybe setting the ToolTip (al la "title") property might do it.. Seems it does not.. Looking at the source, what appears is nowhere to be found, so I would say this is a bro...
What is the best way to keep an asp:button from displaying it's URL on the status bar? What is the best way to keep an asp:button from displaying it's URL on the status bar of the browser? The button is currently defines like this: Update: This appears to be specific to IE7, IE6 and FF do not show the URL in the status...
TITLE: What is the best way to keep an asp:button from displaying it's URL on the status bar? QUESTION: What is the best way to keep an asp:button from displaying it's URL on the status bar of the browser? The button is currently defines like this: Update: This appears to be specific to IE7, IE6 and FF do not show the...
[ "asp.net" ]
1
0
989
2
0
2008-09-12T14:53:24.760000
2008-09-12T14:56:51.117000
59,191
63,770
Do I need to copy the .compiled files to the production server?
I'm using a deploy project to deploy my ASP.net web application. When I build the deploy project, all the.compiled files are re-created. Do I need to FTP them to the production web server? If I do a small change do I need to copy all the web site again?
From my own research, the.compiled files must be copied to the production server, but not needed to copied every time from Rick Strahl excellent blog: The output from the merge utilitity can combine all markup and CodeBeside code into a single assembly, but you will still end up with the.compiled files which are requir...
Do I need to copy the .compiled files to the production server? I'm using a deploy project to deploy my ASP.net web application. When I build the deploy project, all the.compiled files are re-created. Do I need to FTP them to the production web server? If I do a small change do I need to copy all the web site again?
TITLE: Do I need to copy the .compiled files to the production server? QUESTION: I'm using a deploy project to deploy my ASP.net web application. When I build the deploy project, all the.compiled files are re-created. Do I need to FTP them to the production web server? If I do a small change do I need to copy all the ...
[ "asp.net", "deployment", "web-deployment-project" ]
10
8
3,193
3
0
2008-09-12T14:57:00.740000
2008-09-15T15:10:11.590000
59,194
59,252
Developing drivers with no info
How does the open-source/free software community develop drivers for products that offer no documentation?
How do you reverse engineer something? You observe the input and output, and develop a set of rules or models that describe the operation of the object. Example: Let's say you want to develop a USB camera driver. The "black box" is the software driver. Develop hooks into the OS and/or driver so you can see the inputs a...
Developing drivers with no info How does the open-source/free software community develop drivers for products that offer no documentation?
TITLE: Developing drivers with no info QUESTION: How does the open-source/free software community develop drivers for products that offer no documentation? ANSWER: How do you reverse engineer something? You observe the input and output, and develop a set of rules or models that describe the operation of the object. E...
[ "linux", "kernel", "drivers", "bsd" ]
2
7
427
3
0
2008-09-12T14:58:29.770000
2008-09-12T15:17:03.063000
59,195
59,266
How are Mocks meant to be used?
When I originally was introduced to Mocks I felt the primary purpose was to mock up objects that come from external sources of data. This way I did not have to maintain an automated unit testing test database, I could just fake it. But now I am starting to think of it differently. I am wondering if Mocks are more effec...
I recommend you take a look at Martin Fowler's article Mocks Aren't Stubs for a more authoritative treatment of Mocks than I can give you. The purpose of mocks is to unit test your code in isolation of dependencies so you can truly test a piece of code at the "unit" level. The code under test is the real deal, and ever...
How are Mocks meant to be used? When I originally was introduced to Mocks I felt the primary purpose was to mock up objects that come from external sources of data. This way I did not have to maintain an automated unit testing test database, I could just fake it. But now I am starting to think of it differently. I am w...
TITLE: How are Mocks meant to be used? QUESTION: When I originally was introduced to Mocks I felt the primary purpose was to mock up objects that come from external sources of data. This way I did not have to maintain an automated unit testing test database, I could just fake it. But now I am starting to think of it d...
[ "unit-testing", "mocking" ]
24
20
2,827
9
0
2008-09-12T14:59:14.153000
2008-09-12T15:20:04.260000
59,213
61,809
Easiest way to add a Header and Footer to a Printing.PrintDocument (.Net 2.0)?
What's the easiest way to add a header and footer to a.Net PrintDocument object, either pragmatically or at design-time? Specifically I'm trying to print a 3rd party grid control (Infragistics GridEx v4.3), which takes a PrintDocument object and draws itself into it. The resulting page just contains the grid and it's c...
The printdocument object fires the printpage event for each page to be printed. You can draw text/lines/etc into the print queue using the printpageeventargs event parameter: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx Dim it WithEvents when you pass it to the grid, so you can han...
Easiest way to add a Header and Footer to a Printing.PrintDocument (.Net 2.0)? What's the easiest way to add a header and footer to a.Net PrintDocument object, either pragmatically or at design-time? Specifically I'm trying to print a 3rd party grid control (Infragistics GridEx v4.3), which takes a PrintDocument object...
TITLE: Easiest way to add a Header and Footer to a Printing.PrintDocument (.Net 2.0)? QUESTION: What's the easiest way to add a header and footer to a.Net PrintDocument object, either pragmatically or at design-time? Specifically I'm trying to print a 3rd party grid control (Infragistics GridEx v4.3), which takes a Pr...
[ ".net", "vb.net", "printing", "header", "printdocument" ]
4
4
22,398
2
0
2008-09-12T15:05:25.247000
2008-09-15T02:47:19.020000
59,217
59,250
Merging two arrays in .NET
Is there a built in function in.NET 2.0 that will take two arrays and merge them into one array? The arrays are both of the same type. I'm getting these arrays from a widely used function within my code base and can't modify the function to return the data in a different format. I'm looking to avoid writing my own func...
If you can manipulate one of the arrays, you can resize it before performing the copy: T[] array1 = getOneArray(); T[] array2 = getAnotherArray(); int array1OriginalLength = array1.Length; Array.Resize (ref array1, array1OriginalLength + array2.Length); Array.Copy(array2, 0, array1, array1OriginalLength, array2.Length)...
Merging two arrays in .NET Is there a built in function in.NET 2.0 that will take two arrays and merge them into one array? The arrays are both of the same type. I'm getting these arrays from a widely used function within my code base and can't modify the function to return the data in a different format. I'm looking t...
TITLE: Merging two arrays in .NET QUESTION: Is there a built in function in.NET 2.0 that will take two arrays and merge them into one array? The arrays are both of the same type. I'm getting these arrays from a widely used function within my code base and can't modify the function to return the data in a different for...
[ "c#", ".net", "arrays" ]
307
142
535,571
28
0
2008-09-12T15:07:04.587000
2008-09-12T15:16:35.717000
59,220
59,243
How Do I Load an Assembly and All of its Dependencies at Runtime in C# for Reflection?
I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use. What I'm after is basically pointing the application at an assembly and choosing a given class from which to select properties that should be included in an exported HT...
Couple of options here: Attach to AppDomain.AssemblyResolve and do another LoadFile based on the requested assembly. Spin up another AppDomain with the directory as its base and load the assemblies in that AppDomain. I'd highly recommend pursuing option 2, since that will likely be cleaner and allow you to unload all t...
How Do I Load an Assembly and All of its Dependencies at Runtime in C# for Reflection? I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use. What I'm after is basically pointing the application at an assembly and choosing ...
TITLE: How Do I Load an Assembly and All of its Dependencies at Runtime in C# for Reflection? QUESTION: I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use. What I'm after is basically pointing the application at an asse...
[ "c#", ".net", "reflection", "subsonic" ]
17
13
20,559
2
0
2008-09-12T15:07:26.643000
2008-09-12T15:13:56.800000
59,221
59,260
How can I display simple tooltips on icons in html?
I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_link.add ("move" and "copy"). For clarity, I would like to have a tooltip...
The alt attribute is to be used as an alternative to the image, in the case of the image missing, or in a text only browser. IE got it wrong, when they made alt appear as a tooltip. It was never meant to be that. The correct attribute for this is title, which of course doesn't do a tooltip in IE. So, to do have a toolt...
How can I display simple tooltips on icons in html? I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_link.add ("move" and ...
TITLE: How can I display simple tooltips on icons in html? QUESTION: I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_lin...
[ "html", "ruby-on-rails", "ruby", "tooltip", "activescaffold" ]
4
17
9,503
10
0
2008-09-12T15:07:30.187000
2008-09-12T15:17:53.593000
59,232
59,242
How do I find duplicate values in a table in Oracle?
What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table? For example: I have a JOBS table with the column JOB_NUMBER. How can I find out if I have any duplicate JOB_NUMBER s, and how many times they're duplicated?
Aggregate the column by COUNT, then use a HAVING clause to find values that appear more than once. SELECT column_name, COUNT(column_name) FROM table_name GROUP BY column_name HAVING COUNT(column_name) > 1;
How do I find duplicate values in a table in Oracle? What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table? For example: I have a JOBS table with the column JOB_NUMBER. How can I find out if I have any duplicate JOB_NUMB...
TITLE: How do I find duplicate values in a table in Oracle? QUESTION: What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table? For example: I have a JOBS table with the column JOB_NUMBER. How can I find out if I have any ...
[ "sql", "oracle", "duplicate-data" ]
315
697
858,547
13
0
2008-09-12T15:10:27.277000
2008-09-12T15:13:46.583000
59,270
1,648,552
What is the best way to rollout web applications?
I'm trying to create a standard way of rolling out web applications for our company. Currently we do it with zip files, vbscript/javascript, and manual some steps. For thick client installs we generate MSI installers using Wise/Wix. We don't create installers currently for websites as in general they are just xcopy dep...
Do consider MSDeploy, that is the direction Microsoft will be investing in the future for deployment of web applications... Know more about the future direction at Overview Post for Web Deployment in VS 2010
What is the best way to rollout web applications? I'm trying to create a standard way of rolling out web applications for our company. Currently we do it with zip files, vbscript/javascript, and manual some steps. For thick client installs we generate MSI installers using Wise/Wix. We don't create installers currently ...
TITLE: What is the best way to rollout web applications? QUESTION: I'm trying to create a standard way of rolling out web applications for our company. Currently we do it with zip files, vbscript/javascript, and manual some steps. For thick client installs we generate MSI installers using Wise/Wix. We don't create ins...
[ "asp.net", "deployment" ]
1
1
1,119
7
0
2008-09-12T15:21:22.367000
2009-10-30T08:09:04.463000
59,280
59,317
Programmatically change combobox
I need to update a combobox with a new value so it changes the reflected text in it. The cleanest way to do this is after the combobox has been initialised and with a message. So I am trying to craft a postmessage to the hwnd that contains the combobox. So if I want to send a message to it, changing the currently selec...
You want ComboBox_SetCurSel: ComboBox_SetCurSel(hWndCombo, n); or if it's an MFC CComboBox control you can probably do: m_combo.SetCurSel(2); I would imagine if you're doing it manually you would also want SendMessage rather than PostMessage. CBN_SELCHANGE is the notification that the control sends back to you when the...
Programmatically change combobox I need to update a combobox with a new value so it changes the reflected text in it. The cleanest way to do this is after the combobox has been initialised and with a message. So I am trying to craft a postmessage to the hwnd that contains the combobox. So if I want to send a message to...
TITLE: Programmatically change combobox QUESTION: I need to update a combobox with a new value so it changes the reflected text in it. The cleanest way to do this is after the combobox has been initialised and with a message. So I am trying to craft a postmessage to the hwnd that contains the combobox. So if I want to...
[ "c++", "winapi", "mfc", "combobox", "postmessage" ]
2
8
6,343
4
0
2008-09-12T15:25:03.013000
2008-09-12T15:33:27.720000
59,294
59,302
In SQL, what's the difference between count(column) and count(*)?
I have the following query: select column_name, count(column_name) from table group by column_name having count(column_name) > 1; What would be the difference if I replaced all calls to count(column_name) to count(*)? This question was inspired by How do I find duplicate values in a table in Oracle?. To clarify the acc...
count(*) counts NULLs and count(column) does not [edit] added this code so that people can run it create table #bla(id int,id2 int) insert #bla values(null,null) insert #bla values(1,null) insert #bla values(null,1) insert #bla values(1,null) insert #bla values(null,1) insert #bla values(1,null) insert #bla values(null...
In SQL, what's the difference between count(column) and count(*)? I have the following query: select column_name, count(column_name) from table group by column_name having count(column_name) > 1; What would be the difference if I replaced all calls to count(column_name) to count(*)? This question was inspired by How do...
TITLE: In SQL, what's the difference between count(column) and count(*)? QUESTION: I have the following query: select column_name, count(column_name) from table group by column_name having count(column_name) > 1; What would be the difference if I replaced all calls to count(column_name) to count(*)? This question was ...
[ "sql" ]
224
252
49,521
12
0
2008-09-12T15:27:17.253000
2008-09-12T15:28:15.127000
59,296
423,346
How do you stop IIS SMTP Server from sending bounce emails?
How do you stop the "Default SMTP Virtual Server" from sending bounce messages for email addresses that you don't have? i.e. I'm using IIS' SMTP server to handle my email and if an email is sent unknown at mydomain.com a bounce email with 'address not known' (or something like that) is sent back to the sender. I want i...
I found this article which has a script you can run to configure a catch-all account on your server. All emails which would generate a NDR will instead be directed to this account. Sorry, I haven't tested it. The article above has been removed here it is via the WayBack Machine Basically the short answer to your questi...
How do you stop IIS SMTP Server from sending bounce emails? How do you stop the "Default SMTP Virtual Server" from sending bounce messages for email addresses that you don't have? i.e. I'm using IIS' SMTP server to handle my email and if an email is sent unknown at mydomain.com a bounce email with 'address not known' (...
TITLE: How do you stop IIS SMTP Server from sending bounce emails? QUESTION: How do you stop the "Default SMTP Virtual Server" from sending bounce messages for email addresses that you don't have? i.e. I'm using IIS' SMTP server to handle my email and if an email is sent unknown at mydomain.com a bounce email with 'ad...
[ "iis", "smtp", "pop3" ]
2
3
5,449
3
0
2008-09-12T15:27:27.593000
2009-01-08T05:25:26.180000
59,297
59,478
When/Why to use Cascading in SQL Server?
When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it? This probably applies to other databases as well. I'm looking most of all for concrete examples of each scenario, preferably from someone who has used them successful...
Summary of what I've seen so far: Some people don't like cascading at all. Cascade Delete Cascade Delete may make sense when the semantics of the relationship can involve an exclusive "is part of " description. For example, an OrderLine record is part of its parent order, and OrderLines will never be shared between mul...
When/Why to use Cascading in SQL Server? When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it? This probably applies to other databases as well. I'm looking most of all for concrete examples of each scenario, preferably ...
TITLE: When/Why to use Cascading in SQL Server? QUESTION: When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it? This probably applies to other databases as well. I'm looking most of all for concrete examples of each sce...
[ "sql-server", "database-design", "foreign-keys", "rdbms", "cascade" ]
176
147
117,433
16
0
2008-09-12T15:27:36.907000
2008-09-12T16:43:57.333000
59,299
101,498
Hibernate - maxElementsOnDisk from EHCache to TreeCache
I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache. I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with passivation activated. Thanks
In the version I am working on (JBossCache 1.4.1), it looks like it is not possible to configure this parameter.
Hibernate - maxElementsOnDisk from EHCache to TreeCache I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache. I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with pass...
TITLE: Hibernate - maxElementsOnDisk from EHCache to TreeCache QUESTION: I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache. I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCac...
[ "java", "hibernate", "caching", "ehcache" ]
1
0
918
2
0
2008-09-12T15:28:01.540000
2008-09-19T12:38:32.067000
59,303
59,341
Wrap an Oracle schema update in a transaction
I've got a program that periodically updates its database schema. Sometimes, one of the DDL statements might fail and if it does, I want to roll back all the changes. I wrap the update in a transaction like so: BEGIN TRAN; CREATE TABLE A (PKey int NOT NULL IDENTITY, NewFieldKey int NULL, CONSTRAINT PK_A PRIMARY KEY (P...
You can not turn this off. Fairly easy to work around by designing your scripts to drop tables in the event they already exist etc... You can look at using FLASHBACK database, I believe you can do this at the schema/object level but check the docs to confirm that. You would need to be on 10G for that to work.
Wrap an Oracle schema update in a transaction I've got a program that periodically updates its database schema. Sometimes, one of the DDL statements might fail and if it does, I want to roll back all the changes. I wrap the update in a transaction like so: BEGIN TRAN; CREATE TABLE A (PKey int NOT NULL IDENTITY, NewFie...
TITLE: Wrap an Oracle schema update in a transaction QUESTION: I've got a program that periodically updates its database schema. Sometimes, one of the DDL statements might fail and if it does, I want to roll back all the changes. I wrap the update in a transaction like so: BEGIN TRAN; CREATE TABLE A (PKey int NOT NUL...
[ "oracle", "transactions", "ddl" ]
4
6
1,703
1
0
2008-09-12T15:28:28.280000
2008-09-12T15:38:10.160000
59,313
59,383
User Initiated Kernel dump in Windows XP
I remember watching a webcast from Mark Russinovich showing the sequence of keyboard keys for a user initiated kernel dump. Can somebody refresh my memory on the exact order of the keys. Please note this is for XP.
http://psacake.com/web/jr.asp contains full instructions, and here's an excerpt: While it may seem odd to think about purposefully causing a Blue Screen Of Death (BSOD), Microsoft includes such a provision in Windows XP. This might come in handy for testing and troubleshooting your Startup And Recovery settings, Event ...
User Initiated Kernel dump in Windows XP I remember watching a webcast from Mark Russinovich showing the sequence of keyboard keys for a user initiated kernel dump. Can somebody refresh my memory on the exact order of the keys. Please note this is for XP.
TITLE: User Initiated Kernel dump in Windows XP QUESTION: I remember watching a webcast from Mark Russinovich showing the sequence of keyboard keys for a user initiated kernel dump. Can somebody refresh my memory on the exact order of the keys. Please note this is for XP. ANSWER: http://psacake.com/web/jr.asp contain...
[ "windows-xp", "kernel", "memory-dump" ]
7
8
2,252
4
0
2008-09-12T15:30:24.437000
2008-09-12T15:54:13.223000
59,322
59,412
In SQL, what’s the difference between count(*) and count('x')?
I have the following code: SELECT, count(*) FROM GROUP BY HAVING COUNT(*) > 1; Is there any difference to the results or performance if I replace the COUNT(*) with COUNT('x')? (This question is related to a previous one )
To say that SELECT COUNT(*) vs COUNT(1) results in your DBMS returning "columns" is pure bunk. That may have been the case long, long ago but any self-respecting query optimizer will choose some fast method to count the rows in the table - there is NO performance difference between SELECT COUNT(*), COUNT(1), COUNT('thi...
In SQL, what’s the difference between count(*) and count('x')? I have the following code: SELECT, count(*) FROM GROUP BY HAVING COUNT(*) > 1; Is there any difference to the results or performance if I replace the COUNT(*) with COUNT('x')? (This question is related to a previous one )
TITLE: In SQL, what’s the difference between count(*) and count('x')? QUESTION: I have the following code: SELECT, count(*) FROM GROUP BY HAVING COUNT(*) > 1; Is there any difference to the results or performance if I replace the COUNT(*) with COUNT('x')? (This question is related to a previous one ) ANSWER: To say t...
[ "sql" ]
14
18
18,275
4
0
2008-09-12T15:34:16.987000
2008-09-12T16:12:59.467000
59,327
59,363
What online brokers offer APIs?
So I'm getting really sick of E*TRADE and, being a developer, would love to find an online broker that offers an API. It would be great to be able to write my own trading tools, and maybe even modify existing ones. Based on my research so far, I've only found one option. Interactive Brokers offers a multi-language API ...
I vote for IB(Interactive Brokers). I've used them in the past as was quite happy. Pinnacle Capital Markets trading also has an API (pcmtrading.com) but I haven't used them. Interactive Brokers: https://www.interactivebrokers.com/en/?f=%2Fen%2Fsoftware%2Fibapi.php Pinnacle Capital Markets: http://www.pcmtrading.com/es/...
What online brokers offer APIs? So I'm getting really sick of E*TRADE and, being a developer, would love to find an online broker that offers an API. It would be great to be able to write my own trading tools, and maybe even modify existing ones. Based on my research so far, I've only found one option. Interactive Brok...
TITLE: What online brokers offer APIs? QUESTION: So I'm getting really sick of E*TRADE and, being a developer, would love to find an online broker that offers an API. It would be great to be able to write my own trading tools, and maybe even modify existing ones. Based on my research so far, I've only found one option...
[ "stock", "trading" ]
155
39
114,255
8
0
2008-09-12T15:34:58.683000
2008-09-12T15:45:58.033000
59,357
89,310
Copying relational data from database to database
Edit: Let me completely rephrase this, because I'm not sure there's an XML way like I was originally describing. Yet another edit: This needs to be a repeatable process, and it has to be able to be set up in a way that it can be called in C# code. In database A, I have a set of tables, related by PKs and FKs. A parent ...
I think most likely what I'm going to use is typed datasets. It won't be a generalized solution; we'll have to regenerate them if any of the tables change. But based on what I've been told, that's not a problem; the tables aren't expected to change much. Datasets will make it reasonably easy to loop through the data hi...
Copying relational data from database to database Edit: Let me completely rephrase this, because I'm not sure there's an XML way like I was originally describing. Yet another edit: This needs to be a repeatable process, and it has to be able to be set up in a way that it can be called in C# code. In database A, I have ...
TITLE: Copying relational data from database to database QUESTION: Edit: Let me completely rephrase this, because I'm not sure there's an XML way like I was originally describing. Yet another edit: This needs to be a repeatable process, and it has to be able to be set up in a way that it can be called in C# code. In d...
[ "sql", "sql-server", "sql-server-2005", ".net-3.5" ]
5
0
2,421
11
0
2008-09-12T15:42:57.900000
2008-09-18T01:54:45.173000
59,377
64,488
Is there a way to use GflAx to incorporate gradient colours?
Ok, narrow question of the day. I'm using GflAx (from xnview ) to create some graphic tiles. I would like to put some gradients in as well though. Is there a way I can do this within this product? There is also an SDK which is part of this product but I can't find that info there.
You can not do this but you can create the gradient in another program and then do a "LoadBitmap" make the mods you need ontop of that 'background' and then save to a new file.
Is there a way to use GflAx to incorporate gradient colours? Ok, narrow question of the day. I'm using GflAx (from xnview ) to create some graphic tiles. I would like to put some gradients in as well though. Is there a way I can do this within this product? There is also an SDK which is part of this product but I can't...
TITLE: Is there a way to use GflAx to incorporate gradient colours? QUESTION: Ok, narrow question of the day. I'm using GflAx (from xnview ) to create some graphic tiles. I would like to put some gradients in as well though. Is there a way I can do this within this product? There is also an SDK which is part of this p...
[ "image-manipulation", "gradient" ]
0
1
314
1
0
2008-09-12T15:49:58.010000
2008-09-15T16:34:51.293000
59,390
59,554
ColdFusion: Is it safe to leave out the variables keyword in a CFC?
In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables? Am I going to get myself into trouble if I change this: to this?
It won't matter to specify "variables" when you create the variable, because foo will be placed in the variables scope by default; but it will matter when you access the variable. doSomething("args") returns "I have args and a function local variable " doAnotherThing("args") returns "I have a private instance of a vari...
ColdFusion: Is it safe to leave out the variables keyword in a CFC? In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables? Am I going to get myself into trouble if I change this: to this?
TITLE: ColdFusion: Is it safe to leave out the variables keyword in a CFC? QUESTION: In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables? Am I going to get myself into trouble if I change this: to this? ANSWER: It won't matter to specify "variables" when you cr...
[ "coldfusion", "cfc" ]
5
10
1,749
9
0
2008-09-12T15:57:04.857000
2008-09-12T17:22:31.873000
59,392
59,400
Best way to migrate from VSS to Subversion?
I'm a single developer looking to get off of Visual Source Safe and move to svn. A quick search brings up several tools, but I don't see a clear winner and I can't afford to spend a lot of time testing different tools. Has anyone done this successfully, and can recommend a method?
I recommend just adding your code to a new Subversion repository rather than importing from VSS. VSS has a convoluted version control model that doesn't translate well to many other systems, and just starting fresh is usually the best way to avoid taking that clutter with you. If you need to keep the history around, ma...
Best way to migrate from VSS to Subversion? I'm a single developer looking to get off of Visual Source Safe and move to svn. A quick search brings up several tools, but I don't see a clear winner and I can't afford to spend a lot of time testing different tools. Has anyone done this successfully, and can recommend a me...
TITLE: Best way to migrate from VSS to Subversion? QUESTION: I'm a single developer looking to get off of Visual Source Safe and move to svn. A quick search brings up several tools, but I don't see a clear winner and I can't afford to spend a lot of time testing different tools. Has anyone done this successfully, and ...
[ "svn", "version-control", "visual-sourcesafe" ]
25
28
20,140
10
0
2008-09-12T15:58:19.360000
2008-09-12T16:01:54.937000
59,396
867,435
Rhino Mocks: How can I mock out a method that transforms its input?
I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so banal). So when mocking my TransactionDao with RhinoMocks how can I indicate that it shoul...
Gorge, The simplest solution, which I found, applied to your question is the following: Expect.Call(() => dao.Save(transaction)).Do(new Action (x => x.IsSaved = true)); So you don't need to create a special delegate or anything else. Just use Action which is in standard.NET 3.5 libraries. Hope this help. Frantisek
Rhino Mocks: How can I mock out a method that transforms its input? I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so banal). So when mockin...
TITLE: Rhino Mocks: How can I mock out a method that transforms its input? QUESTION: I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so bana...
[ "c#", ".net", "rhino-mocks" ]
2
4
2,581
3
0
2008-09-12T16:00:23.210000
2009-05-15T07:44:14.640000