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
67,706
67,738
LinqToSql and full text search - can it be done?
Has anyone come up with a good way of performing full text searches ( FREETEXT() CONTAINS() ) for any number of arbitrary keywords using standard LinqToSql query syntax? I'd obviously like to avoid having to use a Stored Proc or have to generate a Dynamic SQL calls. Obviously I could just pump the search string in on a...
Unfortunately LINQ to SQL does not support Full Text Search. There are a bunch of products out there that I think could: Lucene.NET, NHibernate Search comes to mind. LINQ for NHibernate combined with NHibernate Search would probably give that functionality, but both are still way deep in beta.
LinqToSql and full text search - can it be done? Has anyone come up with a good way of performing full text searches ( FREETEXT() CONTAINS() ) for any number of arbitrary keywords using standard LinqToSql query syntax? I'd obviously like to avoid having to use a Stored Proc or have to generate a Dynamic SQL calls. Obvi...
TITLE: LinqToSql and full text search - can it be done? QUESTION: Has anyone come up with a good way of performing full text searches ( FREETEXT() CONTAINS() ) for any number of arbitrary keywords using standard LinqToSql query syntax? I'd obviously like to avoid having to use a Stored Proc or have to generate a Dynam...
[ "linq-to-sql", "full-text-search" ]
5
4
1,556
2
0
2008-09-15T22:43:53.510000
2008-09-15T22:51:15.960000
67,713
68,110
How to display a form in any site's pages using a bookmarklet (like Note in Google Reader)?
In Google Reader, you can use a bookmarklet to "note" a page you're visiting. When you press the bookmarklet, a little Google form is displayed on top of the current page. In the form you can enter a description, etc. When you press Submit, the form submits itself without leaving the page, and then the form disappears....
Aupajo has it right. I will, however, point you towards a bookmarklet framework I worked up for our site ( www.iminta.com ). The bookmarklet itself reads as follows: javascript:void((function(){ var e=document.createElement('script'); e.setAttribute('type','text/javascript'); e.setAttribute('src','http://www.iminta.com...
How to display a form in any site's pages using a bookmarklet (like Note in Google Reader)? In Google Reader, you can use a bookmarklet to "note" a page you're visiting. When you press the bookmarklet, a little Google form is displayed on top of the current page. In the form you can enter a description, etc. When you p...
TITLE: How to display a form in any site's pages using a bookmarklet (like Note in Google Reader)? QUESTION: In Google Reader, you can use a bookmarklet to "note" a page you're visiting. When you press the bookmarklet, a little Google form is displayed on top of the current page. In the form you can enter a descriptio...
[ "javascript", "client-side", "bookmarklet", "browser" ]
2
3
848
3
0
2008-09-15T22:46:21.413000
2008-09-16T00:06:00.380000
67,734
69,224
Execute JavaScript from within a C# assembly
I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code. It's easier to define things that I'm not trying to do: I'm not trying to call a JavaScript function on a web page from my code behind. I'm not trying to load a WebBrowser control. ...
You can run your JSUnit from inside Nant using the JSUnit server, it's written in java and there is not a Nant task but you can run it from the command prompt, the results are logged as XML and you can them integrate them with your build report process. This won't be part of your Nunit result but an extra report. We fa...
Execute JavaScript from within a C# assembly I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code. It's easier to define things that I'm not trying to do: I'm not trying to call a JavaScript function on a web page from my code behind. ...
TITLE: Execute JavaScript from within a C# assembly QUESTION: I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code. It's easier to define things that I'm not trying to do: I'm not trying to call a JavaScript function on a web page fro...
[ "c#", ".net", "javascript", "unit-testing", "codedom" ]
20
1
15,030
6
0
2008-09-15T22:50:40.390000
2008-09-16T03:44:17.673000
67,736
370,117
WCF problem passing complex types
I have a service contract that defines a method with a parameter of type System.Object (xs:anyType in the WSDL). I want to be able to pass simple types as well as complex types in this parameter. Simple types work fine, but when I try to pass a complex type that is defined in my WSDL, I get this error: Element ' http:/...
I have solved this problem by using the ServiceKnownType attribute. I simply add my complex type as a service known type on my service contract, and the error goes away. I'm not sure why this didn't work last time I tried it. It doesn't appear to affect the WSDL in any way, so I suspect that the serialized stream must ...
WCF problem passing complex types I have a service contract that defines a method with a parameter of type System.Object (xs:anyType in the WSDL). I want to be able to pass simple types as well as complex types in this parameter. Simple types work fine, but when I try to pass a complex type that is defined in my WSDL, ...
TITLE: WCF problem passing complex types QUESTION: I have a service contract that defines a method with a parameter of type System.Object (xs:anyType in the WSDL). I want to be able to pass simple types as well as complex types in this parameter. Simple types work fine, but when I try to pass a complex type that is de...
[ ".net", "wcf", "wsdl" ]
1
1
9,836
6
0
2008-09-15T22:51:04.913000
2008-12-15T23:58:03.793000
67,780
67,848
Where can I find an example burn-down / planning game template?
I'd like to experiment with burn-down and planning game with the team I'm on. People on my team are interested in making it happen, however I'm sure someone has done this before and has learned some lessons we hopefully don't have to repeat. Does anyone know of an example Excel (or other tool) template available for bu...
This MSDN Blog article Has quite a good review of using burndowns in combination with Cumulative Flow Diagrams which fleshes out the diagrams even more. In the resources links at the bottom of the article there is a link to the Microsoft Scrum kit which has a pre-built excel file.
Where can I find an example burn-down / planning game template? I'd like to experiment with burn-down and planning game with the team I'm on. People on my team are interested in making it happen, however I'm sure someone has done this before and has learned some lessons we hopefully don't have to repeat. Does anyone kn...
TITLE: Where can I find an example burn-down / planning game template? QUESTION: I'd like to experiment with burn-down and planning game with the team I'm on. People on my team are interested in making it happen, however I'm sure someone has done this before and has learned some lessons we hopefully don't have to repe...
[ "templates", "project-management", "project-planning" ]
2
2
679
2
0
2008-09-15T22:58:52.273000
2008-09-15T23:10:03.370000
67,788
67,806
Does SQL Server 2005 scale to a large number of databases?
If I add 3-400 databases to a single SQL Server instance will I encounter scaling issues introduced by the large number of databases?
This is one of those questions best answered by: Why are you trying to do this in the first place? What is the concurrency against those databases? Are you generating databases when you could have normalized tables to do the same functionality? That said, yes MSSQL 2005 will handle that level of database per installati...
Does SQL Server 2005 scale to a large number of databases? If I add 3-400 databases to a single SQL Server instance will I encounter scaling issues introduced by the large number of databases?
TITLE: Does SQL Server 2005 scale to a large number of databases? QUESTION: If I add 3-400 databases to a single SQL Server instance will I encounter scaling issues introduced by the large number of databases? ANSWER: This is one of those questions best answered by: Why are you trying to do this in the first place? W...
[ "sql-server", "sql-server-2005" ]
1
2
307
3
0
2008-09-15T23:00:47.417000
2008-09-15T23:04:37.457000
67,798
67,843
Multiline C# Regex to match after a blank line
I'm looking for a multiline regex that will match occurrences after a blank line. For example, given a sample email below, I'd like to match "From: Alex". ^From:\s*(.*)$ works to match any From line, but I want it to be restricted to lines in the body (anything after the first blank line). Received: from a server Date:...
I'm not sure of the syntax of C# regular expressions but you should have a way to anchor to the beginning of the string (not the beginning of the line such as ^). I'll call that "\A" in my example: \A.*?\r?\n\r?\n.*?^From:\s*([^\r\n]+)$ Make sure you turn the multiline matching option on, however that works, to make "....
Multiline C# Regex to match after a blank line I'm looking for a multiline regex that will match occurrences after a blank line. For example, given a sample email below, I'd like to match "From: Alex". ^From:\s*(.*)$ works to match any From line, but I want it to be restricted to lines in the body (anything after the f...
TITLE: Multiline C# Regex to match after a blank line QUESTION: I'm looking for a multiline regex that will match occurrences after a blank line. For example, given a sample email below, I'd like to match "From: Alex". ^From:\s*(.*)$ works to match any From line, but I want it to be restricted to lines in the body (an...
[ "regex" ]
5
2
6,422
4
0
2008-09-15T23:03:18.143000
2008-09-15T23:09:32.780000
67,831
69,307
What is the best data access paradigm for scalability?
There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps? Linq Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in ASP.NET using Linq. Therefore I wonder if it is really...
I would recommend either NHibernate or Entity Framework. For large sites, I'd use ADO.NET Data Services. I wouldn't do anything large with LINQ to SQL. I think Stack Overflow might end up with some interesting scale problems being 2-tier rather than 3-tier, and they'll also have some trouble refactoring as the physical...
What is the best data access paradigm for scalability? There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps? Linq Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in...
TITLE: What is the best data access paradigm for scalability? QUESTION: There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps? Linq Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't ru...
[ ".net", "asp.net", "linq", "entity-framework", "ado.net" ]
10
17
2,418
9
0
2008-09-15T23:07:46.933000
2008-09-16T04:06:34.280000
67,835
67,860
Deleting a file in VBA
Using VBA, how can I: test whether a file exists, and if so, delete it?
1.) Check here. Basically do this: Function FileExists(ByVal FileToTest As String) As Boolean FileExists = (Dir(FileToTest) <> "") End Function I'll leave it to you to figure out the various error handling needed but these are among the error handling things I'd be considering: Check for an empty string being passed. C...
Deleting a file in VBA Using VBA, how can I: test whether a file exists, and if so, delete it?
TITLE: Deleting a file in VBA QUESTION: Using VBA, how can I: test whether a file exists, and if so, delete it? ANSWER: 1.) Check here. Basically do this: Function FileExists(ByVal FileToTest As String) As Boolean FileExists = (Dir(FileToTest) <> "") End Function I'll leave it to you to figure out the various error h...
[ "vba", "file-io", "delete-file", "file-exists" ]
136
211
579,941
9
0
2008-09-15T23:08:36.447000
2008-09-15T23:12:17.560000
67,875
67,896
Good ways to Learn Cocoa?
I'd love to learn Cocoa, it seems like the best systems language for Mac OS X. Can you recommend any useful ways to learn the language? Books, websites, example projects or even classes to take?
Andy Matuschak has a great blog post that leads you through several good Cocoa tutorials, explaining why you are reading each one. Cocoa Dev Central has loads of tutorials. For books, I echo Dave and Phillip Bowden with Cocoa Programming for Mac OS X by Aaron Hillegass.
Good ways to Learn Cocoa? I'd love to learn Cocoa, it seems like the best systems language for Mac OS X. Can you recommend any useful ways to learn the language? Books, websites, example projects or even classes to take?
TITLE: Good ways to Learn Cocoa? QUESTION: I'd love to learn Cocoa, it seems like the best systems language for Mac OS X. Can you recommend any useful ways to learn the language? Books, websites, example projects or even classes to take? ANSWER: Andy Matuschak has a great blog post that leads you through several good...
[ "cocoa" ]
21
21
20,336
10
0
2008-09-15T23:15:00.707000
2008-09-15T23:20:01.070000
67,890
68,028
What's the best way to hash a url in ruby?
I'm writing a web app that points to external links. I'm looking to create a non-sequential, non-guessable id for each document that I can use in the URL. I did the obvious thing: treating the url as a string and str#crypt on it, but that seems to choke on any non-alphanumberic characters, like the slashes, dots and un...
Depending on how long a string you would like you can use a few alternatives: require 'digest' Digest.hexencode('http://foo-bar.com/yay/?foo=bar&a=22') # "687474703a2f2f666f6f2d6261722e636f6d2f7961792f3f666f6f3d62617226613d3232" require 'digest/md5' Digest::MD5.hexdigest('http://foo-bar.com/yay/?foo=bar&a=22') # "43fa...
What's the best way to hash a url in ruby? I'm writing a web app that points to external links. I'm looking to create a non-sequential, non-guessable id for each document that I can use in the URL. I did the obvious thing: treating the url as a string and str#crypt on it, but that seems to choke on any non-alphanumberi...
TITLE: What's the best way to hash a url in ruby? QUESTION: I'm writing a web app that points to external links. I'm looking to create a non-sequential, non-guessable id for each document that I can use in the URL. I did the obvious thing: treating the url as a string and str#crypt on it, but that seems to choke on an...
[ "ruby" ]
16
35
9,971
3
0
2008-09-15T23:18:36.453000
2008-09-15T23:49:00.033000
67,894
67,930
Why do we need extern "C"{ #include <foo.h> } in C++?
Why do we need to use: extern "C" { #include } Specifically: When should we use it? What is happening at the compiler/linker level that requires us to use it? How in terms of compilation/linking does this solve the problems which require us to use it?
C and C++ are superficially similar, but each compiles into a very different set of code. When you include a header file with a C++ compiler, the compiler is expecting C++ code. If, however, it is a C header, then the compiler expects the data contained in the header file to be compiled to a certain format—the C++ 'ABI...
Why do we need extern "C"{ #include <foo.h> } in C++? Why do we need to use: extern "C" { #include } Specifically: When should we use it? What is happening at the compiler/linker level that requires us to use it? How in terms of compilation/linking does this solve the problems which require us to use it?
TITLE: Why do we need extern "C"{ #include <foo.h> } in C++? QUESTION: Why do we need to use: extern "C" { #include } Specifically: When should we use it? What is happening at the compiler/linker level that requires us to use it? How in terms of compilation/linking does this solve the problems which require us to use ...
[ "c++", "linkage", "name-mangling", "extern-c" ]
152
142
98,375
11
0
2008-09-15T23:19:52.583000
2008-09-15T23:27:38.867000
67,929
67,989
Copying data from one DataTable to another
What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets. Edit: I need to explain a bit more. There is a filtering condition for copying the rows. So, a plain Copy() will not work.
You can't copy the whole table, you need to copy one rows. From http://support.microsoft.com/kb/308909 (sample code if you follow the link) "How to Copy DataRows Between DataTables Before you use the ImportRow method, you must ensure that the target table has the identical structure as the source table. This sample use...
Copying data from one DataTable to another What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets. Edit: I need to explain a bit more. There is a filtering condition for copying the rows. So, a plain Copy() will not work.
TITLE: Copying data from one DataTable to another QUESTION: What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets. Edit: I need to explain a bit more. There is a filtering condition for copying the rows. So, a plain Copy() will ...
[ "c#", "ado.net" ]
5
7
22,719
3
0
2008-09-15T23:27:30.520000
2008-09-15T23:39:22.083000
68,015
68,468
Folder with Extension
I'm looking to have windows recognize that certain folders are associated to my application - maybe by naming the folder 'folder.myExt'. Can this be done via the registry? A bit more info - This is for a x-platform app ( that's why I suggested the folder with an extension - mac can handle that ) - The RAD I'm using doe...
Folders in Windows aren't subject to the name.extension rules at all, there's only 1 entry in the registry's file type handling for "folder" types. (If you try to change it you're going to have very, very rough times ahead) The only simple way to get the effect you're after would be to do what OpenOffice, MS Office 200...
Folder with Extension I'm looking to have windows recognize that certain folders are associated to my application - maybe by naming the folder 'folder.myExt'. Can this be done via the registry? A bit more info - This is for a x-platform app ( that's why I suggested the folder with an extension - mac can handle that ) -...
TITLE: Folder with Extension QUESTION: I'm looking to have windows recognize that certain folders are associated to my application - maybe by naming the folder 'folder.myExt'. Can this be done via the registry? A bit more info - This is for a x-platform app ( that's why I suggested the folder with an extension - mac c...
[ "windows", "registry" ]
2
1
654
2
0
2008-09-15T23:46:15.843000
2008-09-16T01:13:55.303000
68,018
68,075
ResourceBundle from Java/Struts and replace expressions
If I have a Resource bundle property file: A.properties: thekey={0} This is a test And then I have java code that loads the resource bundle: ResourceBundle labels = ResourceBundle.getBundle("A", currentLocale); labels.getString("thekey"); How can I replace the {0} text with some value labels.getString("thekey", "Yes!!!...
The class you're looking for is java.text.MessageFormat; specifically, calling MessageFormat.format("{0} This {1} a test", new Object[] {"Yes!!!", "is"}); or MessageFormat.format("{0} This {1} a test", "Yes!!!", "is"); will return "Yes!!! This is a test" [Unfortunately, I can't help with the Struts connection, although...
ResourceBundle from Java/Struts and replace expressions If I have a Resource bundle property file: A.properties: thekey={0} This is a test And then I have java code that loads the resource bundle: ResourceBundle labels = ResourceBundle.getBundle("A", currentLocale); labels.getString("thekey"); How can I replace the {0}...
TITLE: ResourceBundle from Java/Struts and replace expressions QUESTION: If I have a Resource bundle property file: A.properties: thekey={0} This is a test And then I have java code that loads the resource bundle: ResourceBundle labels = ResourceBundle.getBundle("A", currentLocale); labels.getString("thekey"); How can...
[ "java", "jakarta-ee", "struts", "resourcebundle" ]
4
11
8,786
2
0
2008-09-15T23:46:38.900000
2008-09-15T23:59:14.687000
68,072
68,090
How would I host an external application in WPF?
How can I host a (.Net, Java, VB6, MFC, etc ) application in a WPF window?. I have a need to use WPF windows to wrap external applications and control the window size and location. Does anyone have any ideas on how to accomplish this or a direction to research in?
Use a HwndHost to host the outside window in your application.
How would I host an external application in WPF? How can I host a (.Net, Java, VB6, MFC, etc ) application in a WPF window?. I have a need to use WPF windows to wrap external applications and control the window size and location. Does anyone have any ideas on how to accomplish this or a direction to research in?
TITLE: How would I host an external application in WPF? QUESTION: How can I host a (.Net, Java, VB6, MFC, etc ) application in a WPF window?. I have a need to use WPF windows to wrap external applications and control the window size and location. Does anyone have any ideas on how to accomplish this or a direction to r...
[ "wpf", "hosting", "external" ]
4
3
2,356
2
0
2008-09-15T23:58:57.277000
2008-09-16T00:01:55.943000
68,084
68,130
Switching from C# to C++. Any must-reads?
I'm trying to find a least-resistance path from C# to C++, and while I feel I handle C# pretty well after two solid years, I'm still not sure I've gotten the "groove" of C++, despite numerous attempts. Are there any particular books or websites that might be suitable for this transition?
I recommend The C++ Programming language by Bjarne Stroustrup. It's not a suitable book for new programmers, but I found it quite effective as programmer who was experienced in other languages and didn't want to waste too much time with learning how while loops work. It's a dense but quite comprehensive book.
Switching from C# to C++. Any must-reads? I'm trying to find a least-resistance path from C# to C++, and while I feel I handle C# pretty well after two solid years, I'm still not sure I've gotten the "groove" of C++, despite numerous attempts. Are there any particular books or websites that might be suitable for this t...
TITLE: Switching from C# to C++. Any must-reads? QUESTION: I'm trying to find a least-resistance path from C# to C++, and while I feel I handle C# pretty well after two solid years, I'm still not sure I've gotten the "groove" of C++, despite numerous attempts. Are there any particular books or websites that might be s...
[ "c#", "c++" ]
19
13
5,724
12
0
2008-09-16T00:00:46.477000
2008-09-16T00:09:19.343000
68,103
130,880
How do I copy image data to the clipboard in my XUL application?
I have a XULRunner application that needs to copy image data to the clipboard. I have figured out how to handle copying text to the clipboard, and I can paste PNG data from the clipboard. What I can't figure out is how to get data from a data URL into the clipboard so that it can be pasted into other applications. This...
Here's a workaround that I ended up using that solves the problem pretty well. The variable dataURL is the image I was trying to get to the clipboard in the first place. var newImg=document.createElement('img'); newImg.src=dataURL; document.popupNode=newImg; var command='cmd_copyImageContents' var controller=documen...
How do I copy image data to the clipboard in my XUL application? I have a XULRunner application that needs to copy image data to the clipboard. I have figured out how to handle copying text to the clipboard, and I can paste PNG data from the clipboard. What I can't figure out is how to get data from a data URL into the...
TITLE: How do I copy image data to the clipboard in my XUL application? QUESTION: I have a XULRunner application that needs to copy image data to the clipboard. I have figured out how to handle copying text to the clipboard, and I can paste PNG data from the clipboard. What I can't figure out is how to get data from a...
[ "javascript", "xul", "xpcom", "xulrunner" ]
3
3
1,837
2
0
2008-09-16T00:05:01.350000
2008-09-25T00:57:38.020000
68,109
69,412
Does Java save its runtime optimizations?
My professor did an informal benchmark on a little program and the Java times were: 1.7 seconds for the first run, and 0.8 seconds for the runs thereafter. Is this due entirely to the loading of the runtime environment into the operating environment? OR Is it influenced by Java's optimizing the code and storing the res...
I agree that the performance difference seen by the poster is most likely caused by disk latency bringing the JRE into memory. The Just In Time compiler (JIT) would not have an impact on performance of a little application. Java 1.6u10 ( http://download.java.net/jdk6/ ) touches the runtime JARs in a background process ...
Does Java save its runtime optimizations? My professor did an informal benchmark on a little program and the Java times were: 1.7 seconds for the first run, and 0.8 seconds for the runs thereafter. Is this due entirely to the loading of the runtime environment into the operating environment? OR Is it influenced by Java...
TITLE: Does Java save its runtime optimizations? QUESTION: My professor did an informal benchmark on a little program and the Java times were: 1.7 seconds for the first run, and 0.8 seconds for the runs thereafter. Is this due entirely to the loading of the runtime environment into the operating environment? OR Is it ...
[ "java", "optimization", "caching" ]
4
1
2,833
6
0
2008-09-16T00:05:38.527000
2008-09-16T04:35:44.773000
68,120
216,955
Wildcards for resources in a Tomcat Servlet's context.xml
I'm not overly familiar with Tomcat, but my team has inherited a complex project that revolves around a Java Servlet being hosted in Tomcat across many servers. Custom configuration management software is used to write out the server.xml, and various resources (connection pools, beans, server variables, etc) written in...
I've not come across this, but it might be easier to have something like an AnonymizerService as a resource that reveals all the different required AnonymizerBeans. This way you have no issues with wildcards, have to publish only one Resource to the web application and you're back on the well defined and well understoo...
Wildcards for resources in a Tomcat Servlet's context.xml I'm not overly familiar with Tomcat, but my team has inherited a complex project that revolves around a Java Servlet being hosted in Tomcat across many servers. Custom configuration management software is used to write out the server.xml, and various resources (...
TITLE: Wildcards for resources in a Tomcat Servlet's context.xml QUESTION: I'm not overly familiar with Tomcat, but my team has inherited a complex project that revolves around a Java Servlet being hosted in Tomcat across many servers. Custom configuration management software is used to write out the server.xml, and v...
[ "java", "tomcat" ]
2
1
1,957
2
0
2008-09-16T00:07:20.050000
2008-10-19T20:52:33.927000
68,136
68,350
Plone-like search box in Django?
Plone has a beautiful search box with a "Google suggest" like functionality for its site. It even indexes uploaded documents like PDFs. Does anyone know of a module that can provide this kind of functionality in a Django site?
Plone implements it's LiveSearch feature by maintaining a separate metadata table of indexed attributes (fields such as last modified, creator, title are copied from the content objects into this table). Content objects then send ObjectAdded/ObjectModified/ObjectRemoved events, and an event subscriber listens for these...
Plone-like search box in Django? Plone has a beautiful search box with a "Google suggest" like functionality for its site. It even indexes uploaded documents like PDFs. Does anyone know of a module that can provide this kind of functionality in a Django site?
TITLE: Plone-like search box in Django? QUESTION: Plone has a beautiful search box with a "Google suggest" like functionality for its site. It even indexes uploaded documents like PDFs. Does anyone know of a module that can provide this kind of functionality in a Django site? ANSWER: Plone implements it's LiveSearch ...
[ "django", "search" ]
1
2
1,099
1
0
2008-09-16T00:10:24.317000
2008-09-16T00:53:30.080000
68,144
999,308
Using XmlRpc in C++ and Windows
I need to use XmlRpc in C++ on a Windows platform. Despite the fact that my friends assure me that XmlRpc is a "widely available standard technology", there are not many libraries available for it. In fact I only found one library to do this on Windows, (plus another one that claims "you'll have to do a lot of work to ...
I've written my own C++ library. It's available at sourceforge: xmlrpcc4win The reason I wrote it rather than using Chris Morley's was that: The Windows "wininet.lib" library gives you all the functionality for handling Http requests, so I'd rather use that. As a result, I only needed 1700 LOC. "wininet.lib", and there...
Using XmlRpc in C++ and Windows I need to use XmlRpc in C++ on a Windows platform. Despite the fact that my friends assure me that XmlRpc is a "widely available standard technology", there are not many libraries available for it. In fact I only found one library to do this on Windows, (plus another one that claims "you...
TITLE: Using XmlRpc in C++ and Windows QUESTION: I need to use XmlRpc in C++ on a Windows platform. Despite the fact that my friends assure me that XmlRpc is a "widely available standard technology", there are not many libraries available for it. In fact I only found one library to do this on Windows, (plus another on...
[ "c++", "windows", "ssl", "xml-rpc" ]
7
9
9,522
5
0
2008-09-16T00:12:14.033000
2009-06-16T02:07:44.777000
68,150
68,157
How Long Do You Keep Your Code?
I took a data structures class in C++ last year, and consequently implemented all the major data structures in templated code. I saved it all on a flash drive because I have a feeling that at some point in my life, I'll use it again. I imagine something I end up programming will need a B-Tree, or is that just delusiona...
Forever (or as close as I can get). That's the whole point of a source control system.
How Long Do You Keep Your Code? I took a data structures class in C++ last year, and consequently implemented all the major data structures in templated code. I saved it all on a flash drive because I have a feeling that at some point in my life, I'll use it again. I imagine something I end up programming will need a B...
TITLE: How Long Do You Keep Your Code? QUESTION: I took a data structures class in C++ last year, and consequently implemented all the major data structures in templated code. I saved it all on a flash drive because I have a feeling that at some point in my life, I'll use it again. I imagine something I end up program...
[ "code-reuse" ]
5
32
1,143
17
0
2008-09-16T00:13:16.120000
2008-09-16T00:14:06.587000
68,156
68,171
Doing away with Globals?
I have a set of tree objects with a depth somewhere in the 20s. Each of the nodes in this tree needs access to its tree's root. A couple of solutions: Each node can store a reference to the root directly (wastes memory) I can compute the root at runtime by "going up" (wastes cycles) I can use static fields (but this am...
Pass the root as a parameter to whichever functions in the node that need it. Edit: The options are really the following: Store the root reference in the node Don't store the root reference at all Store the root reference in a global Store the root reference on the stack (my suggestion, either visitor pattern or recurs...
Doing away with Globals? I have a set of tree objects with a depth somewhere in the 20s. Each of the nodes in this tree needs access to its tree's root. A couple of solutions: Each node can store a reference to the root directly (wastes memory) I can compute the root at runtime by "going up" (wastes cycles) I can use s...
TITLE: Doing away with Globals? QUESTION: I have a set of tree objects with a depth somewhere in the 20s. Each of the nodes in this tree needs access to its tree's root. A couple of solutions: Each node can store a reference to the root directly (wastes memory) I can compute the root at runtime by "going up" (wastes c...
[ "c#", "java", "oop", "global-variables" ]
3
6
426
6
0
2008-09-16T00:13:58.693000
2008-09-16T00:16:39.153000
68,160
68,190
Is it possible to get a core dump of a running process and its symbol table?
Is it possible to get gdb or use some other tools to create a core dump of a running process and it's symbol table? It would be great if there's a way to do this without terminating the process. If this is possible, what commands would you use? (I'm trying to do this on a Linux box)
$ gdb --pid=26426 (gdb) gcore Saved corefile core.26426 (gdb) detach
Is it possible to get a core dump of a running process and its symbol table? Is it possible to get gdb or use some other tools to create a core dump of a running process and it's symbol table? It would be great if there's a way to do this without terminating the process. If this is possible, what commands would you use...
TITLE: Is it possible to get a core dump of a running process and its symbol table? QUESTION: Is it possible to get gdb or use some other tools to create a core dump of a running process and it's symbol table? It would be great if there's a way to do this without terminating the process. If this is possible, what comm...
[ "debugging", "coredump" ]
79
90
72,993
3
0
2008-09-16T00:14:57.177000
2008-09-16T00:19:07.917000
68,169
68,186
What's the right way to branch with Visual Source Safe?
What I currently do is I link the project to another location and give it the same name, then check the box where it says "Branch after share." And then I would Check out the shared project and work off it. And finally merge with the original project. This works okay, but it feels very clunky: I have multiple instances...
I think the way you describe in the question is the only way you can do it in sourceSafe. I usually name the copied directory "V1.0" (or whatever is appropriate) and keep them all in a folder that is the main project name.
What's the right way to branch with Visual Source Safe? What I currently do is I link the project to another location and give it the same name, then check the box where it says "Branch after share." And then I would Check out the shared project and work off it. And finally merge with the original project. This works o...
TITLE: What's the right way to branch with Visual Source Safe? QUESTION: What I currently do is I link the project to another location and give it the same name, then check the box where it says "Branch after share." And then I would Check out the shared project and work off it. And finally merge with the original pro...
[ "version-control", "branch", "visual-sourcesafe" ]
34
10
21,084
4
0
2008-09-16T00:16:27.097000
2008-09-16T00:18:37.137000
68,209
74,462
Microsoft Reporting Services WebServices and Java
Has anyone successfully implemented a Java based solution that uses Microsoft SQL Server 2005 Reporting Services? Reporting Services comes with a set of Web Services that allow you to control the creation of a report, execution of a report, etc and I am just starting development on a POC of this integration. A couple o...
My experience with RS would lead me to suggest you go with just about anything else. I think the web services portion would work fine but I'd be concerned about how RS manages memory and how many reports you need to be running at once before making any decisions. I'm fighting with memory management problems today with ...
Microsoft Reporting Services WebServices and Java Has anyone successfully implemented a Java based solution that uses Microsoft SQL Server 2005 Reporting Services? Reporting Services comes with a set of Web Services that allow you to control the creation of a report, execution of a report, etc and I am just starting de...
TITLE: Microsoft Reporting Services WebServices and Java QUESTION: Has anyone successfully implemented a Java based solution that uses Microsoft SQL Server 2005 Reporting Services? Reporting Services comes with a set of Web Services that allow you to control the creation of a report, execution of a report, etc and I a...
[ "java", "web-services", "reporting-services", "axis" ]
0
1
3,522
3
0
2008-09-16T00:22:52.523000
2008-09-16T16:52:23.770000
68,234
83,192
MVC Retrieve Model On Every Request
Let’s say I'm developing a helpdesk application that will be used by multiple departments. Every URL in the application will include a key indicating the specific department. The key will always be the first parameter of every action in the system. For example http://helpdesk/HR/Members http://helpdesk/HR/Members/Peter...
I have a similar scenario in one of my projects, and I'd tend to use a ModelBinder rather than using a separate inheritance hierarchy. You can make a ModelBinder attribute to fetch the entity/entites from the RouteData: public class HelpdeskDepartmentBinder: CustomModelBinderAttribute, IModelBinder { public override I...
MVC Retrieve Model On Every Request Let’s say I'm developing a helpdesk application that will be used by multiple departments. Every URL in the application will include a key indicating the specific department. The key will always be the first parameter of every action in the system. For example http://helpdesk/HR/Memb...
TITLE: MVC Retrieve Model On Every Request QUESTION: Let’s say I'm developing a helpdesk application that will be used by multiple departments. Every URL in the application will include a key indicating the specific department. The key will always be the first parameter of every action in the system. For example http:...
[ "asp.net-mvc" ]
0
2
443
3
0
2008-09-16T00:26:56.790000
2008-09-17T13:29:51.453000
68,282
68,324
Why do you need explicitly have the "self" argument in a Python method?
When defining a method on a class in Python, it looks something like this: class MyClass(object): def __init__(self, x, y): self.x = x self.y = y But in some other languages, such as C#, you have a reference to the object that the method is bound to with the "this" keyword without declaring it as an argument in the met...
I like to quote Peters' Zen of Python. "Explicit is better than implicit." In Java and C++, ' this. ' can be deduced, except when you have variable names that make it impossible to deduce. So you sometimes need it and sometimes don't. Python elects to make things like this explicit rather than based on a rule. Addition...
Why do you need explicitly have the "self" argument in a Python method? When defining a method on a class in Python, it looks something like this: class MyClass(object): def __init__(self, x, y): self.x = x self.y = y But in some other languages, such as C#, you have a reference to the object that the method is bound t...
TITLE: Why do you need explicitly have the "self" argument in a Python method? QUESTION: When defining a method on a class in Python, it looks something like this: class MyClass(object): def __init__(self, x, y): self.x = x self.y = y But in some other languages, such as C#, you have a reference to the object that the...
[ "python", "oop", "methods", "self" ]
222
97
108,787
10
0
2008-09-16T00:39:55.150000
2008-09-16T00:47:55.133000
68,283
281,413
View/edit ID3 data for MP3 files
What's a quick and easy way to view and edit ID3 tags (artist, album, etc.) using C#?
Thirding TagLib Sharp. TagLib.File f = TagLib.File.Create(path); f.Tag.Album = "New Album Title"; f.Save();
View/edit ID3 data for MP3 files What's a quick and easy way to view and edit ID3 tags (artist, album, etc.) using C#?
TITLE: View/edit ID3 data for MP3 files QUESTION: What's a quick and easy way to view and edit ID3 tags (artist, album, etc.) using C#? ANSWER: Thirding TagLib Sharp. TagLib.File f = TagLib.File.Create(path); f.Tag.Album = "New Album Title"; f.Save();
[ "c#", ".net", "mp3", "id3" ]
160
196
138,713
7
0
2008-09-16T00:40:03.373000
2008-11-11T16:34:53.380000
68,298
68,332
Good Java Practices in Ubuntu
Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser. I've considered Eclipse, but it seems to bloated and unfriendly for quick pro...
Java editing tends to go one of two ways; people either stick with a simple editor and use a terminal to compile/run their programs, or they use a big IDE with a zillion features. I usually go the simple route and just use a plain text editor and terminal, but there's still a lot to be said for IDEs. This is especially...
Good Java Practices in Ubuntu Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser. I've considered Eclipse, but it seems to bloate...
TITLE: Good Java Practices in Ubuntu QUESTION: Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser. I've considered Eclipse, but ...
[ "java", "linux", "ubuntu" ]
5
7
1,320
14
0
2008-09-16T00:43:08.450000
2008-09-16T00:49:37.763000
68,307
68,498
How can I make a shortcut start in a different directory when running it as an administrator on Windows Vista?
I have a shortcut on my desktop which opens a command prompt with many arguments that I need. I set the 'start in' field to d:\ and it works as expected (the prompt starts in d:). When I choose Advanced -> run as administrator and then open the shortcut, it starts in C:\Windows\System32, even though I have not changed ...
If you use the /k argument, you can add a single line to execute a change drive and change directory. For instance: C:\Windows\System32\cmd.exe /k "d: & cd d:\storage" Using & you can string together many commands on one line. Edit: You can also change drive with the cd command alone "cd /d d:\storage". Thanks to Adam ...
How can I make a shortcut start in a different directory when running it as an administrator on Windows Vista? I have a shortcut on my desktop which opens a command prompt with many arguments that I need. I set the 'start in' field to d:\ and it works as expected (the prompt starts in d:). When I choose Advanced -> run...
TITLE: How can I make a shortcut start in a different directory when running it as an administrator on Windows Vista? QUESTION: I have a shortcut on my desktop which opens a command prompt with many arguments that I need. I set the 'start in' field to d:\ and it works as expected (the prompt starts in d:). When I choo...
[ "windows", "windows-vista", "uac", "shortcut", "cmd" ]
8
10
8,704
1
0
2008-09-16T00:44:21.473000
2008-09-16T01:20:22.963000
68,323
68,328
What is the best way to implement soft deletion?
Working on a project at the moment and we have to implement soft deletion for the majority of users (user roles). We decided to add an is_deleted='0' field on each table in the database and set it to '1' if particular user roles hit a delete button on a specific record. For future maintenance now, each SELECT query wil...
You could perform all of your queries against a view that contains the WHERE IS_DELETED='0' clause.
What is the best way to implement soft deletion? Working on a project at the moment and we have to implement soft deletion for the majority of users (user roles). We decided to add an is_deleted='0' field on each table in the database and set it to '1' if particular user roles hit a delete button on a specific record. ...
TITLE: What is the best way to implement soft deletion? QUESTION: Working on a project at the moment and we have to implement soft deletion for the majority of users (user roles). We decided to add an is_deleted='0' field on each table in the database and set it to '1' if particular user roles hit a delete button on a...
[ "sql", "database", "database-design", "backup" ]
59
59
49,516
14
0
2008-09-16T00:47:54.557000
2008-09-16T00:49:19.310000
68,327
68,524
Change command Method for Tkinter Button in Python
I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created?
Though Eli Courtwright's program will work fine¹, what you really seem to want though is just a way to reconfigure after instantiation any attribute which you could have set when you instantiated². How you do so is by way of the configure() method. from Tkinter import Tk, Button def goodbye_world(): print "Goodbye Wor...
Change command Method for Tkinter Button in Python I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created?
TITLE: Change command Method for Tkinter Button in Python QUESTION: I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created? ANSWER: Though Eli Courtwright's program will work fine¹, what yo...
[ "python", "user-interface", "tkinter" ]
20
39
44,546
3
0
2008-09-16T00:48:37.410000
2008-09-16T01:24:37.087000
68,335
68,365
How to copy a file to a remote server in Python using SCP or SSH?
I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH.
You can call the scp bash command (it copies files over SSH ) with subprocess.run: import subprocess subprocess.run(["scp", FILE, "USER@SERVER:PATH"]) #e.g. subprocess.run(["scp", "foo.bar", "joe@srvr.net:/path/to/foo.bar"]) If you're creating the file that you want to send in the same Python program, you'll want to ca...
How to copy a file to a remote server in Python using SCP or SSH? I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH.
TITLE: How to copy a file to a remote server in Python using SCP or SSH? QUESTION: I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH. ANSWER: You can call the scp bash command (it copie...
[ "python", "ssh", "automation", "scp" ]
144
75
395,521
14
0
2008-09-16T00:50:10.837000
2008-09-16T00:55:43.850000
68,340
68,354
What level of complexity requires a framework?
At what level of complexity is it mandatory to switch to an existing framework for web development? What measurement of complexity is practical for web development? Code length? Feature list? Database Size?
If you work on several different sites then by using a common framework across all of them you can spend time working on the code rather than trying to remember what is located where and why. I'd always use a framework of some sort, even if it's your own, as the uniformity will help you structure your project. Unless i...
What level of complexity requires a framework? At what level of complexity is it mandatory to switch to an existing framework for web development? What measurement of complexity is practical for web development? Code length? Feature list? Database Size?
TITLE: What level of complexity requires a framework? QUESTION: At what level of complexity is it mandatory to switch to an existing framework for web development? What measurement of complexity is practical for web development? Code length? Feature list? Database Size? ANSWER: If you work on several different sites ...
[ "frameworks", "complexity-theory" ]
1
3
326
9
0
2008-09-16T00:51:01.710000
2008-09-16T00:54:04.570000
68,346
68,395
Implement symmetric difference in SQL Server?
Here's a problem I've been trying to solve at work. I'm not a database expert, so that perhaps this is a bit sophomoric. All apologies. I have a given database D, which has been duplicated on another machine (in a perhaps dubious manner), resulting in database D'. It is my task to check that database D and D' are in fa...
My first reaction is to suggest duplicating to the other machine again in a non-dubious manner. If that is not an option, perhaps some of the tools available from Red Gate could do what you need. (I am in no way affliated with Red Gate, just remember Joel mentioning how good their tools were on the podcast.)
Implement symmetric difference in SQL Server? Here's a problem I've been trying to solve at work. I'm not a database expert, so that perhaps this is a bit sophomoric. All apologies. I have a given database D, which has been duplicated on another machine (in a perhaps dubious manner), resulting in database D'. It is my ...
TITLE: Implement symmetric difference in SQL Server? QUESTION: Here's a problem I've been trying to solve at work. I'm not a database expert, so that perhaps this is a bit sophomoric. All apologies. I have a given database D, which has been duplicated on another machine (in a perhaps dubious manner), resulting in data...
[ "sql", "sql-server" ]
1
1
2,901
5
0
2008-09-16T00:52:53.997000
2008-09-16T01:00:59.407000
68,372
68,421
What is your single most favorite command-line trick using Bash?
We all know how to use -R to reverse search through history, but did you know you can use -S to forward search if you set stty stop ""? Also, have you ever tried running bind -p to see all of your keyboard shortcuts listed? There are over 455 on Mac OS X by default. What is your single most favorite obscure trick, keyb...
When running commands, sometimes I'll want to run a command with the previous ones arguments. To do that, you can use this shortcut: $ mkdir /tmp/new $ cd!!:* Occasionally, in lieu of using find, I'll break-out a one-line loop if I need to run a bunch of commands on a list of files. for file in *.wav; do lame "$file" "...
What is your single most favorite command-line trick using Bash? We all know how to use -R to reverse search through history, but did you know you can use -S to forward search if you set stty stop ""? Also, have you ever tried running bind -p to see all of your keyboard shortcuts listed? There are over 455 on Mac OS X ...
TITLE: What is your single most favorite command-line trick using Bash? QUESTION: We all know how to use -R to reverse search through history, but did you know you can use -S to forward search if you set stty stop ""? Also, have you ever tried running bind -p to see all of your keyboard shortcuts listed? There are ove...
[ "bash", "command-line" ]
156
47
146,845
105
0
2008-09-16T00:55:59.653000
2008-09-16T01:06:25.057000
68,391
69,190
How to write a Rails mixin that spans across model, controller, and view
In an effort to reduce code duplication in my little Rails app, I've been working on getting common code between my models into it's own separate module, so far so good. The model stuff is fairly easy, I just have to include the module at the beginning, e.g.: class Iso < Sale include Shared::TracksSerialNumberExtension...
You could pluginize it (use script/generate plugin). Then in your init.rb just do something like: ActiveRecord::Base.send(:include, PluginName::Sendable) ActionController::Base.send(:include, PluginName::SendableController) And along with your self.included that should work just fine. Check out some of the acts_* plugi...
How to write a Rails mixin that spans across model, controller, and view In an effort to reduce code duplication in my little Rails app, I've been working on getting common code between my models into it's own separate module, so far so good. The model stuff is fairly easy, I just have to include the module at the begi...
TITLE: How to write a Rails mixin that spans across model, controller, and view QUESTION: In an effort to reduce code duplication in my little Rails app, I've been working on getting common code between my models into it's own separate module, so far so good. The model stuff is fairly easy, I just have to include the ...
[ "ruby-on-rails", "ruby", "refactoring", "dry" ]
6
7
7,770
3
0
2008-09-16T01:00:29.470000
2008-09-16T03:36:54.057000
68,408
68,570
Comparing names
Is there any simple algorithm to determine the likeliness of 2 names representing the same person? I'm not asking for something of the level that Custom department might be using. Just a simple algorithm that would tell me if 'James T. Clark' is most likely the same name as 'J. Thomas Clark' or 'James Clerk'. If there ...
I've faced similar problem and tried to use Levenstein distance first, but it did not work well for me. I came up with an algorithm that gives you "similarity" value between two strings (higher value means more similar strings, "1" for identical strings). This value is not very meaningful by itself (if not "1", always ...
Comparing names Is there any simple algorithm to determine the likeliness of 2 names representing the same person? I'm not asking for something of the level that Custom department might be using. Just a simple algorithm that would tell me if 'James T. Clark' is most likely the same name as 'J. Thomas Clark' or 'James C...
TITLE: Comparing names QUESTION: Is there any simple algorithm to determine the likeliness of 2 names representing the same person? I'm not asking for something of the level that Custom department might be using. Just a simple algorithm that would tell me if 'James T. Clark' is most likely the same name as 'J. Thomas ...
[ "c#", "string", "comparison" ]
2
2
1,508
7
0
2008-09-16T01:03:22.880000
2008-09-16T01:32:58.753000
68,448
68,512
How to merge from branch to branch and back again (bidirectional merging) in SVN?
Using the svnmerge.py tool it is possible to merge between branches, up and down. It is hard to find the details for doing this. Hopefully, v1.5 will have a neat method for doing this without using svnmerge.py - details requested!
It looks like you're asking about 1.5 merge tracking. Here's a quick overview for doing merges to/from trunk (or another branch): http://blog.red-bean.com/sussman/?p=92
How to merge from branch to branch and back again (bidirectional merging) in SVN? Using the svnmerge.py tool it is possible to merge between branches, up and down. It is hard to find the details for doing this. Hopefully, v1.5 will have a neat method for doing this without using svnmerge.py - details requested!
TITLE: How to merge from branch to branch and back again (bidirectional merging) in SVN? QUESTION: Using the svnmerge.py tool it is possible to merge between branches, up and down. It is hard to find the details for doing this. Hopefully, v1.5 will have a neat method for doing this without using svnmerge.py - details ...
[ "svn", "version-control" ]
2
2
5,719
2
0
2008-09-16T01:11:14.733000
2008-09-16T01:22:45.767000
68,485
68,503
How to show loading spinner in jQuery?
In Prototype I can show a "loading..." image with this code: var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} ); function showLoad () {... } In jQuery, I can load a server page into an element with this: $('#message').load('index.php?pg=ajaxFlashcard'...
There are a couple of ways. My preferred way is to attach a function to the ajaxStart/Stop events on the element itself. $('#loadingDiv').hide() // Hide it initially.ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); The ajaxStart/Stop functions will fire whenever you do any Ajax calls....
How to show loading spinner in jQuery? In Prototype I can show a "loading..." image with this code: var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} ); function showLoad () {... } In jQuery, I can load a server page into an element with this: $('#mess...
TITLE: How to show loading spinner in jQuery? QUESTION: In Prototype I can show a "loading..." image with this code: var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} ); function showLoad () {... } In jQuery, I can load a server page into an element w...
[ "jquery", "spinner", "prototypejs", "equivalence", "language-interoperability" ]
443
830
964,580
25
0
2008-09-16T01:18:15.590000
2008-09-16T01:21:26.487000
68,509
68,530
Is inline code in your aspx pages a good practice?
If I use the following code I lose the ability to right click on variables in the code behind and refactor (rename in this case) them Edit I see this practice everywhere but it seems weird to me as I no longer am able to get compile time errors if I change the property name. My preferred approach is to do something lik...
I wouldnt call it bad practice (some would disagree, but why did they give us that option in the first place?), but I would say that you'll improve overall readability and maintainability if you do not submit to this practice. You already conveyed out a good point, and that is IDE feature limitation (i.e., design time ...
Is inline code in your aspx pages a good practice? If I use the following code I lose the ability to right click on variables in the code behind and refactor (rename in this case) them Edit I see this practice everywhere but it seems weird to me as I no longer am able to get compile time errors if I change the property...
TITLE: Is inline code in your aspx pages a good practice? QUESTION: If I use the following code I lose the ability to right click on variables in the code behind and refactor (rename in this case) them Edit I see this practice everywhere but it seems weird to me as I no longer am able to get compile time errors if I c...
[ "asp.net", "coding-style" ]
7
4
3,242
9
0
2008-09-16T01:22:23.583000
2008-09-16T01:25:32.170000
68,527
71,582
Should I use EJB3 or Spring for my business layer?
My team is developing a new service oriented product with a web front-end. In discussions about what technologies we will use we have settled on running a JBoss application server, and Flex frontend (with possible desktop deployment using Adobe AIR), and web services to interface the client and server. We've reached an...
There won't be much difference between EJB3 and Spring based on Performance. We chose Spring for the following reasons (not mentioned in the question): Spring drives the architecture in a direction that more readily supports unit testing. For example, inject a mock DAO object to unit test your business layer, or utiliz...
Should I use EJB3 or Spring for my business layer? My team is developing a new service oriented product with a web front-end. In discussions about what technologies we will use we have settled on running a JBoss application server, and Flex frontend (with possible desktop deployment using Adobe AIR), and web services t...
TITLE: Should I use EJB3 or Spring for my business layer? QUESTION: My team is developing a new service oriented product with a web front-end. In discussions about what technologies we will use we have settled on running a JBoss application server, and Flex frontend (with possible desktop deployment using Adobe AIR), ...
[ "java", "performance", "spring", "ejb-3.0", "scalability" ]
73
75
36,199
9
0
2008-09-16T01:25:16.790000
2008-09-16T12:07:55.187000
68,543
68,556
Best Practice for Creating Data Tables Without Controls in ASP.net
So, I am kinda new to ASP.net development still, and I already don't like the stock ASP.net controls for displaying my database query results in table format. (I.e. I would much rather handle the HTML myself and so would the designer!) So my question is: What is the best and most secure practice for doing this without ...
I believe you're looking for a control. It contains some functionality similar to the GridViews, but allows you hand-craft all of the HTML for the Header, Item, and Footers yourself. Simply call the databinding code as you would for a gridview, and change the ASPX page to suit your exact HTML needs. http://msdn.microso...
Best Practice for Creating Data Tables Without Controls in ASP.net So, I am kinda new to ASP.net development still, and I already don't like the stock ASP.net controls for displaying my database query results in table format. (I.e. I would much rather handle the HTML myself and so would the designer!) So my question is...
TITLE: Best Practice for Creating Data Tables Without Controls in ASP.net QUESTION: So, I am kinda new to ASP.net development still, and I already don't like the stock ASP.net controls for displaying my database query results in table format. (I.e. I would much rather handle the HTML myself and so would the designer!)...
[ ".net", "asp.net" ]
1
4
626
4
0
2008-09-16T01:27:42.353000
2008-09-16T01:30:18.820000
68,548
69,083
"Winning" OO programming job interviews with sysadmin/Perl/Linux background?
I'm a student in software engineering in Montreal. For the last 3 years I've had a few interships (once per year). The first two (in the same company) were mostly sysadmin jobs, but I did get to do a few Perl programs (mostly log file analysing and statistics generation). My other intership was in the IT security field...
no offense, but from your description it would appear that you're not really qualified for a 'real' OO programming job. Academic classes are a good introduction to a language but no substitute for solving real problems with fluctuating deadlines, finicky users, cholicky managers, et al;-) this leaves three options: joi...
"Winning" OO programming job interviews with sysadmin/Perl/Linux background? I'm a student in software engineering in Montreal. For the last 3 years I've had a few interships (once per year). The first two (in the same company) were mostly sysadmin jobs, but I did get to do a few Perl programs (mostly log file analysin...
TITLE: "Winning" OO programming job interviews with sysadmin/Perl/Linux background? QUESTION: I'm a student in software engineering in Montreal. For the last 3 years I've had a few interships (once per year). The first two (in the same company) were mostly sysadmin jobs, but I did get to do a few Perl programs (mostly...
[ "oop", "system-administration", "candidate" ]
3
4
1,722
9
0
2008-09-16T01:28:41.477000
2008-09-16T03:07:18.060000
68,561
71,193
VS2008 Setup Project always requires .NET 3.5 at install time but I don't need it!
1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting.NET Framework 2.0. 2, Create a Setup project that installs just the single executable from the Windows Forms project. 3, Run that installer and it always says that it needs to install.NET 3.5 S...
No need to edit the file manually. The hint is just above the GUID there:"LaunchCondition". Right click the setup project Select "View" -> "Launch Conditions" Expand the "Launch Conditions" node if it isn't already expanded Right click the ".NET Framework" node and select "Properties Window" In the "Properties" window ...
VS2008 Setup Project always requires .NET 3.5 at install time but I don't need it! 1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting.NET Framework 2.0. 2, Create a Setup project that installs just the single executable from the Windows Forms p...
TITLE: VS2008 Setup Project always requires .NET 3.5 at install time but I don't need it! QUESTION: 1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting.NET Framework 2.0. 2, Create a Setup project that installs just the single executable from t...
[ ".net-3.5", ".net-2.0", "installation" ]
12
21
6,128
4
0
2008-09-16T01:31:31.300000
2008-09-16T10:56:09.367000
68,565
68,615
What XML parser do you use for PHP?
I like the XMLReader class for it's simplicity and speed. But I like the xml_parse associated functions as it better allows for error recovery. It would be nice if the XMLReader class would throw exceptions for things like invalid entity refs instead of just issuinng a warning.
I'd avoid SimpleXML if you can. Though it looks very tempting by getting to avoid a lot of "ugly" code, it's just what the name suggests: simple. For example, it can't handle this: Here is a very simple XML document. Bite the bullet and go to the DOM Functions. The power of it far outweighs the little bit extra complex...
What XML parser do you use for PHP? I like the XMLReader class for it's simplicity and speed. But I like the xml_parse associated functions as it better allows for error recovery. It would be nice if the XMLReader class would throw exceptions for things like invalid entity refs instead of just issuinng a warning.
TITLE: What XML parser do you use for PHP? QUESTION: I like the XMLReader class for it's simplicity and speed. But I like the xml_parse associated functions as it better allows for error recovery. It would be nice if the XMLReader class would throw exceptions for things like invalid entity refs instead of just issuinn...
[ "php", "xml" ]
3
4
1,727
5
0
2008-09-16T01:32:02.313000
2008-09-16T01:41:12.587000
68,572
69,069
Fluent NHibernate Architecture Question
I have a question that I may be over thinking at this point but here goes... I have 2 classes Users and Groups. Users and groups have a many to many relationship and I was thinking that the join table group_users I wanted to have an IsAuthorized property (because some groups are private -- users will need authorization...
I generally only like to create classes that represent actual business entities. In this case I don't think 'groupmembers' represents anything of value in your code. To me the ORM should map the database to your business objects. This means that your classes don't have to exactly mirror the database layout. Also I susp...
Fluent NHibernate Architecture Question I have a question that I may be over thinking at this point but here goes... I have 2 classes Users and Groups. Users and groups have a many to many relationship and I was thinking that the join table group_users I wanted to have an IsAuthorized property (because some groups are ...
TITLE: Fluent NHibernate Architecture Question QUESTION: I have a question that I may be over thinking at this point but here goes... I have 2 classes Users and Groups. Users and groups have a many to many relationship and I was thinking that the join table group_users I wanted to have an IsAuthorized property (becaus...
[ "nhibernate", "architecture", "fluent" ]
1
1
617
2
0
2008-09-16T01:33:02.373000
2008-09-16T03:04:44.400000
68,578
68,611
Multiple cases in switch statement
Is there a way to fall through multiple case statements without stating case value: repeatedly? I know this works: switch (value) { case 1: case 2: case 3: // Do some stuff break; case 4: case 5: case 6: // Do some different stuff break; default: // Default stuff break; } but I'd like to do something like this: switch ...
There is no syntax in C++ nor C# for the second method you mentioned. There's nothing wrong with your first method. If however you have very big ranges, just use a series of if statements.
Multiple cases in switch statement Is there a way to fall through multiple case statements without stating case value: repeatedly? I know this works: switch (value) { case 1: case 2: case 3: // Do some stuff break; case 4: case 5: case 6: // Do some different stuff break; default: // Default stuff break; } but I'd like...
TITLE: Multiple cases in switch statement QUESTION: Is there a way to fall through multiple case statements without stating case value: repeatedly? I know this works: switch (value) { case 1: case 2: case 3: // Do some stuff break; case 4: case 5: case 6: // Do some different stuff break; default: // Default stuff bre...
[ "c#", "switch-statement" ]
754
371
1,330,202
26
0
2008-09-16T01:34:41.277000
2008-09-16T01:40:32.557000
68,583
68,612
foreach access the index or an associative array
I have the following code snippet. $items['A'] = "Test"; $items['B'] = "Test"; $items['C'] = "Test"; $items['D'] = "Test"; $index = 0; foreach($items as $key => $value) { echo "$index is a $key containing $value\n"; $index++; } Expected output: 0 is a A containing Test 1 is a B containing Test 2 is a C containing Test...
Your $index variable there kind of misleading. That number isn't the index, your "A", "B", "C", "D" keys are. You can still access the data through the numbered index $index[1], but that's really not the point. If you really want to keep the numbered index, I'd almost restructure the data: $items[] = array("A", "Test")...
foreach access the index or an associative array I have the following code snippet. $items['A'] = "Test"; $items['B'] = "Test"; $items['C'] = "Test"; $items['D'] = "Test"; $index = 0; foreach($items as $key => $value) { echo "$index is a $key containing $value\n"; $index++; } Expected output: 0 is a A containing Test ...
TITLE: foreach access the index or an associative array QUESTION: I have the following code snippet. $items['A'] = "Test"; $items['B'] = "Test"; $items['C'] = "Test"; $items['D'] = "Test"; $index = 0; foreach($items as $key => $value) { echo "$index is a $key containing $value\n"; $index++; } Expected output: 0 is a ...
[ "php", "foreach" ]
5
14
21,417
3
0
2008-09-16T01:35:07.843000
2008-09-16T01:41:00.467000
68,592
68,623
Good ways to test a unit that communicates via HTTP
Often, I find myself wanting to write a unit test for a portion of code that accesses HTTP resources as part of its normal function. Have you found any good ways to write these kinds of tests?
Extract the part that accesses the HTTP resources out of your main code. Create an interface for that new component, In your test, mock the interface and return data that you can control reliably. You can test the HTTP access as an integration test.
Good ways to test a unit that communicates via HTTP Often, I find myself wanting to write a unit test for a portion of code that accesses HTTP resources as part of its normal function. Have you found any good ways to write these kinds of tests?
TITLE: Good ways to test a unit that communicates via HTTP QUESTION: Often, I find myself wanting to write a unit test for a portion of code that accesses HTTP resources as part of its normal function. Have you found any good ways to write these kinds of tests? ANSWER: Extract the part that accesses the HTTP resource...
[ "unit-testing", "language-agnostic", "http" ]
3
5
221
4
0
2008-09-16T01:37:18.477000
2008-09-16T01:42:35.080000
68,614
196,305
Mixing EJB 2.x BMP entity beans with Hibernate 3.x
I have a large application that uses EJB 2.x entity beans (BMP). This is well-known to be a horrible persistence strategy (I can elaborate if necessary). I'd like to start migrating this application to use a much more expressive, transparent, and non-invasive persistence strategy, and given my company's previous experi...
As said jodonnel, you have to pay attention to caching, because if you use second-level caching in Hibernate and a table is modified outside of Hibernate, then Hibernate has no way to know that its cache entry is stale. For the transactions, they should both use JTA provided by the container, so for that it should be s...
Mixing EJB 2.x BMP entity beans with Hibernate 3.x I have a large application that uses EJB 2.x entity beans (BMP). This is well-known to be a horrible persistence strategy (I can elaborate if necessary). I'd like to start migrating this application to use a much more expressive, transparent, and non-invasive persisten...
TITLE: Mixing EJB 2.x BMP entity beans with Hibernate 3.x QUESTION: I have a large application that uses EJB 2.x entity beans (BMP). This is well-known to be a horrible persistence strategy (I can elaborate if necessary). I'd like to start migrating this application to use a much more expressive, transparent, and non-...
[ "java", "hibernate", "jakarta-ee", "ejb-2.x" ]
6
2
1,417
2
0
2008-09-16T01:41:07.923000
2008-10-12T23:43:55.067000
68,617
79,798
Design question: does the Phone dial the PhoneNumber, or does the PhoneNumber dial itself on the Phone?
This is re-posted from something I posted on the DDD Yahoo! group. All things being equal, do you write phone.dial(phoneNumber) or phoneNumber.dialOn(phone)? Keep in mind possible future requirements (account numbers in addition to phone numbers, calculators in addition to phones). The choice tends to illustrate how th...
Choosing whether to give the column objects or the row objects the dial method doesn't change how the program will scale. The dial method is just going to be itself a sequence of row and column methods. You have to ask what those methods depend on. If the sequence of row methods doesn't depend on knowing exactly which ...
Design question: does the Phone dial the PhoneNumber, or does the PhoneNumber dial itself on the Phone? This is re-posted from something I posted on the DDD Yahoo! group. All things being equal, do you write phone.dial(phoneNumber) or phoneNumber.dialOn(phone)? Keep in mind possible future requirements (account numbers...
TITLE: Design question: does the Phone dial the PhoneNumber, or does the PhoneNumber dial itself on the Phone? QUESTION: This is re-posted from something I posted on the DDD Yahoo! group. All things being equal, do you write phone.dial(phoneNumber) or phoneNumber.dialOn(phone)? Keep in mind possible future requirement...
[ "oop" ]
9
1
2,089
13
0
2008-09-16T01:41:13.490000
2008-09-17T03:52:49.203000
68,624
68,648
How to parse a query string into a NameValueCollection in .NET
I would like to parse a string such as p1=6&p2=7&p3=8 into a NameValueCollection. What is the most elegant way of doing this when you don't have access to the Page.Request object?
There's a built-in.NET utility for this: HttpUtility.ParseQueryString // C# NameValueCollection qscoll = HttpUtility.ParseQueryString(querystring); ' VB.NET Dim qscoll As NameValueCollection = HttpUtility.ParseQueryString(querystring) You may need to replace querystring with new Uri(fullUrl).Query.
How to parse a query string into a NameValueCollection in .NET I would like to parse a string such as p1=6&p2=7&p3=8 into a NameValueCollection. What is the most elegant way of doing this when you don't have access to the Page.Request object?
TITLE: How to parse a query string into a NameValueCollection in .NET QUESTION: I would like to parse a string such as p1=6&p2=7&p3=8 into a NameValueCollection. What is the most elegant way of doing this when you don't have access to the Page.Request object? ANSWER: There's a built-in.NET utility for this: HttpUtili...
[ ".net", "parsing", "query-string" ]
191
371
149,425
19
0
2008-09-16T01:42:35.453000
2008-09-16T01:47:17.690000
68,630
68,817
Are tuples more efficient than lists in Python?
Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements?
The dis module disassembles the byte code for a function and is useful to see the difference between tuples and lists. In this case, you can see that accessing an element generates identical code, but that assigning a tuple is much faster than assigning a list. >>> def a():... x=[1,2,3,4,5]... y=x[2]... >>> def b():......
Are tuples more efficient than lists in Python? Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements?
TITLE: Are tuples more efficient than lists in Python? QUESTION: Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements? ANSWER: The dis module disassembles the byte code for a function and is useful to see the difference between tuples and lists. In this...
[ "python", "performance", "list", "tuples", "python-internals" ]
321
208
141,181
9
0
2008-09-16T01:43:39.040000
2008-09-16T02:13:29.577000
68,633
68,669
Regex that Will Match a Java Method Declaration
I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the declaration. If you have any suggestions to improve my regex or simply have a better one then please submit an answer. H...
Have you considered matching the actual possible keywords? such as: (?:(?:public)|(?:private)|(?:static)|(?:protected)\s+)* It might be a bit more likely to match correctly, though it might also make the regex harder to read...
Regex that Will Match a Java Method Declaration I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the declaration. If you have any suggestions to improve my regex or simply h...
TITLE: Regex that Will Match a Java Method Declaration QUESTION: I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the declaration. If you have any suggestions to improve my...
[ "java", "regex", "methods" ]
20
4
33,529
16
0
2008-09-16T01:44:18.960000
2008-09-16T01:50:52.330000
68,640
68,681
Can you have a class in a struct?
Is it possible in C# to have a Struct with a member variable which is a Class type? If so, where does the information get stored, on the Stack, the Heap, or both?
Yes, you can. The pointer to the class member variable is stored on the stack with the rest of the struct's values, and the class instance's data is stored on the heap. Structs can also contain class definitions as members (inner classes). Here's some really useless code that at least compiles and runs to show that it'...
Can you have a class in a struct? Is it possible in C# to have a Struct with a member variable which is a Class type? If so, where does the information get stored, on the Stack, the Heap, or both?
TITLE: Can you have a class in a struct? QUESTION: Is it possible in C# to have a Struct with a member variable which is a Class type? If so, where does the information get stored, on the Stack, the Heap, or both? ANSWER: Yes, you can. The pointer to the class member variable is stored on the stack with the rest of t...
[ "c#", "class", "struct", "value-type", "reference-type" ]
32
30
23,760
4
0
2008-09-16T01:45:44.510000
2008-09-16T01:53:07.223000
68,645
68,672
Class (static) variables and methods
How do I create class (i.e. static ) variables or methods in Python?
Variables declared inside the class definition, but not inside a method are class or static variables: >>> class MyClass:... i = 3... >>> MyClass.i 3 As @ millerdev points out, this creates a class-level i variable, but this is distinct from any instance-level i variable, so you could have >>> m = MyClass() >>> m.i = 4...
Class (static) variables and methods How do I create class (i.e. static ) variables or methods in Python?
TITLE: Class (static) variables and methods QUESTION: How do I create class (i.e. static ) variables or methods in Python? ANSWER: Variables declared inside the class definition, but not inside a method are class or static variables: >>> class MyClass:... i = 3... >>> MyClass.i 3 As @ millerdev points out, this creat...
[ "python", "class", "static", "class-variables" ]
2,568
2,353
1,696,308
27
0
2008-09-16T01:46:36.847000
2008-09-16T01:51:06.713000
68,651
68,742
How to stop PHP replacing dot characters in GET, POST, or COOKIE names?
If I pass request fields or cookies with a period/dot in their names, PHP auto-replaces them with underscores. For example, if I put this code at https://example.com/test.php?x.y=a.b: the output is: /test.php?x.y=a.b a.b Is there any way I can prevent this behaviour?
Here's PHP.net's explanation of why it does it: Dots in incoming variable names Typically, PHP does not alter the names of variables when they are passed into a script. However, it should be noted that the dot (period, full stop) is not a valid character in a PHP variable name. For the reason, look at it: Now, what the...
How to stop PHP replacing dot characters in GET, POST, or COOKIE names? If I pass request fields or cookies with a period/dot in their names, PHP auto-replaces them with underscores. For example, if I put this code at https://example.com/test.php?x.y=a.b: the output is: /test.php?x.y=a.b a.b Is there any way I can pre...
TITLE: How to stop PHP replacing dot characters in GET, POST, or COOKIE names? QUESTION: If I pass request fields or cookies with a period/dot in their names, PHP auto-replaces them with underscores. For example, if I put this code at https://example.com/test.php?x.y=a.b: the output is: /test.php?x.y=a.b a.b Is there...
[ "php" ]
93
79
48,897
13
0
2008-09-16T01:47:44.363000
2008-09-16T02:01:36.047000
68,664
68,701
Algorithm for finding characters in the same positions in a list of strings?
Suppose I have: Toby Tiny Tory Tily Is there an algorithm that can easily create a list of common characters in the same positions in all these strings? (in this case the common characters are 'T' at position 0 and 'y' at position 3) I tried looking at some of the algorithms used for DNA sequence matching but it seems ...
Finding a list of characters that are common in ALL strings at a certain position is trivially simple. Just iterate on each string for each character position 1 character position at a time. If any string's character is not the match of it's closest neighbor string's character, then the position does not contain a comm...
Algorithm for finding characters in the same positions in a list of strings? Suppose I have: Toby Tiny Tory Tily Is there an algorithm that can easily create a list of common characters in the same positions in all these strings? (in this case the common characters are 'T' at position 0 and 'y' at position 3) I tried l...
TITLE: Algorithm for finding characters in the same positions in a list of strings? QUESTION: Suppose I have: Toby Tiny Tory Tily Is there an algorithm that can easily create a list of common characters in the same positions in all these strings? (in this case the common characters are 'T' at position 0 and 'y' at pos...
[ "algorithm", "string" ]
3
3
1,167
8
0
2008-09-16T01:50:33.813000
2008-09-16T01:54:57.157000
68,666
68,857
CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET
Why does the following code sometimes causes an Exception with the contents "CLIPBRD_E_CANT_OPEN": Clipboard.SetText(str); This usually occurs the first time the Clipboard is used in the application and not after that.
Actually, I think this is the fault of the Win32 API. To set data in the clipboard, you have to open it first. Only one process can have the clipboard open at a time. So, when you check, if another process has the clipboard open for any reason, your attempt to open it will fail. It just so happens that Terminal Service...
CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET Why does the following code sometimes causes an Exception with the contents "CLIPBRD_E_CANT_OPEN": Clipboard.SetText(str); This usually occurs the first time the Clipboard is used in the application and not after that.
TITLE: CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET QUESTION: Why does the following code sometimes causes an Exception with the contents "CLIPBRD_E_CANT_OPEN": Clipboard.SetText(str); This usually occurs the first time the Clipboard is used in the application and not after that. ANSWER: Actually, I...
[ ".net", "wpf", "clipboard" ]
64
43
28,745
10
0
2008-09-16T01:50:35.403000
2008-09-16T02:21:31.710000
68,677
68,872
How can I print a binary value as hex in TSQL?
I'm using SQL Server 2000 to print out some values from a table using PRINT. With most non-string data, I can cast to nvarchar to be able to print it, but binary values attempt to convert using the bit representation of characters. For example: DECLARE @binvalue binary(4) SET @binvalue = 0x12345678 PRINT CAST(@binvalue...
If you were on Sql Server 2005 you could use this: print master.sys.fn_varbintohexstr(@binvalue) I don't think that exists on 2000, though, so you might have to roll your own.
How can I print a binary value as hex in TSQL? I'm using SQL Server 2000 to print out some values from a table using PRINT. With most non-string data, I can cast to nvarchar to be able to print it, but binary values attempt to convert using the bit representation of characters. For example: DECLARE @binvalue binary(4) ...
TITLE: How can I print a binary value as hex in TSQL? QUESTION: I'm using SQL Server 2000 to print out some values from a table using PRINT. With most non-string data, I can cast to nvarchar to be able to print it, but binary values attempt to convert using the bit representation of characters. For example: DECLARE @b...
[ "sql-server", "t-sql" ]
42
29
50,577
7
0
2008-09-16T01:52:12.077000
2008-09-16T02:23:39.303000
68,691
73,418
What's the best way to extract table content from a group of HTML files?
After cleaning a folder full of HTML files with TIDY, how can the tables content be extracted for further processing?
Depends on what sort of processing you want to do. You can tell Tidy to generate XHTML, which is a type of XML, which means you can use all the usual XML tools like XSLT and XQuery on the results. If you want to process them in Microsoft Excel, then you should be able to slice the table out of the HTML and put it in a ...
What's the best way to extract table content from a group of HTML files? After cleaning a folder full of HTML files with TIDY, how can the tables content be extracted for further processing?
TITLE: What's the best way to extract table content from a group of HTML files? QUESTION: After cleaning a folder full of HTML files with TIDY, how can the tables content be extracted for further processing? ANSWER: Depends on what sort of processing you want to do. You can tell Tidy to generate XHTML, which is a typ...
[ "java", "html", "excel", "csv", "extract" ]
1
1
2,394
6
0
2008-09-16T01:53:46.097000
2008-09-16T15:13:48.653000
68,711
68,745
PHP: Can I reference a single member of an array that is returned by a function?
any idea how if the following is possible in PHP as a single line?:... It doesn't seem to 'take'. I need to do this as a 2-stepper:... just curious - other languages I play with allow things like this, and I'm lazy enoug to miss this in PHP... any insight appreciated...
Try: If you're just looking for the first element of the array.
PHP: Can I reference a single member of an array that is returned by a function? any idea how if the following is possible in PHP as a single line?:... It doesn't seem to 'take'. I need to do this as a 2-stepper:... just curious - other languages I play with allow things like this, and I'm lazy enoug to miss this in PH...
TITLE: PHP: Can I reference a single member of an array that is returned by a function? QUESTION: any idea how if the following is possible in PHP as a single line?:... It doesn't seem to 'take'. I need to do this as a 2-stepper:... just curious - other languages I play with allow things like this, and I'm lazy enoug ...
[ "php", "arrays", "function" ]
11
8
1,313
17
0
2008-09-16T01:56:27.980000
2008-09-16T02:02:30.820000
68,749
68,827
Working with USB devices in .NET
Using.Net (C#), how can you work with USB devices? How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write). Is there a native.Net solution to do this?
There is no native (e.g., System libraries) solution for this. That's the reason why SharpUSBLib exists as mentioned by moobaa. If you wish to roll your own handler for USB devices, you can check out the SerialPort class of System.IO.Ports.
Working with USB devices in .NET Using.Net (C#), how can you work with USB devices? How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write). Is there a native.Net solution to do this?
TITLE: Working with USB devices in .NET QUESTION: Using.Net (C#), how can you work with USB devices? How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write). Is there a native.Net solution to do this? ANSWER: There is no native (e.g., System libraries) solution ...
[ ".net", "usb", "communication" ]
50
23
119,838
11
0
2008-09-16T02:02:58.073000
2008-09-16T02:15:41.380000
68,750
68,772
How do you write a C# Extension Method for a Generically Typed Class
This should hopefully be a simple one. I would like to add an extension method to the System.Web.Mvc.ViewPage< T > class. How should this extension method look? My first intuitive thought is something like this: namespace System.Web.Mvc { public static class ViewPageExtensions { public static string GetDefaultPageTitle...
I don't have VS installed on my current machine, but I think the syntax would be: namespace System.Web.Mvc { public static class ViewPageExtensions { public static string GetDefaultPageTitle (this ViewPage v) { return ""; } } }
How do you write a C# Extension Method for a Generically Typed Class This should hopefully be a simple one. I would like to add an extension method to the System.Web.Mvc.ViewPage< T > class. How should this extension method look? My first intuitive thought is something like this: namespace System.Web.Mvc { public stati...
TITLE: How do you write a C# Extension Method for a Generically Typed Class QUESTION: This should hopefully be a simple one. I would like to add an extension method to the System.Web.Mvc.ViewPage< T > class. How should this extension method look? My first intuitive thought is something like this: namespace System.Web....
[ "c#", "asp.net-mvc", "generics", "extension-methods" ]
11
19
14,913
7
0
2008-09-16T02:03:16.387000
2008-09-16T02:05:58.580000
68,774
68,796
Best way to open a socket in Python
I want to open a TCP client socket in Python. Do I have to go through all the low-level BSD create-socket-handle / connect-socket stuff or is there a simpler one-line way?
Opening sockets in python is pretty simple. You really just need something like this: import socket sock = socket.socket() sock.connect((address, port)) and then you can send() and recv() like any other socket
Best way to open a socket in Python I want to open a TCP client socket in Python. Do I have to go through all the low-level BSD create-socket-handle / connect-socket stuff or is there a simpler one-line way?
TITLE: Best way to open a socket in Python QUESTION: I want to open a TCP client socket in Python. Do I have to go through all the low-level BSD create-socket-handle / connect-socket stuff or is there a simpler one-line way? ANSWER: Opening sockets in python is pretty simple. You really just need something like this:...
[ "python", "networking", "tcp" ]
52
83
72,465
3
0
2008-09-16T02:06:11.857000
2008-09-16T02:09:46.170000
68,821
152,558
Dynamically hiding columns in a NSTableView
I want to dynamically hide/show some of the columns in a NSTableView, based on the data that is going to be displayed - basically, if a column is empty I'd like the column to be hidden. I'm currently populating the table with a controller class as the delegate for the table. Any ideas? I see that I can set the column h...
A NSTable is just the class that paints the table. As you said yourself, you have some class you give the table as delegate and this class feeds the table with the data to display. If you store the table data as NSArray's within your delegate class, it should be easy to find out if one column is empty, isn't it? And NS...
Dynamically hiding columns in a NSTableView I want to dynamically hide/show some of the columns in a NSTableView, based on the data that is going to be displayed - basically, if a column is empty I'd like the column to be hidden. I'm currently populating the table with a controller class as the delegate for the table. ...
TITLE: Dynamically hiding columns in a NSTableView QUESTION: I want to dynamically hide/show some of the columns in a NSTableView, based on the data that is going to be displayed - basically, if a column is empty I'd like the column to be hidden. I'm currently populating the table with a controller class as the delega...
[ "cocoa", "macos" ]
2
0
6,558
9
0
2008-09-16T02:14:21.743000
2008-09-30T10:48:50.090000
68,898
68,914
Automatic Internationalization Testing For Web
Does there exist a website service or set of scripts that will tell you whether your web page badly configured if your goal is to be internationally friendly? To be more precise, I'm wondering if something like this exists: Checking URL: http://www.example.com GET / HTTP/1.0 Accept-Charset: utf8... HTTP/1.0 200 OK Cha...
I believe the W3C validator does it, but maybe not to the extent you are looking for...
Automatic Internationalization Testing For Web Does there exist a website service or set of scripts that will tell you whether your web page badly configured if your goal is to be internationally friendly? To be more precise, I'm wondering if something like this exists: Checking URL: http://www.example.com GET / HTTP/1...
TITLE: Automatic Internationalization Testing For Web QUESTION: Does there exist a website service or set of scripts that will tell you whether your web page badly configured if your goal is to be internationally friendly? To be more precise, I'm wondering if something like this exists: Checking URL: http://www.exampl...
[ "testing", "internationalization" ]
0
0
329
1
0
2008-09-16T02:29:43.717000
2008-09-16T02:31:45.680000
68,907
68,938
How do you measure the time a function takes to execute?
How can you measure the amount of time a function will take to execute? This is a relatively short function and the execution time would probably be in the millisecond range. This particular question relates to an embedded system, programmed in C or C++.
The best way to do that on an embedded system is to set an external hardware pin when you enter the function and clear it when you leave the function. This is done preferably with a little assembly instruction so you don't skew your results too much. Edit: One of the benefits is that you can do it in your actual applic...
How do you measure the time a function takes to execute? How can you measure the amount of time a function will take to execute? This is a relatively short function and the execution time would probably be in the millisecond range. This particular question relates to an embedded system, programmed in C or C++.
TITLE: How do you measure the time a function takes to execute? QUESTION: How can you measure the amount of time a function will take to execute? This is a relatively short function and the execution time would probably be in the millisecond range. This particular question relates to an embedded system, programmed in ...
[ "time", "embedded", "profiling" ]
4
10
14,220
12
0
2008-09-16T02:30:56.740000
2008-09-16T02:36:25.263000
68,929
68,950
How to fix the endless printing loop bug in Nevrona Rave
Nevrona Designs' Rave Reports is a Report Engine for use by Embarcadero's Delphi IDE. This is what I call the Rave Endless Loop bug. In Rave Reports version 6.5.0 (VCL10) that comes bundled with Delphi 2006, there is a nortorious bug that plagues many Rave report developers. If you have a non-empty dataset, and the dat...
This is more of a work-around than a true solution. I first posted this work-around on the Nevrona newsgroup (Group=nevrona.public.rave.developer.delphi.rave; Subject="Are you suffering from the Rave Endless Loop bug?: Work-around announced."; Date=13/11/2006 7:06 PM) So here is my solution. It is more of a work-around...
How to fix the endless printing loop bug in Nevrona Rave Nevrona Designs' Rave Reports is a Report Engine for use by Embarcadero's Delphi IDE. This is what I call the Rave Endless Loop bug. In Rave Reports version 6.5.0 (VCL10) that comes bundled with Delphi 2006, there is a nortorious bug that plagues many Rave report...
TITLE: How to fix the endless printing loop bug in Nevrona Rave QUESTION: Nevrona Designs' Rave Reports is a Report Engine for use by Embarcadero's Delphi IDE. This is what I call the Rave Endless Loop bug. In Rave Reports version 6.5.0 (VCL10) that comes bundled with Delphi 2006, there is a nortorious bug that plague...
[ "delphi", "infinite-loop", "rave-reports" ]
4
2
4,565
4
0
2008-09-16T02:34:38.310000
2008-09-16T02:37:26.023000
68,993
76,888
How to get Emacs to unwrap a block of code?
Say I have a line in an emacs buffer that looks like this: foo -option1 value1 -option2 value2 -option3 value3 \ -option4 value4... I want it to look like this: foo -option1 value1 \ -option2 value2 \ -option3 value3 \ -option4 value4 \... I want each option/value pair on a separate line. I also want those subsequent l...
Nobody had what I was looking for so I decided to dust off my elisp manual and do it myself. This seems to work well enough, though the output isn't precisely what I asked for. In this version the first option goes on a line by itself instead of staying on the first line like in my original question. (defun tcl-multili...
How to get Emacs to unwrap a block of code? Say I have a line in an emacs buffer that looks like this: foo -option1 value1 -option2 value2 -option3 value3 \ -option4 value4... I want it to look like this: foo -option1 value1 \ -option2 value2 \ -option3 value3 \ -option4 value4 \... I want each option/value pair on a s...
TITLE: How to get Emacs to unwrap a block of code? QUESTION: Say I have a line in an emacs buffer that looks like this: foo -option1 value1 -option2 value2 -option3 value3 \ -option4 value4... I want it to look like this: foo -option1 value1 \ -option2 value2 \ -option3 value3 \ -option4 value4 \... I want each option...
[ "emacs" ]
4
2
1,374
4
0
2008-09-16T02:46:04.070000
2008-09-16T20:48:20.800000
68,999
69,223
How can I find the response time of a HTTP request through a Socket
I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I'm looking for a short answer, I don't want to use other protocols etc. Obviously do I neither want to have a solution that ...
I would say it depends on what exact interval you are trying measure, the amount of time from the last byte of the request that you send until the first byte of the response that you receive? Or until the entire response is received? Or are you trying to measure the server-side time only? If you're trying to measure th...
How can I find the response time of a HTTP request through a Socket I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I'm looking for a short answer, I don't want to use other...
TITLE: How can I find the response time of a HTTP request through a Socket QUESTION: I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I'm looking for a short answer, I don't...
[ "java", "http" ]
20
14
104,822
7
0
2008-09-16T02:46:46.283000
2008-09-16T03:44:09.577000
69,000
69,654
Visual Studio basicHttpBinding and endpoint problems
I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings. Unfortunately, this means that when I update the service references in the project ...
Create a.Bat file which uses svcutil, for proxygeneration, that has the settings that is right for your project. It's fairly easy. Clicking on the batfile, to generate new proxyfiles whenever the interface have been changed is easy. The batch can then later be used in automated builds. Then you only need to set up the ...
Visual Studio basicHttpBinding and endpoint problems I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings. Unfortunately, this means that...
TITLE: Visual Studio basicHttpBinding and endpoint problems QUESTION: I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings. Unfortunatel...
[ "asp.net", "wpf", "visual-studio", "web-services" ]
3
3
2,138
5
0
2008-09-16T02:46:52.087000
2008-09-16T05:47:35.070000
69,030
69,404
In Applescript, how can I find out if a menu item is selected/focused?
I have a script for OS X 10.5 that focuses the Search box in the Help menu of any application. I have it on a key combination and, much like Spotlight, I want it to toggle when I run the script. So, I want to detect if the search box is already focused for typing, and if so, type Esc instead of clicking the Help menu. ...
Using /Developer/Applications/Utilities/Accessibility Tools/Accessibility Inspector.app you can use the built-in accessibility system to look at properties of the UI element under the mouse. Take special note of the cmd-F7 action to lock focus on an element and the Refresh button. Sadly the element and property names d...
In Applescript, how can I find out if a menu item is selected/focused? I have a script for OS X 10.5 that focuses the Search box in the Help menu of any application. I have it on a key combination and, much like Spotlight, I want it to toggle when I run the script. So, I want to detect if the search box is already focu...
TITLE: In Applescript, how can I find out if a menu item is selected/focused? QUESTION: I have a script for OS X 10.5 that focuses the Search box in the Help menu of any application. I have it on a key combination and, much like Spotlight, I want it to toggle when I run the script. So, I want to detect if the search b...
[ "macos", "focus", "applescript", "menu" ]
7
3
9,225
5
0
2008-09-16T02:53:34.533000
2008-09-16T04:34:10.847000
69,048
69,103
Binding a form combo box in Access 2007
I've created an Access 2007 form that displays, for example, Products from a Product table. One of the fields in the Product table is a CategoryID that corresponds to this product's parent category. In the form, the CategoryID needs to be represented as a combo box that is bound to the Category table. The idea here is ...
You need to use both values in the query for the combo box. e.g. SELECT CategoryId, CategoryName FROM CategoryTable... Bind the combo box to the fist column, CategoryId. Set the column widths for the combo box to 0in (no second value need, so there is no limit). This will hide the first column which contains your selec...
Binding a form combo box in Access 2007 I've created an Access 2007 form that displays, for example, Products from a Product table. One of the fields in the Product table is a CategoryID that corresponds to this product's parent category. In the form, the CategoryID needs to be represented as a combo box that is bound ...
TITLE: Binding a form combo box in Access 2007 QUESTION: I've created an Access 2007 form that displays, for example, Products from a Product table. One of the fields in the Product table is a CategoryID that corresponds to this product's parent category. In the form, the CategoryID needs to be represented as a combo ...
[ "ms-access", "data-binding", "forms", "combobox" ]
7
6
17,160
2
0
2008-09-16T02:59:56.843000
2008-09-16T03:10:47.067000
69,049
69,351
How can you insure your code runs with no variability in execution time due to cache?
In an embedded application (written in C, on a 32-bit processor) with hard real-time constraints, the execution time of critical code (specially interrupts) needs to be constant. How do you insure that time variability is not introduced in the execution of the code, specifically due to the processor's caches (be it L1,...
If you can get your hands on the hardware, or work with someone who can, you can turn off the cache. Some CPUs have a pin that, if wired to ground instead of power (or maybe the other way), will disable all internal caches. That will give predictability but not speed! Failing that, maybe in certain places in the softwa...
How can you insure your code runs with no variability in execution time due to cache? In an embedded application (written in C, on a 32-bit processor) with hard real-time constraints, the execution time of critical code (specially interrupts) needs to be constant. How do you insure that time variability is not introduc...
TITLE: How can you insure your code runs with no variability in execution time due to cache? QUESTION: In an embedded application (written in C, on a 32-bit processor) with hard real-time constraints, the execution time of critical code (specially interrupts) needs to be constant. How do you insure that time variabili...
[ "caching", "time", "profiling", "processor" ]
5
2
487
6
0
2008-09-16T03:00:00.463000
2008-09-16T04:19:16.217000
69,063
74,731
How to default the source folder for new JUnit tests in Eclipse?
Most of our Eclipse projects have multiple source folders, for example: src/main/java src/test/java When you right-click on a class and choose New JUnit Test, the default source folder for the new test is "src/main/java" (presumably the first source folder listed in the project properties). Is there any way to change t...
I use moreUnit, an Eclipse plugin to assist writing unit tests. Among other features, it lets you configure the default source folder of tests.
How to default the source folder for new JUnit tests in Eclipse? Most of our Eclipse projects have multiple source folders, for example: src/main/java src/test/java When you right-click on a class and choose New JUnit Test, the default source folder for the new test is "src/main/java" (presumably the first source folde...
TITLE: How to default the source folder for new JUnit tests in Eclipse? QUESTION: Most of our Eclipse projects have multiple source folders, for example: src/main/java src/test/java When you right-click on a class and choose New JUnit Test, the default source folder for the new test is "src/main/java" (presumably the ...
[ "java", "eclipse", "junit", "usability" ]
41
52
26,081
3
0
2008-09-16T03:03:12.593000
2008-09-16T17:19:40.333000
69,068
69,079
Split long commands in multiple lines through Windows batch file
How can I split long commands over multiple lines in a batch file?
You can break up long lines with the caret ^ as long as you remember that the caret and the newline following it are completely removed. So, if there should be a space where you're breaking the line, include a space. ( More on that below. ) Example: copy file1.txt file2.txt would be written as: copy file1.txt^ file2.tx...
Split long commands in multiple lines through Windows batch file How can I split long commands over multiple lines in a batch file?
TITLE: Split long commands in multiple lines through Windows batch file QUESTION: How can I split long commands over multiple lines in a batch file? ANSWER: You can break up long lines with the caret ^ as long as you remember that the caret and the newline following it are completely removed. So, if there should be a...
[ "batch-file", "line-continuation" ]
999
1,231
616,589
7
0
2008-09-16T03:04:34.260000
2008-09-16T03:06:37.857000
69,089
3,338,113
How to do hit-highlighting of results from a SQL Server full-text query
We have a web application that uses SQL Server 2008 as the database. Our users are able to do full-text searches on particular columns in the database. SQL Server's full-text functionality does not seem to provide support for hit highlighting. Do we need to build this ourselves or is there perhaps some library or knowl...
Expanding on Ishmael's idea, it's not the final solution, but I think it's a good way to start. Firstly we need to get the list of words that have been retrieved with the full-text engine: declare @SearchPattern nvarchar(1000) = 'FORMSOF (INFLECTIONAL, " ' + @SearchString + ' ")' declare @SearchWords table (Word varcha...
How to do hit-highlighting of results from a SQL Server full-text query We have a web application that uses SQL Server 2008 as the database. Our users are able to do full-text searches on particular columns in the database. SQL Server's full-text functionality does not seem to provide support for hit highlighting. Do w...
TITLE: How to do hit-highlighting of results from a SQL Server full-text query QUESTION: We have a web application that uses SQL Server 2008 as the database. Our users are able to do full-text searches on particular columns in the database. SQL Server's full-text functionality does not seem to provide support for hit ...
[ "sql-server", "full-text-search", "highlighting", "hit-highlighting" ]
8
3
9,660
4
0
2008-09-16T03:08:20.147000
2010-07-26T19:07:45.023000
69,107
69,148
Best Refactor to Handle Multiple jQuery Email Field Form Validation
What is the best way to refactor the attached code to accommodate multiple email addresses? The attached HTML/jQuery is complete and works for the first email address. I can setup the other two by copy/pasting and changing the code. But I would like to just refactor the existing code to handle multiple email address fi...
Instead of using IDs for your email fields, you can give them each a class: Friend #1 Friend #2 Friend #3 Then, instead of selecting $("#Email_Address_Status_Icon_1"), you can select $("input.email"), which would give you a jQuery wrapped set of all input elements of class email. Finally, instead of referring to the st...
Best Refactor to Handle Multiple jQuery Email Field Form Validation What is the best way to refactor the attached code to accommodate multiple email addresses? The attached HTML/jQuery is complete and works for the first email address. I can setup the other two by copy/pasting and changing the code. But I would like to...
TITLE: Best Refactor to Handle Multiple jQuery Email Field Form Validation QUESTION: What is the best way to refactor the attached code to accommodate multiple email addresses? The attached HTML/jQuery is complete and works for the first email address. I can setup the other two by copy/pasting and changing the code. B...
[ "jquery", "email", "refactoring", "validation" ]
0
2
4,891
3
0
2008-09-16T03:12:33.710000
2008-09-16T03:23:08.270000
69,108
69,134
Using Java JAR file in .NET
What options / methods / software are available to convert a JAR file to a managed.NET assembly? Please provide all commercial and non-commercial methods in the answer. These don't include solutions which require Java to be installed on the host machine.
I could be wrong, but I'm pretty sure that's impossible. The java byte code is different to the code produced to run on the CLR. Snarky answer: Get the source code, and port it. EDIT: A little poking comes up with http://sourceforge.net/projects/ikvm/, a Java Virtual Machine implementation for.NET. Not quite what you a...
Using Java JAR file in .NET What options / methods / software are available to convert a JAR file to a managed.NET assembly? Please provide all commercial and non-commercial methods in the answer. These don't include solutions which require Java to be installed on the host machine.
TITLE: Using Java JAR file in .NET QUESTION: What options / methods / software are available to convert a JAR file to a managed.NET assembly? Please provide all commercial and non-commercial methods in the answer. These don't include solutions which require Java to be installed on the host machine. ANSWER: I could be...
[ "java", ".net", "jar", "managed" ]
8
9
6,534
2
0
2008-09-16T03:12:40.293000
2008-09-16T03:18:38.920000
69,112
69,169
What is a symbol table?
Can someone describe what a symbol table is within the context of C and C++?
There are two common and related meaning of symbol tables here. First, there's the symbol table in your object files. Usually, a C or C++ compiler compiles a single source file into an object file with a.obj or.o extension. This contains a collection of executable code and data that the linker can process into a workin...
What is a symbol table? Can someone describe what a symbol table is within the context of C and C++?
TITLE: What is a symbol table? QUESTION: Can someone describe what a symbol table is within the context of C and C++? ANSWER: There are two common and related meaning of symbol tables here. First, there's the symbol table in your object files. Usually, a C or C++ compiler compiles a single source file into an object ...
[ "c++", "c", "symbol-table" ]
98
95
78,083
7
0
2008-09-16T03:14:58.447000
2008-09-16T03:28:59.037000
69,115
69,218
char[] to hex string exercise
Below is my current char* to hex string function. I wrote it as an exercise in bit manipulation. It takes ~7ms on a AMD Athlon MP 2800+ to hexify a 10 million byte array. Is there any trick or other way that I am missing? How can I make this faster? Compiled with -O3 in g++ static const char _hex2asciiU_value[256][2] =...
At the cost of more memory you can create a full 256-entry table of the hex codes: static const char _hex2asciiU_value[256][2] = { {'0','0'}, {'0','1'}, /*..., */ {'F','E'},{'F','F'} }; Then direct index into the table, no bit fiddling required. const char *pHexVal = pHex[*pChar]; pszHex[0] = pHexVal[0]; pszHex[1] = pH...
char[] to hex string exercise Below is my current char* to hex string function. I wrote it as an exercise in bit manipulation. It takes ~7ms on a AMD Athlon MP 2800+ to hexify a 10 million byte array. Is there any trick or other way that I am missing? How can I make this faster? Compiled with -O3 in g++ static const ch...
TITLE: char[] to hex string exercise QUESTION: Below is my current char* to hex string function. I wrote it as an exercise in bit manipulation. It takes ~7ms on a AMD Athlon MP 2800+ to hexify a 10 million byte array. Is there any trick or other way that I am missing? How can I make this faster? Compiled with -O3 in g...
[ "c++", "optimization", "hex" ]
6
4
18,712
16
0
2008-09-16T03:15:40.440000
2008-09-16T03:42:49.143000
69,128
69,366
SaaS database design - Multiple Databases? Split?
I've seen SaaS applications hosted in many different ways. Is it a good idea to split features and modules across multiple databases? For example, putting things like the User table on one DB and feature/app specific tables on another DB and perhaps other commonly shared tables in another DB?
Start with one database. Split data/functionality when project requires it. Here is what we can learn from LinkedIn: A single database does not work Referential integrity will not be possible Any data loss is a problem Caching is good even when it's modestly effective Never underestimate growth trajectory Source: Linke...
SaaS database design - Multiple Databases? Split? I've seen SaaS applications hosted in many different ways. Is it a good idea to split features and modules across multiple databases? For example, putting things like the User table on one DB and feature/app specific tables on another DB and perhaps other commonly share...
TITLE: SaaS database design - Multiple Databases? Split? QUESTION: I've seen SaaS applications hosted in many different ways. Is it a good idea to split features and modules across multiple databases? For example, putting things like the User table on one DB and feature/app specific tables on another DB and perhaps ot...
[ "database-design", "architecture", "database-schema", "multi-tenant", "saas" ]
21
35
21,534
10
0
2008-09-16T03:18:10.140000
2008-09-16T04:22:59.843000
69,164
69,625
Errors creating WebPart subclass in another assembly
I am trying to create a subclass of WebPart that will act as a parent to any WebParts we create. If I create an empty class in the same project, I am able to inherit from it as one would expect. However, if I try to place it in another assembly -- one that I've been able to reference and use classes from -- I get the f...
OK, I found the problem. The packaging task uses reflection for some reason or another. When it finds that your class inherits from a class in another domain, it tries to load it using reflection. However, reflection doesn't do binding policy, so that domain isn't loaded. The authors of the packaging program could solv...
Errors creating WebPart subclass in another assembly I am trying to create a subclass of WebPart that will act as a parent to any WebParts we create. If I create an empty class in the same project, I am able to inherit from it as one would expect. However, if I try to place it in another assembly -- one that I've been ...
TITLE: Errors creating WebPart subclass in another assembly QUESTION: I am trying to create a subclass of WebPart that will act as a parent to any WebParts we create. If I create an empty class in the same project, I am able to inherit from it as one would expect. However, if I try to place it in another assembly -- o...
[ "sharepoint", "web-parts" ]
1
1
629
1
0
2008-09-16T03:27:06.013000
2008-09-16T05:36:36.467000
69,230
766,728
A snippet to monitor the last INSERT/UPDATE in an Oracle DB from C#?
I'm looking for a simple, sample snippet of C# code to monitor an Oracle database and basically check for its last update. It could be either command line (great for future integration with Nagios) or GUI. I've did some prototypes but the code tend to get lengthy as I'm still kind of learning the language. Any suggesti...
One possible solution is: Add a DATE field that represents the last update time to MY_TABLE table. ALTER TABLE my_table ADD (last_update_time DATE); Create an index on that field. CREATE INDEX i_my_table_upd_time ON my_table (last_update_time); Create a database trigger on that table that fires ON UPDATE and ON INSERT ...
A snippet to monitor the last INSERT/UPDATE in an Oracle DB from C#? I'm looking for a simple, sample snippet of C# code to monitor an Oracle database and basically check for its last update. It could be either command line (great for future integration with Nagios) or GUI. I've did some prototypes but the code tend to...
TITLE: A snippet to monitor the last INSERT/UPDATE in an Oracle DB from C#? QUESTION: I'm looking for a simple, sample snippet of C# code to monitor an Oracle database and basically check for its last update. It could be either command line (great for future integration with Nagios) or GUI. I've did some prototypes bu...
[ "c#", ".net", "oracle" ]
0
1
1,198
1
0
2008-09-16T03:46:35.093000
2009-04-20T03:00:38.223000
69,250
69,252
Why does a C/C++ program often have optimization turned off in debug mode?
In most C or C++ environments, there is a "debug" mode and a "release" mode compilation. Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) but it also disables most optimizations. In "release" mode, you usually have all sorts of opt...
Without any optimization on, the flow through your code is linear. If you are on line 5 and single step, you step to line 6. With optimization on, you can get instruction re-ordering, loop unrolling and all sorts of optimizations. For example: void foo() { 1: int i; 2: for(i = 0; i < 2; ) 3: i++; 4: return; In this exa...
Why does a C/C++ program often have optimization turned off in debug mode? In most C or C++ environments, there is a "debug" mode and a "release" mode compilation. Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) but it also disabl...
TITLE: Why does a C/C++ program often have optimization turned off in debug mode? QUESTION: In most C or C++ environments, there is a "debug" mode and a "release" mode compilation. Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) ...
[ "c++", "c", "compiler-construction" ]
15
30
5,379
6
0
2008-09-16T03:51:07.203000
2008-09-16T03:51:20.933000
69,262
69,279
Is there an easy way in .NET to get "st", "nd", "rd" and "th" endings for numbers?
I am wondering if there is a method or format string I'm missing in.NET to convert the following: 1 to 1st 2 to 2nd 3 to 3rd 4 to 4th 11 to 11th 101 to 101st 111 to 111th This link has a bad example of the basic principle involved in writing your own function, but I am more curious if there is an inbuilt capacity I'm m...
No, there is no inbuilt capability in the.NET Base Class Library.
Is there an easy way in .NET to get "st", "nd", "rd" and "th" endings for numbers? I am wondering if there is a method or format string I'm missing in.NET to convert the following: 1 to 1st 2 to 2nd 3 to 3rd 4 to 4th 11 to 11th 101 to 101st 111 to 111th This link has a bad example of the basic principle involved in wri...
TITLE: Is there an easy way in .NET to get "st", "nd", "rd" and "th" endings for numbers? QUESTION: I am wondering if there is a method or format string I'm missing in.NET to convert the following: 1 to 1st 2 to 2nd 3 to 3rd 4 to 4th 11 to 11th 101 to 101st 111 to 111th This link has a bad example of the basic princip...
[ ".net", "formatting", "date", "ordinals" ]
73
60
57,542
11
0
2008-09-16T03:53:16.387000
2008-09-16T03:56:07.880000
69,275
74,815
Drawing a Web Graph
I'm trying to draw a graph on an ASP webpage. I'm hoping an API can be helpful, but so far I have not been able to find one. The graph contains labeled nodes and unlabeled directional edges. The ideal output would be something like this. Anybody know of anything pre-built than can help?
Definitely graphviz. The image on the wikipedia link you are pointing at was made in graphviz. From its description page the graph description file looked like this: graph untitled { graph[bgcolor="transparent"]; node [fontname="Bitstream Vera Sans", fontsize="22.00", shape=circle, style="bold,filled" fillcolor=white];...
Drawing a Web Graph I'm trying to draw a graph on an ASP webpage. I'm hoping an API can be helpful, but so far I have not been able to find one. The graph contains labeled nodes and unlabeled directional edges. The ideal output would be something like this. Anybody know of anything pre-built than can help?
TITLE: Drawing a Web Graph QUESTION: I'm trying to draw a graph on an ASP webpage. I'm hoping an API can be helpful, but so far I have not been able to find one. The graph contains labeled nodes and unlabeled directional edges. The ideal output would be something like this. Anybody know of anything pre-built than can ...
[ "asp.net", "api", "visualization", "graph-theory" ]
9
5
4,251
9
0
2008-09-16T03:55:45.430000
2008-09-16T17:28:43.247000
69,277
69,985
Rhino Mocks: How do I return numbers from a sequence
I have an Enumerable array int meas[] = new double[] {3, 6, 9, 12, 15, 18}; On each successive call to the mock's method that I'm testing I want to return a value from that array. using(_mocks.Record()) { Expect.Call(mocked_class.GetValue()).Return(meas); } using(_mocks.Playback()) { foreach(var i in meas) Assert.AreEq...
There is alway static fake object, but this question is about rhino-mocks, so I present you with the way I'll do it. The trick is that you create a local variable as the counter, and use it in your anonymous delegate/lambda to keep track of where you are on the array. Notice that I didn't handle the case that GetValue(...
Rhino Mocks: How do I return numbers from a sequence I have an Enumerable array int meas[] = new double[] {3, 6, 9, 12, 15, 18}; On each successive call to the mock's method that I'm testing I want to return a value from that array. using(_mocks.Record()) { Expect.Call(mocked_class.GetValue()).Return(meas); } using(_mo...
TITLE: Rhino Mocks: How do I return numbers from a sequence QUESTION: I have an Enumerable array int meas[] = new double[] {3, 6, 9, 12, 15, 18}; On each successive call to the mock's method that I'm testing I want to return a value from that array. using(_mocks.Record()) { Expect.Call(mocked_class.GetValue()).Return(...
[ "c#", ".net", "rhino-mocks" ]
2
4
1,543
4
0
2008-09-16T03:55:58.707000
2008-09-16T07:08:48.243000
69,281
69,335
Eclipse Ganymede hacks, hints, tips, tricks, and best practices
I've recently started using Eclipse Ganymede CDT for C development and I couldn't like it more. I'm aware the learning curve could be sort of pronounced, therefore and with your help, my goal is to flatten it as much as possible. I'm looking for the best hacks, hints, tips, tricks, and best practices to really unleash ...
Accurate Indexing With CDT you should be sure to enable the "Full Indexing" option rather than the "Fast Indexing" default. It's not perceptibly slower on modern hardware and it does a much better job. In that vein, you should be sure to enable semantic highlighting. This isn't as important in C/C++ as it is in a langu...
Eclipse Ganymede hacks, hints, tips, tricks, and best practices I've recently started using Eclipse Ganymede CDT for C development and I couldn't like it more. I'm aware the learning curve could be sort of pronounced, therefore and with your help, my goal is to flatten it as much as possible. I'm looking for the best h...
TITLE: Eclipse Ganymede hacks, hints, tips, tricks, and best practices QUESTION: I've recently started using Eclipse Ganymede CDT for C development and I couldn't like it more. I'm aware the learning curve could be sort of pronounced, therefore and with your help, my goal is to flatten it as much as possible. I'm look...
[ "c", "eclipse", "eclipse-cdt", "ganymede" ]
8
16
5,530
4
0
2008-09-16T03:56:14.213000
2008-09-16T04:14:34.607000
69,296
69,407
XML Serialization and empty collections
I have a a property defined as: [XmlArray("delete", IsNullable = true)] [XmlArrayItem("contact", typeof(ContactEvent)), XmlArrayItem("sms", typeof(SmsEvent))] public List Delete { get; set; } If the List<> Delete has no items is emitted. If the List<> Delete is set to null is emitted. Is there a way using attributes to...
If you set IsNullable=false or just remove it (it is false by default), then the "delete" element will not be emitted. This will work only if the collection equals to null. My guess is that there is a confusion between "nullability" in terms of.NET, and the one related to nullable elements in XML -- those that are mark...
XML Serialization and empty collections I have a a property defined as: [XmlArray("delete", IsNullable = true)] [XmlArrayItem("contact", typeof(ContactEvent)), XmlArrayItem("sms", typeof(SmsEvent))] public List Delete { get; set; } If the List<> Delete has no items is emitted. If the List<> Delete is set to null is emi...
TITLE: XML Serialization and empty collections QUESTION: I have a a property defined as: [XmlArray("delete", IsNullable = true)] [XmlArrayItem("contact", typeof(ContactEvent)), XmlArrayItem("sms", typeof(SmsEvent))] public List Delete { get; set; } If the List<> Delete has no items is emitted. If the List<> Delete is ...
[ "c#", "xml-serialization" ]
3
5
15,803
4
0
2008-09-16T03:59:47.543000
2008-09-16T04:34:48.410000
69,330
69,389
Zend PHP debugger: How can I start debugging a page using a get argument?
I am trying out the debugger built into Zend studio. It seems great! One thing though, when I start a page using the debugger does anyone know how I can set a request get argument within the page? For example, I don't want to debug runtests.php I want to debug runtests.php?test=10 I assume its a simple configuration an...
Just start the debugger on another page, and then change the browser url to what you wanted. It's not ideal but it should work. I have high hopes for their next release.
Zend PHP debugger: How can I start debugging a page using a get argument? I am trying out the debugger built into Zend studio. It seems great! One thing though, when I start a page using the debugger does anyone know how I can set a request get argument within the page? For example, I don't want to debug runtests.php I...
TITLE: Zend PHP debugger: How can I start debugging a page using a get argument? QUESTION: I am trying out the debugger built into Zend studio. It seems great! One thing though, when I start a page using the debugger does anyone know how I can set a request get argument within the page? For example, I don't want to de...
[ "php", "debugging", "zend-studio", "zend-debugger" ]
1
2
1,640
2
0
2008-09-16T04:13:14.267000
2008-09-16T04:29:34.710000
69,332
69,416
Tracking CPU and Memory usage per process
I suspect that one of my applications eats more CPU cycles than I want it to. The problem is - it happens in bursts, and just looking at the task manager doesn't help me as it shows immediate usage only. Is there a way (on Windows) to track the history of CPU & Memory usage for some process. E.g. I will start tracking ...
Press Win + R, type perfmon and press Enter. When the Performance window is open, click on the + sign to add new counters to the graph. The counters are different aspects of how your PC works and are grouped by similarity into groups called "Performance Object". For your questions, you can choose the "Process", "Memory...
Tracking CPU and Memory usage per process I suspect that one of my applications eats more CPU cycles than I want it to. The problem is - it happens in bursts, and just looking at the task manager doesn't help me as it shows immediate usage only. Is there a way (on Windows) to track the history of CPU & Memory usage for...
TITLE: Tracking CPU and Memory usage per process QUESTION: I suspect that one of my applications eats more CPU cycles than I want it to. The problem is - it happens in bursts, and just looking at the task manager doesn't help me as it shows immediate usage only. Is there a way (on Windows) to track the history of CPU ...
[ "windows", "system-administration", "process-management" ]
184
183
448,380
16
0
2008-09-16T04:13:53.467000
2008-09-16T04:36:46.750000
69,352
69,372
Is there a way to programmatically minimize a window
What I'm doing is I have a full-screen form, with no title bar, and consequently lacks the minimize/maximize/close buttons found in the upper-right hand corner. I'm wanting to replace that functionality with a keyboard short-cut and a context menu item, but I can't seem to find an event to trigger to minimize the form.
private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if(e.KeyChar == 'm') this.WindowState = FormWindowState.Minimized; }
Is there a way to programmatically minimize a window What I'm doing is I have a full-screen form, with no title bar, and consequently lacks the minimize/maximize/close buttons found in the upper-right hand corner. I'm wanting to replace that functionality with a keyboard short-cut and a context menu item, but I can't s...
TITLE: Is there a way to programmatically minimize a window QUESTION: What I'm doing is I have a full-screen form, with no title bar, and consequently lacks the minimize/maximize/close buttons found in the upper-right hand corner. I'm wanting to replace that functionality with a keyboard short-cut and a context menu i...
[ "c#", ".net", "vb.net", "winforms" ]
76
123
136,544
10
0
2008-09-16T04:19:29.057000
2008-09-16T04:25:03.830000
69,375
69,380
Looking for the ways for test automation of web site
We develop custom survey web sites and I am looking for a way to automate the pattern testing of these sites. Surveys often contain many complex rules and branches which are triggered on how items are responded too. All surveys are rigorously tested before being released to clients. This testing results in a lot of man...
Check out selenium: http://selenium.openqa.org/ Also, check out the answers to this other question: https://stackoverflow.com/questions/484/how-do-you-test-layout-design-across-multiple-browsersoss
Looking for the ways for test automation of web site We develop custom survey web sites and I am looking for a way to automate the pattern testing of these sites. Surveys often contain many complex rules and branches which are triggered on how items are responded too. All surveys are rigorously tested before being rele...
TITLE: Looking for the ways for test automation of web site QUESTION: We develop custom survey web sites and I am looking for a way to automate the pattern testing of these sites. Surveys often contain many complex rules and branches which are triggered on how items are responded too. All surveys are rigorously tested...
[ "unit-testing", "web-applications", "asp-classic", "automated-tests" ]
4
10
702
9
0
2008-09-16T04:26:02.567000
2008-09-16T04:27:00.347000
69,391
69,393
In Applescript, how can I get to the Help menu Search field, like Spotlight?
In OS X, in order to quickly get at menu items from the keyboard, I want to be able to type a key combination, have it run a script, and have the script focus the Search field in the Help menu. It should work just like the key combination for Spotlight, so if I run it again, it should dismiss the menu. I can run the sc...
Here is the script I came up with. tell application "System Events" tell (first process whose frontmost is true) click menu "Help" of menu bar 1 end tell end tell
In Applescript, how can I get to the Help menu Search field, like Spotlight? In OS X, in order to quickly get at menu items from the keyboard, I want to be able to type a key combination, have it run a script, and have the script focus the Search field in the Help menu. It should work just like the key combination for ...
TITLE: In Applescript, how can I get to the Help menu Search field, like Spotlight? QUESTION: In OS X, in order to quickly get at menu items from the keyboard, I want to be able to type a key combination, have it run a script, and have the script focus the Search field in the Help menu. It should work just like the ke...
[ "macos", "search", "applescript", "menu", "spotlight" ]
1
1
567
2
0
2008-09-16T04:29:55.207000
2008-09-16T04:30:09.390000
69,430
4,448,972
Is there a way to make text unselectable on an HTML page?
I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in many browsers. I might be able to solve this with a JavaScript trick (I'd like to see those answers, too) -- but I'm reall...
In most browsers, this can be achieved using CSS: *.unselectable { -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; /* Introduced in IE 10. See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/ */ -ms-user-select: none; user-select: none; } For IE < 10 and Opera, you will need to u...
Is there a way to make text unselectable on an HTML page? I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in many browsers. I might be able to solve this with a JavaScript t...
TITLE: Is there a way to make text unselectable on an HTML page? QUESTION: I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in many browsers. I might be able to solve this w...
[ "javascript", "html", "css", "cross-browser", "textselection" ]
149
208
128,043
16
0
2008-09-16T04:39:50.863000
2010-12-15T10:35:16.423000