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
54,626
54,637
How do I get an XML file as XML (and not a string) with Ajax in Prototype.js?
This code is from Prototype.js. I've looked at probably 20 different tutorials, and I can't figure out why this is not working. The response I get is null. new Ajax.Request(/path/to / xml / file.xml, { method: "get", contentType: "application/xml", onSuccess: function(transport) { alert(transport.responseXML); } }); If...
If transport.responseXML is null but you have a value for transport.responseText then I believe it's because it's not a valid XML file. Edit: I just noticed that in our code here whenever we request an XML file we set the content type to 'text/xml'. I have no idea if that makes a difference or not.
How do I get an XML file as XML (and not a string) with Ajax in Prototype.js? This code is from Prototype.js. I've looked at probably 20 different tutorials, and I can't figure out why this is not working. The response I get is null. new Ajax.Request(/path/to / xml / file.xml, { method: "get", contentType: "application...
TITLE: How do I get an XML file as XML (and not a string) with Ajax in Prototype.js? QUESTION: This code is from Prototype.js. I've looked at probably 20 different tutorials, and I can't figure out why this is not working. The response I get is null. new Ajax.Request(/path/to / xml / file.xml, { method: "get", content...
[ "javascript", "xml", "prototypejs" ]
0
3
1,199
2
0
2008-09-10T16:42:35.700000
2008-09-10T16:44:39.720000
54,658
112,736
Is there a ClientScriptManager.RegisterClientScriptInclude equivalent for CSS
The ClientScriptManager.RegisterClientScriptInclude method allows you to register a JavaScript reference with the Page object (checking for duplicates). Is there an equivalent of this method for CSS references? Similar questions apply for ClientScriptManager.RegisterClientScriptBlock and ClientScriptManager.RegisterCli...
Short answer: no. You could certainly roll your own functions (as CMPalmer suggests) to take CSS embedded resources (as Gulzar suggests) and embed them on the page. As a best-practice matter, though, I'm not sure why you would want to do this. If you're making a reusable control that has a lot of CSS styling, my advice...
Is there a ClientScriptManager.RegisterClientScriptInclude equivalent for CSS The ClientScriptManager.RegisterClientScriptInclude method allows you to register a JavaScript reference with the Page object (checking for duplicates). Is there an equivalent of this method for CSS references? Similar questions apply for Cli...
TITLE: Is there a ClientScriptManager.RegisterClientScriptInclude equivalent for CSS QUESTION: The ClientScriptManager.RegisterClientScriptInclude method allows you to register a JavaScript reference with the Page object (checking for duplicates). Is there an equivalent of this method for CSS references? Similar quest...
[ "asp.net", "css" ]
13
7
6,394
6
0
2008-09-10T16:50:57.800000
2008-09-22T01:08:38.597000
54,674
54,742
Any good building tools for a C++ project, which can replace make?
i'm wondering if there is any nice and neat tool to replace the GNU Autotools or Make to build a very large C++ project, which are such a complicated thing to use. It is simple to generate all the files that de Autotools require if the project is small, but if the source code is divided in many directories, with multip...
The Google V8 JavaScript Engine is written in C++ and uses SCons, so I guess that's one vote for it.
Any good building tools for a C++ project, which can replace make? i'm wondering if there is any nice and neat tool to replace the GNU Autotools or Make to build a very large C++ project, which are such a complicated thing to use. It is simple to generate all the files that de Autotools require if the project is small,...
TITLE: Any good building tools for a C++ project, which can replace make? QUESTION: i'm wondering if there is any nice and neat tool to replace the GNU Autotools or Make to build a very large C++ project, which are such a complicated thing to use. It is simple to generate all the files that de Autotools require if the...
[ "c++", "build-process", "makefile" ]
22
18
9,397
9
0
2008-09-10T16:54:04.907000
2008-09-10T17:14:33.640000
54,702
55,745
Modifying the AJAX Control Toolkit Dropdown extender
I am using the example on the AJAX website for the DropDownExtender. I'm looking to make the target control (the label) have the DropDown image appear always, instead of just when I hover over it. Is there any way to do this?
This can be done using the following script tag: I found this and some other tips at this dot net curry example. It works but I'd also consider writing a new control based on the drop down extender exposing a property to set the behaviour you want on or off. Writing a new AJAX control isn't too hard, more fiddly than a...
Modifying the AJAX Control Toolkit Dropdown extender I am using the example on the AJAX website for the DropDownExtender. I'm looking to make the target control (the label) have the DropDown image appear always, instead of just when I hover over it. Is there any way to do this?
TITLE: Modifying the AJAX Control Toolkit Dropdown extender QUESTION: I am using the example on the AJAX website for the DropDownExtender. I'm looking to make the target control (the label) have the DropDown image appear always, instead of just when I hover over it. Is there any way to do this? ANSWER: This can be do...
[ "asp.net", "asp.net-ajax", "ajaxcontroltoolkit" ]
3
4
4,294
1
0
2008-09-10T17:02:00.707000
2008-09-11T03:19:07.947000
54,703
54,750
Should I choose scripting or compiled code for small tasks?
I'm a Java programmer, and I like my compiler, static analysis tools and unit testing frameworks as tools that help me quickly deliver robust and efficient code. The JRE is pretty much everywhere I would work, too. Given that situation, I can't see a reason why I would ever choose to use shell scripting, vb scripting e...
Whatever you think will be most efficient for you! I had a co-worker who seemed to use a different language for every task; Perl for quick text processing, PHP for small internal web applications,.NET for our main product, cygwin for filesystem stuff. He preferred to use the technology which was most specific to the ta...
Should I choose scripting or compiled code for small tasks? I'm a Java programmer, and I like my compiler, static analysis tools and unit testing frameworks as tools that help me quickly deliver robust and efficient code. The JRE is pretty much everywhere I would work, too. Given that situation, I can't see a reason wh...
TITLE: Should I choose scripting or compiled code for small tasks? QUESTION: I'm a Java programmer, and I like my compiler, static analysis tools and unit testing frameworks as tools that help me quickly deliver robust and efficient code. The JRE is pretty much everywhere I would work, too. Given that situation, I can...
[ "testing", "scripting" ]
6
2
304
11
0
2008-09-10T17:02:03.500000
2008-09-10T17:16:07.053000
54,708
54,745
Programmatically accessing Data in an ASP.NET 2.0 Repeater
This is an ASP.Net 2.0 web app. The Item template looks like this, for reference: <%# DataBinder.Eval(Container.DataItem,"field1") %> <%# DataBinder.Eval(Container.DataItem,"field2") %> <%# DataBinder.Eval(Container.DataItem,"field3") %> <%# DataBinder.Eval(Container.DataItem,"field4") %> Using this in codebehind: fore...
Off the top of my head, you can try something like this: Then, in your code behind, you can access each Literal control as follows: foreach (RepeaterItem item in rptrFollowupSummary.Items) { Literal lit1 = (Literal)item.FindControl("litField1"); string value1 = lit1.Text; Literal lit4 = (Literal)item.FindControl("litFi...
Programmatically accessing Data in an ASP.NET 2.0 Repeater This is an ASP.Net 2.0 web app. The Item template looks like this, for reference: <%# DataBinder.Eval(Container.DataItem,"field1") %> <%# DataBinder.Eval(Container.DataItem,"field2") %> <%# DataBinder.Eval(Container.DataItem,"field3") %> <%# DataBinder.Eval(Con...
TITLE: Programmatically accessing Data in an ASP.NET 2.0 Repeater QUESTION: This is an ASP.Net 2.0 web app. The Item template looks like this, for reference: <%# DataBinder.Eval(Container.DataItem,"field1") %> <%# DataBinder.Eval(Container.DataItem,"field2") %> <%# DataBinder.Eval(Container.DataItem,"field3") %> <%# D...
[ "asp.net", "repeater", "data-access" ]
4
6
8,306
5
0
2008-09-10T17:03:10.470000
2008-09-10T17:15:19.223000
54,725
380,573
Change the "From:" address in Unix "mail"
Sending a message from the Unix command line using mail TO_ADDR results in an email from $USER@$HOSTNAME. Is there a way to change the "From:" address inserted by mail? For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the same behavior with Fedora and RHEL). [EDIT] $ mail -s Testing chris@exampl...
In my version of mail ( Debian linux 4.0 ) the following options work for controlling the source / reply addresses the -a switch, for additional headers to apply, supplying a From: header on the command line that will be appended to the outgoing mail header the $REPLYTO environment variable specifies a Reply-To: header...
Change the "From:" address in Unix "mail" Sending a message from the Unix command line using mail TO_ADDR results in an email from $USER@$HOSTNAME. Is there a way to change the "From:" address inserted by mail? For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the same behavior with Fedora and RH...
TITLE: Change the "From:" address in Unix "mail" QUESTION: Sending a message from the Unix command line using mail TO_ADDR results in an email from $USER@$HOSTNAME. Is there a way to change the "From:" address inserted by mail? For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the same behavior ...
[ "unix", "email" ]
105
118
291,404
20
0
2008-09-10T17:08:37.867000
2008-12-19T10:09:18.020000
54,754
54,777
How can you do paging with NHibernate?
For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this?
ICriteria has a SetFirstResult(int i) method, which indicates the index of the first item that you wish to get (basically the first data row in your page). It also has a SetMaxResults(int i) method, which indicates the number of rows you wish to get (i.e., your page size). For example, this criteria object gets the fir...
How can you do paging with NHibernate? For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this?
TITLE: How can you do paging with NHibernate? QUESTION: For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this? ANSWER: ICriteria has a SetFirstResult(int i) method, which indicates the index of the first item...
[ ".net", "nhibernate", "orm", "pagination" ]
110
113
53,375
8
0
2008-09-10T17:16:53.230000
2008-09-10T17:27:33.860000
54,758
110,029
Getting the back/fwd history of the WebBrowser Control
In C# WinForms, what's the proper way to get the backward/forward history stacks for the System.Windows.Forms.WebBrowser?
Check out http://www.bsalsa.com/downloads.html. This is a series of Delphi components (free source code, you can see an example of this here: http://staruml.cvs.sourceforge.net/staruml/staruml/staruml/components/plastic-components/src/embeddedwb.pas?revision=1.1&view=markup - it's the starUML projects code) and they ha...
Getting the back/fwd history of the WebBrowser Control In C# WinForms, what's the proper way to get the backward/forward history stacks for the System.Windows.Forms.WebBrowser?
TITLE: Getting the back/fwd history of the WebBrowser Control QUESTION: In C# WinForms, what's the proper way to get the backward/forward history stacks for the System.Windows.Forms.WebBrowser? ANSWER: Check out http://www.bsalsa.com/downloads.html. This is a series of Delphi components (free source code, you can see...
[ "c#", ".net", "winforms", "navigation", "webbrowser-control" ]
5
4
3,067
2
0
2008-09-10T17:17:21.530000
2008-09-21T02:20:47.637000
54,760
57,771
Unfiltering NSPasteboard
Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide? I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types, I get eleven different flavors of said RTF...
-[NSPasteboard types] will return all the available types for the data on the clipboard, but it should return them "in the order they were declared." The documentation for -[NSPasteboard declareTypes:owner:] says that "the types should be ordered according to the preference of the source application." A properly implem...
Unfiltering NSPasteboard Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide? I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types, I get eleven diff...
TITLE: Unfiltering NSPasteboard QUESTION: Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide? I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types,...
[ "cocoa", "filtering", "pasteboard" ]
5
4
1,161
2
0
2008-09-10T17:20:03.597000
2008-09-11T22:06:49.657000
54,770
54,804
ClickOnce Deployment, system update required Microsoft.mshtml
We have an application that works with MS Office and uses Microsoft.mshtml.dll. We use ClickOnce to deploy the application. The application deploys without issues on most machines, but sometimes we get errors saying "System Update Required, Microsoft.mshtl.dll should be in the GAC". We tried installing the PIA for Offi...
Do you know which version of MS Office you are targeting? These PIAs are very specific to the version of Office. I remember when we were building a smart client application, we used to have Build VM machines, each one targeting a specific version of Outlook. Another hurdle was not being able to specify these PIAs as pr...
ClickOnce Deployment, system update required Microsoft.mshtml We have an application that works with MS Office and uses Microsoft.mshtml.dll. We use ClickOnce to deploy the application. The application deploys without issues on most machines, but sometimes we get errors saying "System Update Required, Microsoft.mshtl.d...
TITLE: ClickOnce Deployment, system update required Microsoft.mshtml QUESTION: We have an application that works with MS Office and uses Microsoft.mshtml.dll. We use ClickOnce to deploy the application. The application deploys without issues on most machines, but sometimes we get errors saying "System Update Required,...
[ "clickonce", "microsoft.mshtml" ]
1
1
2,782
4
0
2008-09-10T17:24:56.067000
2008-09-10T17:40:48.040000
54,771
54,778
Website Monitoring Libraries
There has been some talk of Website performance monitoring tools and services on stackoverflow, however, they seem fairly expensive for what they actually do. Are there any good opensource libraries for automating checking/monitoring the availability of a website?
If you just want to know if your server is serving out content or not, take a look at Montastic. I use it, and am pleased. Plus its free! It will ping your site periodically, and if it doesn't get a 200 status, it lets you know.
Website Monitoring Libraries There has been some talk of Website performance monitoring tools and services on stackoverflow, however, they seem fairly expensive for what they actually do. Are there any good opensource libraries for automating checking/monitoring the availability of a website?
TITLE: Website Monitoring Libraries QUESTION: There has been some talk of Website performance monitoring tools and services on stackoverflow, however, they seem fairly expensive for what they actually do. Are there any good opensource libraries for automating checking/monitoring the availability of a website? ANSWER:...
[ "monitoring", "web", "polling" ]
6
2
497
4
0
2008-09-10T17:25:19.950000
2008-09-10T17:27:42.753000
54,789
54,817
What is the correct .NET exception to throw when try to insert a duplicate object into a collection?
I have an Asset object that has a property AssignedSoftware, which is a collection. I want to make sure that the same piece of Software is not assigned to an Asset more than once. In Add method I check to see if the Software already exist, and if it does, I want to throw an exception. Is there a standard.NET exception ...
From the Class Library design guidelines for errors ( http://msdn.microsoft.com/en-us/library/8ey5ey87(VS.71).aspx ): In most cases, use the predefined exception types. Only define new exception types for programmatic scenarios, where you expect users of your class library to catch exceptions of this new type and perfo...
What is the correct .NET exception to throw when try to insert a duplicate object into a collection? I have an Asset object that has a property AssignedSoftware, which is a collection. I want to make sure that the same piece of Software is not assigned to an Asset more than once. In Add method I check to see if the Sof...
TITLE: What is the correct .NET exception to throw when try to insert a duplicate object into a collection? QUESTION: I have an Asset object that has a property AssignedSoftware, which is a collection. I want to make sure that the same piece of Software is not assigned to an Asset more than once. In Add method I check...
[ "c#", "exception", "collections" ]
6
5
5,113
5
0
2008-09-10T17:35:36.460000
2008-09-10T17:43:01.700000
54,790
56,113
Is it possible to build MSBuild files (visual studio sln) from the command line in Mono?
Is it possible to build Visual Studio solutions without having to fire up MonoDevelop?
Current status (Mono 2.10, 2011): xbuild is now able to build all versions of Visual Studio / MSBuild projects, including.sln files. Simply run xbuild just as you would execute msbuild on Microsoft.Net Framework. You don't need Monodevelop installed, xbuild comes with the standard Mono installation. If your build uses ...
Is it possible to build MSBuild files (visual studio sln) from the command line in Mono? Is it possible to build Visual Studio solutions without having to fire up MonoDevelop?
TITLE: Is it possible to build MSBuild files (visual studio sln) from the command line in Mono? QUESTION: Is it possible to build Visual Studio solutions without having to fire up MonoDevelop? ANSWER: Current status (Mono 2.10, 2011): xbuild is now able to build all versions of Visual Studio / MSBuild projects, inclu...
[ "msbuild", "mono" ]
65
70
57,503
4
0
2008-09-10T17:36:00.110000
2008-09-11T09:19:47.753000
54,797
54,798
How do you implement Levenshtein distance in Delphi?
I'm posting this in the spirit of answering your own questions. The question I had was: How can I implement the Levenshtein algorithm for calculating edit-distance between two strings, as described here, in Delphi? Just a note on performance: This thing is very fast. On my desktop (2.33 Ghz dual-core, 2GB ram, WinXP), ...
function EditDistance(s, t: string): integer; var d: array of array of integer; i,j,cost: integer; begin { Compute the edit-distance between two strings. Algorithm and description may be found at either of these two links: http://en.wikipedia.org/wiki/Levenshtein_distance http://www.google.com/search?q=Levenshtein+dist...
How do you implement Levenshtein distance in Delphi? I'm posting this in the spirit of answering your own questions. The question I had was: How can I implement the Levenshtein algorithm for calculating edit-distance between two strings, as described here, in Delphi? Just a note on performance: This thing is very fast....
TITLE: How do you implement Levenshtein distance in Delphi? QUESTION: I'm posting this in the spirit of answering your own questions. The question I had was: How can I implement the Levenshtein algorithm for calculating edit-distance between two strings, as described here, in Delphi? Just a note on performance: This t...
[ "algorithm", "delphi", "levenshtein-distance", "edit-distance" ]
20
18
5,010
1
0
2008-09-10T17:38:05.193000
2008-09-10T17:38:15.987000
54,808
55,802
How to best merge information, at a server, into a "form", a PDF being generated as the final output
Background: I have a VB6 application I've "inherited" that generates a PDF for the user to review using unsupported Acrobat Reader OCX integration. The program generates an FDF file with the data, then renders the merged result when the FDF is merged with a PDF. It only works correctly with Acrobat Reader 4:-(. Install...
can't help with VB6 solution, can help with.net or java solution on the server. Get iText or iTextSharp from http://www.lowagie.com/iText/. It has a PdfStamper class that can merge a PDF and FDF FDFReader/FDFWriter classes to generate FDF files, get field names out of PDF files, etc...
How to best merge information, at a server, into a "form", a PDF being generated as the final output Background: I have a VB6 application I've "inherited" that generates a PDF for the user to review using unsupported Acrobat Reader OCX integration. The program generates an FDF file with the data, then renders the merge...
TITLE: How to best merge information, at a server, into a "form", a PDF being generated as the final output QUESTION: Background: I have a VB6 application I've "inherited" that generates a PDF for the user to review using unsupported Acrobat Reader OCX integration. The program generates an FDF file with the data, then...
[ ".net", "forms", "pdf", "pdf-generation" ]
3
2
1,986
4
0
2008-09-10T17:41:28.570000
2008-09-11T04:24:58.867000
54,833
54,888
Prevent Multi-Line ASP:Textbox from trimming line feeds
I have the following webform: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWebApp.Default" %> and each time I post-back the leading line feeds in the textbox are being removed. Is there any way that I can prevent this behavior? I was thinking of creating a custom-control that...
I ended up doing the following in the btnSubmitClick() public void btnSubmitClick(object sender, EventArgs e) { if (this.txtMultiLine.Text.StartsWith("\r\n")) { this.txtMultiLine.Text = "\r\n" + this.txtMultiLine.Text; } } I must be really tired or sick or something.
Prevent Multi-Line ASP:Textbox from trimming line feeds I have the following webform: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWebApp.Default" %> and each time I post-back the leading line feeds in the textbox are being removed. Is there any way that I can prevent this be...
TITLE: Prevent Multi-Line ASP:Textbox from trimming line feeds QUESTION: I have the following webform: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWebApp.Default" %> and each time I post-back the leading line feeds in the textbox are being removed. Is there any way that I c...
[ "c#", "asp.net", "textbox", "postback" ]
2
2
2,859
2
0
2008-09-10T17:48:28.023000
2008-09-10T18:05:45.423000
54,837
54,900
Is there a good library for dealing with the Modbus protocol in .NET?
Does anyone know of a good (preferably open source) library for dealing with the Modbus protocol? I have seen a few libraries, but I am looking for some people's personal experiences, not just the top ten Google hits. I figure there has to be at least one other person who deals with PLCs and automation hardware like I ...
I have done a lot of communication with devices for the past few years, since I work for a home automation company, but we don't use Modbus. We do communication in a standard and open way using Web Services for Devices(WSD) which is also know as Devices Profile for Web Services(DPWS). During this time at one point, I d...
Is there a good library for dealing with the Modbus protocol in .NET? Does anyone know of a good (preferably open source) library for dealing with the Modbus protocol? I have seen a few libraries, but I am looking for some people's personal experiences, not just the top ten Google hits. I figure there has to be at leas...
TITLE: Is there a good library for dealing with the Modbus protocol in .NET? QUESTION: Does anyone know of a good (preferably open source) library for dealing with the Modbus protocol? I have seen a few libraries, but I am looking for some people's personal experiences, not just the top ten Google hits. I figure there...
[ ".net", "open-source", "protocols", "plc", "modbus" ]
21
22
29,580
5
0
2008-09-10T17:49:24.743000
2008-09-10T18:08:23.857000
54,851
54,856
What are some best practices for creating my own custom exception?
In a follow-up to a previous question regarding exceptions, what are best practices for creating a custom exception in.NET? More specifically should you inherit from System.Exception, System.ApplicationException or some other base exception?
Inherit from System.Exception. System.ApplicationException is useless and the design guidelines say " Do not throw or derive from System.ApplicationException." See http://blogs.msdn.com/kcwalina/archive/2006/06/23/644822.aspx
What are some best practices for creating my own custom exception? In a follow-up to a previous question regarding exceptions, what are best practices for creating a custom exception in.NET? More specifically should you inherit from System.Exception, System.ApplicationException or some other base exception?
TITLE: What are some best practices for creating my own custom exception? QUESTION: In a follow-up to a previous question regarding exceptions, what are best practices for creating a custom exception in.NET? More specifically should you inherit from System.Exception, System.ApplicationException or some other base exce...
[ "c#", ".net", "exception" ]
24
16
14,003
5
0
2008-09-10T17:55:01.063000
2008-09-10T17:57:04.413000
54,861
54,967
Better way of opening a Document from Java?
I've been using the following code to open Office Documents, PDF, etc. on my windows machines using Java and it's working fine, except for some reason when a filename has embedded it within it multiple contiguous spaces like "File[SPACE][SPACE]Test.doc". How can I make this work? I'm not averse to canning the whole pie...
If you are using Java 6 you can just use the open method of java.awt.Desktop to launch the file using the default application for the current platform.
Better way of opening a Document from Java? I've been using the following code to open Office Documents, PDF, etc. on my windows machines using Java and it's working fine, except for some reason when a filename has embedded it within it multiple contiguous spaces like "File[SPACE][SPACE]Test.doc". How can I make this w...
TITLE: Better way of opening a Document from Java? QUESTION: I've been using the following code to open Office Documents, PDF, etc. on my windows machines using Java and it's working fine, except for some reason when a filename has embedded it within it multiple contiguous spaces like "File[SPACE][SPACE]Test.doc". How...
[ "java", "windows", "process" ]
3
5
641
3
0
2008-09-10T17:58:19.370000
2008-09-10T18:36:43.727000
54,866
54,928
Best way to parse Space Separated Text
I have string like this /c SomeText\MoreText "Some Text\More Text\Lol" SomeText I want to tokenize it, however I can't just split on the spaces. I've come up with somewhat ugly parser that works, but I'm wondering if anyone has a more elegant design. This is in C# btw. EDIT: My ugly version, while ugly, is O(N) and may...
The computer term for what you're doing is lexical analysis; read that for a good summary of this common task. Based on your example, I'm guessing that you want whitespace to separate your words, but stuff in quotation marks should be treated as a "word" without the quotes. The simplest way to do this is to define a wo...
Best way to parse Space Separated Text I have string like this /c SomeText\MoreText "Some Text\More Text\Lol" SomeText I want to tokenize it, however I can't just split on the spaces. I've come up with somewhat ugly parser that works, but I'm wondering if anyone has a more elegant design. This is in C# btw. EDIT: My ug...
TITLE: Best way to parse Space Separated Text QUESTION: I have string like this /c SomeText\MoreText "Some Text\More Text\Lol" SomeText I want to tokenize it, however I can't just split on the spaces. I've come up with somewhat ugly parser that works, but I'm wondering if anyone has a more elegant design. This is in C...
[ "c#", "string", "tokenize" ]
7
16
11,168
6
0
2008-09-10T18:00:12.143000
2008-09-10T18:20:11.923000
54,867
54,873
What is the difference between old style and new style classes in Python?
What is the difference between old style and new style classes in Python? When should I use one or the other?
From New-style and classic classes: Up to Python 2.1, old-style classes were the only flavour available to the user. The concept of (old-style) class is unrelated to the concept of type: if x is an instance of an old-style class, then x.__class__ designates the class of x, but type(x) is always. This reflects the fact ...
What is the difference between old style and new style classes in Python? What is the difference between old style and new style classes in Python? When should I use one or the other?
TITLE: What is the difference between old style and new style classes in Python? QUESTION: What is the difference between old style and new style classes in Python? When should I use one or the other? ANSWER: From New-style and classic classes: Up to Python 2.1, old-style classes were the only flavour available to th...
[ "python", "class", "oop", "types", "new-style-class" ]
1,129
624
273,172
8
0
2008-09-10T18:01:27.163000
2008-09-10T18:02:43.743000
54,877
54,970
How to use JQuery "after" selector
I can't seem to figure out a good way to do this, but it seems like it should be simple. I have an element that I want to append a div to. Then I have another element that I want to clone and shove into that intermediate div. Here's what I was hoping to do: $("#somediv > ul").after(" ").append($("#someotherdiv").clone(...
Go the other way around and use insertAfter(). $(" ").append($("#someotherdiv").clone()).insertAfter("#somediv > ul") Try to add your generated DOM nodes to the document only after finishing your work. Once the nodes are added to the displayed document, the browser starts listening to any change to refresh the view. Do...
How to use JQuery "after" selector I can't seem to figure out a good way to do this, but it seems like it should be simple. I have an element that I want to append a div to. Then I have another element that I want to clone and shove into that intermediate div. Here's what I was hoping to do: $("#somediv > ul").after(" ...
TITLE: How to use JQuery "after" selector QUESTION: I can't seem to figure out a good way to do this, but it seems like it should be simple. I have an element that I want to append a div to. Then I have another element that I want to clone and shove into that intermediate div. Here's what I was hoping to do: $("#somed...
[ "jquery", "dom", "css-selectors" ]
8
9
6,624
3
0
2008-09-10T18:03:12.777000
2008-09-10T18:37:39.010000
54,889
54,907
As a ASP.NET programmer, do I need to be concerned about email injection attacks?
There are lots of PHP articles about the subject so is this a PHP only problem. I am sending emails using System.Net.Mail after some regular expression checks of course. Similar to http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx
the PHP email injection attack works because of a weakness in the PHP Mail() function. As a.net developer you need not worry.
As a ASP.NET programmer, do I need to be concerned about email injection attacks? There are lots of PHP articles about the subject so is this a PHP only problem. I am sending emails using System.Net.Mail after some regular expression checks of course. Similar to http://weblogs.asp.net/scottgu/archive/2005/12/10/432854....
TITLE: As a ASP.NET programmer, do I need to be concerned about email injection attacks? QUESTION: There are lots of PHP articles about the subject so is this a PHP only problem. I am sending emails using System.Net.Mail after some regular expression checks of course. Similar to http://weblogs.asp.net/scottgu/archive/...
[ "asp.net", "security", "email" ]
7
6
333
3
0
2008-09-10T18:05:54.500000
2008-09-10T18:11:07.843000
54,926
54,927
Make a JPanel not draw its background (Transparent)
Is it possible, in Java, to make a JPanel skip drawing its background thus being transparent except for the components on it?
setOpaque(false) It'll pass off painting the background to its parent, which may draw its own background. You can do a screen capture and then use that to paint the background of the panel.
Make a JPanel not draw its background (Transparent) Is it possible, in Java, to make a JPanel skip drawing its background thus being transparent except for the components on it?
TITLE: Make a JPanel not draw its background (Transparent) QUESTION: Is it possible, in Java, to make a JPanel skip drawing its background thus being transparent except for the components on it? ANSWER: setOpaque(false) It'll pass off painting the background to its parent, which may draw its own background. You can d...
[ "java", "user-interface" ]
26
38
47,722
5
0
2008-09-10T18:18:28.060000
2008-09-10T18:19:21.130000
54,943
54,947
How do I know when to use state based testing versus mock testing?
Which scenarios, areas of an application/system, etc. are best suited for 'classic' state based testing versus using mock objects?
You should be using mocks for dependencies. I don't think that its an either-or; Usually you will create mocks for dependencies, set expectations (whether it is calls or state) on them, then run the unit under test. Then you would check its state, and verify the expectations on the mocks, afterwards.
How do I know when to use state based testing versus mock testing? Which scenarios, areas of an application/system, etc. are best suited for 'classic' state based testing versus using mock objects?
TITLE: How do I know when to use state based testing versus mock testing? QUESTION: Which scenarios, areas of an application/system, etc. are best suited for 'classic' state based testing versus using mock objects? ANSWER: You should be using mocks for dependencies. I don't think that its an either-or; Usually you wi...
[ "unit-testing" ]
4
3
1,277
6
0
2008-09-10T18:27:38.897000
2008-09-10T18:29:10.450000
54,952
55,307
Java, UTF-8, and Windows console
We try to use Java and UTF-8 on Windows. The application writes logs on the console, and we would like to use UTF-8 for the logs as our application has internationalized logs. It is possible to configure the JVM so it generates UTF-8, using -Dfile.encoding=UTF-8 as arguments to the JVM. It works fine, but the output on...
Try chcp 65001 && start.bat The chcp command changes the code page, and 65001 is the Win32 code page identifier for UTF-8 under Windows 7 and up. A code page, or character encoding, specifies how to convert a Unicode code point to a sequence of bytes or back again.
Java, UTF-8, and Windows console We try to use Java and UTF-8 on Windows. The application writes logs on the console, and we would like to use UTF-8 for the logs as our application has internationalized logs. It is possible to configure the JVM so it generates UTF-8, using -Dfile.encoding=UTF-8 as arguments to the JVM....
TITLE: Java, UTF-8, and Windows console QUESTION: We try to use Java and UTF-8 on Windows. The application writes logs on the console, and we would like to use UTF-8 for the logs as our application has internationalized logs. It is possible to configure the JVM so it generates UTF-8, using -Dfile.encoding=UTF-8 as arg...
[ "java", "windows", "utf-8", "console" ]
15
11
23,623
5
0
2008-09-10T18:30:55.253000
2008-09-10T20:55:48.570000
54,953
55,008
Count the number of nodes that match a given XPath expression in XmlSpy
I am using XmlSpy to analyze an xml file, and I want to get a quick count of the number of nodes that match a given xpath. I know how to enter the XPathand get the list of nodes, but I am really just interested in the count. Is it possible to get this? I'm using XmlSpy Professional Edition version 2007 sp2, if it matte...
I just figureed it out. I just needed to put count() around my xpath, like so: count(//my/node)
Count the number of nodes that match a given XPath expression in XmlSpy I am using XmlSpy to analyze an xml file, and I want to get a quick count of the number of nodes that match a given xpath. I know how to enter the XPathand get the list of nodes, but I am really just interested in the count. Is it possible to get t...
TITLE: Count the number of nodes that match a given XPath expression in XmlSpy QUESTION: I am using XmlSpy to analyze an xml file, and I want to get a quick count of the number of nodes that match a given xpath. I know how to enter the XPathand get the list of nodes, but I am really just interested in the count. Is it...
[ "xml", "xpath", "xmlspy" ]
5
9
9,068
1
0
2008-09-10T18:31:37.870000
2008-09-10T18:50:34.580000
54,955
54,968
What is a prepared statement?
I see a bunch of lines in the.log files in the postgres pg_log directory that say something like: ERROR: prepared statement "pdo_pgsql_stmt_09e097f4" does not exist What are prepared statements, and what kinds of things can cause these error messages to be displayed?
From the documentation: A prepared statement is a server-side object that can be used to optimize performance. When the PREPARE statement is executed, the specifie statement is parsed, rewritten, and planned. When an EXECUTE command is subsequently issued, the prepared statement need only be executed. Thus, the parsing...
What is a prepared statement? I see a bunch of lines in the.log files in the postgres pg_log directory that say something like: ERROR: prepared statement "pdo_pgsql_stmt_09e097f4" does not exist What are prepared statements, and what kinds of things can cause these error messages to be displayed?
TITLE: What is a prepared statement? QUESTION: I see a bunch of lines in the.log files in the postgres pg_log directory that say something like: ERROR: prepared statement "pdo_pgsql_stmt_09e097f4" does not exist What are prepared statements, and what kinds of things can cause these error messages to be displayed? ANS...
[ "sql", "database", "postgresql", "prepared-statement" ]
3
4
1,847
1
0
2008-09-10T18:32:18.540000
2008-09-10T18:37:08.093000
54,966
55,021
Replacing Windows Explorer With Third Party Tool
How would I go about replacing Windows Explorer with a third party tool such as TotalCommander, explorer++, etc? I would like to have one of those load instead of win explorer when I type "C:\directoryName" into the run window. Is this possible?
From a comment on the first LifeHacker link, How to make x² your default folder application As part of the installation process, x² adds "open with xplorer2" in the context menu for filesystem folders. If you want to have this the default action (so that folders always open in x2 when you click on them) then make sure ...
Replacing Windows Explorer With Third Party Tool How would I go about replacing Windows Explorer with a third party tool such as TotalCommander, explorer++, etc? I would like to have one of those load instead of win explorer when I type "C:\directoryName" into the run window. Is this possible?
TITLE: Replacing Windows Explorer With Third Party Tool QUESTION: How would I go about replacing Windows Explorer with a third party tool such as TotalCommander, explorer++, etc? I would like to have one of those load instead of win explorer when I type "C:\directoryName" into the run window. Is this possible? ANSWER...
[ "windows", "windows-vista", "file-management" ]
4
3
3,675
2
0
2008-09-10T18:35:47.330000
2008-09-10T18:53:47.833000
54,972
54,984
How to Prevent the "Please tell Microsoft about this problem" Dialog Boxes
We have an error that we can't seem to find and don't have the need/resources to try and track it down. What we do need to do is just keep the freaking "Please tell Microsoft about this problem" dialog boxes from cluttering up the server. It is from an MS-Access error (we think) but I can't find where Access is install...
From http://www.codeproject.com/KB/exception/UnhandledExceptionClass.aspx: If you also want to disable the Windows “Send Error Report” dialog on your computer, right-click on the “My Computer” icon, select “Properties”, switch to the “Advanced” tab, and click on the “Error Reporting” button. In the Options dialog, sele...
How to Prevent the "Please tell Microsoft about this problem" Dialog Boxes We have an error that we can't seem to find and don't have the need/resources to try and track it down. What we do need to do is just keep the freaking "Please tell Microsoft about this problem" dialog boxes from cluttering up the server. It is ...
TITLE: How to Prevent the "Please tell Microsoft about this problem" Dialog Boxes QUESTION: We have an error that we can't seem to find and don't have the need/resources to try and track it down. What we do need to do is just keep the freaking "Please tell Microsoft about this problem" dialog boxes from cluttering up ...
[ "ms-access", "dialog", "windows-server-2003" ]
3
8
10,842
7
0
2008-09-10T18:38:07.077000
2008-09-10T18:43:04.803000
54,978
55,032
Adopting standard libraries
My team has a command parsing library for console apps. Each team around us has their own as well. There isn't anything in the BCL so I suppose this is natural. I've looked at the the module in Mono, which seems solid, and the one on CodePlex looks fine as well. There are probably others out there that will work (and I...
Well to be honest, you can't make everyone settle on one solution. You can suggest a solution and point out it's benefits, but eventually the advantages would have to be greater than the inertia that they have built up with their present library. To make them settle on one library you would need to go up the management...
Adopting standard libraries My team has a command parsing library for console apps. Each team around us has their own as well. There isn't anything in the BCL so I suppose this is natural. I've looked at the the module in Mono, which seems solid, and the one on CodePlex looks fine as well. There are probably others out...
TITLE: Adopting standard libraries QUESTION: My team has a command parsing library for console apps. Each team around us has their own as well. There isn't anything in the BCL so I suppose this is natural. I've looked at the the module in Mono, which seems solid, and the one on CodePlex looks fine as well. There are p...
[ ".net" ]
2
2
183
6
0
2008-09-10T18:40:33.233000
2008-09-10T18:56:52.820000
54,980
55,046
How do prepared statements work?
I'm writing some DB routines and I'm using prepared statements. My environment is PDO with PHP5. I understand prepared statements primarily provide a performance benefit, as well as some auxiliary bonuses such as not having to manually SQL-escape input data. My question is about the performance part. I have two impleme...
From what I understand, prepared statements will reuse the generated SQL plan if it is the same statement, so the database will see the same prepared statement and not have to do the work to figure out how to query the database. I would say the extra work of saving the prepared statement in Product::getPrice_A is not t...
How do prepared statements work? I'm writing some DB routines and I'm using prepared statements. My environment is PDO with PHP5. I understand prepared statements primarily provide a performance benefit, as well as some auxiliary bonuses such as not having to manually SQL-escape input data. My question is about the per...
TITLE: How do prepared statements work? QUESTION: I'm writing some DB routines and I'm using prepared statements. My environment is PDO with PHP5. I understand prepared statements primarily provide a performance benefit, as well as some auxiliary bonuses such as not having to manually SQL-escape input data. My questio...
[ "php", "sql", "pdo" ]
5
3
2,049
1
0
2008-09-10T18:41:19.393000
2008-09-10T19:02:42.663000
54,989
55,212
Change windows hostname from command line
Is it possible to change the hostname in Windows 2003 from the command line with out-of-the-box tools?
The netdom.exe command line program can be used. This is available from the Windows XP Support Tools or Server 2003 Support Tools (both on the installation CD). Usage guidelines here
Change windows hostname from command line Is it possible to change the hostname in Windows 2003 from the command line with out-of-the-box tools?
TITLE: Change windows hostname from command line QUESTION: Is it possible to change the hostname in Windows 2003 from the command line with out-of-the-box tools? ANSWER: The netdom.exe command line program can be used. This is available from the Windows XP Support Tools or Server 2003 Support Tools (both on the insta...
[ "windows", "command-line" ]
35
1
201,294
8
0
2008-09-10T18:45:04.097000
2008-09-10T20:15:41.193000
54,991
55,447
Generating Random Passwords
When a user on our site loses his password and heads off to the Lost Password page we need to give him a new temporary password. I don't really mind how random this is, or if it matches all the "needed" strong password rules, all I want to do is give them a password that they can change later. The application is a Web ...
There's always System.Web.Security.Membership.GeneratePassword(int length, int numberOfNonAlphanumericCharacters ).
Generating Random Passwords When a user on our site loses his password and heads off to the Lost Password page we need to give him a new temporary password. I don't really mind how random this is, or if it matches all the "needed" strong password rules, all I want to do is give them a password that they can change late...
TITLE: Generating Random Passwords QUESTION: When a user on our site loses his password and heads off to the Lost Password page we need to give him a new temporary password. I don't really mind how random this is, or if it matches all the "needed" strong password rules, all I want to do is give them a password that th...
[ "c#", "passwords", "random" ]
288
666
337,267
35
0
2008-09-10T18:45:15.437000
2008-09-10T22:44:45.250000
54,998
62,220
How Scalable is SQLite?
I recently read this Question about SQLite vs MySQL and the answer pointed out that SQLite doesn't scale well and the official website sort-of confirms this, however. How scalable is SQLite and what are its upper most limits?
Yesterday I released a small site * to track your rep that used a shared SQLite database for all visitors. Unfortunately, even with the modest load that it put on my host it ran quite slowly. This is because the entire database was locked every time someone viewed the page because it contained updates/inserts. I soon s...
How Scalable is SQLite? I recently read this Question about SQLite vs MySQL and the answer pointed out that SQLite doesn't scale well and the official website sort-of confirms this, however. How scalable is SQLite and what are its upper most limits?
TITLE: How Scalable is SQLite? QUESTION: I recently read this Question about SQLite vs MySQL and the answer pointed out that SQLite doesn't scale well and the official website sort-of confirms this, however. How scalable is SQLite and what are its upper most limits? ANSWER: Yesterday I released a small site * to trac...
[ "sqlite", "scalability" ]
189
442
55,828
9
0
2008-09-10T18:47:58.067000
2008-09-15T11:42:11.557000
55,010
55,581
What's a clean/simple way to ensure the security of a page?
Supposing you have a form that collects and submits sensitive information and you want to ensure it is never accessed via insecure (non-HTTPS) means, how might you best go about enforcing that policy?
I think the most bullet-proof solution is to keep the code inside your SSL document root only. This will ensure that you (or another developer in the future) can't accidentally link to a non-secure version of the form. If you have the form on both HTTP and HTTPS, you might not even notice if the wrong one gets used ina...
What's a clean/simple way to ensure the security of a page? Supposing you have a form that collects and submits sensitive information and you want to ensure it is never accessed via insecure (non-HTTPS) means, how might you best go about enforcing that policy?
TITLE: What's a clean/simple way to ensure the security of a page? QUESTION: Supposing you have a form that collects and submits sensitive information and you want to ensure it is never accessed via insecure (non-HTTPS) means, how might you best go about enforcing that policy? ANSWER: I think the most bullet-proof so...
[ "security", "forms", "ssl", "https" ]
3
3
286
5
0
2008-09-10T18:50:47.903000
2008-09-11T00:54:28.823000
55,013
55,031
Should I always use the AndAlso and OrElse operators?
Is there ever a circumstance in which I would not want to use the AndAlso operator rather than the And operator? …or in which I would not want to use the OrElse operator rather than the Or operator?
From MSDN: Short-Circuiting Trade-Offs Short-circuiting can improve performance by not evaluating an expression that cannot alter the result of the logical operation. However, if that expression performs additional actions, short-circuiting skips those actions. For example, if the expression includes a call to a Functi...
Should I always use the AndAlso and OrElse operators? Is there ever a circumstance in which I would not want to use the AndAlso operator rather than the And operator? …or in which I would not want to use the OrElse operator rather than the Or operator?
TITLE: Should I always use the AndAlso and OrElse operators? QUESTION: Is there ever a circumstance in which I would not want to use the AndAlso operator rather than the And operator? …or in which I would not want to use the OrElse operator rather than the Or operator? ANSWER: From MSDN: Short-Circuiting Trade-Offs S...
[ ".net", "vb.net", "boolean-logic" ]
50
38
6,316
3
0
2008-09-10T18:51:52.487000
2008-09-10T18:56:39.870000
55,035
55,063
Application to Stress Test in a Windows .NET Application
I am developing a Windows.NET application (WinForms) and I need to simulate a stress test of the database and the application ( more than 100 conections). What tools do you recommend?
Tools like AutomatedQA TestComplete allow you to make a script which simulates a user controlling your application. Running multiple scripts at the same time could be your stress test.
Application to Stress Test in a Windows .NET Application I am developing a Windows.NET application (WinForms) and I need to simulate a stress test of the database and the application ( more than 100 conections). What tools do you recommend?
TITLE: Application to Stress Test in a Windows .NET Application QUESTION: I am developing a Windows.NET application (WinForms) and I need to simulate a stress test of the database and the application ( more than 100 conections). What tools do you recommend? ANSWER: Tools like AutomatedQA TestComplete allow you to mak...
[ ".net", "stress-testing" ]
6
0
2,928
1
0
2008-09-10T18:57:41.163000
2008-09-10T19:12:10.753000
55,039
55,048
Rehsarper 4.0 - Renaming a class does not rename the file
Rehsarper 4.0 - Renaming a class does not rename the file… I probably set something on accident in the options, but I can't find it. Any ideas?
When I do a rename in Resharper there's a checkbox below the textbox where you type the new name that says "Synchronise file name with class name". Check that and the file is renamed too. Be sure you're using Resharper's rename (right-click/Refactor/Rename) rather than Visual Studio's (right-click/Rename), as the latte...
Rehsarper 4.0 - Renaming a class does not rename the file Rehsarper 4.0 - Renaming a class does not rename the file… I probably set something on accident in the options, but I can't find it. Any ideas?
TITLE: Rehsarper 4.0 - Renaming a class does not rename the file QUESTION: Rehsarper 4.0 - Renaming a class does not rename the file… I probably set something on accident in the options, but I can't find it. Any ideas? ANSWER: When I do a rename in Resharper there's a checkbox below the textbox where you type the new...
[ "visual-studio", "resharper" ]
1
5
636
2
0
2008-09-10T18:59:56.680000
2008-09-10T19:03:32.240000
55,042
55,053
How can I program a simple chat bot AI?
I want to build a bot that asks someone a few simple questions and branches based on the answer. I realize parsing meaning from the human responses will be challenging, but how do you setup the program to deal with the "state" of the conversation? It will be a one-to-one conversation between a human and the bot.
You probably want to look into Markov Chains as the basics for the bot AI. I wrote something a long time ago (the code to which I'm not proud of at all, and needs some mods to run on Python > 1.5) that may be a useful starting place for you: http://sourceforge.net/projects/benzo/ EDIT: Here's a minimal example in Pytho...
How can I program a simple chat bot AI? I want to build a bot that asks someone a few simple questions and branches based on the answer. I realize parsing meaning from the human responses will be challenging, but how do you setup the program to deal with the "state" of the conversation? It will be a one-to-one conversa...
TITLE: How can I program a simple chat bot AI? QUESTION: I want to build a bot that asks someone a few simple questions and branches based on the answer. I realize parsing meaning from the human responses will be challenging, but how do you setup the program to deal with the "state" of the conversation? It will be a o...
[ "language-agnostic", "artificial-intelligence", "chat", "chatbot" ]
33
24
39,858
11
0
2008-09-10T19:00:40.500000
2008-09-10T19:04:47.463000
55,054
55,057
How to capitalize the first letter of each word in a string in SQL Server
What’s the best way to capitalize the first letter of each word in a string in SQL Server.
From http://www.sql-server-helper.com/functions/initcap.aspx CREATE FUNCTION [dbo].[InitCap] ( @InputString varchar(4000) ) RETURNS VARCHAR(4000) AS BEGIN DECLARE @Index INT DECLARE @Char CHAR(1) DECLARE @PrevChar CHAR(1) DECLARE @OutputString VARCHAR(255) SET @OutputString = LOWER(@InputString) SET @Index = 1 WHILE...
How to capitalize the first letter of each word in a string in SQL Server What’s the best way to capitalize the first letter of each word in a string in SQL Server.
TITLE: How to capitalize the first letter of each word in a string in SQL Server QUESTION: What’s the best way to capitalize the first letter of each word in a string in SQL Server. ANSWER: From http://www.sql-server-helper.com/functions/initcap.aspx CREATE FUNCTION [dbo].[InitCap] ( @InputString varchar(4000) ) RETU...
[ "sql", "sql-server", "string" ]
66
92
114,918
15
0
2008-09-10T19:07:08.363000
2008-09-10T19:09:23.647000
55,056
840,596
What's the best Django search app?
I'm building a Django project that needs search functionality, and until there's a django.contrib.search, I have to choose a search app. So, which is the best? By "best" I mean... easy to install / set up has a Django- or at least Python-friendly API can perform reasonably complex searches Here are some apps I've heard...
Check out Haystack Search - a new model based search abstraction layer that currently supports Xapian, Solr and Whoosh. Looks like it's well supported and documented.
What's the best Django search app? I'm building a Django project that needs search functionality, and until there's a django.contrib.search, I have to choose a search app. So, which is the best? By "best" I mean... easy to install / set up has a Django- or at least Python-friendly API can perform reasonably complex sea...
TITLE: What's the best Django search app? QUESTION: I'm building a Django project that needs search functionality, and until there's a django.contrib.search, I have to choose a search app. So, which is the best? By "best" I mean... easy to install / set up has a Django- or at least Python-friendly API can perform reas...
[ "python", "django", "search", "search-engine" ]
114
105
52,092
15
0
2008-09-10T19:09:14.600000
2009-05-08T16:10:42.847000
55,060
55,191
Php function argument error suppression, empty() isset() emulation
I'm pretty sure the answer to this question is no, but in case there's some PHP guru is it possible to write a function in a way where invalid arguments or non existent variables can be passed in and php will not error without the use of '@' Much like empty and isset do. You can pass in a variable you just made up and ...
Summing up, the proper answer is no, you shouldn't (see caveat below). There are workarounds already mentioned by many people in this thread, like using reference variables or isset() or empty() in conditions and suppressing notices in PHP configuration. That in addition to the obvious workaround, using @, which you do...
Php function argument error suppression, empty() isset() emulation I'm pretty sure the answer to this question is no, but in case there's some PHP guru is it possible to write a function in a way where invalid arguments or non existent variables can be passed in and php will not error without the use of '@' Much like e...
TITLE: Php function argument error suppression, empty() isset() emulation QUESTION: I'm pretty sure the answer to this question is no, but in case there's some PHP guru is it possible to write a function in a way where invalid arguments or non existent variables can be passed in and php will not error without the use ...
[ "php", "error-handling", "error-suppression" ]
10
8
5,442
14
0
2008-09-10T19:09:47.577000
2008-09-10T20:09:21.817000
55,061
55,388
How to jump to a class definition in CodeRush
Just downloaded the CodeRush trial version and I can't easily find the one feature that I really wanted. I would like to be able to start typing a class name and to jump to its definition, sort of like the quick navigator but I want it to search in closed files within my solution as well as open ones. I know R# has tha...
1) Ctrl + Shift + Q (this will bring up the Quick Nav) 2) Start typing the name of the Type, Variable, etc. 3) Hit Enter to select when the target shows in the top of the list If the scope is not already set to "Solution" (you can tell via the drop-down on the right of the Quick Nav), you can hit Alt + Shift + S to set...
How to jump to a class definition in CodeRush Just downloaded the CodeRush trial version and I can't easily find the one feature that I really wanted. I would like to be able to start typing a class name and to jump to its definition, sort of like the quick navigator but I want it to search in closed files within my so...
TITLE: How to jump to a class definition in CodeRush QUESTION: Just downloaded the CodeRush trial version and I can't easily find the one feature that I really wanted. I would like to be able to start typing a class name and to jump to its definition, sort of like the quick navigator but I want it to search in closed ...
[ "keyboard-shortcuts", "coderush" ]
2
2
847
2
0
2008-09-10T19:10:04.223000
2008-09-10T21:48:31.067000
55,083
55,177
Display a PDF in WPF Application
Any ideas how to display a PDF file in a WPF Windows Application? I am using the following code to run the browser but the Browser.Navigate method does not do anything! WebBrowser browser = new WebBrowser(); browser.Navigate("http://www.google.com"); this.AddChild(browser); // this is the System.Windows.Window
Oops. this is for a winforms app. Not for WPF. I will post this anyway. try this private AxAcroPDFLib.AxAcroPDF axAcroPDF1; this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF(); this.axAcroPDF1.Dock = System.Windows.Forms.DockStyle.Fill; this.axAcroPDF1.Enabled = true; this.axAcroPDF1.Name = "axAcroPDF1"; this.axAcroPDF1.Ocx...
Display a PDF in WPF Application Any ideas how to display a PDF file in a WPF Windows Application? I am using the following code to run the browser but the Browser.Navigate method does not do anything! WebBrowser browser = new WebBrowser(); browser.Navigate("http://www.google.com"); this.AddChild(browser); // this is t...
TITLE: Display a PDF in WPF Application QUESTION: Any ideas how to display a PDF file in a WPF Windows Application? I am using the following code to run the browser but the Browser.Navigate method does not do anything! WebBrowser browser = new WebBrowser(); browser.Navigate("http://www.google.com"); this.AddChild(brow...
[ "wpf", "pdf" ]
28
9
107,759
9
0
2008-09-10T19:19:52.997000
2008-09-10T20:04:59.020000
55,093
55,149
How to deal with arrays (declared on the stack) in C++?
I have a class to parse a matrix that keeps the result in an array member: class Parser {... double matrix_[4][4]; }; The user of this class needs to call an API function (as in, a function I have no control over, so I can't just change its interface to make things work more easily) that looks like this: void api_func(...
Here's a nice, clean way: class Parser { public: typedef double matrix[4][4]; //... const matrix& getMatrix() const { return matrix_; } //... private: matrix matrix_; }; Now you're working with a descriptive type name rather than an array, but since it's a typedef the compiler will still allow passing it to the unc...
How to deal with arrays (declared on the stack) in C++? I have a class to parse a matrix that keeps the result in an array member: class Parser {... double matrix_[4][4]; }; The user of this class needs to call an API function (as in, a function I have no control over, so I can't just change its interface to make thing...
TITLE: How to deal with arrays (declared on the stack) in C++? QUESTION: I have a class to parse a matrix that keeps the result in an array member: class Parser {... double matrix_[4][4]; }; The user of this class needs to call an API function (as in, a function I have no control over, so I can't just change its inter...
[ "c++", "arrays" ]
15
16
2,522
5
0
2008-09-10T19:27:04.430000
2008-09-10T19:53:16.443000
55,099
55,309
Find checkout history for SVN working folder
We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder used only by IIS). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that working folder in the last 48 hours. Update: If there's an option ...
All the code in the web folder should be backed by SVN commits, shouldn't it? If this is the case you should easily be able to track the problem down just by looking through your SVN logs at the last few changes that got committed. svn info will tell you which revision the working copy currently is at, so you know wher...
Find checkout history for SVN working folder We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder used only by IIS). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that working folder in the...
TITLE: Find checkout history for SVN working folder QUESTION: We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder used only by IIS). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that wor...
[ "svn", "tortoisesvn" ]
4
2
7,533
4
0
2008-09-10T19:32:35.510000
2008-09-10T20:56:39.240000
55,101
55,254
How can I return an anonymous type from a method?
I have a Linq query that I want to call from multiple places: var myData = from a in db.MyTable where a.MyValue == "A" select new { a.Key, a.MyValue }; How can I create a method, put this code in it, and then call it? public??? GetSomeData() { // my Linq query }
IQueryable and IEnumerable both work. But you want to use a type specific version, IQueryable < T > or IEnumerable < T >. So you'll want to create a type to keep the data. var myData = from a in db.MyTable where a.MyValue == "A" select new MyType { Key = a.Key, Value = a.MyValue };
How can I return an anonymous type from a method? I have a Linq query that I want to call from multiple places: var myData = from a in db.MyTable where a.MyValue == "A" select new { a.Key, a.MyValue }; How can I create a method, put this code in it, and then call it? public??? GetSomeData() { // my Linq query }
TITLE: How can I return an anonymous type from a method? QUESTION: I have a Linq query that I want to call from multiple places: var myData = from a in db.MyTable where a.MyValue == "A" select new { a.Key, a.MyValue }; How can I create a method, put this code in it, and then call it? public??? GetSomeData() { // my Li...
[ "c#", "linq", "data-structures", "parameter-passing" ]
13
10
9,048
4
0
2008-09-10T19:33:28.347000
2008-09-10T20:32:44.787000
55,113
55,117
How do I convert a .docx to html using asp.net?
Word 2007 saves its documents in.docx format which is really a zip file with a bunch of stuff in it including an xml file with the document. I want to be able to take a.docx file and drop it into a folder in my asp.net web app and have the code open the.docx file and render the (xml part of the) document as a web page....
Try this post? I don't know but might be what you are looking for.
How do I convert a .docx to html using asp.net? Word 2007 saves its documents in.docx format which is really a zip file with a bunch of stuff in it including an xml file with the document. I want to be able to take a.docx file and drop it into a folder in my asp.net web app and have the code open the.docx file and rend...
TITLE: How do I convert a .docx to html using asp.net? QUESTION: Word 2007 saves its documents in.docx format which is really a zip file with a bunch of stuff in it including an xml file with the document. I want to be able to take a.docx file and drop it into a folder in my asp.net web app and have the code open the....
[ "asp.net", "xml", "xslt", "openxml" ]
8
4
16,226
5
0
2008-09-10T19:36:39.447000
2008-09-10T19:37:40.100000
55,114
55,182
Where does RegexBuddy store its working data between uses?
Ok, so I'm an idiot. So I was working on a regex that took way to long to craft. After perfecting it, I upgraded my work machine with a blazing fast hard drive and realized that I never saved the regex anywhere and simply used RegexBuddy's autosave to store it. Dumb dumb dumb. I sent a copy of the regex to a coworker b...
On my XP box, it was in the registry here: HKEY_CURRENT_USER\Software\JGsoft\RegexBuddy3\History There were two REG_BINARY keys called Action0 and Action1 that had hex data containing my two regexes from the history. The test data that I was testing the regex against was here: C:\Documents and Settings\ \Application Da...
Where does RegexBuddy store its working data between uses? Ok, so I'm an idiot. So I was working on a regex that took way to long to craft. After perfecting it, I upgraded my work machine with a blazing fast hard drive and realized that I never saved the regex anywhere and simply used RegexBuddy's autosave to store it....
TITLE: Where does RegexBuddy store its working data between uses? QUESTION: Ok, so I'm an idiot. So I was working on a regex that took way to long to craft. After perfecting it, I upgraded my work machine with a blazing fast hard drive and realized that I never saved the regex anywhere and simply used RegexBuddy's aut...
[ "regexbuddy" ]
6
9
791
2
0
2008-09-10T19:36:47.620000
2008-09-10T20:06:57.953000
55,140
327,907
Database engines Comparison - Windows Mobile
What are the different database options on Windows Mobile available? I have used CEDB and EDB for linear dataset needs. I have heard of SQL server 2005 Mobile edition. But what are the advantages over others (if there is any)
I've found both sqllite and codebase to be easy to implement and install. Easier (and more stable) than the Microsoft options, which seem to be in serious flux.
Database engines Comparison - Windows Mobile What are the different database options on Windows Mobile available? I have used CEDB and EDB for linear dataset needs. I have heard of SQL server 2005 Mobile edition. But what are the advantages over others (if there is any)
TITLE: Database engines Comparison - Windows Mobile QUESTION: What are the different database options on Windows Mobile available? I have used CEDB and EDB for linear dataset needs. I have heard of SQL server 2005 Mobile edition. But what are the advantages over others (if there is any) ANSWER: I've found both sqllit...
[ "sql-server", "windows-mobile", "pocketpc", "sql-server-mobile" ]
4
5
720
6
0
2008-09-10T19:51:03.157000
2008-11-29T19:37:33.767000
55,147
55,156
Embed a File Chooser in a UserControl / Form
I've inherited a desktop application which has a custom.NET file chooser that is embedded in a control, but it has some issues. I'd like to replace it with a non-custom File Chooser (like the OpenFileDialog ). However, for a variety of reasons it needs to be embedded in the parent control not a popup dialog. Is there a...
The.Net control is a thin wrapper for the common dialog built into windows, and that is a dialog. So there is no way to embed it as though it were a control.
Embed a File Chooser in a UserControl / Form I've inherited a desktop application which has a custom.NET file chooser that is embedded in a control, but it has some issues. I'd like to replace it with a non-custom File Chooser (like the OpenFileDialog ). However, for a variety of reasons it needs to be embedded in the ...
TITLE: Embed a File Chooser in a UserControl / Form QUESTION: I've inherited a desktop application which has a custom.NET file chooser that is embedded in a control, but it has some issues. I'd like to replace it with a non-custom File Chooser (like the OpenFileDialog ). However, for a variety of reasons it needs to b...
[ "c#", ".net", "winforms" ]
1
1
3,815
2
0
2008-09-10T19:52:21.983000
2008-09-10T19:55:50.227000
55,159
55,172
In SQL Server is it possible to get "id" of a record when Insert is executed?
In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the Insert is executed to get what the "id" was set to without having to do a Sele...
In.Net at least, you can send multiple queries to the server in one go. I do this in my app: command.CommandText = "INSERT INTO [Employee] (Name) VALUES (@Name); SELECT SCOPE_IDENTITY()"; int id = (int)command.ExecuteScalar(); Works like a charm.
In SQL Server is it possible to get "id" of a record when Insert is executed? In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the ...
TITLE: In SQL Server is it possible to get "id" of a record when Insert is executed? QUESTION: In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an ...
[ "sql-server", "identity" ]
12
32
43,785
7
0
2008-09-10T19:56:54.470000
2008-09-10T20:02:45.407000
55,179
55,189
Why all the Linq To Entities Hate?
I've noticed that there seems to be quite a bit of hostility towards Linq To Entities particularly from the Alt.Net folks. I understand the resistance to more "drag and drop" programming, but from my understanding, Linq To Entities doesn't require it. We're currently using Linq to SQL, and we are using the DBML documen...
I don't think it's a hate for the idea of it per se. It's just that people don't like the implementation of it. http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/
Why all the Linq To Entities Hate? I've noticed that there seems to be quite a bit of hostility towards Linq To Entities particularly from the Alt.Net folks. I understand the resistance to more "drag and drop" programming, but from my understanding, Linq To Entities doesn't require it. We're currently using Linq to SQL...
TITLE: Why all the Linq To Entities Hate? QUESTION: I've noticed that there seems to be quite a bit of hostility towards Linq To Entities particularly from the Alt.Net folks. I understand the resistance to more "drag and drop" programming, but from my understanding, Linq To Entities doesn't require it. We're currently...
[ "linq-to-entities" ]
6
5
1,753
6
0
2008-09-10T20:05:02.983000
2008-09-10T20:09:11.287000
55,203
55,242
How do I insert text into a textbox after popping up another window to request information?
I have an asp.net web page written in C#. Using some javascript I popup another.aspx page which has a few controls that are filled in and from which I create a small snippet of text. When the user clicks OK on that dialog box I want to insert that piece of text into a textbox on the page that initial "popped up" the di...
You will have to do something like: parent.opener.document.getElemenyById('ParentTextBox').value = "New Text";
How do I insert text into a textbox after popping up another window to request information? I have an asp.net web page written in C#. Using some javascript I popup another.aspx page which has a few controls that are filled in and from which I create a small snippet of text. When the user clicks OK on that dialog box I ...
TITLE: How do I insert text into a textbox after popping up another window to request information? QUESTION: I have an asp.net web page written in C#. Using some javascript I popup another.aspx page which has a few controls that are filled in and from which I create a small snippet of text. When the user clicks OK on ...
[ "c#", "asp.net", "javascript" ]
1
6
1,668
2
0
2008-09-10T20:14:01.667000
2008-09-10T20:27:05.783000
55,206
55,215
What is the operator precedence order in Visual Basic 6.0?
What is the operator precedence order in Visual Basic 6.0 (VB6)? In particular, for the logical operators.
Arithmetic Operation Precedence Order ^ - (unary negation) *, / \ Mod +, - (binary addition/subtraction) & Comparison Operation Precedence Order = <> < > <= >= Like, Is Logical Operation Precedence Order Not And Or Xor Eqv Imp Source: Sams Teach Yourself Visual Basic 6 in 24 Hours — Appendix A: Operator Precedence
What is the operator precedence order in Visual Basic 6.0? What is the operator precedence order in Visual Basic 6.0 (VB6)? In particular, for the logical operators.
TITLE: What is the operator precedence order in Visual Basic 6.0? QUESTION: What is the operator precedence order in Visual Basic 6.0 (VB6)? In particular, for the logical operators. ANSWER: Arithmetic Operation Precedence Order ^ - (unary negation) *, / \ Mod +, - (binary addition/subtraction) & Comparison Operation...
[ "vb6", "operators", "operator-precedence" ]
17
18
13,646
3
0
2008-09-10T20:14:07.983000
2008-09-10T20:16:37.463000
55,218
55,324
Unique key generation
I looking for a way, specifically in PHP that I will be guaranteed to always get a unique key. I have done the following: strtolower(substr(crypt(time()), 0, 7)); But I have found that once in a while I end up with a duplicate key (rarely, but often enough). I have also thought of doing: strtolower(substr(crypt(uniqid(...
There are only 3 ways to generate unique values, rather they be passwords, user IDs, etc.: Use an effective GUID generator - these are long and cannot be shrunk. If you only use part you FAIL. At least part of the number is sequentially generated off of a single sequence. You can add fluff or encoding to make it look l...
Unique key generation I looking for a way, specifically in PHP that I will be guaranteed to always get a unique key. I have done the following: strtolower(substr(crypt(time()), 0, 7)); But I have found that once in a while I end up with a duplicate key (rarely, but often enough). I have also thought of doing: strtolowe...
TITLE: Unique key generation QUESTION: I looking for a way, specifically in PHP that I will be guaranteed to always get a unique key. I have done the following: strtolower(substr(crypt(time()), 0, 7)); But I have found that once in a while I end up with a duplicate key (rarely, but often enough). I have also thought o...
[ "php", "web-services", "security", "passwords" ]
12
19
16,715
13
0
2008-09-10T20:17:03
2008-09-10T21:06:12.557000
55,223
63,451
How do I implement a HTML cache for a PHP site?
What is the best way of implementing a cache for a PHP site? Obviously, there are some things that shouldn't be cached (for example search queries), but I want to find a good solution that will make sure that I avoid the 'digg effect'. I know there is WP-Cache for WordPress, but I'm writing a custom solution that isn't...
If a proxy cache is out of the question, and you're serving complete HTML files, you'll get the best performance by bypassing PHP altogether. Study how WP Super Cache works. Uncached pages are copied to a cache folder with similar URL structure as your site. On later requests, mod_rewrite notes the existence of the cac...
How do I implement a HTML cache for a PHP site? What is the best way of implementing a cache for a PHP site? Obviously, there are some things that shouldn't be cached (for example search queries), but I want to find a good solution that will make sure that I avoid the 'digg effect'. I know there is WP-Cache for WordPre...
TITLE: How do I implement a HTML cache for a PHP site? QUESTION: What is the best way of implementing a cache for a PHP site? Obviously, there are some things that shouldn't be cached (for example search queries), but I want to find a good solution that will make sure that I avoid the 'digg effect'. I know there is WP...
[ "php", "html", "caching" ]
12
7
8,266
8
0
2008-09-10T20:20:46.470000
2008-09-15T14:34:35.870000
55,256
55,289
Files on Windows and Contiguous Sectors
Is there a way to guarantee that a file on Windows (using the NTFS file system) will use contiguous sectors on the hard disk? In other words, the first chunk of the file will be stored in a certain sector, the second chunk of the file will be stored in the next sector, and so on. I should add that I want to be able to ...
I would start here: http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx and follow Mark's documentation of the defrag stuff: http://technet.microsoft.com/en-us/sysinternals/bb897427.aspx
Files on Windows and Contiguous Sectors Is there a way to guarantee that a file on Windows (using the NTFS file system) will use contiguous sectors on the hard disk? In other words, the first chunk of the file will be stored in a certain sector, the second chunk of the file will be stored in the next sector, and so on....
TITLE: Files on Windows and Contiguous Sectors QUESTION: Is there a way to guarantee that a file on Windows (using the NTFS file system) will use contiguous sectors on the hard disk? In other words, the first chunk of the file will be stored in a certain sector, the second chunk of the file will be stored in the next ...
[ "windows", "filesystems" ]
4
7
1,079
3
0
2008-09-10T20:34:45.283000
2008-09-10T20:45:32.853000
55,273
111,222
What are the advantages of VistaDB
I have seen the references to VistaDB over the years and with tools like SQLite, Firebird, MS SQL et. al. I have never had a reason to consider it. What are the benefits of paying for VistaDB vs using another technology? Things I have thought of: 1. Compact Framework Support. SQLite+MSSQL support the CF. 2. Need migrat...
The VistaDB client runtime is free. The runtime will never "expire at 3am" as you put it. Only the developer tools are licensed in that manner. You need 1 license per developer, simple. We even offer a really inexpensive Lite version with no Visual Studio tools. Some other benefits 100% managed code - there are no inte...
What are the advantages of VistaDB I have seen the references to VistaDB over the years and with tools like SQLite, Firebird, MS SQL et. al. I have never had a reason to consider it. What are the benefits of paying for VistaDB vs using another technology? Things I have thought of: 1. Compact Framework Support. SQLite+M...
TITLE: What are the advantages of VistaDB QUESTION: I have seen the references to VistaDB over the years and with tools like SQLite, Firebird, MS SQL et. al. I have never had a reason to consider it. What are the benefits of paying for VistaDB vs using another technology? Things I have thought of: 1. Compact Framework...
[ "sql-server", "database", "sqlite", "firebird", "vistadb" ]
12
26
9,289
4
0
2008-09-10T20:40:27.687000
2008-09-21T15:24:12.323000
55,296
55,389
How exactly do you configure httpOnly Cookies in ASP Classic?
I'm looking to implement httpOnly in my legacy ASP classic sites. Anyone knows how to do it?
Response.AddHeader "Set-Cookie", "mycookie=yo; HttpOnly" Other options like expires, path and secure can be also added in this way. I don't know of any magical way to change your whole cookies collection, but I could be wrong about that.
How exactly do you configure httpOnly Cookies in ASP Classic? I'm looking to implement httpOnly in my legacy ASP classic sites. Anyone knows how to do it?
TITLE: How exactly do you configure httpOnly Cookies in ASP Classic? QUESTION: I'm looking to implement httpOnly in my legacy ASP classic sites. Anyone knows how to do it? ANSWER: Response.AddHeader "Set-Cookie", "mycookie=yo; HttpOnly" Other options like expires, path and secure can be also added in this way. I don'...
[ "security", "asp-classic", "httponly" ]
13
13
35,444
6
0
2008-09-10T20:49:52.470000
2008-09-10T21:49:08.193000
55,297
75,703
asp consuming a web service, what do do with recordset object?
Currently I run an classic (old) ASP webpage with recordset object used directly in bad old spagethi code fasion. I'm thinking of implementing a data layer in asp.net as web serivce to improve manageability. This is also a first step towards upgrading the website to asp.net. The site itself remains ASP for the moment.....
If you wanted to stick with Classic ASP then I would suggest creating a Database handling object via ASP Classes then just use that object to do your recordset creations. This would centralize your database handling code and make it so that you only have to handle SQL Injection attacks in a single location. A simple ex...
asp consuming a web service, what do do with recordset object? Currently I run an classic (old) ASP webpage with recordset object used directly in bad old spagethi code fasion. I'm thinking of implementing a data layer in asp.net as web serivce to improve manageability. This is also a first step towards upgrading the w...
TITLE: asp consuming a web service, what do do with recordset object? QUESTION: Currently I run an classic (old) ASP webpage with recordset object used directly in bad old spagethi code fasion. I'm thinking of implementing a data layer in asp.net as web serivce to improve manageability. This is also a first step towar...
[ "asp.net", "web-services", "asp-classic" ]
1
1
2,572
7
0
2008-09-10T20:50:32.093000
2008-09-16T18:56:44.110000
55,313
55,712
Automatic code quality tool for Ruby?
One thing I really miss about Java is the tool support. FindBugs, Checkstyle and PMD made for a holy trinity of code quality metrics and automatic bug checking. Is there anything that will check for simple bugs and / or style violations of Ruby code? Bonus points if I can adapt it for frameworks such as Rails so that R...
I've recently started looking for something like this for Ruby. What I've run across so far: Saikuro Roodi Flog These might be places to start. Unfortunately I haven't used any of the three enough yet to offer a good opinion.
Automatic code quality tool for Ruby? One thing I really miss about Java is the tool support. FindBugs, Checkstyle and PMD made for a holy trinity of code quality metrics and automatic bug checking. Is there anything that will check for simple bugs and / or style violations of Ruby code? Bonus points if I can adapt it ...
TITLE: Automatic code quality tool for Ruby? QUESTION: One thing I really miss about Java is the tool support. FindBugs, Checkstyle and PMD made for a holy trinity of code quality metrics and automatic bug checking. Is there anything that will check for simple bugs and / or style violations of Ruby code? Bonus points ...
[ "ruby-on-rails", "ruby", "code-analysis" ]
37
17
11,256
9
0
2008-09-10T21:00:07.390000
2008-09-11T02:41:16.743000
55,317
55,412
OpenGl And Flickering
When objects from a CallList intersect the near plane I get a flicker..., what can I do? Im using OpenGL and SDL. Yes it is double buffered.
It sounds like you're getting z-fighting. "Z-fighting is a phenomenon in 3D rendering that occurs when two or more primitives have similar values in the z-buffer, and is particularly prevalent with coplanar polygons. The effect causes pseudo-random pixels to be rendered with the color of one polygon or another in a non...
OpenGl And Flickering When objects from a CallList intersect the near plane I get a flicker..., what can I do? Im using OpenGL and SDL. Yes it is double buffered.
TITLE: OpenGl And Flickering QUESTION: When objects from a CallList intersect the near plane I get a flicker..., what can I do? Im using OpenGL and SDL. Yes it is double buffered. ANSWER: It sounds like you're getting z-fighting. "Z-fighting is a phenomenon in 3D rendering that occurs when two or more primitives have...
[ "opengl" ]
1
5
6,960
4
0
2008-09-10T21:02:52.733000
2008-09-10T22:07:24.747000
55,322
83,069
JVM choices on Windows Mobile
What are the JVM implementations available on Windows Mobile? Esmertec JBed is the one on my WinMo phone. Wondering how many other JVM vendors are in this zone. Are there any comparison or benchmarking data available?
JVM Choices for Windows CE in general (including Pocket PC and Windows Mobile): CrE-ME Mysaifu Skelmir CEEJ If you're looking to have a common code base between WinMo and Symbina, you might also look at Red Five Labs. They have a Symbian runtime that allows you to run COmpact Framework apps, so you could have a CF code...
JVM choices on Windows Mobile What are the JVM implementations available on Windows Mobile? Esmertec JBed is the one on my WinMo phone. Wondering how many other JVM vendors are in this zone. Are there any comparison or benchmarking data available?
TITLE: JVM choices on Windows Mobile QUESTION: What are the JVM implementations available on Windows Mobile? Esmertec JBed is the one on my WinMo phone. Wondering how many other JVM vendors are in this zone. Are there any comparison or benchmarking data available? ANSWER: JVM Choices for Windows CE in general (includ...
[ "windows-mobile", "jvm" ]
8
7
16,047
8
0
2008-09-10T21:05:06.677000
2008-09-17T13:18:46.707000
55,323
56,645
ASP.NET Web Application Build Output - How do I include all deployment files?
When I build my ASP.NET web application I get a.dll file with the code for the website in it (which is great) but the website also needs all the.aspx files and friends, and these need to be placed in the correct directory structure. How can I get this all in one directory as the result of each build? Trying to pick the...
One solution appears to be Web Deployment Projects (WDPs), an add-on for Visual Studio (and msbuild) available that builds a web project to a directory and can optionally merge assemblies and alter the web.config file. The output of building a WDP is all the files necessary to deploy the site in one directory. More inf...
ASP.NET Web Application Build Output - How do I include all deployment files? When I build my ASP.NET web application I get a.dll file with the code for the website in it (which is great) but the website also needs all the.aspx files and friends, and these need to be placed in the correct directory structure. How can I...
TITLE: ASP.NET Web Application Build Output - How do I include all deployment files? QUESTION: When I build my ASP.NET web application I get a.dll file with the code for the website in it (which is great) but the website also needs all the.aspx files and friends, and these need to be placed in the correct directory st...
[ "asp.net", "deployment", "build-process", "build-automation" ]
4
5
4,786
9
0
2008-09-10T21:06:06.050000
2008-09-11T14:15:42.033000
55,340
55,504
Bespoke SQL Server 'encoding' sproc - is there a neater way of doing this?
I'm just wondering if there's a better way of doing this in SQL Server 2005. Effectively, I'm taking an originator_id (a number between 0 and 99) and a 'next_element' (it's really just a sequential counter between 1 and 999,999). We are trying to create a 6-character 'code' from them. The originator_id is multiplied up...
Seeing as it's SQL Server 2005, any reason not to use a CLR stored procedure? You could use your CLR language of choice then and it'd probably be a relatively direct port of your existing Delphi code.
Bespoke SQL Server 'encoding' sproc - is there a neater way of doing this? I'm just wondering if there's a better way of doing this in SQL Server 2005. Effectively, I'm taking an originator_id (a number between 0 and 99) and a 'next_element' (it's really just a sequential counter between 1 and 999,999). We are trying t...
TITLE: Bespoke SQL Server 'encoding' sproc - is there a neater way of doing this? QUESTION: I'm just wondering if there's a better way of doing this in SQL Server 2005. Effectively, I'm taking an originator_id (a number between 0 and 99) and a 'next_element' (it's really just a sequential counter between 1 and 999,999...
[ "sql-server", "t-sql" ]
1
3
601
2
0
2008-09-10T21:15:12.173000
2008-09-10T23:44:26.123000
55,342
55,359
How can I kill all sessions connecting to my oracle database?
I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator. I don't want to just lock the database and let the users quit gracefully. How would I script this?
This answer is heavily influenced by a conversation here: http://www.tek-tips.com/viewthread.cfm?qid=1395151&page=3 ALTER SYSTEM ENABLE RESTRICTED SESSION; begin for x in ( select Sid, Serial#, machine, program from v$session where machine <> 'MyDatabaseServerName' ) loop execute immediate 'Alter System Kill Session '...
How can I kill all sessions connecting to my oracle database? I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator. I don't want to just lock the database and let the users quit gracefully. How would I script this?
TITLE: How can I kill all sessions connecting to my oracle database? QUESTION: I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator. I don't want to just lock the database and let the users quit gracefully. How would I script this...
[ "oracle", "session", "sqlplus", "kill", "database-administration" ]
30
46
137,569
10
0
2008-09-10T21:16:10.613000
2008-09-10T21:27:44.500000
55,350
55,813
"Background" task in palm OS
I'm trying to create a Palm OS app to check a web site every X minutes or hours, and provide a notification when a piece of data is available. I know that this kind of thing can be done on the new Palm's - for example, my Centro can have email or web sites download when the application isn't on top - but I don't know h...
This is possible to do but very difficult. There are several steps you'll have to take. First off, this only works on Palm OS 5 and is sketchy on some of the early Palm OS 5 devices. The latest devices are better but not perfect. Next, you will need to create an alarm for your application using AlmSetAlarm. This is how...
"Background" task in palm OS I'm trying to create a Palm OS app to check a web site every X minutes or hours, and provide a notification when a piece of data is available. I know that this kind of thing can be done on the new Palm's - for example, my Centro can have email or web sites download when the application isn'...
TITLE: "Background" task in palm OS QUESTION: I'm trying to create a Palm OS app to check a web site every X minutes or hours, and provide a notification when a piece of data is available. I know that this kind of thing can be done on the new Palm's - for example, my Centro can have email or web sites download when th...
[ "palm-os", "garnet-os" ]
4
7
399
1
0
2008-09-10T21:19:39.340000
2008-09-11T04:37:39.507000
55,360
87,364
__doPostBack is not working in firefox
The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome?? It's a simple asp:LinkButton with an OnClick event The javascript confirm is firing so I know the javascript is working, it's specirically the __doPostBack event. There is a lot more go...
Check your User Agent string. This same thing happened to me one time and I realized it was because I was testing out some pages as "googlebot". The JavaScript that is generated depends on knowing what the user agent is. From http://support.mozilla.com/tiki-view_forum_thread.php?locale=tr&comments_parentId=160492&forum...
__doPostBack is not working in firefox The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome?? It's a simple asp:LinkButton with an OnClick event The javascript confirm is firing so I know the javascript is working, it's specirically the __d...
TITLE: __doPostBack is not working in firefox QUESTION: The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome?? It's a simple asp:LinkButton with an OnClick event The javascript confirm is firing so I know the javascript is working, it's sp...
[ "c#", "asp.net" ]
3
5
16,485
14
0
2008-09-10T21:28:13.907000
2008-09-17T20:35:43.083000
55,365
56,008
How can I get Emacs' key bindings in Python's IDLE?
I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs?
IDLE provides Emacs keybindings without having to install other software. Open up the menu item Options -> Configure IDLE... Go to Keys tab In the drop down menu on the right side of the dialog change the select to "IDLE Classic Unix" It's not the true emacs key bindings but you get the basics like movement, saving/ope...
How can I get Emacs' key bindings in Python's IDLE? I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs?
TITLE: How can I get Emacs' key bindings in Python's IDLE? QUESTION: I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs? ANSWER: IDLE provides Emacs keybindings without having to install other software. Open up the menu item Option...
[ "python", "emacs", "ide", "keyboard" ]
6
6
2,153
3
0
2008-09-10T21:32:47.140000
2008-09-11T08:18:07.027000
55,369
55,396
Reading VC++ CArchive Binary Format (or Java reading (CObArray))
Is there any clear documentation on the binary formats used to serialize the various MFC data structures? I've been able to view some of my own classes in a hex editor and use Java's ByteBuffer class to read them in (with automatic endianness conversions, etc). However, I am currently running into issues while trying t...
Since MFC ships with source code I would create a test MFC application that serializes a CObArray and step through the serialization code. This should give you all the information you need.
Reading VC++ CArchive Binary Format (or Java reading (CObArray)) Is there any clear documentation on the binary formats used to serialize the various MFC data structures? I've been able to view some of my own classes in a hex editor and use Java's ByteBuffer class to read them in (with automatic endianness conversions,...
TITLE: Reading VC++ CArchive Binary Format (or Java reading (CObArray)) QUESTION: Is there any clear documentation on the binary formats used to serialize the various MFC data structures? I've been able to view some of my own classes in a hex editor and use Java's ByteBuffer class to read them in (with automatic endia...
[ "java", "visual-c++", "serialization", "mfc", "carchive" ]
3
3
2,140
2
0
2008-09-10T21:33:48.480000
2008-09-10T21:53:09.323000
55,375
55,435
Extending an enum via inheritance
I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum. I assume it's not possible in Java, as it only got them fairly recently (Java 5?). C# seems m...
The reason you can't extend Enums is because it would lead to problems with polymorphism. Say you have an enum MyEnum with values A, B, and C, and extend it with value D as MyExtEnum. Suppose a method expects a myEnum value somewhere, for instance as a parameter. It should be legal to supply a MyExtEnum value, because ...
Extending an enum via inheritance I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum. I assume it's not possible in Java, as it only got them fai...
TITLE: Extending an enum via inheritance QUESTION: I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum. I assume it's not possible in Java, as it...
[ "c#", "java", ".net" ]
101
115
108,577
15
0
2008-09-10T21:39:21.477000
2008-09-10T22:29:39.640000
55,391
55,424
Python regular expression for HTML parsing
I want to grab the value of a hidden input field in HTML. I want to write a regular expression in Python that will return the value of fooId, given that I know the line in the HTML follows the format Can someone provide an example in Python to parse the HTML for the value?
For this particular case, BeautifulSoup is harder to write than a regex, but it is much more robust... I'm just contributing with the BeautifulSoup example, given that you already know which regexp to use:-) from BeautifulSoup import BeautifulSoup #Or retrieve it from the web, etc. html_data = open('/yourwebsite/page....
Python regular expression for HTML parsing I want to grab the value of a hidden input field in HTML. I want to write a regular expression in Python that will return the value of fooId, given that I know the line in the HTML follows the format Can someone provide an example in Python to parse the HTML for the value?
TITLE: Python regular expression for HTML parsing QUESTION: I want to grab the value of a hidden input field in HTML. I want to write a regular expression in Python that will return the value of fooId, given that I know the line in the HTML follows the format Can someone provide an example in Python to parse the HTML ...
[ "python", "regex", "web-scraping", "beautifulsoup" ]
11
27
27,539
7
0
2008-09-10T21:49:53.900000
2008-09-10T22:16:24.273000
55,403
319,096
Have you successfully used a GPGPU?
I am interested to know whether anyone has written an application that takes advantage of a GPGPU by using, for example, nVidia CUDA. If so, what issues did you find and what performance gains did you achieve compared with a standard CPU?
I have been doing gpgpu development with ATI's stream SDK instead of Cuda. What kind of performance gain you will get depends on a lot of factors, but the most important is the numeric intensity. (That is, the ratio of compute operations to memory references.) A BLAS level-1 or BLAS level-2 function like adding two vec...
Have you successfully used a GPGPU? I am interested to know whether anyone has written an application that takes advantage of a GPGPU by using, for example, nVidia CUDA. If so, what issues did you find and what performance gains did you achieve compared with a standard CPU?
TITLE: Have you successfully used a GPGPU? QUESTION: I am interested to know whether anyone has written an application that takes advantage of a GPGPU by using, for example, nVidia CUDA. If so, what issues did you find and what performance gains did you achieve compared with a standard CPU? ANSWER: I have been doing ...
[ "cuda", "gpgpu", "hpc" ]
19
29
3,671
10
0
2008-09-10T21:59:23.363000
2008-11-25T22:18:40.460000
55,411
60,353
Path.GetTempFileName -- Directory name is invalid
Running into a problem where on certain servers we get an error that the directory name is invalid when using Path.GetTempFileName. Further investigation shows that it is trying to write a file to c:\Documents and Setting\computername\aspnet\local settings\temp (found by using Path.GetTempPath). This folder exists so I...
This is probably a combination of impersonation and a mismatch of different authentication methods occurring. There are many pieces; I'll try to go over them one by one. Impersonation is a technique to "temporarily" switch the user account under which a thread is running. Essentially, the thread briefly gains the same ...
Path.GetTempFileName -- Directory name is invalid Running into a problem where on certain servers we get an error that the directory name is invalid when using Path.GetTempFileName. Further investigation shows that it is trying to write a file to c:\Documents and Setting\computername\aspnet\local settings\temp (found b...
TITLE: Path.GetTempFileName -- Directory name is invalid QUESTION: Running into a problem where on certain servers we get an error that the directory name is invalid when using Path.GetTempFileName. Further investigation shows that it is trying to write a file to c:\Documents and Setting\computername\aspnet\local sett...
[ "c#", "asp.net", "iis" ]
10
18
14,142
5
0
2008-09-10T22:06:40.477000
2008-09-13T05:56:29.970000
55,414
82,710
ASP.NET MVC versus the Zeitgeist
ASP.NET MVC seems to be making a pretty big entrance. Can anyone summarize how its MVC implementation stacks up against popular MVC frameworks for other languages? (I'm thinking specifically of Rails and Zend Framework, though there are obviously lots.) Observations on learning curve, common terminology, ease of use an...
I'm just getting into ASP.NET MVC, so these are some early thoughts comparing it to Rails: Mostly manages to stick with static typing, at the expense of a little extra code. This will either give you the warm fuzzies or make you feel slightly shackled depending on how you feel about dynamic typing. For instance, you ca...
ASP.NET MVC versus the Zeitgeist ASP.NET MVC seems to be making a pretty big entrance. Can anyone summarize how its MVC implementation stacks up against popular MVC frameworks for other languages? (I'm thinking specifically of Rails and Zend Framework, though there are obviously lots.) Observations on learning curve, c...
TITLE: ASP.NET MVC versus the Zeitgeist QUESTION: ASP.NET MVC seems to be making a pretty big entrance. Can anyone summarize how its MVC implementation stacks up against popular MVC frameworks for other languages? (I'm thinking specifically of Rails and Zend Framework, though there are obviously lots.) Observations on...
[ "asp.net-mvc", "model-view-controller", "zend-framework" ]
5
7
635
2
0
2008-09-10T22:11:24.583000
2008-09-17T12:42:58.790000
55,434
55,445
How to parse relative time?
This question is the other side of the question asking, " How do I calculate relative time? ". Given some human input for a relative time, how can you parse it? By default you would offset from DateTime.Now(), but could optionally offset from another DateTime. (Prefer answers in C#) Example input: "in 20 minutes" "5 ho...
That's building a DSL (Domain specific language) for date handling. I don't know if somebody has done one for.NET but the construction of a DSL is fairly straightforward: Define the language precisely, which input forms you will accept and what will you do with ambiguities Construct the grammar for the language Build t...
How to parse relative time? This question is the other side of the question asking, " How do I calculate relative time? ". Given some human input for a relative time, how can you parse it? By default you would offset from DateTime.Now(), but could optionally offset from another DateTime. (Prefer answers in C#) Example ...
TITLE: How to parse relative time? QUESTION: This question is the other side of the question asking, " How do I calculate relative time? ". Given some human input for a relative time, how can you parse it? By default you would offset from DateTime.Now(), but could optionally offset from another DateTime. (Prefer answe...
[ "c#", "parsing", "time", "language-agnostic" ]
12
3
2,640
5
0
2008-09-10T22:27:51.143000
2008-09-10T22:39:07.120000
55,437
55,441
Using Microsoft's Application Blocks
I haven't done a lot of.NET programming, but I've examined a few of the application blocks published by Microsoft's Patterns and Practices group. I was wondering how these are typically used: Linked directly into applications Source added into applications and built with them, perhaps with some customization's Sample c...
I usually put the source into my project, and then I can get better intellisense (and a better understanding of them). I don't tend to customize them at all though. I like to have them stock so I can just distribute the stock binaries anytime I need them.
Using Microsoft's Application Blocks I haven't done a lot of.NET programming, but I've examined a few of the application blocks published by Microsoft's Patterns and Practices group. I was wondering how these are typically used: Linked directly into applications Source added into applications and built with them, perha...
TITLE: Using Microsoft's Application Blocks QUESTION: I haven't done a lot of.NET programming, but I've examined a few of the application blocks published by Microsoft's Patterns and Practices group. I was wondering how these are typically used: Linked directly into applications Source added into applications and buil...
[ ".net", "design-patterns", "application-blocks" ]
4
2
2,074
6
0
2008-09-10T22:30:38.217000
2008-09-10T22:35:48.190000
55,440
55,446
Checking Inheritance with templates in C++
I've a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this. template class WrapperClass { // the code goes here } Now, how do I make sure that ImplementationClass can be derived from a set of classes only, similar to java'...
It's verbose, but you can do it like this: #include #include struct base {}; template class WrapperClass; template class WrapperClass >::type> {}; struct derived: base {}; struct not_derived {}; int main() { WrapperClass x; // Compile error here: WrapperClass y; } This requires a compiler with good support for the...
Checking Inheritance with templates in C++ I've a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this. template class WrapperClass { // the code goes here } Now, how do I make sure that ImplementationClass can be derived f...
TITLE: Checking Inheritance with templates in C++ QUESTION: I've a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this. template class WrapperClass { // the code goes here } Now, how do I make sure that ImplementationClas...
[ "java", "c++", "templates" ]
2
7
654
3
0
2008-09-10T22:35:06.913000
2008-09-10T22:43:38.140000
55,448
55,476
What’s the best approach when migrating legacy projects across versions of visual studio?
I've been thinking about the number of projects we have in-house that are still being developed using visual studio 6 and how best to migrate them forward onto visual studio 2008. The projects range in flavours of C/C++ and VB. Is it better to let VS2008 convert the work-spaces into solutions, fix any compile errors an...
The Microsoft p&p team has recommended some strategies that answers this. Basically they recommend something like the project by project approach you mention. Of course, they're assuming a neatly architected application that has no nasty, dark corners from which late nights of coding and copious amounts of coffee sprin...
What’s the best approach when migrating legacy projects across versions of visual studio? I've been thinking about the number of projects we have in-house that are still being developed using visual studio 6 and how best to migrate them forward onto visual studio 2008. The projects range in flavours of C/C++ and VB. Is...
TITLE: What’s the best approach when migrating legacy projects across versions of visual studio? QUESTION: I've been thinking about the number of projects we have in-house that are still being developed using visual studio 6 and how best to migrate them forward onto visual studio 2008. The projects range in flavours o...
[ "visual-studio", "migration", "legacy" ]
4
3
287
2
0
2008-09-10T22:45:20.367000
2008-09-10T23:09:39.887000
55,449
55,509
Can you "ignore" a file in Perforce?
I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot. It launches another window that performs a 'Folder Diff'. I have files I never want to check in to source control (like ones found in bin folder such...
As of version 2012.1, Perforce supports the P4IGNORE environment variable. I updated my answer to this question about ignoring directories with an explanation of how it works. Then I noticed this answer, which is now superfluous I guess. Assuming you have a client named "CLIENT", a directory named "foo" (located at you...
Can you "ignore" a file in Perforce? I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot. It launches another window that performs a 'Folder Diff'. I have files I never want to check in to source contro...
TITLE: Can you "ignore" a file in Perforce? QUESTION: I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot. It launches another window that performs a 'Folder Diff'. I have files I never want to check i...
[ "version-control", "perforce", "ignore" ]
104
60
64,153
11
0
2008-09-10T22:45:31.193000
2008-09-10T23:48:48.123000
55,451
55,477
Which C# project type would you use to redevelop a MFC C++ activex control?
Looking at the C# project templates in VS2008 and the offerings are WPF User Control Library, WPF Custom Control Library and Windows Forms Control Library. Which of these would you use if you wanted to move a legacy active control written in c++ into the world of C# and.NET?
It sounds like you are trying to do several different things all at once: Migrate your code to building in a newer version of visual studio. Migrate your use of technology to a newer technology (ActiveX to.net) Migrate your language (c++ to c#). If you have a small codebase you are probably as well to start from scratc...
Which C# project type would you use to redevelop a MFC C++ activex control? Looking at the C# project templates in VS2008 and the offerings are WPF User Control Library, WPF Custom Control Library and Windows Forms Control Library. Which of these would you use if you wanted to move a legacy active control written in c+...
TITLE: Which C# project type would you use to redevelop a MFC C++ activex control? QUESTION: Looking at the C# project templates in VS2008 and the offerings are WPF User Control Library, WPF Custom Control Library and Windows Forms Control Library. Which of these would you use if you wanted to move a legacy active con...
[ "c#", "c++", "visual-studio", "code-migration" ]
0
2
453
3
0
2008-09-10T22:47:35.650000
2008-09-10T23:10:50.900000
55,460
55,528
What is the possible mimetype hierarchy of an email message?
I'm working with a snippet of code that recursively calls itself and tries to pull out a MIME Type part of text/html from an email (if it exists) for further processing. The "text/html" could exist inside other content such as multipart/alternative, so I'm trying to find out if there is a defined hierarchy for email MI...
In theory, only multipart/ and message/ can parent other types (per RFC2046).
What is the possible mimetype hierarchy of an email message? I'm working with a snippet of code that recursively calls itself and tries to pull out a MIME Type part of text/html from an email (if it exists) for further processing. The "text/html" could exist inside other content such as multipart/alternative, so I'm tr...
TITLE: What is the possible mimetype hierarchy of an email message? QUESTION: I'm working with a snippet of code that recursively calls itself and tries to pull out a MIME Type part of text/html from an email (if it exists) for further processing. The "text/html" could exist inside other content such as multipart/alte...
[ "mime-types", "html-email", "email", "email-validation" ]
0
1
409
2
0
2008-09-10T22:57:22.647000
2008-09-11T00:03:34.190000
55,463
55,475
Should I use one big SQL Select statement or several small ones?
I'm building a PHP page with data sent from MySQL. Is it better to have 1 SELECT query with 4 table joins, or 4 small SELECT queries with no table join; I do select from an ID Which is faster and what is the pro/con of each method? I only need one row from each tables.
You should run a profiling tool if you're truly worried cause it depends on many things and it can vary but as a rule its better to have fewer queries being compiled and fewer round trips to the database. Make sure you filter things as well as you can using your where and join on clauses. But honestly, it usually doesn...
Should I use one big SQL Select statement or several small ones? I'm building a PHP page with data sent from MySQL. Is it better to have 1 SELECT query with 4 table joins, or 4 small SELECT queries with no table join; I do select from an ID Which is faster and what is the pro/con of each method? I only need one row fro...
TITLE: Should I use one big SQL Select statement or several small ones? QUESTION: I'm building a PHP page with data sent from MySQL. Is it better to have 1 SELECT query with 4 table joins, or 4 small SELECT queries with no table join; I do select from an ID Which is faster and what is the pro/con of each method? I onl...
[ "php", "mysql", "performance", "optimization" ]
18
20
17,558
7
0
2008-09-10T23:02:40.653000
2008-09-10T23:08:36.490000
55,482
57,801
Uninstall Command Fails Only in Release Mode
I'm able to successfully uninstall a third-party application via the command line and via a custom Inno Setup installer. Command line Execution: MSIEXEC.exe /x {14D74337-01C2-4F8F-B44B-67FC613E5B1F} /qn Inno Setup Command: [Run] Filename: msiexec.exe; Flags: runhidden waituntilterminated; Parameters: "/x {{14D74337-01C...
Thanks to those offering help. This appears to be a permissions issue. I have updated my service to run under an Administrator account and it was able to successfully uninstall the third-party application. To Orion's point, though the Local System account is a powerful account that has full access to the system -- http...
Uninstall Command Fails Only in Release Mode I'm able to successfully uninstall a third-party application via the command line and via a custom Inno Setup installer. Command line Execution: MSIEXEC.exe /x {14D74337-01C2-4F8F-B44B-67FC613E5B1F} /qn Inno Setup Command: [Run] Filename: msiexec.exe; Flags: runhidden waitun...
TITLE: Uninstall Command Fails Only in Release Mode QUESTION: I'm able to successfully uninstall a third-party application via the command line and via a custom Inno Setup installer. Command line Execution: MSIEXEC.exe /x {14D74337-01C2-4F8F-B44B-67FC613E5B1F} /qn Inno Setup Command: [Run] Filename: msiexec.exe; Flags...
[ "c#", "installation", "service" ]
4
2
1,510
5
0
2008-09-10T23:16:32.867000
2008-09-11T22:24:15.837000
55,487
55,582
Find the settings JNDI is using for error reporting
I've got a J2SE application that I am maintaining uses JNDI. (It uses JNDI to find it's J2EE application server.) It has pretty poor error reporting of failure to find the JNDI server. I've been looking around fora way to display which server the InitialContext is trying to talk to. Has anyone got a neat way to do this...
Reporting the value for InitialContext.getEnvironment().get(Context.PROVIDER_URL) might be helpful.
Find the settings JNDI is using for error reporting I've got a J2SE application that I am maintaining uses JNDI. (It uses JNDI to find it's J2EE application server.) It has pretty poor error reporting of failure to find the JNDI server. I've been looking around fora way to display which server the InitialContext is try...
TITLE: Find the settings JNDI is using for error reporting QUESTION: I've got a J2SE application that I am maintaining uses JNDI. (It uses JNDI to find it's J2EE application server.) It has pretty poor error reporting of failure to find the JNDI server. I've been looking around fora way to display which server the Ini...
[ "java", "jndi" ]
1
1
168
1
0
2008-09-10T23:27:17.880000
2008-09-11T00:54:43.333000
55,502
55,507
Return collection as read-only
I have an object in a multi-threaded environment that maintains a collection of information, e.g.: public IList Data { get { return data; } } I currently have return data; wrapped by a ReaderWriterLockSlim to protect the collection from sharing violations. However, to be doubly sure, I'd like to return the collection a...
If your underlying data is stored as list you can use List(T).AsReadOnly method. If your data can be enumerated, you can use Enumerable.ToList method to cast your collection to List and call AsReadOnly on it.
Return collection as read-only I have an object in a multi-threaded environment that maintains a collection of information, e.g.: public IList Data { get { return data; } } I currently have return data; wrapped by a ReaderWriterLockSlim to protect the collection from sharing violations. However, to be doubly sure, I'd ...
TITLE: Return collection as read-only QUESTION: I have an object in a multi-threaded environment that maintains a collection of information, e.g.: public IList Data { get { return data; } } I currently have return data; wrapped by a ReaderWriterLockSlim to protect the collection from sharing violations. However, to be...
[ "c#", ".net", "multithreading", "collections", "concurrency" ]
22
33
26,603
7
0
2008-09-10T23:43:35.577000
2008-09-10T23:47:57.783000
55,503
55,575
How do I logout of multiple asp.net applications?
I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that?
What you are looking to do is called Single Sign On and Single Sign Off. There are differences based on how you have the applications set up. I will try to clarify where those differences come into play. To implement single sign on and single sign off you need to make the cookie name, protection, and path attributes th...
How do I logout of multiple asp.net applications? I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that?
TITLE: How do I logout of multiple asp.net applications? QUESTION: I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that? AN...
[ "asp.net", "authentication", "forms-authentication", "asp.net-1.1" ]
3
5
3,264
4
0
2008-09-10T23:44:04.377000
2008-09-11T00:51:29.737000
55,506
55,546
How do I conditionally create a stored procedure in SQL Server?
As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.: if @version <> @expects begin declare @error varchar(100); set @error = 'Invalid version. Your version is ' + convert(varchar, @versio...
Here's what I came up with: Wrap it in an EXEC(), like so: if @version <> @expects begin...snip... end else begin exec('CREATE PROC MyProc AS SELECT ''Victory!'''); end Works like a charm!
How do I conditionally create a stored procedure in SQL Server? As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.: if @version <> @expects begin declare @error varchar(100); set @error ...
TITLE: How do I conditionally create a stored procedure in SQL Server? QUESTION: As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.: if @version <> @expects begin declare @error varchar...
[ "sql-server", "stored-procedures" ]
25
25
22,665
11
0
2008-09-10T23:45:27.617000
2008-09-11T00:16:51.100000
55,510
55,548
When do function-level static variables get allocated/initialized?
I'm quite confident that globally declared variables get allocated (and initialized, if applicable) at program start time. int globalgarbage; unsigned int anumber = 42; But what about static ones defined within a function? void doSomething() { static bool globalish = true; //... } When is the space for globalish alloca...
I was curious about this so I wrote the following test program and compiled it with g++ version 4.1.2. include #include using namespace std; class test { public: test(const char *name): _name(name) { cout << _name << " created" << endl; } ~test() { cout << _name << " destroyed" << endl; } string _name; }; test t("g...
When do function-level static variables get allocated/initialized? I'm quite confident that globally declared variables get allocated (and initialized, if applicable) at program start time. int globalgarbage; unsigned int anumber = 42; But what about static ones defined within a function? void doSomething() { static bo...
TITLE: When do function-level static variables get allocated/initialized? QUESTION: I'm quite confident that globally declared variables get allocated (and initialized, if applicable) at program start time. int globalgarbage; unsigned int anumber = 42; But what about static ones defined within a function? void doSomet...
[ "c++", "variables" ]
109
108
83,004
8
0
2008-09-10T23:49:09.107000
2008-09-11T00:18:08.460000
55,517
55,645
Very slow compile times on Visual Studio 2005
We are getting very slow compile times, which can take upwards of 20+ minutes on dual core 2GHz, 2G Ram machines. A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you have a lot of files. (swapping out VSS is not an option unfortunate...
The Chromium.org team listed several options for accelerating the build (at this point about half-way down the page): In decreasing order of speedup: Install Microsoft hotfix 935225. Install Microsoft hotfix 947315. Use a true multicore processor (ie. an Intel Core Duo 2; not a Pentium 4 HT). Use 3 parallel builds. In ...
Very slow compile times on Visual Studio 2005 We are getting very slow compile times, which can take upwards of 20+ minutes on dual core 2GHz, 2G Ram machines. A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you have a lot of files. ...
TITLE: Very slow compile times on Visual Studio 2005 QUESTION: We are getting very slow compile times, which can take upwards of 20+ minutes on dual core 2GHz, 2G Ram machines. A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you hav...
[ "c#", "visual-studio", "compilation" ]
133
74
88,157
34
0
2008-09-10T23:56:00.353000
2008-09-11T01:34:44.267000
55,531
55,544
How do I calculate the "cost" of a crash?
Background: Some time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for prioritizing types of crashes. It worked reasonably well. Now, ...
I've not seen any studies, but a reasonable heuristic would be something like: ( Time since last application save when crash occurred + Time to restart application ) * Average hourly rate of application operator. The estimation gets more complex if the crashes have some impact on external customers such, or might delay...
How do I calculate the "cost" of a crash? Background: Some time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for prioritizing types of...
TITLE: How do I calculate the "cost" of a crash? QUESTION: Background: Some time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for pri...
[ "crash", "statistics", "crash-reports" ]
11
11
1,511
4
0
2008-09-11T00:05:58.053000
2008-09-11T00:15:33.037000
55,532
55,660
Casting between multi- and single-dimentional arrays
This came up from this answer to a previous question of mine. Is it guaranteed for the compiler to treat array[4][4] the same as array[16]? For instance, would either of the below calls to api_func() be safe? void api_func(const double matrix[4][4]); //... { typedef double Matrix[4][4]; double* array1 = new double[1...
From the C++ standard, referring to the sizeof operator: When applied to an array, the result is the total number of bytes in the array. This implies that the size of an array of n elements is n times the size of an element. From this, I'd say that double[4][4] and double[16] would have to have the same underlying repr...
Casting between multi- and single-dimentional arrays This came up from this answer to a previous question of mine. Is it guaranteed for the compiler to treat array[4][4] the same as array[16]? For instance, would either of the below calls to api_func() be safe? void api_func(const double matrix[4][4]); //... { typede...
TITLE: Casting between multi- and single-dimentional arrays QUESTION: This came up from this answer to a previous question of mine. Is it guaranteed for the compiler to treat array[4][4] the same as array[16]? For instance, would either of the below calls to api_func() be safe? void api_func(const double matrix[4][4])...
[ "c++", "arrays" ]
3
3
595
6
0
2008-09-11T00:06:58.097000
2008-09-11T01:42:11.113000
55,556
55,634
Characters to avoid in automatically generated passwords
I need to generate some passwords, I want to avoid characters that can be confused for each other. Is there a definitive list of characters I should avoid? my current list is il10o8B3Evu![]{} Are there any other pairs of characters that are easy to confuse? for special characters I was going to limit myself to those un...
Here are the character sets that Steve Gibson uses for his "Perfect Paper Password" system. They are "characters to allow" rather than "characters to avoid", but they seem pretty reasonable for what you want: A standard set of 64 characters!#%+23456789:=?@ABCDEFGHJKLMNPRS TUVWXYZabcdefghijkmnopqrstuvwxyz A larger set o...
Characters to avoid in automatically generated passwords I need to generate some passwords, I want to avoid characters that can be confused for each other. Is there a definitive list of characters I should avoid? my current list is il10o8B3Evu![]{} Are there any other pairs of characters that are easy to confuse? for s...
TITLE: Characters to avoid in automatically generated passwords QUESTION: I need to generate some passwords, I want to avoid characters that can be confused for each other. Is there a definitive list of characters I should avoid? my current list is il10o8B3Evu![]{} Are there any other pairs of characters that are easy...
[ "security", "passwords", "user-experience" ]
33
54
22,574
11
0
2008-09-11T00:27:50.060000
2008-09-11T01:24:43.760000
55,572
55,599
live asp.net web.config settings
I've only recently started working with asp.net and c#. Is there a standard practice set of web.config settings for a live final website? There seem to be a ton of options available and I'm looking to streamline performance, close possible security holes and other unnecessary options.
Tip/Trick: Automating Dev, QA, Staging, and Production Web.Config Settings with VS 2005
live asp.net web.config settings I've only recently started working with asp.net and c#. Is there a standard practice set of web.config settings for a live final website? There seem to be a ton of options available and I'm looking to streamline performance, close possible security holes and other unnecessary options.
TITLE: live asp.net web.config settings QUESTION: I've only recently started working with asp.net and c#. Is there a standard practice set of web.config settings for a live final website? There seem to be a ton of options available and I'm looking to streamline performance, close possible security holes and other unne...
[ "asp.net", "security", "web-config" ]
5
3
742
4
0
2008-09-11T00:48:10.743000
2008-09-11T01:04:59.220000
55,574
55,610
Learning Ruby on Rails
As it stands now, I'm a Java and C# developer. The more and more I look at Ruby on Rails, the more I really want to learn it. What have you found to be the best route to learn RoR? Would it be easier to develop on Windows, or should I just run a virtual machine with Linux? Is there an IDE that can match the robustness ...
I've been moving from C# in my professional career to looking at Ruby and RoR in my personal life, and I've found linux to be slightly more appealing personally for development. Particularly now that I've started using git, the implementation is cleaner on linux. Currently I'm dual booting and getting closer to running...
Learning Ruby on Rails As it stands now, I'm a Java and C# developer. The more and more I look at Ruby on Rails, the more I really want to learn it. What have you found to be the best route to learn RoR? Would it be easier to develop on Windows, or should I just run a virtual machine with Linux? Is there an IDE that ca...
TITLE: Learning Ruby on Rails QUESTION: As it stands now, I'm a Java and C# developer. The more and more I look at Ruby on Rails, the more I really want to learn it. What have you found to be the best route to learn RoR? Would it be easier to develop on Windows, or should I just run a virtual machine with Linux? Is th...
[ "ruby-on-rails", "ruby" ]
241
205
191,736
56
0
2008-09-11T00:50:59.520000
2008-09-11T01:11:52.683000
55,576
240,739
ASP.Net: If I have the Session ID, Can I get the Session object?
This question is related to this one, though I think I was a little too long-winded there to really get a good answer. I'll keep this brief. I'm working on a web handler (ashx) that accepts a form post from an aspx page. When the handler receives this form post, in order to do what it needs to do, it needs to know the ...
Jonas posted a great answer to this question here: Can I put an ASP.Net session ID in a hidden form field?
ASP.Net: If I have the Session ID, Can I get the Session object? This question is related to this one, though I think I was a little too long-winded there to really get a good answer. I'll keep this brief. I'm working on a web handler (ashx) that accepts a form post from an aspx page. When the handler receives this for...
TITLE: ASP.Net: If I have the Session ID, Can I get the Session object? QUESTION: This question is related to this one, though I think I was a little too long-winded there to really get a good answer. I'll keep this brief. I'm working on a web handler (ashx) that accepts a form post from an aspx page. When the handler...
[ "asp.net", "session" ]
14
1
17,833
4
0
2008-09-11T00:52:25.053000
2008-10-27T17:30:51.733000
55,577
55,578
How can I test my web pages in Microsoft Internet Explorer on a Mac?
I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.
Update: Microsoft now provide virtual machine images for various versions of IE that are ready to use on all of the major OS X virtualisation platforms ( VirtualBox, VMWare Fusion, and Parallels ). Download the appropriate image from: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ On an Intel based Mac...
How can I test my web pages in Microsoft Internet Explorer on a Mac? I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.
TITLE: How can I test my web pages in Microsoft Internet Explorer on a Mac? QUESTION: I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC. ANSWER: Update: Microsoft now provide virtual machine ima...
[ "internet-explorer", "macos", "testing" ]
35
59
18,000
14
0
2008-09-11T00:53:06.707000
2008-09-11T00:53:35.130000