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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
189,087 | 189,165 | How can I, in python, iterate over multiple 2d lists at once, cleanly? | If I'm making a simple grid based game, for example, I might have a few 2d lists. One might be for terrain, another might be for objects, etc. Unfortunately, when I need to iterate over the lists and have the contents of a square in one list affect part of another list, I have to do something like this. for i in range(... | I'd start by writing a generator method: def grid_objects(alist, blist): for i in range(len(alist)): for j in range(len(alist[i])): yield(alist[i][j], blist[i][j]) Then whenever you need to iterate over the lists your code looks like this: for (a, b) in grid_objects(alist, blist): if a.is_whatever(): b.do_something() | How can I, in python, iterate over multiple 2d lists at once, cleanly? If I'm making a simple grid based game, for example, I might have a few 2d lists. One might be for terrain, another might be for objects, etc. Unfortunately, when I need to iterate over the lists and have the contents of a square in one list affect ... | TITLE:
How can I, in python, iterate over multiple 2d lists at once, cleanly?
QUESTION:
If I'm making a simple grid based game, for example, I might have a few 2d lists. One might be for terrain, another might be for objects, etc. Unfortunately, when I need to iterate over the lists and have the contents of a square i... | [
"python"
] | 23 | 15 | 32,098 | 11 | 0 | 2008-10-09T20:32:13.657000 | 2008-10-09T20:51:33.320000 |
189,094 | 189,739 | How to scan a folder in Java? | How can I get list all the files within a folder recursively in Java? | Not sure how you want to represent the tree? Anyway here's an example which scans the entire subtree using recursion. Files and directories are treated alike. Note that File.listFiles() returns null for non-directories. public static void main(String[] args) { Collection all = new ArrayList (); addTree(new File("."), a... | How to scan a folder in Java? How can I get list all the files within a folder recursively in Java? | TITLE:
How to scan a folder in Java?
QUESTION:
How can I get list all the files within a folder recursively in Java?
ANSWER:
Not sure how you want to represent the tree? Anyway here's an example which scans the entire subtree using recursion. Files and directories are treated alike. Note that File.listFiles() returns... | [
"java",
"file",
"directory"
] | 65 | 78 | 135,712 | 6 | 0 | 2008-10-09T20:34:40.750000 | 2008-10-10T00:45:14.347000 |
189,113 | 189,125 | How can I get the current page's full URL on a Windows/IIS server? | I moved a WordPress installation to a new folder on a Windows/ IIS server. I'm setting up 301 redirects in PHP, but it doesn't seem to be working. My post URLs have the following format: http:://www.example.com/OLD_FOLDER/index.php/post-title/ I can't figure out how to grab the /post-title/ part of the URL. $_SERVER["R... | Maybe, because you are under IIS, $_SERVER['PATH_INFO'] is what you want, based on the URLs you used to explain. For Apache, you'd use $_SERVER['REQUEST_URI']. | How can I get the current page's full URL on a Windows/IIS server? I moved a WordPress installation to a new folder on a Windows/ IIS server. I'm setting up 301 redirects in PHP, but it doesn't seem to be working. My post URLs have the following format: http:://www.example.com/OLD_FOLDER/index.php/post-title/ I can't f... | TITLE:
How can I get the current page's full URL on a Windows/IIS server?
QUESTION:
I moved a WordPress installation to a new folder on a Windows/ IIS server. I'm setting up 301 redirects in PHP, but it doesn't seem to be working. My post URLs have the following format: http:://www.example.com/OLD_FOLDER/index.php/pos... | [
"php",
"iis"
] | 137 | 135 | 334,782 | 15 | 0 | 2008-10-09T20:39:49.960000 | 2008-10-09T20:42:19.533000 |
189,121 | 191,182 | MVP dependency injection | using MVP, what is the normal order of construction and dependency injection. normally you create a presenter for each view and pass the view into the presenter on constructor. But what if you have: A Service that multiple views need to listen to events on. Multiple views all pointing to the same data model cache. can ... | Here is what I do: First, I define theses interfaces: public interface IView { TPresenter Presenter { get; set; } }
public interface IPresenter where TView: IView where TPresenter: IPresenter { TView View { get; set; } } Then this abstract presenter class: public abstract class AbstractPresenter: IPresenter where TVie... | MVP dependency injection using MVP, what is the normal order of construction and dependency injection. normally you create a presenter for each view and pass the view into the presenter on constructor. But what if you have: A Service that multiple views need to listen to events on. Multiple views all pointing to the sa... | TITLE:
MVP dependency injection
QUESTION:
using MVP, what is the normal order of construction and dependency injection. normally you create a presenter for each view and pass the view into the presenter on constructor. But what if you have: A Service that multiple views need to listen to events on. Multiple views all ... | [
"c#",
"winforms",
"mvp"
] | 14 | 12 | 6,703 | 4 | 0 | 2008-10-09T20:41:52.873000 | 2008-10-10T13:09:09.093000 |
189,140 | 189,212 | Good language & framework for cross platform (windows & mac) desktop application | The last cross platform desktop development I did was Java/Swing. What about flex? | Don't do it. If you need to go cross-platform, write the main guts of your application in a business logic layer that doesn't depend on any GUI framework and then use the native platform API to finish each app. Your users will thank you. | Good language & framework for cross platform (windows & mac) desktop application The last cross platform desktop development I did was Java/Swing. What about flex? | TITLE:
Good language & framework for cross platform (windows & mac) desktop application
QUESTION:
The last cross platform desktop development I did was Java/Swing. What about flex?
ANSWER:
Don't do it. If you need to go cross-platform, write the main guts of your application in a business logic layer that doesn't dep... | [
"cross-platform",
"desktop-application"
] | 1 | 4 | 2,367 | 11 | 0 | 2008-10-09T20:45:14.613000 | 2008-10-09T21:04:24.090000 |
189,148 | 206,207 | How do I report an error midway through a chunked http repsonse if I'm willing to close the connection? | (See related question: How do I report an error midway through a chunked http repsonse without closing the connection? ) In my case, the #1 desire is for the browser to display an error message. No matter how uninformative. Closing the ServletResponse outputStream obviously doesn't work. Neither does throwing an except... | My own answer, after research. Part one: There seems to be no way to convince the application servers that I tested to put an error onto the wire past the "committed" phase. The following Servlet code results in legal HTTP Chunked Transfer headers on the socket. Interestingly, in the case of WebSphere an error message ... | How do I report an error midway through a chunked http repsonse if I'm willing to close the connection? (See related question: How do I report an error midway through a chunked http repsonse without closing the connection? ) In my case, the #1 desire is for the browser to display an error message. No matter how uninfor... | TITLE:
How do I report an error midway through a chunked http repsonse if I'm willing to close the connection?
QUESTION:
(See related question: How do I report an error midway through a chunked http repsonse without closing the connection? ) In my case, the #1 desire is for the browser to display an error message. No ... | [
"servlets"
] | 1 | 1 | 509 | 3 | 0 | 2008-10-09T20:47:55.543000 | 2008-10-15T20:07:57.327000 |
189,155 | 263,332 | Where can I find facial detection software, algorithms, etc? | I'm interested in writing software that depends on being able to identify that there is a face in a picture (or video frame). It doesn't have to ID the face - so no metrics other than: Is there a human face in the picture (or more than one) Where, approximately, are the eyes and mouth or nose tip (whatever it keyed on.... | Check out the OpenCV library, here is a link for a good wiki about it. And here you can see a sample program of implementing a face recognition app. | Where can I find facial detection software, algorithms, etc? I'm interested in writing software that depends on being able to identify that there is a face in a picture (or video frame). It doesn't have to ID the face - so no metrics other than: Is there a human face in the picture (or more than one) Where, approximate... | TITLE:
Where can I find facial detection software, algorithms, etc?
QUESTION:
I'm interested in writing software that depends on being able to identify that there is a face in a picture (or video frame). It doesn't have to ID the face - so no metrics other than: Is there a human face in the picture (or more than one) ... | [
"video",
"image-processing",
"computer-vision",
"pattern-recognition"
] | 9 | 9 | 1,121 | 3 | 0 | 2008-10-09T20:48:59.957000 | 2008-11-04T20:35:37.623000 |
189,156 | 189,208 | Coupling is too high - how to design this class better? | Running FxCop on my code, I get this warning: Microsoft.Maintainability: 'FooBar.ctor is coupled with 99 different types from 9 different namespaces. Rewrite or refactor the method to decrease its class coupling, or consider moving the method to one of the other types it is tightly coupled with. A class coupling above ... | Have the classes that do the work register for events they're interested in...an event broker pattern. class EventBroker { private Dictionary > messageHandlers;
void Register (Action subscriber) where T:EventArgs { // may have to combine delegates if more than 1 listener messageHandlers[typeof(T)] = subscriber; }
voi... | Coupling is too high - how to design this class better? Running FxCop on my code, I get this warning: Microsoft.Maintainability: 'FooBar.ctor is coupled with 99 different types from 9 different namespaces. Rewrite or refactor the method to decrease its class coupling, or consider moving the method to one of the other t... | TITLE:
Coupling is too high - how to design this class better?
QUESTION:
Running FxCop on my code, I get this warning: Microsoft.Maintainability: 'FooBar.ctor is coupled with 99 different types from 9 different namespaces. Rewrite or refactor the method to decrease its class coupling, or consider moving the method to ... | [
"design-patterns",
"coupling"
] | 8 | 15 | 5,142 | 5 | 0 | 2008-10-09T20:49:24.620000 | 2008-10-09T21:02:31.723000 |
189,172 | 189,444 | C++ templates Turing-complete? | I'm told that the template system in C++ is Turing-complete at compile time. This is mentioned in this post and also on wikipedia. Can you provide a nontrivial example of a computation that exploits this property? Is this fact useful in practice? | Example #include template struct Factorial { enum { val = Factorial::val * N }; };
template<> struct Factorial<0> { enum { val = 1 }; };
int main() { // Note this value is generated at compile time. // Also note that most compilers have a limit on the depth of the recursion available. std::cout << Factorial<4>::val <... | C++ templates Turing-complete? I'm told that the template system in C++ is Turing-complete at compile time. This is mentioned in this post and also on wikipedia. Can you provide a nontrivial example of a computation that exploits this property? Is this fact useful in practice? | TITLE:
C++ templates Turing-complete?
QUESTION:
I'm told that the template system in C++ is Turing-complete at compile time. This is mentioned in this post and also on wikipedia. Can you provide a nontrivial example of a computation that exploits this property? Is this fact useful in practice?
ANSWER:
Example #includ... | [
"c++",
"templates",
"template-meta-programming",
"turing-complete"
] | 142 | 127 | 49,096 | 12 | 0 | 2008-10-09T20:53:46.563000 | 2008-10-09T22:28:43.187000 |
189,184 | 189,211 | "The selected files was not found" on an InfoPath form in Sharepoint | When using a file attachment control on a InfoPath form as part of a SharePoint workflow I get the error "The selected files was not found". | Found this online somewhere but can't find it again to link. You need to modify the following file: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\WrkTaskIP.aspx Add: into the file just before the first table opening tag. iisreset and then the attachment control of the form sho... | "The selected files was not found" on an InfoPath form in Sharepoint When using a file attachment control on a InfoPath form as part of a SharePoint workflow I get the error "The selected files was not found". | TITLE:
"The selected files was not found" on an InfoPath form in Sharepoint
QUESTION:
When using a file attachment control on a InfoPath form as part of a SharePoint workflow I get the error "The selected files was not found".
ANSWER:
Found this online somewhere but can't find it again to link. You need to modify the... | [
"sharepoint",
"infopath"
] | 1 | 2 | 1,300 | 1 | 0 | 2008-10-09T20:56:45.900000 | 2008-10-09T21:03:18.540000 |
189,186 | 189,282 | Linear algebra for graphics in C | I'm developing software that writes to a tiny LCD screen (less than 1" x 1"). I've got all the usual suspects - lines, filled polygons, fonts, etc. I remember, however, learning how to do fun vector manipulation in linear algebra many moons ago, and creating rotating wireframe objects. I'd like to do that again, but fi... | I used to use LAPACK++ ( http://math.nist.gov/lapack++/ ), but I see it is now being replaced with TNT ( http://math.nist.gov/tnt/ ) For simple rotations you might just rather coding a matrix type and implementing matrix multiplication | Linear algebra for graphics in C I'm developing software that writes to a tiny LCD screen (less than 1" x 1"). I've got all the usual suspects - lines, filled polygons, fonts, etc. I remember, however, learning how to do fun vector manipulation in linear algebra many moons ago, and creating rotating wireframe objects. ... | TITLE:
Linear algebra for graphics in C
QUESTION:
I'm developing software that writes to a tiny LCD screen (less than 1" x 1"). I've got all the usual suspects - lines, filled polygons, fonts, etc. I remember, however, learning how to do fun vector manipulation in linear algebra many moons ago, and creating rotating w... | [
"c",
"graphics",
"3d",
"vector-graphics"
] | 3 | 2 | 593 | 1 | 0 | 2008-10-09T20:57:28.053000 | 2008-10-09T21:27:45.713000 |
189,190 | 189,265 | Replace in multiple files - graphical tool for Linux | It needs to be graphical. No sed, awk, grep, perl, whatever. I know how to use those and I do use them now, but I need to cherry-pick each replace in 300+ files. I want a tool where I can: type a search string type a replace string select a directory and file extension and it would recursively go into each file in that... | I think regexxer is exactly what you're looking for: Regexxer regexxer is a nifty GUI search/replace tool featuring Perl-style regular expressions. If you need project-wide substitution and you’re tired of hacking sed command lines together, then you should definitely give it a try. See also the screenshot, looks a lot... | Replace in multiple files - graphical tool for Linux It needs to be graphical. No sed, awk, grep, perl, whatever. I know how to use those and I do use them now, but I need to cherry-pick each replace in 300+ files. I want a tool where I can: type a search string type a replace string select a directory and file extensi... | TITLE:
Replace in multiple files - graphical tool for Linux
QUESTION:
It needs to be graphical. No sed, awk, grep, perl, whatever. I know how to use those and I do use them now, but I need to cherry-pick each replace in 300+ files. I want a tool where I can: type a search string type a replace string select a director... | [
"search",
"replace",
"text-editor"
] | 25 | 30 | 11,370 | 7 | 0 | 2008-10-09T20:58:31.873000 | 2008-10-09T21:22:01.403000 |
189,209 | 189,269 | Do you really use your reverse domain for package naming in java? | For a long time ago, I have thought that, in java, reversing the domain you own for package naming is silly and awkward. Which do you use for package naming in your projects? | Once you understand why the convention exists, it shouldn't feel silly or awkward in the least. This scheme does two important things: All of your code is contained in packages that no one else will collide with. You own your domain name, so it's isolated. If we didn't have this convention, many companies would have a ... | Do you really use your reverse domain for package naming in java? For a long time ago, I have thought that, in java, reversing the domain you own for package naming is silly and awkward. Which do you use for package naming in your projects? | TITLE:
Do you really use your reverse domain for package naming in java?
QUESTION:
For a long time ago, I have thought that, in java, reversing the domain you own for package naming is silly and awkward. Which do you use for package naming in your projects?
ANSWER:
Once you understand why the convention exists, it sh... | [
"java",
"namespaces"
] | 25 | 71 | 11,171 | 9 | 0 | 2008-10-09T21:02:55.857000 | 2008-10-09T21:23:50.370000 |
189,213 | 189,221 | SQL selecting rows by most recent date with two unique columns | Using the following query and results, I'm looking for the most recent entry where the ChargeId and ChargeType are unique. select chargeId, chargeType, serviceMonth from invoice
CHARGEID CHARGETYPE SERVICEMONTH 1 101 R 8/1/2008 2 161 N 2/1/2008 3 101 R 2/1/2008 4 101 R 3/1/2008 5 101 R 4/1/2008 6 101 R 5/1/2008 7 101 ... | You can use a GROUP BY to group items by type and id. Then you can use the MAX() Aggregate function to get the most recent service month. The below returns a result set with ChargeId, ChargeType, and MostRecentServiceMonth SELECT CHARGEID, CHARGETYPE, MAX(SERVICEMONTH) AS "MostRecentServiceMonth" FROM INVOICE GROUP BY ... | SQL selecting rows by most recent date with two unique columns Using the following query and results, I'm looking for the most recent entry where the ChargeId and ChargeType are unique. select chargeId, chargeType, serviceMonth from invoice
CHARGEID CHARGETYPE SERVICEMONTH 1 101 R 8/1/2008 2 161 N 2/1/2008 3 101 R 2/1... | TITLE:
SQL selecting rows by most recent date with two unique columns
QUESTION:
Using the following query and results, I'm looking for the most recent entry where the ChargeId and ChargeType are unique. select chargeId, chargeType, serviceMonth from invoice
CHARGEID CHARGETYPE SERVICEMONTH 1 101 R 8/1/2008 2 161 N 2/... | [
"sql",
"oracle"
] | 115 | 161 | 422,764 | 6 | 0 | 2008-10-09T21:05:02.280000 | 2008-10-09T21:07:29.890000 |
189,228 | 189,325 | Ending asynchronous delegate invocation with partial type information | When writing async method implementations using the BeginInvoke/EndInvoke pattern the code might look something like the following (and to save you guessing this is an async wrapper around a cache): IAsyncResult BeginPut(string key, object value) { Action put = this.cache.Put; return put.BeginInvoke(key, value, null, n... | I was wrong, there is a cleaner way. You create Action( IAsyncResult ) delegates for the specific EndInvoke() method in the same context where you already know the specific type of the delegate, passing it as the AsyncState. I'm passing EndPut() as the callback for convenience. IAsyncResult BeginPut( string key, object... | Ending asynchronous delegate invocation with partial type information When writing async method implementations using the BeginInvoke/EndInvoke pattern the code might look something like the following (and to save you guessing this is an async wrapper around a cache): IAsyncResult BeginPut(string key, object value) { A... | TITLE:
Ending asynchronous delegate invocation with partial type information
QUESTION:
When writing async method implementations using the BeginInvoke/EndInvoke pattern the code might look something like the following (and to save you guessing this is an async wrapper around a cache): IAsyncResult BeginPut(string key,... | [
"c#",
"asynchronous",
"delegates"
] | 4 | 4 | 1,723 | 3 | 0 | 2008-10-09T21:10:14.440000 | 2008-10-09T21:42:08.603000 |
189,237 | 189,315 | Statistical tools for programmers | I'm trying to evaluate the purchase of a statistical tool. This will be used in part by non-programming users (doing clinical studies) and in part by programmers, so I'm trying to find a good compromise between usability and automation. Of course, cost is an issue, but if I can build a solid case, we could probably buy... | Stata and SPSS tend to be the most commonly used packages in clinical studies. Both are pretty easy to pick up and use for non-technically minded folks but are generally flexible enough. I've used Stata more than any of the others and have been pretty happy with its options (supports both menu-based and command line op... | Statistical tools for programmers I'm trying to evaluate the purchase of a statistical tool. This will be used in part by non-programming users (doing clinical studies) and in part by programmers, so I'm trying to find a good compromise between usability and automation. Of course, cost is an issue, but if I can build a... | TITLE:
Statistical tools for programmers
QUESTION:
I'm trying to evaluate the purchase of a statistical tool. This will be used in part by non-programming users (doing clinical studies) and in part by programmers, so I'm trying to find a good compromise between usability and automation. Of course, cost is an issue, bu... | [
"math",
"statistics"
] | 5 | 2 | 1,653 | 11 | 0 | 2008-10-09T21:13:53.387000 | 2008-10-09T21:38:25.083000 |
189,239 | 189,245 | How does one use FileStream to append to a file without an exclusive lock? | What I'm trying to do with FileStream in C#/.NET is to open two streams: one appending to a file and the other reading those writes asynchronously (for unit testing some network connection handling code). I can't figure out how to get the writer stream to open the file in non-exlusive locking mode and thus the code alw... | See this question: C# file read/write fileshare doesn’t appear to work In short, your freader has to specify FileShare.Write to allow for the fact that there is already a writer on the file. | How does one use FileStream to append to a file without an exclusive lock? What I'm trying to do with FileStream in C#/.NET is to open two streams: one appending to a file and the other reading those writes asynchronously (for unit testing some network connection handling code). I can't figure out how to get the writer... | TITLE:
How does one use FileStream to append to a file without an exclusive lock?
QUESTION:
What I'm trying to do with FileStream in C#/.NET is to open two streams: one appending to a file and the other reading those writes asynchronously (for unit testing some network connection handling code). I can't figure out how... | [
"c#",
".net",
"file",
"stream",
"filestream"
] | 4 | 5 | 16,533 | 2 | 0 | 2008-10-09T21:14:06.147000 | 2008-10-09T21:15:34.910000 |
189,252 | 189,262 | Share your Vista 64bit experiences | I've got a Dell XPS M1330 with a 2.2ghz processor, 4gig ram, GeForce 8400M, and a 64GB SSD disk. I'm primarily doing web-development, sharepoint development, integration (Microsoft BI tools) and biztalk. I use virtual machines for these purposes. I've been using Vista 32Bit up until now but I'm considering moving to 64... | I have recently switched from a Vista 32 bit development machine to a Vista 64 bit development machine, with a quad-core intel processor, and 6gb of ram. THe performance improvements have been quite impressive, and thus far, no "issues" with any development tools that I have been using. | Share your Vista 64bit experiences I've got a Dell XPS M1330 with a 2.2ghz processor, 4gig ram, GeForce 8400M, and a 64GB SSD disk. I'm primarily doing web-development, sharepoint development, integration (Microsoft BI tools) and biztalk. I use virtual machines for these purposes. I've been using Vista 32Bit up until n... | TITLE:
Share your Vista 64bit experiences
QUESTION:
I've got a Dell XPS M1330 with a 2.2ghz processor, 4gig ram, GeForce 8400M, and a 64GB SSD disk. I'm primarily doing web-development, sharepoint development, integration (Microsoft BI tools) and biztalk. I use virtual machines for these purposes. I've been using Vist... | [
"vista64"
] | 1 | 3 | 411 | 7 | 0 | 2008-10-09T21:17:21.927000 | 2008-10-09T21:21:31.420000 |
189,280 | 193,400 | Problem using SQLite :memory: with NHibernate | I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the:memory: option. When I fire up any of the integration tests, the database seems to be created (NHibernate spits out the table creation sql) but interfacting wit... | A SQLite memory database only exists as long as the connection to it remains open. To use it in unit tests with NHibernate: 1. Open an ISession at the beginning of your test (maybe in a [SetUp] method). 2. Use the connection from that session in your SchemaExport call. 3. Use that same session in your tests. 4. Close t... | Problem using SQLite :memory: with NHibernate I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the:memory: option. When I fire up any of the integration tests, the database seems to be created (NHibernate spits ou... | TITLE:
Problem using SQLite :memory: with NHibernate
QUESTION:
I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the:memory: option. When I fire up any of the integration tests, the database seems to be created (N... | [
"c#",
"nhibernate",
"sqlite",
"orm",
"integration-testing"
] | 34 | 41 | 17,467 | 9 | 0 | 2008-10-09T21:27:24.497000 | 2008-10-10T23:54:10.180000 |
189,284 | 226,903 | Running Eclipse under Valgrind | Has anybody here succeeded in running Eclipse under Valgrind? I'm battling a particularly hairy crash involving JNI code, and was hoping that Valgrind perhaps could (again) prove its excellence, but when I run Eclipse under Valgrind, the JVM terminates with an error message about not being able to create the initial ob... | If there is a crash in native code, then gdb might be a better choice. It should even stop the execution automatically on a crash and might show You the stack trace (command bt ). | Running Eclipse under Valgrind Has anybody here succeeded in running Eclipse under Valgrind? I'm battling a particularly hairy crash involving JNI code, and was hoping that Valgrind perhaps could (again) prove its excellence, but when I run Eclipse under Valgrind, the JVM terminates with an error message about not bein... | TITLE:
Running Eclipse under Valgrind
QUESTION:
Has anybody here succeeded in running Eclipse under Valgrind? I'm battling a particularly hairy crash involving JNI code, and was hoping that Valgrind perhaps could (again) prove its excellence, but when I run Eclipse under Valgrind, the JVM terminates with an error mess... | [
"eclipse",
"valgrind"
] | 5 | 1 | 1,620 | 2 | 0 | 2008-10-09T21:28:43.807000 | 2008-10-22T18:02:37.917000 |
189,286 | 254,880 | Resources for windows form design and increased usability | The majority of resources that I have for UI design all deal with the web world. There are a number of advantages there because of the dynamic nature of the presentation layer. However, I would like to design better windows form programs. I want a professional flow to my applications. Right now they look pretty by usin... | You may also want to take a look at the "Windows User Experience Interaction Guidelines" or UX Guide available at http://msdn.microsoft.com/en-us/library/aa511258.aspx or in PDF. Here's the goals as listed on the website: Establish a high quality and consistency baseline for all Windows-based applications. Answer your ... | Resources for windows form design and increased usability The majority of resources that I have for UI design all deal with the web world. There are a number of advantages there because of the dynamic nature of the presentation layer. However, I would like to design better windows form programs. I want a professional f... | TITLE:
Resources for windows form design and increased usability
QUESTION:
The majority of resources that I have for UI design all deal with the web world. There are a number of advantages there because of the dynamic nature of the presentation layer. However, I would like to design better windows form programs. I wan... | [
"winforms",
"user-interface"
] | 6 | 1 | 2,286 | 3 | 0 | 2008-10-09T21:29:21.187000 | 2008-10-31T20:39:03.813000 |
189,288 | 189,358 | Automate getting report from webpage | I'm a Java developer and I have a question about automating a task I've been given. I'm having to 3 times daily, login to this website we have at work, select a few form elements and then click on submit to get a report printed out. I'm wondering how I can write some sort of script that will automate this task? Where s... | Check out cURL in PHP. It allows you to do all the normal functions of a web browser with code (other than moving the mouse). And yes, you'll need to do screen scraping. | Automate getting report from webpage I'm a Java developer and I have a question about automating a task I've been given. I'm having to 3 times daily, login to this website we have at work, select a few form elements and then click on submit to get a report printed out. I'm wondering how I can write some sort of script ... | TITLE:
Automate getting report from webpage
QUESTION:
I'm a Java developer and I have a question about automating a task I've been given. I'm having to 3 times daily, login to this website we have at work, select a few form elements and then click on submit to get a report printed out. I'm wondering how I can write so... | [
"php",
"post",
"automation",
"scripting",
"greasemonkey"
] | 0 | 2 | 1,669 | 4 | 0 | 2008-10-09T21:30:47.157000 | 2008-10-09T21:57:03.643000 |
189,291 | 189,668 | Emacs - Ubuntu initialization | Odd behavior loading emacs on ubuntu, there seems to be some initialization that goes on that is not in the.emacs nor in any of the files emacs reports loading through "emacs --debug-init". I've found some references to font-related resizing but this behavior doesn't seem to be limited to that (e.g reappearing menus an... | The sequence of the Emacs initialization is the following (at least, for Emacs 22): Load the file debian-startup (.el or.elc) found in load-path (usually, /usr/share/emacs/site-lisp/debian-startup.el or /usr/share/emacs22/site-lisp/debian-startup.elc ) and call the function debian-startup defined in this file. This fun... | Emacs - Ubuntu initialization Odd behavior loading emacs on ubuntu, there seems to be some initialization that goes on that is not in the.emacs nor in any of the files emacs reports loading through "emacs --debug-init". I've found some references to font-related resizing but this behavior doesn't seem to be limited to ... | TITLE:
Emacs - Ubuntu initialization
QUESTION:
Odd behavior loading emacs on ubuntu, there seems to be some initialization that goes on that is not in the.emacs nor in any of the files emacs reports loading through "emacs --debug-init". I've found some references to font-related resizing but this behavior doesn't seem... | [
"emacs",
"ubuntu"
] | 9 | 14 | 5,355 | 2 | 0 | 2008-10-09T21:31:17.127000 | 2008-10-10T00:15:02.630000 |
189,293 | 189,316 | How do I get a filehandle from the command line? | I have a subroutine that takes a filehandle as an argument. How do I make a filehandle from a file path specified on the command line? I don't want to do any processing of this file myself, I just want to pass it off to this other subroutine, which returns an array of hashes with all the parsed data from the file. Here... | Command line arguments are available in the predefined @ARGV array. You can get the file name from there and use open to open a filehandle to it. Assuming that you want read-only access to the file, you would do it this way: my $file = shift @ARGV; open(my $fh, '<', $file) or die "Can't read file '$file' [$!]\n"; parse... | How do I get a filehandle from the command line? I have a subroutine that takes a filehandle as an argument. How do I make a filehandle from a file path specified on the command line? I don't want to do any processing of this file myself, I just want to pass it off to this other subroutine, which returns an array of ha... | TITLE:
How do I get a filehandle from the command line?
QUESTION:
I have a subroutine that takes a filehandle as an argument. How do I make a filehandle from a file path specified on the command line? I don't want to do any processing of this file myself, I just want to pass it off to this other subroutine, which retu... | [
"perl",
"filehandle"
] | 3 | 16 | 2,720 | 4 | 0 | 2008-10-09T21:32:27.747000 | 2008-10-09T21:39:00.310000 |
189,303 | 189,501 | Tools to assist managing the application promotion process in an enterprise environment | I am curious on how others manage code promotion from DEV to TEST to PROD within an enterprise. What tools or processes do you use to manage the "red tape", entry/exit criteria side of things? My current organisation is half stuck between some custom online forms type functionality and paper based dependencies to submi... | It's hard to find one that's good via google. There is a vast array of tools out there for issue management so I'll mention what we use and what we woudl like to use. We currently use serena products. They have worked well for us in the past. Team Track is our issue management and handles the life cycle of any issue we... | Tools to assist managing the application promotion process in an enterprise environment I am curious on how others manage code promotion from DEV to TEST to PROD within an enterprise. What tools or processes do you use to manage the "red tape", entry/exit criteria side of things? My current organisation is half stuck b... | TITLE:
Tools to assist managing the application promotion process in an enterprise environment
QUESTION:
I am curious on how others manage code promotion from DEV to TEST to PROD within an enterprise. What tools or processes do you use to manage the "red tape", entry/exit criteria side of things? My current organisati... | [
"process-management"
] | 2 | 3 | 2,102 | 2 | 0 | 2008-10-09T21:34:36.620000 | 2008-10-09T22:50:25.920000 |
189,308 | 189,794 | What's a good way in PowerShell to check for an IP address switch on a webserver? | Problem Our web host provider is changing the IP address of one of the servers we are on. We have been given a time frame for when the switch will take place, but no exact details. Therefore, our current poor man's check requires a periodic page refresh on a browser to see if our website is still there. Question We are... | If you can alert if the page is gone or does not have an expected value, you could use a script like $ip = 192.168.1.1 $webclient = new-object System.Net.WebClient $regex = 'regular expression to match something on your page' $ping = new-object System.Net.NetworkInformation.Ping
do { $result = $ping.Send($ip) if ($res... | What's a good way in PowerShell to check for an IP address switch on a webserver? Problem Our web host provider is changing the IP address of one of the servers we are on. We have been given a time frame for when the switch will take place, but no exact details. Therefore, our current poor man's check requires a period... | TITLE:
What's a good way in PowerShell to check for an IP address switch on a webserver?
QUESTION:
Problem Our web host provider is changing the IP address of one of the servers we are on. We have been given a time frame for when the switch will take place, but no exact details. Therefore, our current poor man's check... | [
"networking",
"powershell"
] | 5 | 3 | 2,195 | 2 | 0 | 2008-10-09T21:35:12.797000 | 2008-10-10T01:16:56.907000 |
189,323 | 189,337 | Is there a mode for Visual Basic (VB6) in Emacs? | I would like to use Emacs to edit some VB6 files but Emacs does not appear to have any of built-in niceties of other languages such as syntax highlighting, etc. Any plugins/extensions? What else can I do to make Emacs an acceptable and comfortable IDE for VB? | Visual Basic mode http://www.emacswiki.org/cgi-bin/wiki/visual-basic-mode.el edit: after installing this script (see script for instructions) syntax highlighting can be toggled via the options menu -- emacs calls it 'font-lock':) | Is there a mode for Visual Basic (VB6) in Emacs? I would like to use Emacs to edit some VB6 files but Emacs does not appear to have any of built-in niceties of other languages such as syntax highlighting, etc. Any plugins/extensions? What else can I do to make Emacs an acceptable and comfortable IDE for VB? | TITLE:
Is there a mode for Visual Basic (VB6) in Emacs?
QUESTION:
I would like to use Emacs to edit some VB6 files but Emacs does not appear to have any of built-in niceties of other languages such as syntax highlighting, etc. Any plugins/extensions? What else can I do to make Emacs an acceptable and comfortable IDE f... | [
"emacs",
"vb6"
] | 10 | 8 | 3,345 | 3 | 0 | 2008-10-09T21:41:41.643000 | 2008-10-09T21:48:54.343000 |
189,335 | 215,220 | How do you get the visual element inside a ItemsControl | I have a list of States in an ItemsControl, the DataTemplate is a CheckBox. I would like to add a function to select(check) all states. However I need to loop through the CheckBoxs rather then the data items since the checked state is stored in a separate data structure then the list of states the ItemsControl's ItemSo... | In the data template I subscribed to the checkbox's onload event. And in the event handler I add the checkbox reference to a generic list of checkbox. | How do you get the visual element inside a ItemsControl I have a list of States in an ItemsControl, the DataTemplate is a CheckBox. I would like to add a function to select(check) all states. However I need to loop through the CheckBoxs rather then the data items since the checked state is stored in a separate data str... | TITLE:
How do you get the visual element inside a ItemsControl
QUESTION:
I have a list of States in an ItemsControl, the DataTemplate is a CheckBox. I would like to add a function to select(check) all states. However I need to loop through the CheckBoxs rather then the data items since the checked state is stored in a... | [
"silverlight",
"silverlight-2.0"
] | 1 | 0 | 561 | 2 | 0 | 2008-10-09T21:48:43.160000 | 2008-10-18T16:23:57.087000 |
189,350 | 189,524 | Detect GCC compile-time flags of a binary | Is there a way to find out what gcc flags a particular binary was compiled with? | A quick look at the GCC documentation doesn't turn anything up. The Boost guys are some of the smartest C++ developers out there, and they resort to naming conventions because this is generally not possible any other way (the executable could have been created in any number of languages, by any number of compiler versi... | Detect GCC compile-time flags of a binary Is there a way to find out what gcc flags a particular binary was compiled with? | TITLE:
Detect GCC compile-time flags of a binary
QUESTION:
Is there a way to find out what gcc flags a particular binary was compiled with?
ANSWER:
A quick look at the GCC documentation doesn't turn anything up. The Boost guys are some of the smartest C++ developers out there, and they resort to naming conventions be... | [
"c++",
"c",
"gcc"
] | 29 | 26 | 11,844 | 4 | 0 | 2008-10-09T21:53:44.803000 | 2008-10-09T22:58:46.403000 |
189,363 | 190,086 | Regex to find lines containing sequence but not containing a different sequence | How do I write a regular expression to find all lines containing 665 and not having.pdf I can't seem to find how to do not in regex. This is for Notepad++ syntax if it matters. Thanks | If.pdf will only occur after 665, the negative lookahead assertion 665(?!.*\.pdf) should work fine. Otherwise, I prefer to use two regexs, one to match, one to fail. In Perl syntax that would be: /665/ &&!/\.pdf/ | Regex to find lines containing sequence but not containing a different sequence How do I write a regular expression to find all lines containing 665 and not having.pdf I can't seem to find how to do not in regex. This is for Notepad++ syntax if it matters. Thanks | TITLE:
Regex to find lines containing sequence but not containing a different sequence
QUESTION:
How do I write a regular expression to find all lines containing 665 and not having.pdf I can't seem to find how to do not in regex. This is for Notepad++ syntax if it matters. Thanks
ANSWER:
If.pdf will only occur after ... | [
"regex",
"string",
"search",
"notepad++"
] | 3 | 4 | 2,911 | 2 | 0 | 2008-10-09T21:58:45.620000 | 2008-10-10T04:02:43.187000 |
189,365 | 189,427 | How to change the function called when I click in the close button on php-gtk? | I load a single instance of a window on php-gtk, I have a button named "Cancel" that hide(); the window, so when the window is needed again I just show();. But when I click on the close button instead of the cancel button the window is destroyed. Even when I redirect the event (I'm not sure if i'm doing it right) it ca... | Following the advice here: delete-event. I changed my code to return TRUE: function on_multipleCancelButton_activate() { global $GladeMultiple;
$MultipleWindow = $GladeMultiple->get_widget('multipleWindow'); $MultipleWindow->hide();
return TRUE; } On the GTK designer I linked the delete-event to this function. | How to change the function called when I click in the close button on php-gtk? I load a single instance of a window on php-gtk, I have a button named "Cancel" that hide(); the window, so when the window is needed again I just show();. But when I click on the close button instead of the cancel button the window is destr... | TITLE:
How to change the function called when I click in the close button on php-gtk?
QUESTION:
I load a single instance of a window on php-gtk, I have a button named "Cancel" that hide(); the window, so when the window is needed again I just show();. But when I click on the close button instead of the cancel button t... | [
"php-gtk"
] | 0 | 0 | 305 | 1 | 0 | 2008-10-09T21:59:50.813000 | 2008-10-09T22:22:41.483000 |
189,366 | 189,472 | Lucene.Net Search result to highlight search keywords | I use Lucene.Net to index some documents. I want to show the user a couple of lines as to why that document is in the result set. just like when you use google to search and it shows the link and followed by the link there are a few lines with the keywords highlighted. any ideas? | When you have a result you can get the indexed text pass it along with your query through a method similar to this: public string GeneratePreviewText(Query q, string text) { QueryScorer scorer = new QueryScorer(q); Formatter formatter = new SimpleHTMLFormatter(highlightStartTag, highlightEndTag); Highlighter highlighte... | Lucene.Net Search result to highlight search keywords I use Lucene.Net to index some documents. I want to show the user a couple of lines as to why that document is in the result set. just like when you use google to search and it shows the link and followed by the link there are a few lines with the keywords highlight... | TITLE:
Lucene.Net Search result to highlight search keywords
QUESTION:
I use Lucene.Net to index some documents. I want to show the user a couple of lines as to why that document is in the result set. just like when you use google to search and it shows the link and followed by the link there are a few lines with the ... | [
"lucene",
"lucene.net"
] | 17 | 23 | 8,486 | 1 | 0 | 2008-10-09T22:00:00.640000 | 2008-10-09T22:38:44.587000 |
189,370 | 189,624 | How to put WPF Tab Control tabs on the side | I am trying to create a Tab Control in WPF that has the tabs arranged down the right side of the control, with the text rotated 90 degrees The look is similar to those plastic tabs you can buy and use in a notebook. I have tried changing the TabStripPlacement to Right, but it just stacks the tabs up on the top right si... | The effect I believe you are seeking is achieved by providing a HeaderTemplate for the TabItem's in you Tab collection. Hope this helps! | How to put WPF Tab Control tabs on the side I am trying to create a Tab Control in WPF that has the tabs arranged down the right side of the control, with the text rotated 90 degrees The look is similar to those plastic tabs you can buy and use in a notebook. I have tried changing the TabStripPlacement to Right, but it... | TITLE:
How to put WPF Tab Control tabs on the side
QUESTION:
I am trying to create a Tab Control in WPF that has the tabs arranged down the right side of the control, with the text rotated 90 degrees The look is similar to those plastic tabs you can buy and use in a notebook. I have tried changing the TabStripPlacemen... | [
"wpf",
"xaml",
"tabcontrol"
] | 30 | 48 | 25,227 | 1 | 0 | 2008-10-09T22:00:35.897000 | 2008-10-09T23:50:33.303000 |
189,375 | 191,406 | Replace control arrays before migrating from vb6 | With a view to avoiding the construction of further barriers to migration whilst enhancing an existing vb6 program. Is there a way to achieve the same functionality as control arrays in vb6 without using them? | In.NET you have a tag property. You can also have the same delegate handle events raised by multiple controls. Set the Tag property of the new control to the Index. Private Sub MyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click,Button2.Click
Dim Btn As Button = CType(sende... | Replace control arrays before migrating from vb6 With a view to avoiding the construction of further barriers to migration whilst enhancing an existing vb6 program. Is there a way to achieve the same functionality as control arrays in vb6 without using them? | TITLE:
Replace control arrays before migrating from vb6
QUESTION:
With a view to avoiding the construction of further barriers to migration whilst enhancing an existing vb6 program. Is there a way to achieve the same functionality as control arrays in vb6 without using them?
ANSWER:
In.NET you have a tag property. Yo... | [
"vb6",
"vb6-migration"
] | 0 | 1 | 1,019 | 3 | 0 | 2008-10-09T22:02:52.740000 | 2008-10-10T14:00:02.157000 |
189,392 | 189,447 | How do you Draw Transparent Image using System.Drawing? | I'm trying to return a transparent GIF from an.aspx page for display within a web page. I am trying to get the image to have transparency, but I just keep getting Black being where the image should be Transparent. Does anyone know what I'm doing wrong? Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.E... | Unfortunately, there is no easy way to create a transparent Gif using a Bitmap object. (See this KB article ) You can alternatively use the PNG format that supports transparency with the code you are using. | How do you Draw Transparent Image using System.Drawing? I'm trying to return a transparent GIF from an.aspx page for display within a web page. I am trying to get the image to have transparency, but I just keep getting Black being where the image should be Transparent. Does anyone know what I'm doing wrong? Protected S... | TITLE:
How do you Draw Transparent Image using System.Drawing?
QUESTION:
I'm trying to return a transparent GIF from an.aspx page for display within a web page. I am trying to get the image to have transparency, but I just keep getting Black being where the image should be Transparent. Does anyone know what I'm doing ... | [
"asp.net",
"transparency",
"gif",
"system.drawing"
] | 11 | 5 | 13,971 | 4 | 0 | 2008-10-09T22:10:04.397000 | 2008-10-09T22:29:13.063000 |
189,422 | 189,431 | How do I create and query linked database servers in SQL Server? | I need to do a join across two different database servers (IPs 10.0.0.50 and 10.0.0.51). What's the best way? | You need to use sp_linkedserver to create a linked server. sp_addlinkedserver [ @server= ] 'server' [, [ @srvproduct= ] 'product_name' ] [, [ @provider= ] 'provider_name' ] [, [ @datasrc= ] 'data_source' ] [, [ @location= ] 'location' ] [, [ @provstr= ] 'provider_string' ] [, [ @catalog= ] 'catalog' ] More information ... | How do I create and query linked database servers in SQL Server? I need to do a join across two different database servers (IPs 10.0.0.50 and 10.0.0.51). What's the best way? | TITLE:
How do I create and query linked database servers in SQL Server?
QUESTION:
I need to do a join across two different database servers (IPs 10.0.0.50 and 10.0.0.51). What's the best way?
ANSWER:
You need to use sp_linkedserver to create a linked server. sp_addlinkedserver [ @server= ] 'server' [, [ @srvproduct= ... | [
"sql",
"sql-server",
"database"
] | 18 | 19 | 103,823 | 4 | 0 | 2008-10-09T22:21:29.070000 | 2008-10-09T22:23:54.837000 |
189,433 | 189,466 | ASP.NET version 3.5 website: what does the file "vwd.webinfo" do, exactly? And what is with the bloated web.config file? | I am running Visual Studio Team Edition 2008. When I create a new website, I get a new file I've never seen before: vwd.webinfo. The contents of this file is as follows: What do I need a "global web project settings" file for? What does it do, exactly? Also; what is with the bloated web.config file? In standard ASP.NET... | It is created because you are using a file system web site. Read more about it here: http://msdn.microsoft.com/en-us/library/e5x4xz73.aspx What do you mean with "bloat"? Can you please paste the bloat? | ASP.NET version 3.5 website: what does the file "vwd.webinfo" do, exactly? And what is with the bloated web.config file? I am running Visual Studio Team Edition 2008. When I create a new website, I get a new file I've never seen before: vwd.webinfo. The contents of this file is as follows: What do I need a "global web ... | TITLE:
ASP.NET version 3.5 website: what does the file "vwd.webinfo" do, exactly? And what is with the bloated web.config file?
QUESTION:
I am running Visual Studio Team Edition 2008. When I create a new website, I get a new file I've never seen before: vwd.webinfo. The contents of this file is as follows: What do I n... | [
"visual-studio-2008",
"asp.net-3.5"
] | 7 | 2 | 8,987 | 2 | 0 | 2008-10-09T22:24:20.687000 | 2008-10-09T22:37:10.613000 |
189,435 | 191,538 | Best Method for reading a YAML response in .NET? | Weve recently been trying to work on an application that uses pandastream to encode our videos, we are sending the videos successfully, and the response that we get back is in YAML, however the only tool that we can find (YAML for.NET) is not parsing the file. Has anyone else ran into this, or have any insight on the b... | Just to update, i found a rather useful, but not too elegant as yet solution for my issue. yamldotnet | Best Method for reading a YAML response in .NET? Weve recently been trying to work on an application that uses pandastream to encode our videos, we are sending the videos successfully, and the response that we get back is in YAML, however the only tool that we can find (YAML for.NET) is not parsing the file. Has anyone... | TITLE:
Best Method for reading a YAML response in .NET?
QUESTION:
Weve recently been trying to work on an application that uses pandastream to encode our videos, we are sending the videos successfully, and the response that we get back is in YAML, however the only tool that we can find (YAML for.NET) is not parsing th... | [
".net",
"yaml",
"pandastream"
] | 2 | 1 | 432 | 2 | 0 | 2008-10-09T22:25:40.510000 | 2008-10-10T14:19:59.997000 |
189,451 | 189,730 | Apache - Reverse Proxy and HTTP 302 status message | My team is trying to setup an Apache reverse proxy from a customer's site into one of our web applications. http://www.example.com/app1/some-path maps to http://internal1.example.com/some-path Inside our application we use struts and have redirect = true set on certain actions in order to provide certain functionality.... | There is an article titled Running a Reverse Proxy in Apache that seems to address your problem. It even uses the same example.com and /app1 that you have in your example. Go to the "Configuring the Proxy" section for examples on how to use ProxyPassReverse. | Apache - Reverse Proxy and HTTP 302 status message My team is trying to setup an Apache reverse proxy from a customer's site into one of our web applications. http://www.example.com/app1/some-path maps to http://internal1.example.com/some-path Inside our application we use struts and have redirect = true set on certain... | TITLE:
Apache - Reverse Proxy and HTTP 302 status message
QUESTION:
My team is trying to setup an Apache reverse proxy from a customer's site into one of our web applications. http://www.example.com/app1/some-path maps to http://internal1.example.com/some-path Inside our application we use struts and have redirect = t... | [
"apache",
"redirect",
"reverse-proxy",
"http-status-code-302"
] | 14 | 15 | 45,687 | 4 | 0 | 2008-10-09T22:30:15.557000 | 2008-10-10T00:42:19.127000 |
189,467 | 189,485 | How do you refine your estimation process? | Estimating how long any given task will take seems to be one of the hardest parts about software development. At my current shop we estimate tasks in hours at the start of an iteration, but once the task is complete we do not use it to aide us in future estimations. How do you use the information you gather from past e... | By far one of the most interesting approaches I've ever seen for scheduling realistically is Evidence Based Scheduling which is part of the FogCreek FogBugz 6.0 release. See Joel's blog post linked above for a synopsis and some examples. | How do you refine your estimation process? Estimating how long any given task will take seems to be one of the hardest parts about software development. At my current shop we estimate tasks in hours at the start of an iteration, but once the task is complete we do not use it to aide us in future estimations. How do you... | TITLE:
How do you refine your estimation process?
QUESTION:
Estimating how long any given task will take seems to be one of the hardest parts about software development. At my current shop we estimate tasks in hours at the start of an iteration, but once the task is complete we do not use it to aide us in future estim... | [
"estimation"
] | 6 | 10 | 593 | 5 | 0 | 2008-10-09T22:37:17.413000 | 2008-10-09T22:43:45.450000 |
189,468 | 189,521 | Identifying the season from the Date using Java | I've had nothing but good luck from SO, so why not try again? I have an application that needs to show a different image based on the season of the year (spring, summer, winter, fall). I have very specific start and end dates for these seasons. What I would like from you geniuses is a method called GetSeason that takes... | Seems like just checking the month would do: private static final String seasons[] = { "Winter", "Winter", "Spring", "Spring", "Summer", "Summer", "Summer", "Summer", "Fall", "Fall", "Winter", "Winter" }; public String getSeason( Date date ) { return seasons[ date.getMonth() ]; }
// As stated above, getMonth() is depr... | Identifying the season from the Date using Java I've had nothing but good luck from SO, so why not try again? I have an application that needs to show a different image based on the season of the year (spring, summer, winter, fall). I have very specific start and end dates for these seasons. What I would like from you ... | TITLE:
Identifying the season from the Date using Java
QUESTION:
I've had nothing but good luck from SO, so why not try again? I have an application that needs to show a different image based on the season of the year (spring, summer, winter, fall). I have very specific start and end dates for these seasons. What I wo... | [
"java",
"date"
] | 2 | 7 | 28,427 | 11 | 0 | 2008-10-09T22:37:41.423000 | 2008-10-09T22:57:50.727000 |
189,471 | 189,498 | Does NuSoap have to be configured a certain way when calling from WCF? | I'm trying to call a php webservice using WCF. I googled some public php services to see if I could replicate the error I was receiving and I created 2 different unit tests to demonstrate. The test that failed I get the following error: System.ServiceModel.ProtocolException: The content type text/xml; charset=ISO-8859-... | Make sure to set the UTF-8 encoding using soap_defencoding in the PHP code. If you want some more related information, see this blog post. | Does NuSoap have to be configured a certain way when calling from WCF? I'm trying to call a php webservice using WCF. I googled some public php services to see if I could replicate the error I was receiving and I created 2 different unit tests to demonstrate. The test that failed I get the following error: System.Servi... | TITLE:
Does NuSoap have to be configured a certain way when calling from WCF?
QUESTION:
I'm trying to call a php webservice using WCF. I googled some public php services to see if I could replicate the error I was receiving and I created 2 different unit tests to demonstrate. The test that failed I get the following e... | [
"php",
"wcf"
] | 0 | 1 | 1,422 | 1 | 0 | 2008-10-09T22:38:36.850000 | 2008-10-09T22:49:38.590000 |
189,479 | 189,494 | Trouble deploying code written on VS2008 to server running .NET Framework 2.0 | When I created the project I'm trying to deploy I selected that I wanted to target.NET Framework 2.0. After deploying the project I try to brows to it and get and error page that shows: One of the selling points of VS2008 is that you can develop for and deploy to server running.NET2.0 what Am I doing wrong? | You are referencing assemblies of the.NET Framework 3.5, are you using EntityDataSources?? Remove those 3.5 references... You also need the AJAX Extensions (System.Web.Extensions) for.NET 2.0 on the server. | Trouble deploying code written on VS2008 to server running .NET Framework 2.0 When I created the project I'm trying to deploy I selected that I wanted to target.NET Framework 2.0. After deploying the project I try to brows to it and get and error page that shows: One of the selling points of VS2008 is that you can deve... | TITLE:
Trouble deploying code written on VS2008 to server running .NET Framework 2.0
QUESTION:
When I created the project I'm trying to deploy I selected that I wanted to target.NET Framework 2.0. After deploying the project I try to brows to it and get and error page that shows: One of the selling points of VS2008 is... | [
"asp.net",
"visual-studio-2008",
".net-3.5",
"deployment",
".net-2.0"
] | 0 | 1 | 846 | 4 | 0 | 2008-10-09T22:41:06.113000 | 2008-10-09T22:48:13.493000 |
189,490 | 189,509 | Where can I find my .emacs file for Emacs running on Windows? | I tried looking for the.emacs file for my Windows installation for Emacs, but I could not find it. Does it have the same filename under Windows as in Unix? Do I have to create it myself? If so, under what specific directory does it go? | Copy and pasted from the Emacs FAQ, http://www.gnu.org/software/emacs/windows/: Where do I put my init file? On Windows, the.emacs file may be called _emacs for backward compatibility with DOS and FAT filesystems where filenames could not start with a dot. Some users prefer to continue using such a name, because Window... | Where can I find my .emacs file for Emacs running on Windows? I tried looking for the.emacs file for my Windows installation for Emacs, but I could not find it. Does it have the same filename under Windows as in Unix? Do I have to create it myself? If so, under what specific directory does it go? | TITLE:
Where can I find my .emacs file for Emacs running on Windows?
QUESTION:
I tried looking for the.emacs file for my Windows installation for Emacs, but I could not find it. Does it have the same filename under Windows as in Unix? Do I have to create it myself? If so, under what specific directory does it go?
ANS... | [
"windows",
"emacs",
"winapi",
"path",
"customization"
] | 128 | 119 | 97,714 | 16 | 0 | 2008-10-09T22:46:39.347000 | 2008-10-09T22:53:45.510000 |
189,493 | 189,495 | Error Message: "Access to the path c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah) is denied." - what causes this? | Every so often when I'm debugging, I get this message in nice brown text on an ASP.NET error page: Access to the path "c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah)" is denied. I've never been able to figure out what causes it, what really fixes it, and why it happens. Often times the path... | It was my understanding this can be caused by anti-virus running on the machine and intermittently locking the files. | Error Message: "Access to the path c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah) is denied." - what causes this? Every so often when I'm debugging, I get this message in nice brown text on an ASP.NET error page: Access to the path "c:\windows\microsoft.net\framework\(version)\Temporary ASP... | TITLE:
Error Message: "Access to the path c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah) is denied." - what causes this?
QUESTION:
Every so often when I'm debugging, I get this message in nice brown text on an ASP.NET error page: Access to the path "c:\windows\microsoft.net\framework\(vers... | [
"c#",
".net",
"asp.net",
"visual-studio-2003"
] | 4 | 4 | 5,502 | 6 | 0 | 2008-10-09T22:47:48.237000 | 2008-10-09T22:49:00.650000 |
189,534 | 189,582 | .NET TransactionScope class and T-SQL TRAN COMMIT and ROLLBACK | I am current writing an application that will require multiple inserts, updates and deletes for my business entity. I am using the TransactionScope class to guarantee all the stored procedures can commit or roll back as a single unit of work. My question is, I am required to also use COMMIT TRAN and ROLLBACK TRAN is ea... | ON 2005 its not necessary, on 2000 I would,Also, i usually put the transactionscope in a "using" block. There are some performance issues when using it on 2000 and older vs 2005. See here Thanks | .NET TransactionScope class and T-SQL TRAN COMMIT and ROLLBACK I am current writing an application that will require multiple inserts, updates and deletes for my business entity. I am using the TransactionScope class to guarantee all the stored procedures can commit or roll back as a single unit of work. My question is... | TITLE:
.NET TransactionScope class and T-SQL TRAN COMMIT and ROLLBACK
QUESTION:
I am current writing an application that will require multiple inserts, updates and deletes for my business entity. I am using the TransactionScope class to guarantee all the stored procedures can commit or roll back as a single unit of wo... | [
".net",
"database",
"t-sql",
"transactions"
] | 5 | 2 | 4,746 | 4 | 0 | 2008-10-09T23:02:42.620000 | 2008-10-09T23:25:22.857000 |
189,537 | 2,698,118 | NFS Server in Java | I search an implementation of a network (or distributed) file system like NFS in Java. The goal is to extend it and do some research stuff with it. On the web I found some implementation e.g. DJ NFS, but the open question is how mature and fast they are. Can anyone purpose a good starting point, has anyone experience w... | Have a look at dcache.org. They implement a NFSv4.1 server in Java. whitepaper github manual | NFS Server in Java I search an implementation of a network (or distributed) file system like NFS in Java. The goal is to extend it and do some research stuff with it. On the web I found some implementation e.g. DJ NFS, but the open question is how mature and fast they are. Can anyone purpose a good starting point, has ... | TITLE:
NFS Server in Java
QUESTION:
I search an implementation of a network (or distributed) file system like NFS in Java. The goal is to extend it and do some research stuff with it. On the web I found some implementation e.g. DJ NFS, but the open question is how mature and fast they are. Can anyone purpose a good st... | [
"java",
"filesystems"
] | 7 | 5 | 8,042 | 4 | 0 | 2008-10-09T23:04:38.140000 | 2010-04-23T11:30:28.993000 |
189,552 | 189,563 | Subdomain on different host | I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up. Here are the specifics: Domain is registered with GoDaddy. Nameservers are pointing to DiscountASP.net where ASP.NET app has been happily running for couple of years. Would like blog.mydomain.exa... | A sub domain is part of the domain, it's like subletting a room of an apartment. A records has to be setup on the DNS for the domain e.g mydomain.example has IP 123.456.789.999 and hosted with Godaddy. Now to get the sub domain anothersite.mydomain.example of which the site is actually on another server then login to G... | Subdomain on different host I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up. Here are the specifics: Domain is registered with GoDaddy. Nameservers are pointing to DiscountASP.net where ASP.NET app has been happily running for couple of years. ... | TITLE:
Subdomain on different host
QUESTION:
I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up. Here are the specifics: Domain is registered with GoDaddy. Nameservers are pointing to DiscountASP.net where ASP.NET app has been happily running for... | [
"subdomain",
"hosting"
] | 125 | 173 | 139,309 | 3 | 0 | 2008-10-09T23:13:31.053000 | 2008-10-09T23:19:02.557000 |
189,555 | 189,580 | How to use Python to login to a webpage and retrieve cookies for later usage? | I want to download and parse webpage using python, but to access it I need a couple of cookies set. Therefore I need to login over https to the webpage first. The login moment involves sending two POST params (username, password) to /login.php. During the login request I want to retrieve the cookies from the response h... | import urllib, urllib2, cookielib
username = 'myuser' password = 'mypassword'
cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) login_data = urllib.urlencode({'username': username, 'j_password': password}) opener.open('http://www.example.com/login.php', login_data) resp = opene... | How to use Python to login to a webpage and retrieve cookies for later usage? I want to download and parse webpage using python, but to access it I need a couple of cookies set. Therefore I need to login over https to the webpage first. The login moment involves sending two POST params (username, password) to /login.ph... | TITLE:
How to use Python to login to a webpage and retrieve cookies for later usage?
QUESTION:
I want to download and parse webpage using python, but to access it I need a couple of cookies set. Therefore I need to login over https to the webpage first. The login moment involves sending two POST params (username, pass... | [
"python",
"http",
"authentication",
"cookies"
] | 148 | 146 | 183,828 | 2 | 0 | 2008-10-09T23:14:43.830000 | 2008-10-09T23:24:39.690000 |
189,557 | 189,660 | ORA-00942: table or view does not exist : How do I find which table or view it is talking about | We're running a java/hibernate app going against ORACLE 10g in TESTING. Once in a while, we're seeing this error: ORA-00942: table or view does not exist Is there a way to find out which table/view(s) ORACLE is talking about? I know that I can add extra levels of logging in hibernate which will show all the SQL that it... | Take a look into the DBA_AUDIT_EXISTS table, when auditing is turned on for Oracle. I believe that Oracle can provide very detailed auditing which you can simply toggle on and off when you like via DB commands, although I dont remember what they are off the top of my head. See: http://docs.oracle.com/cd/B19306_01/netwo... | ORA-00942: table or view does not exist : How do I find which table or view it is talking about We're running a java/hibernate app going against ORACLE 10g in TESTING. Once in a while, we're seeing this error: ORA-00942: table or view does not exist Is there a way to find out which table/view(s) ORACLE is talking about... | TITLE:
ORA-00942: table or view does not exist : How do I find which table or view it is talking about
QUESTION:
We're running a java/hibernate app going against ORACLE 10g in TESTING. Once in a while, we're seeing this error: ORA-00942: table or view does not exist Is there a way to find out which table/view(s) ORACL... | [
"java",
"sql",
"oracle",
"hibernate",
"ora-00942"
] | 9 | 3 | 29,148 | 5 | 0 | 2008-10-09T23:16:23.967000 | 2008-10-10T00:07:43.910000 |
189,562 | 189,570 | What is the proper name for doing debugging by adding 'print' statements | There are many ways of doing debugging, using a debugger is one, but the simple one for the humble, lazy, programmer is to just add a bunch of print statements to your code. i.e. def foo(x): print 'Hey wow, we got to foo!', x...
print 'foo is returning:', bar return bar Is there a proper name for this style of debuggi... | Yes - it's known as printf() debugging, named after the ubiquitous C function: Used to describe debugging work done by inserting commands that output more or less carefully chosen status information at key points in the program flow, observing that information and deducing what's wrong based on that information. -- pri... | What is the proper name for doing debugging by adding 'print' statements There are many ways of doing debugging, using a debugger is one, but the simple one for the humble, lazy, programmer is to just add a bunch of print statements to your code. i.e. def foo(x): print 'Hey wow, we got to foo!', x...
print 'foo is ret... | TITLE:
What is the proper name for doing debugging by adding 'print' statements
QUESTION:
There are many ways of doing debugging, using a debugger is one, but the simple one for the humble, lazy, programmer is to just add a bunch of print statements to your code. i.e. def foo(x): print 'Hey wow, we got to foo!', x...
... | [
"debugging",
"printf-debugging"
] | 45 | 77 | 25,888 | 19 | 0 | 2008-10-09T23:19:00.637000 | 2008-10-09T23:21:55.420000 |
189,588 | 189,727 | Speed of SELECT vs. SET in T-SQL | I've been led to believe that for single variable assignment in T-SQL, set is the best way to go about things, for two reasons: it's the ANSI standard for variable assignment it's actually faster than doing a SELECT (for a single variable) So... SELECT @thingy = 'turnip shaped' becomes SET @thingy = 'turnip shaped' But... | SET is faster on single runs. You can prove this easily enough. Whether or not it makes a difference is up to you, but I prefer SET, since I don't see the point of SELECT if all the code is doing is an assignment. I prefer to keep SELECT confined to SELECT statements from tables, views, etc. Here is a sample script, wi... | Speed of SELECT vs. SET in T-SQL I've been led to believe that for single variable assignment in T-SQL, set is the best way to go about things, for two reasons: it's the ANSI standard for variable assignment it's actually faster than doing a SELECT (for a single variable) So... SELECT @thingy = 'turnip shaped' becomes ... | TITLE:
Speed of SELECT vs. SET in T-SQL
QUESTION:
I've been led to believe that for single variable assignment in T-SQL, set is the best way to go about things, for two reasons: it's the ANSI standard for variable assignment it's actually faster than doing a SELECT (for a single variable) So... SELECT @thingy = 'turni... | [
"performance",
"t-sql"
] | 5 | 9 | 3,824 | 3 | 0 | 2008-10-09T23:29:48.120000 | 2008-10-10T00:40:07.400000 |
189,601 | 214,974 | Eclipse as IDE + Mercurial for version control + ? Bug tracking = Good idea? | For a new Java web project I thought about using: Eclipse as IDE Mercurial for version control Some kind of bug tracking software I have heard of bug tracking software where you can tie a change to an unresolved bug when you check it in. I haven't used any such solution myself, but it sounds good. Are there any good bu... | In my experience the MercurialEclipse plug-in works quite well - as far as I understood, nobody commenting here has actually used it, so don't base your decisions solely on those opinions. You'd probably be better off to test it yourself. As I said before - it works for me. Disclaimer: I've participated in developing t... | Eclipse as IDE + Mercurial for version control + ? Bug tracking = Good idea? For a new Java web project I thought about using: Eclipse as IDE Mercurial for version control Some kind of bug tracking software I have heard of bug tracking software where you can tie a change to an unresolved bug when you check it in. I hav... | TITLE:
Eclipse as IDE + Mercurial for version control + ? Bug tracking = Good idea?
QUESTION:
For a new Java web project I thought about using: Eclipse as IDE Mercurial for version control Some kind of bug tracking software I have heard of bug tracking software where you can tie a change to an unresolved bug when you ... | [
"java",
"eclipse",
"mercurial",
"hudson",
"bug-tracking"
] | 2 | 2 | 3,537 | 7 | 0 | 2008-10-09T23:37:08.353000 | 2008-10-18T12:26:59.703000 |
189,610 | 190,196 | Speed of multiple variable assignment in T-SQL | Imagine I have a chunk of initialisation code at the top of a stored procedure with a number of variable assignments: SET @proc = 'sp_madeupname' SET @magic_number = 42 SET @tomorrows_date = DATEADD(dd, 1, GETDATE())... Clearly doing all of the above as one SELECT would be faster: SELECT @proc = 'sp_madeupname',@magic_... | In this case, SELECT wins, performance-wise, when performing multiple assignments. Here is some more information about it: SELECT vs. SET: Optimizing Loops | Speed of multiple variable assignment in T-SQL Imagine I have a chunk of initialisation code at the top of a stored procedure with a number of variable assignments: SET @proc = 'sp_madeupname' SET @magic_number = 42 SET @tomorrows_date = DATEADD(dd, 1, GETDATE())... Clearly doing all of the above as one SELECT would be... | TITLE:
Speed of multiple variable assignment in T-SQL
QUESTION:
Imagine I have a chunk of initialisation code at the top of a stored procedure with a number of variable assignments: SET @proc = 'sp_madeupname' SET @magic_number = 42 SET @tomorrows_date = DATEADD(dd, 1, GETDATE())... Clearly doing all of the above as o... | [
"performance",
"t-sql",
"variables",
"variable-assignment"
] | 0 | 3 | 1,244 | 2 | 0 | 2008-10-09T23:40:41.310000 | 2008-10-10T05:15:21.743000 |
189,621 | 189,634 | When does CSS's !important declaration not work? | I am wondering if someone can put a bit of an authoritative reference summary of when the!important declaration in CSS does not work to override inline styles. | There are many factors involved in determining which styles override one another. The lower a style declaration appears in the cascade, and the more specific it is in targeting the element, the more it will weigh against other styles. This is the CSS2 standard for style inheritance: If the cascade results in a value, u... | When does CSS's !important declaration not work? I am wondering if someone can put a bit of an authoritative reference summary of when the!important declaration in CSS does not work to override inline styles. | TITLE:
When does CSS's !important declaration not work?
QUESTION:
I am wondering if someone can put a bit of an authoritative reference summary of when the!important declaration in CSS does not work to override inline styles.
ANSWER:
There are many factors involved in determining which styles override one another. Th... | [
"css"
] | 26 | 18 | 41,289 | 4 | 0 | 2008-10-09T23:47:33.840000 | 2008-10-09T23:54:06.463000 |
189,622 | 189,628 | What is the purpose of the cbSize member in Win32API structs | I frequently encounter some definitions for Win32API structures (but not limited to it) that have a cbSize member as in the following example. typedef struct _TEST { int cbSize; // other members follow } TEST, *PTEST; And then we use it like this: TEST t = { sizeof(TEST) };... or TEST t; t.cbSize = sizeof(TEST);... My ... | My initial guess is that this could potentially be used for versioning. That's one reason. I think it's the more usual one. Another is for structures that have variable length data. I don't think that checking for correct packing or bugs in the caller are a particular reasoning behind it, but it would have that effect. | What is the purpose of the cbSize member in Win32API structs I frequently encounter some definitions for Win32API structures (but not limited to it) that have a cbSize member as in the following example. typedef struct _TEST { int cbSize; // other members follow } TEST, *PTEST; And then we use it like this: TEST t = { ... | TITLE:
What is the purpose of the cbSize member in Win32API structs
QUESTION:
I frequently encounter some definitions for Win32API structures (but not limited to it) that have a cbSize member as in the following example. typedef struct _TEST { int cbSize; // other members follow } TEST, *PTEST; And then we use it like... | [
"c++",
"winapi",
"api"
] | 10 | 11 | 6,579 | 4 | 0 | 2008-10-09T23:48:51.497000 | 2008-10-09T23:51:26.437000 |
189,623 | 197,916 | WCF transport security with no authentication | Is it possible to have transport security without authentication? I'm well aware of it's flaws but atm I can't install a certificate a the client side. It seems I can set WSHttpBinding.SecurityMode to Transport and the ClientCredentialType to HttpClientCredentialType.None, but when I try to call the service I get this ... | You can have HTTPS communication without authentication, but you cannot have HTTPS communication without certificates, since HTTPS encryption uses certificates. There are a few things to check: Can you access the WSDL or another resource on the site over HTTPS in a browser? Do you get any warnings about the certificate... | WCF transport security with no authentication Is it possible to have transport security without authentication? I'm well aware of it's flaws but atm I can't install a certificate a the client side. It seems I can set WSHttpBinding.SecurityMode to Transport and the ClientCredentialType to HttpClientCredentialType.None, ... | TITLE:
WCF transport security with no authentication
QUESTION:
Is it possible to have transport security without authentication? I'm well aware of it's flaws but atm I can't install a certificate a the client side. It seems I can set WSHttpBinding.SecurityMode to Transport and the ClientCredentialType to HttpClientCre... | [
"wcf",
"security",
"authentication"
] | 6 | 6 | 19,839 | 3 | 0 | 2008-10-09T23:50:03.867000 | 2008-10-13T15:08:36.823000 |
189,631 | 189,638 | Should the Visual Studio GUI editor be used? | Coming from a background, I'm familiar with GUI editors that do a poor job of producing code. However, I've never written a GUI using.NET. Does the GUI editor in Visual Studio have the same problem(s)? Are both the source files and output GUI good? | The GUI editor in Visual Studio is probably the best I've used. Also, because C# supports partial classes, there is a clean separation between the IDE-generated code and your own. | Should the Visual Studio GUI editor be used? Coming from a background, I'm familiar with GUI editors that do a poor job of producing code. However, I've never written a GUI using.NET. Does the GUI editor in Visual Studio have the same problem(s)? Are both the source files and output GUI good? | TITLE:
Should the Visual Studio GUI editor be used?
QUESTION:
Coming from a background, I'm familiar with GUI editors that do a poor job of producing code. However, I've never written a GUI using.NET. Does the GUI editor in Visual Studio have the same problem(s)? Are both the source files and output GUI good?
ANSWER:... | [
".net",
"visual-studio",
"user-interface"
] | 2 | 9 | 2,109 | 4 | 0 | 2008-10-09T23:53:35.467000 | 2008-10-09T23:57:57.127000 |
189,640 | 192,880 | MS Office hyperlinks change code page? | When you paste the following URL into IE: http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx, the link on the right of the page cleanly says "Download Zoomit (77 KB)". If you paste the link into an Office document (Word, Excel, PowerPoint -- tested using Office 2003), and activate the link from the document,... | I found an answer that seems to be working. First I added an alert to display the document.charset. This displayed "utf-8" when invoked directly, and "windows-1252" when invoked from a hyperlink in a MS Office document. I therefore inserted the following meta-tag, and pages seem to display correctly even when invoked f... | MS Office hyperlinks change code page? When you paste the following URL into IE: http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx, the link on the right of the page cleanly says "Download Zoomit (77 KB)". If you paste the link into an Office document (Word, Excel, PowerPoint -- tested using Office 2003), a... | TITLE:
MS Office hyperlinks change code page?
QUESTION:
When you paste the following URL into IE: http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx, the link on the right of the page cleanly says "Download Zoomit (77 KB)". If you paste the link into an Office document (Word, Excel, PowerPoint -- tested usi... | [
"html",
"unicode",
"ms-office",
"character-encoding"
] | 0 | 0 | 1,492 | 1 | 0 | 2008-10-09T23:58:55.300000 | 2008-10-10T20:10:05.203000 |
189,644 | 189,987 | What are some common things to consider when developing a web-based application to be sold | I'm developing an application for an internal customer. One of the requirements is that it be developed in such a way that it could potentially be sold to other organizations. The application is a tracking application for a fund-raising organization that will manage their donations, donors, participants, and events. I ... | I want to caution you against trying to make the "do everything" framework. This is a common mistake that a lot of developers make when trying to build their first few mass-market software apps. You have a customer already, and they are likely bankrolling the initial version of the application. You need to deliver as m... | What are some common things to consider when developing a web-based application to be sold I'm developing an application for an internal customer. One of the requirements is that it be developed in such a way that it could potentially be sold to other organizations. The application is a tracking application for a fund-... | TITLE:
What are some common things to consider when developing a web-based application to be sold
QUESTION:
I'm developing an application for an internal customer. One of the requirements is that it be developed in such a way that it could potentially be sold to other organizations. The application is a tracking appli... | [
"c#",
"asp.net",
"architecture",
"web-applications",
"product"
] | 13 | 27 | 1,572 | 4 | 0 | 2008-10-10T00:01:53.407000 | 2008-10-10T02:57:34.097000 |
189,645 | 189,685 | How can I break out of multiple loops? | Given the following code (that doesn't work): while True: # Snip: print out current state while True: ok = get_input("Is this ok? (y/n)") if ok.lower() == "y": break 2 # This doesn't work:( if ok.lower() == "n": break
# Do more processing with menus and stuff Is there a way to make this work? Or do I have do one check... | My first instinct would be to refactor the nested loop into a function and use return to break out. | How can I break out of multiple loops? Given the following code (that doesn't work): while True: # Snip: print out current state while True: ok = get_input("Is this ok? (y/n)") if ok.lower() == "y": break 2 # This doesn't work:( if ok.lower() == "n": break
# Do more processing with menus and stuff Is there a way to ma... | TITLE:
How can I break out of multiple loops?
QUESTION:
Given the following code (that doesn't work): while True: # Snip: print out current state while True: ok = get_input("Is this ok? (y/n)") if ok.lower() == "y": break 2 # This doesn't work:( if ok.lower() == "n": break
# Do more processing with menus and stuff Is... | [
"python",
"nested-loops",
"break",
"control-flow"
] | 735 | 737 | 758,529 | 40 | 0 | 2008-10-10T00:02:01.690000 | 2008-10-10T00:25:05.480000 |
189,669 | 189,672 | COM from x86 assembly? | Is it possible to call into COM objects via x86 assembly language? If so, how? Why would I want to do this? Let's say I've got two programs that I don't have source for - all I've got are the binaries. One of them implements a COM interface, the other doesn't. I want to inject code into the first program to call into t... | Of course it's possible - in effect that's what the C/C++ compiler does. But why in God's name would you want to do this? If it were for educational value, then surely doing the COM stuff by hand in straight C would do the trick. Given the updated question, I'd suggest that you write the COM stuff in a DLL and inject t... | COM from x86 assembly? Is it possible to call into COM objects via x86 assembly language? If so, how? Why would I want to do this? Let's say I've got two programs that I don't have source for - all I've got are the binaries. One of them implements a COM interface, the other doesn't. I want to inject code into the first... | TITLE:
COM from x86 assembly?
QUESTION:
Is it possible to call into COM objects via x86 assembly language? If so, how? Why would I want to do this? Let's say I've got two programs that I don't have source for - all I've got are the binaries. One of them implements a COM interface, the other doesn't. I want to inject c... | [
"com",
"x86",
"assembly"
] | 0 | 5 | 409 | 5 | 0 | 2008-10-10T00:16:16.013000 | 2008-10-10T00:18:05.837000 |
189,680 | 189,693 | Database localization | i am looking for opinions if the following problem maybe has a better/different/common solution: I have a database for products which contains the names of the products in english (the default language of this application) and i need translations of the names if available. Currently i have this setup: A product table C... | Looks good to me. The one thing I might change is the way you handle languages: that should probably be a separate table. Thus, you would have: CREATE TABLE products_l10n ( product_id serial NOT NULL, language_id int NOT NULL, "name" character varying(255) NOT NULL, CONSTRAINT products_l10n_pkey PRIMARY KEY (product_id... | Database localization i am looking for opinions if the following problem maybe has a better/different/common solution: I have a database for products which contains the names of the products in english (the default language of this application) and i need translations of the names if available. Currently i have this se... | TITLE:
Database localization
QUESTION:
i am looking for opinions if the following problem maybe has a better/different/common solution: I have a database for products which contains the names of the products in english (the default language of this application) and i need translations of the names if available. Curren... | [
"sql",
"database",
"localization"
] | 10 | 7 | 6,662 | 6 | 0 | 2008-10-10T00:21:54.397000 | 2008-10-10T00:28:51.497000 |
189,694 | 189,737 | How to keep row order with SqlBulkCopy? | I'm exporting data programatically from Excel to SQL Server 2005 using SqlBulkCopy. It works great, the only problem I have is that it doesn't preserve the row sequence i have in Excel file. I don't have a column to order by, I just want the records to be inserted in the same order they appear in the Excel Spreadsheet.... | I don't think that row ordering is specified or guaranteed by SQL unless you use an "ORDER BY " clause. From a post by Bill Vaughn ( http://betav.com/blog/billva/2008/08/sql_server_indexing_tips_and_t.html ): Using Order By: Even when a table has a clustered index (which stores the data in physical order), SQL Server d... | How to keep row order with SqlBulkCopy? I'm exporting data programatically from Excel to SQL Server 2005 using SqlBulkCopy. It works great, the only problem I have is that it doesn't preserve the row sequence i have in Excel file. I don't have a column to order by, I just want the records to be inserted in the same ord... | TITLE:
How to keep row order with SqlBulkCopy?
QUESTION:
I'm exporting data programatically from Excel to SQL Server 2005 using SqlBulkCopy. It works great, the only problem I have is that it doesn't preserve the row sequence i have in Excel file. I don't have a column to order by, I just want the records to be insert... | [
"sql-server",
"excel",
"import",
"export",
"sqlbulkcopy"
] | 3 | 3 | 4,537 | 4 | 0 | 2008-10-10T00:28:55.537000 | 2008-10-10T00:44:24.227000 |
189,708 | 190,466 | Testing for the existence of a temporary table in a multi tempdb environment? | Is there any way of determining whether or not a specific temp table has been created in a session without referencing the tempdb database that it was created on? Users are allocated to a specific tempdb when they log in, so I don't know which tempdb they'll be using. I don't need to specify a tempdb to select data out... | It seems to me that you shouldn't be using temporary tables here... these seem more like regular tables (perhaps with a user identifier). What is the scenario here? Note that using temporary tables in this way can play havoc with the optimiser/query cache - it will have to do lots of recompiles, as the meaning of #FOO ... | Testing for the existence of a temporary table in a multi tempdb environment? Is there any way of determining whether or not a specific temp table has been created in a session without referencing the tempdb database that it was created on? Users are allocated to a specific tempdb when they log in, so I don't know whic... | TITLE:
Testing for the existence of a temporary table in a multi tempdb environment?
QUESTION:
Is there any way of determining whether or not a specific temp table has been created in a session without referencing the tempdb database that it was created on? Users are allocated to a specific tempdb when they log in, so... | [
"t-sql",
"sybase",
"temp-tables"
] | 0 | 0 | 5,756 | 2 | 0 | 2008-10-10T00:32:11.503000 | 2008-10-10T08:00:28.963000 |
189,726 | 190,994 | What is the best way to learn more about imperative-style concurrent programming? | Have had to write my first "proper" multithreaded coded recently, and realised just how little I knew about how "imperative-style" (ie, concurrency models used by C++/C#/Java, and the like) concurrent programming techniques. What resources are there (both books and online tutorials, etc) in order to learn more about th... | Patterns for Parallel Porgramming is a good general book on concurrent programming techniques. It uses Java threads, OpenMP in C and MPI in C for the examples. Pretty much any decent book on multithreaded programming in any of the languages you mention should cover the general principles. I'm covering this ground in C+... | What is the best way to learn more about imperative-style concurrent programming? Have had to write my first "proper" multithreaded coded recently, and realised just how little I knew about how "imperative-style" (ie, concurrency models used by C++/C#/Java, and the like) concurrent programming techniques. What resource... | TITLE:
What is the best way to learn more about imperative-style concurrent programming?
QUESTION:
Have had to write my first "proper" multithreaded coded recently, and realised just how little I knew about how "imperative-style" (ie, concurrency models used by C++/C#/Java, and the like) concurrent programming techniq... | [
"multithreading",
"concurrency"
] | 5 | 11 | 1,588 | 4 | 0 | 2008-10-10T00:40:04.983000 | 2008-10-10T12:11:03.563000 |
189,733 | 189,785 | Factory Class - Should i populate my object with data here? | im creating a Factory class that will contruct and return an object. I normally would do all of the data stuff at the Data Access Layer, but i dont think i could reach my objective and still do so. What i want to do is use a SQLDataReader to quickly read the data information and populate the object to be returned from ... | In most cases this is a good idea as this way provides two major benefits: This way you can seperate the data access and business logic, which means if you change database design the upper layer algorithms do not need to be changed. From OO stand point, you are converting some pure data into objects and may also added ... | Factory Class - Should i populate my object with data here? im creating a Factory class that will contruct and return an object. I normally would do all of the data stuff at the Data Access Layer, but i dont think i could reach my objective and still do so. What i want to do is use a SQLDataReader to quickly read the d... | TITLE:
Factory Class - Should i populate my object with data here?
QUESTION:
im creating a Factory class that will contruct and return an object. I normally would do all of the data stuff at the Data Access Layer, but i dont think i could reach my objective and still do so. What i want to do is use a SQLDataReader to ... | [
"c#",
".net",
"factory"
] | 0 | 1 | 915 | 3 | 0 | 2008-10-10T00:43:46.427000 | 2008-10-10T01:13:44.493000 |
189,751 | 189,935 | Google App Engine and 404 error | I've setup a static website on GAE using hints found elsewhere, but can't figure out how to return a 404 error. My app.yaml file looks like - url: (.*)/ static_files: static\1/index.html upload: static/index.html
- url: / static_dir: static with all the static html/jpg files stored under the static directory. The abov... | You need to register a catch-all script handler. Append this at the end of your app.yaml: - url: /.* script: main.py In main.py you will need to put this code: from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app
class NotFoundPageHandler(webapp.RequestHandler): def get(sel... | Google App Engine and 404 error I've setup a static website on GAE using hints found elsewhere, but can't figure out how to return a 404 error. My app.yaml file looks like - url: (.*)/ static_files: static\1/index.html upload: static/index.html
- url: / static_dir: static with all the static html/jpg files stored unde... | TITLE:
Google App Engine and 404 error
QUESTION:
I've setup a static website on GAE using hints found elsewhere, but can't figure out how to return a 404 error. My app.yaml file looks like - url: (.*)/ static_files: static\1/index.html upload: static/index.html
- url: / static_dir: static with all the static html/jpg... | [
"python",
"google-app-engine",
"http-status-code-404"
] | 40 | 37 | 33,834 | 9 | 0 | 2008-10-10T00:51:00.140000 | 2008-10-10T02:36:02.923000 |
189,757 | 189,761 | Can a .NET app be compiled to native? | Just wondering if a.NET app can be compiled down to native machine code ahead of time? I'm not planning on doing so even if I could; I'm just curious. Thanks | You can use NGen to compile it ahead of time, but this still depends on the.NET framework. Remotesoft's Salamander (a commercial app) can make a framework-less app. | Can a .NET app be compiled to native? Just wondering if a.NET app can be compiled down to native machine code ahead of time? I'm not planning on doing so even if I could; I'm just curious. Thanks | TITLE:
Can a .NET app be compiled to native?
QUESTION:
Just wondering if a.NET app can be compiled down to native machine code ahead of time? I'm not planning on doing so even if I could; I'm just curious. Thanks
ANSWER:
You can use NGen to compile it ahead of time, but this still depends on the.NET framework. Remote... | [
".net",
"native",
"compilation",
"machine-code"
] | 8 | 11 | 1,621 | 4 | 0 | 2008-10-10T00:55:13.767000 | 2008-10-10T00:57:19.393000 |
189,770 | 189,983 | Retrieving the new ID from a SQLDataAdaptor.Update | How would you go about retrieving the @@IDENTITY value for each row when the SQLDataAdapater.Update is executed on a table? eg. Is it possible to modify/intercept the InsertCommand, generated by the SQLCommandBuilder, to say add an output parameter, and then retrieve its value in the da.RowUpdated event??? | Bill Vaughn knows a thing or two about this. They key is tweaking your InsertCommand. See "Managing an @@IDENTITY Crisis". Note: the actual solution uses SCOPE_IDENTITY() in order to be trigger-safe. | Retrieving the new ID from a SQLDataAdaptor.Update How would you go about retrieving the @@IDENTITY value for each row when the SQLDataAdapater.Update is executed on a table? eg. Is it possible to modify/intercept the InsertCommand, generated by the SQLCommandBuilder, to say add an output parameter, and then retrieve i... | TITLE:
Retrieving the new ID from a SQLDataAdaptor.Update
QUESTION:
How would you go about retrieving the @@IDENTITY value for each row when the SQLDataAdapater.Update is executed on a table? eg. Is it possible to modify/intercept the InsertCommand, generated by the SQLCommandBuilder, to say add an output parameter, a... | [
"sql",
"ado.net"
] | 0 | 1 | 151 | 2 | 0 | 2008-10-10T01:02:42.410000 | 2008-10-10T02:55:44.087000 |
189,771 | 189,854 | SSRS Reports - parameter query | I have an SQL reporting server report which has 5 parameters which permit nullable values. The user may enter values for any of the fields. I need to enforce the condition that the user must enter at least one out of five parameter values (any one is required). ****Note**: I need to do this in SQL Server reports itself... | What would you like to do if you detect they haven't entered any values? You code write some code for the report (Report Menu -> Properties -> Code). The code would check to see if at least one of your parameters is not null. Then you could use that code to show or hide a textbox to display a message. Same code: Public... | SSRS Reports - parameter query I have an SQL reporting server report which has 5 parameters which permit nullable values. The user may enter values for any of the fields. I need to enforce the condition that the user must enter at least one out of five parameter values (any one is required). ****Note**: I need to do th... | TITLE:
SSRS Reports - parameter query
QUESTION:
I have an SQL reporting server report which has 5 parameters which permit nullable values. The user may enter values for any of the fields. I need to enforce the condition that the user must enter at least one out of five parameter values (any one is required). ****Note*... | [
"reporting-services"
] | 1 | 2 | 2,828 | 1 | 0 | 2008-10-10T01:02:48.337000 | 2008-10-10T01:51:12.577000 |
189,780 | 190,221 | Why is Apache executing .php.html files as PHP? | I have an odd problem...I'm using a documentation generator which generates a lot of output like docs/foo.php.html. It's XHTML, and thus contains tags at the beginning of file. The problem is, Apache has somehow decided to run it through the PHP interpreter, even though ".php" appears in the middle of the filename, and... | The problem seems to be in mod_mime. Quote from the Apache mod_mime documentation page: If you would prefer only the last dot-separated part of the filename to be mapped to a particular piece of meta-data, then do not use the Add* directives. For example, if you wish to have the file foo.html.cgi processed as a CGI scr... | Why is Apache executing .php.html files as PHP? I have an odd problem...I'm using a documentation generator which generates a lot of output like docs/foo.php.html. It's XHTML, and thus contains tags at the beginning of file. The problem is, Apache has somehow decided to run it through the PHP interpreter, even though "... | TITLE:
Why is Apache executing .php.html files as PHP?
QUESTION:
I have an odd problem...I'm using a documentation generator which generates a lot of output like docs/foo.php.html. It's XHTML, and thus contains tags at the beginning of file. The problem is, Apache has somehow decided to run it through the PHP interpre... | [
"php",
"html",
"apache"
] | 4 | 11 | 2,355 | 3 | 0 | 2008-10-10T01:10:28.963000 | 2008-10-10T05:27:18.413000 |
189,787 | 189,834 | How to format methods with large parameter lists | I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this: public Booking createVehicleBooking(Long officeId, Long start, Long end, String origin, String destination, String purpose, String requirements, Integer numberOfPassengers) throws ServiceExcepti... | A large set of parameters like this is often (but not always) an indicator that you could be using an object to represent the parameter set. This is especially true if either: There are several methods with similar large parameter sets, that can be replaced with a single method taking a parameter object. The method is ... | How to format methods with large parameter lists I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this: public Booking createVehicleBooking(Long officeId, Long start, Long end, String origin, String destination, String purpose, String requirements, ... | TITLE:
How to format methods with large parameter lists
QUESTION:
I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this: public Booking createVehicleBooking(Long officeId, Long start, Long end, String origin, String destination, String purpose, Str... | [
"java",
"formatting",
"methods"
] | 23 | 18 | 15,006 | 6 | 0 | 2008-10-10T01:14:41.480000 | 2008-10-10T01:35:09.037000 |
189,791 | 189,795 | Stop overlooking minor details | Compared to most people on this site I am admittedly a novice. I wanted to get some advice from the pros on how to avoid making stupid errors in your code. Is there anyone else who had the problem when they were first starting out of missing some detail that causes big problems? Are there any habits or behaviors that h... | Here's a list of common pitfalls, and/or suggestions to avoid them: Experience, the best way to avoid mistakes is to have already had them happen to you. Review other people's code Have other people review your code Use source control, even if you are the only developer Review all of your changes before doing a commit ... | Stop overlooking minor details Compared to most people on this site I am admittedly a novice. I wanted to get some advice from the pros on how to avoid making stupid errors in your code. Is there anyone else who had the problem when they were first starting out of missing some detail that causes big problems? Are there... | TITLE:
Stop overlooking minor details
QUESTION:
Compared to most people on this site I am admittedly a novice. I wanted to get some advice from the pros on how to avoid making stupid errors in your code. Is there anyone else who had the problem when they were first starting out of missing some detail that causes big p... | [
"language-agnostic"
] | 13 | 34 | 1,634 | 26 | 0 | 2008-10-10T01:16:00.013000 | 2008-10-10T01:17:22.397000 |
189,799 | 189,824 | Factory Class - Save Objects | I have a factory class that populates objects with data. I want to implementing saving from the object, but do not want to populate the object with db stuff - is it stupid to have my Factory that creates the class also save the data? ie: in my.Save() method on the object i would call Factory.Save(myObject); | If you are concerned about database stuff in classes - have you considered using O/R mapper? This would keep the database stuff entirely out of your code and your domain objects clean. Maybe take a look at NHibernate or Active Record. | Factory Class - Save Objects I have a factory class that populates objects with data. I want to implementing saving from the object, but do not want to populate the object with db stuff - is it stupid to have my Factory that creates the class also save the data? ie: in my.Save() method on the object i would call Factor... | TITLE:
Factory Class - Save Objects
QUESTION:
I have a factory class that populates objects with data. I want to implementing saving from the object, but do not want to populate the object with db stuff - is it stupid to have my Factory that creates the class also save the data? ie: in my.Save() method on the object i... | [
"c#",
"factory"
] | 5 | 3 | 995 | 3 | 0 | 2008-10-10T01:18:09.273000 | 2008-10-10T01:26:14.670000 |
189,831 | 190,826 | Should we upgrade to SQL Server 2005 or 2008? | Our company is considering upgrading our SQL server. At this point, would it be better to upgrade to 2005 or 2008? Here are some of my considerations: Features Licensing costs Learning curve Bear in mind our staff has already been using SQL server 2000 for many years. | If you're porting your SQL Server 2000 codebase to SQL Server 2005 or 2008 the effort to go to 2008 is not going to be significantly greater. While 2008 has some features over 2005 the difference is not so great as the jump from 2000 to 2005. I would suggest going straight to SQL Server 2008 with the following major pr... | Should we upgrade to SQL Server 2005 or 2008? Our company is considering upgrading our SQL server. At this point, would it be better to upgrade to 2005 or 2008? Here are some of my considerations: Features Licensing costs Learning curve Bear in mind our staff has already been using SQL server 2000 for many years. | TITLE:
Should we upgrade to SQL Server 2005 or 2008?
QUESTION:
Our company is considering upgrading our SQL server. At this point, would it be better to upgrade to 2005 or 2008? Here are some of my considerations: Features Licensing costs Learning curve Bear in mind our staff has already been using SQL server 2000 for... | [
"sql-server",
"ssis"
] | 4 | 4 | 920 | 4 | 0 | 2008-10-10T01:33:25.670000 | 2008-10-10T10:58:48.790000 |
189,850 | 189,877 | What is the javascript MIME type for the type attribute of a script tag? | What is the MIME type of javascript? More specifically, what is the right thing to put in the "type" attribute of a script tag? application/x-javascript and text/javascript seem to be the main contenders. | This is a common mistake. The MIME type for javascript wasn't standardized for years. It's now officially: " application/javascript ". The real kicker here is that most browsers won't use that attribute anyway, at least not in the case of the script tag. They actually peek inside the packet and determine the type for t... | What is the javascript MIME type for the type attribute of a script tag? What is the MIME type of javascript? More specifically, what is the right thing to put in the "type" attribute of a script tag? application/x-javascript and text/javascript seem to be the main contenders. | TITLE:
What is the javascript MIME type for the type attribute of a script tag?
QUESTION:
What is the MIME type of javascript? More specifically, what is the right thing to put in the "type" attribute of a script tag? application/x-javascript and text/javascript seem to be the main contenders.
ANSWER:
This is a commo... | [
"javascript",
"mime-types"
] | 124 | 151 | 95,457 | 5 | 0 | 2008-10-10T01:48:40.930000 | 2008-10-10T02:08:38.313000 |
189,851 | 189,869 | Converting a class library to a webapp in Visual Basic? | I was delivered several hundred source files for a web app original written in classic ASP, but somewhat ported to VisualBasic.NET and ASP.NET It didn't come with any form of project or solution files. I'm trying to get it setup to build, but am struggling. If I try to open it as a WebSite (ala Web Site instead of Web ... | You could create a new ASP.NET Web Application Project in Visual Studio, delete the default files that are created, then add all the existing files to the project. This seems like the easiest way to get started that I would try first. | Converting a class library to a webapp in Visual Basic? I was delivered several hundred source files for a web app original written in classic ASP, but somewhat ported to VisualBasic.NET and ASP.NET It didn't come with any form of project or solution files. I'm trying to get it setup to build, but am struggling. If I t... | TITLE:
Converting a class library to a webapp in Visual Basic?
QUESTION:
I was delivered several hundred source files for a web app original written in classic ASP, but somewhat ported to VisualBasic.NET and ASP.NET It didn't come with any form of project or solution files. I'm trying to get it setup to build, but am ... | [
"asp.net",
"vb.net"
] | 1 | 3 | 231 | 2 | 0 | 2008-10-10T01:48:44.983000 | 2008-10-10T02:02:26.453000 |
189,855 | 189,900 | N-ary trees in C | Which would be a neat implemenation of a N-ary tree in C language? Particulary, I want to implement an n-ary tree, not self-ballancing, with an unbound number of children in each node, in which each node holds an already defined struct, like this for example: struct task { char command[MAX_LENGTH]; int required_time; }... | As a first pass, you could simply create a struct (let's call it TreeNode ) which holds a task, as well as a set of pointers to TreeNode s. This set could either be an array (if N is fixed) or a linked list (if N is variable). The linked list would require you to declare an additional struct (let's called it ListNode )... | N-ary trees in C Which would be a neat implemenation of a N-ary tree in C language? Particulary, I want to implement an n-ary tree, not self-ballancing, with an unbound number of children in each node, in which each node holds an already defined struct, like this for example: struct task { char command[MAX_LENGTH]; int... | TITLE:
N-ary trees in C
QUESTION:
Which would be a neat implemenation of a N-ary tree in C language? Particulary, I want to implement an n-ary tree, not self-ballancing, with an unbound number of children in each node, in which each node holds an already defined struct, like this for example: struct task { char comman... | [
"c",
"struct",
"n-ary-tree",
"abstract-data-type"
] | 17 | 14 | 19,861 | 2 | 0 | 2008-10-10T01:52:09.423000 | 2008-10-10T02:21:00.880000 |
189,873 | 189,879 | What is the best way to remotely manage a Sqlite DB? | We have an Sqlite DB on our Linux/PHP production webserver. What is the best way to manage it remotely? I've found some server wrappers are available and some applications claim to offer remote access methods. Any suggestions? | SSH in and use the SQLite command-line client. But...why are you using SQLite on a production webserver!? Even the SQLite website advises against this! | What is the best way to remotely manage a Sqlite DB? We have an Sqlite DB on our Linux/PHP production webserver. What is the best way to manage it remotely? I've found some server wrappers are available and some applications claim to offer remote access methods. Any suggestions? | TITLE:
What is the best way to remotely manage a Sqlite DB?
QUESTION:
We have an Sqlite DB on our Linux/PHP production webserver. What is the best way to manage it remotely? I've found some server wrappers are available and some applications claim to offer remote access methods. Any suggestions?
ANSWER:
SSH in and us... | [
"sqlite",
"remote-administration"
] | 0 | 0 | 1,796 | 2 | 0 | 2008-10-10T02:06:42.280000 | 2008-10-10T02:09:30.480000 |
189,887 | 190,011 | if statements in mysql? | is there an if statement when it comes to mysql query statements? when i am updating a table record, i want to only update certain columns if they have a value to be updated. for example, i want an update table function, and there is a table for volunteers and a table for people who just want email updates. i want to u... | I think this should work: UPDATE volunteer, people SET volunteer.email = 'me@email.com', people.email = 'other@gmail.com', people.first_name = 'first', WHERE people.id = 2 AND volunteer.id = 5; I got this from the update syntax on the MySQL website. | if statements in mysql? is there an if statement when it comes to mysql query statements? when i am updating a table record, i want to only update certain columns if they have a value to be updated. for example, i want an update table function, and there is a table for volunteers and a table for people who just want em... | TITLE:
if statements in mysql?
QUESTION:
is there an if statement when it comes to mysql query statements? when i am updating a table record, i want to only update certain columns if they have a value to be updated. for example, i want an update table function, and there is a table for volunteers and a table for peopl... | [
"php",
"mysql"
] | 0 | 3 | 3,756 | 2 | 0 | 2008-10-10T02:13:28.477000 | 2008-10-10T03:25:06.740000 |
189,889 | 189,955 | Java MessageFormat - How can I insert values between single quotes? | I'm having a problem using the java.text.MessageFormat object. I'm trying to create SQL insert statements. The problem is, when I do something like this: MessageFormat messageFormat = "insert into {0} values ( '{1}', '{2}', '{3}', {4} )"; Object[] args = { str0, str1, str2, str3, str4 }; String result = messageFormat.f... | I just tried double quotes and it worked fine for me: MessageFormat messageFormat = new MessageFormat("insert into {0} values ( ''{1}'', ''{2}'', ''{3}'', {4} )"); Object[] args = {"000", "111", "222","333","444","555"}; String result = messageFormat.format(args); The result is: insert into 000 values ( '111', '222', '... | Java MessageFormat - How can I insert values between single quotes? I'm having a problem using the java.text.MessageFormat object. I'm trying to create SQL insert statements. The problem is, when I do something like this: MessageFormat messageFormat = "insert into {0} values ( '{1}', '{2}', '{3}', {4} )"; Object[] args... | TITLE:
Java MessageFormat - How can I insert values between single quotes?
QUESTION:
I'm having a problem using the java.text.MessageFormat object. I'm trying to create SQL insert statements. The problem is, when I do something like this: MessageFormat messageFormat = "insert into {0} values ( '{1}', '{2}', '{3}', {4}... | [
"java"
] | 69 | 123 | 63,080 | 5 | 0 | 2008-10-10T02:15:16.710000 | 2008-10-10T02:44:06.340000 |
189,892 | 189,907 | Best practices for handling variable size arrays in c / c++? | If I have an array of a fixed size depending on how it is defined and used, I typically use one of two ways to reference it. Array type 1: Since it is a fixed size based on a define, I just use that define in all my loops referencing it. #define MAXPLAYERS 4
int playerscores[MAXPLAYERS];
for(i=0;i Array type 2: Since... | This will work for both of your cases, regardless of array element type: #define ARRAY_COUNT(x) (sizeof(x)/sizeof((x)[0]))...
struct foo arr[100];...
for (i = 0; i < ARRAY_COUNT(arr); ++i) { /* do stuff to arr[i] */ } | Best practices for handling variable size arrays in c / c++? If I have an array of a fixed size depending on how it is defined and used, I typically use one of two ways to reference it. Array type 1: Since it is a fixed size based on a define, I just use that define in all my loops referencing it. #define MAXPLAYERS 4
... | TITLE:
Best practices for handling variable size arrays in c / c++?
QUESTION:
If I have an array of a fixed size depending on how it is defined and used, I typically use one of two ways to reference it. Array type 1: Since it is a fixed size based on a define, I just use that define in all my loops referencing it. #de... | [
"c++",
"c",
"arrays"
] | 4 | 7 | 8,486 | 9 | 0 | 2008-10-10T02:16:26.520000 | 2008-10-10T02:23:45.647000 |
189,893 | 189,924 | Is there any way to get code folding in Delphi 7? | I know this is a long shot - but is there any way at all to get code folding into Delphi 7? I'm working on some.. "suboptimal".. code. Sometimes I really need to fold bits away to grok a stupid-long procedure. Currently I'm pasting code into Notepad++, which works, but it would be nice to have it in the IDE. | Look for "method folding" on this FAQ (for GExperts) and you'll see that even this team, which has added many enhancements to Delphi, doesn't think this is in the cards for Delphi 7. I've looked for solutions and haven't seen them. | Is there any way to get code folding in Delphi 7? I know this is a long shot - but is there any way at all to get code folding into Delphi 7? I'm working on some.. "suboptimal".. code. Sometimes I really need to fold bits away to grok a stupid-long procedure. Currently I'm pasting code into Notepad++, which works, but ... | TITLE:
Is there any way to get code folding in Delphi 7?
QUESTION:
I know this is a long shot - but is there any way at all to get code folding into Delphi 7? I'm working on some.. "suboptimal".. code. Sometimes I really need to fold bits away to grok a stupid-long procedure. Currently I'm pasting code into Notepad++,... | [
"delphi",
"delphi-7",
"code-folding"
] | 2 | 5 | 3,174 | 5 | 0 | 2008-10-10T02:16:41.963000 | 2008-10-10T02:33:50.993000 |
189,903 | 195,131 | Scaling solutions for MySQL (Replication, Clustering) | At the startup I'm working at we are now considering scaling solutions for our database. Things get somewhat confusing (for me at least) with MySQL, which has the MySQL cluster, replication and MySQL cluster replication (from ver. 5.1.6), which is an asynchronous version of the MySQL cluster. The MySQL manual explains ... | I've been doing A LOT of reading on the available options. I also got my hands on High Performance MySQL 2nd edition, which I highly recommend. This is what I've managed to piece together: Clustering Clustering in the general sense is distributing load across many servers that appear to an outside application as one se... | Scaling solutions for MySQL (Replication, Clustering) At the startup I'm working at we are now considering scaling solutions for our database. Things get somewhat confusing (for me at least) with MySQL, which has the MySQL cluster, replication and MySQL cluster replication (from ver. 5.1.6), which is an asynchronous ve... | TITLE:
Scaling solutions for MySQL (Replication, Clustering)
QUESTION:
At the startup I'm working at we are now considering scaling solutions for our database. Things get somewhat confusing (for me at least) with MySQL, which has the MySQL cluster, replication and MySQL cluster replication (from ver. 5.1.6), which is ... | [
"mysql",
"replication",
"scaling",
"cluster-computing",
"database-cluster"
] | 86 | 106 | 37,038 | 9 | 0 | 2008-10-10T02:21:52.657000 | 2008-10-12T05:23:19.140000 |
189,906 | 330,061 | Upgrade Subversion 1.4.3 to 1.5.2 on Debian (hosted account) | I'm trying to upgrade my subversion server (I have it hosted with Dreamhost) This is what I run: wget http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2 wget http://subversion.tigris.org/downloads/subversion-deps-1.5.2.tar.bz2 tar -xjf subversion-1.5.2.tar.bz2 tar -xjf subversion-deps-1.5.2.tar.bz2 cd subv... | If you're using openssl with SVN then you need to configure SVN with./configure.... --with-openssl=/path/to/openssl When I've done this in the past I've had issues building other binaries that use this lib if I don't specify the -fPIC flag. So it's best to run make with that parameter (if you have that issue). You may ... | Upgrade Subversion 1.4.3 to 1.5.2 on Debian (hosted account) I'm trying to upgrade my subversion server (I have it hosted with Dreamhost) This is what I run: wget http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2 wget http://subversion.tigris.org/downloads/subversion-deps-1.5.2.tar.bz2 tar -xjf subversion... | TITLE:
Upgrade Subversion 1.4.3 to 1.5.2 on Debian (hosted account)
QUESTION:
I'm trying to upgrade my subversion server (I have it hosted with Dreamhost) This is what I run: wget http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2 wget http://subversion.tigris.org/downloads/subversion-deps-1.5.2.tar.bz2 t... | [
"linux",
"svn",
"version-control",
"debian",
"dreamhost"
] | 3 | 2 | 9,585 | 6 | 0 | 2008-10-10T02:22:49.643000 | 2008-12-01T04:44:33.350000 |
189,925 | 189,961 | password encryption in iphone apps | I need to store the user's password in my iphone app. When posting an app to the app store, I have to tell Apple if there's encryption in the app for export purposes. I don't want my app to be restricted to US only, but I also don't want to store or send passwords over the net in clear text. So basically the question i... | Looks like the supplied crypt() function can be used for passwords: This library (FreeSec 1.0) was developed outside the United States of America as an unencumbered replacement for the U.S.only libcrypt encryption library. Programs linked against the crypt() interface may be exported from the U.S.A. only if they use cr... | password encryption in iphone apps I need to store the user's password in my iphone app. When posting an app to the app store, I have to tell Apple if there's encryption in the app for export purposes. I don't want my app to be restricted to US only, but I also don't want to store or send passwords over the net in clea... | TITLE:
password encryption in iphone apps
QUESTION:
I need to store the user's password in my iphone app. When posting an app to the app store, I have to tell Apple if there's encryption in the app for export purposes. I don't want my app to be restricted to US only, but I also don't want to store or send passwords ov... | [
"iphone",
"encryption"
] | 9 | 5 | 8,419 | 3 | 0 | 2008-10-10T02:34:01.743000 | 2008-10-10T02:46:13.293000 |
189,934 | 189,966 | What's the equivalent of XMLHTTP from VB6 in C# .Net 2005? | I'm trying to convert some code that worked great in VB, but I can't figure out what objects to use in.Net. Dim oXMLHttp As XMLHTTP oXMLHttp = New XMLHTTP oXMLHttp.open "POST", "https://www.server.com/path", False oXMLHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" oXMLHttp.send requestString ... | See the following for a sample which does this: http://www.codeproject.com/KB/dotnet/NET_Interact_j2EE.aspx I have put the sample below. Sorry, I know it's big, but you never know how long links like this will stay valid. NOTE: the first version of the question didn't say in C#.NET - it just said "in.NET". (perhaps it ... | What's the equivalent of XMLHTTP from VB6 in C# .Net 2005? I'm trying to convert some code that worked great in VB, but I can't figure out what objects to use in.Net. Dim oXMLHttp As XMLHTTP oXMLHttp = New XMLHTTP oXMLHttp.open "POST", "https://www.server.com/path", False oXMLHttp.setRequestHeader "Content-Type", "appl... | TITLE:
What's the equivalent of XMLHTTP from VB6 in C# .Net 2005?
QUESTION:
I'm trying to convert some code that worked great in VB, but I can't figure out what objects to use in.Net. Dim oXMLHttp As XMLHTTP oXMLHttp = New XMLHTTP oXMLHttp.open "POST", "https://www.server.com/path", False oXMLHttp.setRequestHeader "Co... | [
"c#",
"xml",
"http",
"vb6"
] | 3 | 1 | 8,261 | 2 | 0 | 2008-10-10T02:35:32.597000 | 2008-10-10T02:47:45.660000 |
189,943 | 3,935,002 | How can I quantify difference between two images? | Here's what I would like to do: I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest snapshot. I imagine there's some way of quantifying the difference, and I wou... | General idea Option 1: Load both images as arrays ( scipy.misc.imread ) and calculate an element-wise (pixel-by-pixel) difference. Calculate the norm of the difference. Option 2: Load both images. Calculate some feature vector for each of them (like a histogram). Calculate distance between feature vectors rather than i... | How can I quantify difference between two images? Here's what I would like to do: I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest snapshot. I imagine there's... | TITLE:
How can I quantify difference between two images?
QUESTION:
Here's what I would like to do: I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest snapshot.... | [
"python",
"image-processing",
"background-subtraction",
"image-comparison",
"timelapse"
] | 227 | 314 | 261,659 | 25 | 0 | 2008-10-10T02:39:33.650000 | 2010-10-14T15:43:55.083000 |
189,947 | 190,371 | How to detect intermittent time out problem in web applications? | Have a n-tire web application and search often times out after 30 secs. How to detect the root cause of the problem? | Log at separation of concerns, in this case at the boundaries of each layer. when you say search, I'd assume that this is a web app where the user is searching for some text. Is the DB search involved? Is there a possibility that your garbage collector is kicking in and the search timed out? Try to log your garbage col... | How to detect intermittent time out problem in web applications? Have a n-tire web application and search often times out after 30 secs. How to detect the root cause of the problem? | TITLE:
How to detect intermittent time out problem in web applications?
QUESTION:
Have a n-tire web application and search often times out after 30 secs. How to detect the root cause of the problem?
ANSWER:
Log at separation of concerns, in this case at the boundaries of each layer. when you say search, I'd assume th... | [
"java",
"web-services"
] | 1 | 0 | 581 | 3 | 0 | 2008-10-10T02:40:47.767000 | 2008-10-10T07:04:58.200000 |
189,954 | 189,963 | VB.NET generics to C# syntax | Could you please show me the C# Equivalent of this VB.NET code: Public Partial Class Index Inherits System.Web.Mvc.Viewpage(Of List(Of Task))
End Class I am not sure where/how to add it in for C#: public partial class DirList: System.Web.Mvc.ViewPage {
} The code is suppose to tell the class to expect a list of tasks... | public partial class DirList: System.Web.Mvc.ViewPage > {
} | VB.NET generics to C# syntax Could you please show me the C# Equivalent of this VB.NET code: Public Partial Class Index Inherits System.Web.Mvc.Viewpage(Of List(Of Task))
End Class I am not sure where/how to add it in for C#: public partial class DirList: System.Web.Mvc.ViewPage {
} The code is suppose to tell the cl... | TITLE:
VB.NET generics to C# syntax
QUESTION:
Could you please show me the C# Equivalent of this VB.NET code: Public Partial Class Index Inherits System.Web.Mvc.Viewpage(Of List(Of Task))
End Class I am not sure where/how to add it in for C#: public partial class DirList: System.Web.Mvc.ViewPage {
} The code is supp... | [
"c#",
"asp.net-mvc",
"vb.net",
"generics"
] | 7 | 14 | 797 | 1 | 0 | 2008-10-10T02:43:38.540000 | 2008-10-10T02:46:39.923000 |
189,972 | 191,821 | Argument-parsing helpers for C/Unix | I know of the following: The venerable getopt(3) The extended getopt_long glibc's argp parser for Unix-style argument vectors popt from the GNOME project (or its spiritual successor in Glib ) I'm sure there's more that I haven't used or even heard of; a quick Google search reveals Gopt, argtable, and Optlist. Personall... | GNU has gengetopt which generates code for an options data structure and the getopt_long code to parse the command line and fill the structure.. It's fairly easy to learn and works well. As a bonus you can pass the options structure around your code and avoid global storage if desired. It provides GNU style semantics (... | Argument-parsing helpers for C/Unix I know of the following: The venerable getopt(3) The extended getopt_long glibc's argp parser for Unix-style argument vectors popt from the GNOME project (or its spiritual successor in Glib ) I'm sure there's more that I haven't used or even heard of; a quick Google search reveals Go... | TITLE:
Argument-parsing helpers for C/Unix
QUESTION:
I know of the following: The venerable getopt(3) The extended getopt_long glibc's argp parser for Unix-style argument vectors popt from the GNOME project (or its spiritual successor in Glib ) I'm sure there's more that I haven't used or even heard of; a quick Google... | [
"c",
"command-line",
"parsing"
] | 44 | 18 | 18,021 | 7 | 0 | 2008-10-10T02:51:08.430000 | 2008-10-10T15:17:52.047000 |
189,981 | 200,604 | Strange OpenGL ES behavior in iPhone app | I'm making a simple 2D game for the iPhone. It's based on CrashLanding. so it's basically a background texture and a few rectangular textures moving around. I have this bizarre little graphics problem: some of the small 2d items (can assume just rectangles) moving around get this little flashing black bar on top of the... | Do you have a thing like that little black bar in your textures? I've encountered similar problems when I have done something wrong. Here's a small check-list: Have you have mipmapped your texture or not, and check what parameters does it have. glTexParameters. (WRAP_S, WRAP_T, MAG_FILTER, MIN_FILTER...) texture's dime... | Strange OpenGL ES behavior in iPhone app I'm making a simple 2D game for the iPhone. It's based on CrashLanding. so it's basically a background texture and a few rectangular textures moving around. I have this bizarre little graphics problem: some of the small 2d items (can assume just rectangles) moving around get thi... | TITLE:
Strange OpenGL ES behavior in iPhone app
QUESTION:
I'm making a simple 2D game for the iPhone. It's based on CrashLanding. so it's basically a background texture and a few rectangular textures moving around. I have this bizarre little graphics problem: some of the small 2d items (can assume just rectangles) mov... | [
"iphone",
"opengl-es"
] | 3 | 5 | 1,703 | 2 | 0 | 2008-10-10T02:55:15.413000 | 2008-10-14T10:05:36.293000 |
189,988 | 190,052 | "Inline" Class Instantiation in PHP? (For Ease of Method Chaining) | An idiom commonly used in OO languages like Python and Ruby is instantiating an object and chaining methods that return a reference to the object itself, such as: s = User.new.login.get_db_data.get_session_data In PHP, it is possible to replicate this behavior like so: $u = new User(); $s = $u->login()->get_db_data()->... | All of these proposed solutions complicate your code in order to bend PHP to accomplish some syntactic nicety. Wanting PHP to be something it's not (like good) is the path to madness. I would just use: $u = new User(); $s = $u->login()->get_db_data()->get_session_data(); It is clear, relatively concise and involves no ... | "Inline" Class Instantiation in PHP? (For Ease of Method Chaining) An idiom commonly used in OO languages like Python and Ruby is instantiating an object and chaining methods that return a reference to the object itself, such as: s = User.new.login.get_db_data.get_session_data In PHP, it is possible to replicate this b... | TITLE:
"Inline" Class Instantiation in PHP? (For Ease of Method Chaining)
QUESTION:
An idiom commonly used in OO languages like Python and Ruby is instantiating an object and chaining methods that return a reference to the object itself, such as: s = User.new.login.get_db_data.get_session_data In PHP, it is possible t... | [
"php",
"oop",
"static-methods"
] | 9 | 14 | 8,384 | 6 | 0 | 2008-10-10T02:57:57.543000 | 2008-10-10T03:44:55.577000 |
190,006 | 190,018 | Online C reference manuals | I've studied C programming in college some years ago and have developed some medium applications back then (nothing serious). Now I have to develop some more 'advanced' C applications (involving POSIX threads and RPC), but right now I'm a little rusty even with the basics. Can anyone recommend me good online C referenc... | C standard library reference (both C89 and C99) C89 library reference guide GNU C tutorial (more than just a tutorial, quite a useful reference) I got these all from a previous similar question on SO. I would like to credit the original posters, but unfortunately cannot seem to find that question. | Online C reference manuals I've studied C programming in college some years ago and have developed some medium applications back then (nothing serious). Now I have to develop some more 'advanced' C applications (involving POSIX threads and RPC), but right now I'm a little rusty even with the basics. Can anyone recommen... | TITLE:
Online C reference manuals
QUESTION:
I've studied C programming in college some years ago and have developed some medium applications back then (nothing serious). Now I have to develop some more 'advanced' C applications (involving POSIX threads and RPC), but right now I'm a little rusty even with the basics. C... | [
"c",
"reference-manual"
] | 19 | 6 | 15,829 | 9 | 0 | 2008-10-10T03:21:36.437000 | 2008-10-10T03:28:30.587000 |
190,010 | 190,017 | Daemon Threads Explanation | In the Python documentation it says: A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. Does anyone have a clearer explanation of what that means or a practical ex... | Some threads do background tasks, like sending keepalive packets, or performing periodic garbage collection, or whatever. These are only useful when the main program is running, and it's okay to kill them off once the other, non-daemon, threads have exited. Without daemon threads, you'd have to keep track of them, and ... | Daemon Threads Explanation In the Python documentation it says: A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. Does anyone have a clearer explanation of what t... | TITLE:
Daemon Threads Explanation
QUESTION:
In the Python documentation it says: A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. Does anyone have a clearer exp... | [
"python",
"multithreading",
"daemon",
"python-multithreading"
] | 298 | 542 | 172,584 | 9 | 0 | 2008-10-10T03:24:07.490000 | 2008-10-10T03:27:36.143000 |
190,043 | 190,305 | Add a IIS host header to website programmatically | I would like to setup a admin page (ASP.NET/C#) that can add IIS host headers to the website that the admin page is hosted on. Is this possible? I dont want to add a http header - I want to mimick the action of going into IIS manually, bringing up the properties of the website, clicking advanced on the website tab, and... | Here's a forum on Adding Another Identity To A Site Programmatically RSS Also, here's an article on how to Append a host header by code in IIS: The following example adds a host header to a website in IIS. This involves changing the ServerBindings property. There is no Append method that can be used to append a new ser... | Add a IIS host header to website programmatically I would like to setup a admin page (ASP.NET/C#) that can add IIS host headers to the website that the admin page is hosted on. Is this possible? I dont want to add a http header - I want to mimick the action of going into IIS manually, bringing up the properties of the ... | TITLE:
Add a IIS host header to website programmatically
QUESTION:
I would like to setup a admin page (ASP.NET/C#) that can add IIS host headers to the website that the admin page is hosted on. Is this possible? I dont want to add a http header - I want to mimick the action of going into IIS manually, bringing up the ... | [
"c#",
"asp.net",
"iis",
"hostheader"
] | 6 | 2 | 4,007 | 1 | 0 | 2008-10-10T03:41:26.800000 | 2008-10-10T06:09:53.053000 |
190,045 | 453,398 | What's the best way to copy/fill a large array with a smaller array in C#? | I have a large int[] array and a much smaller int[] array. I want to fill up the large array with values from the small array, by repeat copying the small array into the large array until it is full (so that large[0] = large[13] = large[26]... = small[0] etc.). I already have a simple method: int iSource = 0; for (int ... | Interestingly the winning answer is the slowest with the provided source array! The solution I was going to propose was for (int i = 0; i < destArray.Length; i++) { destArray[i] = sourceArray[i%sourceArray.Length]; } but when i tested the perf over 100000 iterations using the inputs in the answering question it perform... | What's the best way to copy/fill a large array with a smaller array in C#? I have a large int[] array and a much smaller int[] array. I want to fill up the large array with values from the small array, by repeat copying the small array into the large array until it is full (so that large[0] = large[13] = large[26]... =... | TITLE:
What's the best way to copy/fill a large array with a smaller array in C#?
QUESTION:
I have a large int[] array and a much smaller int[] array. I want to fill up the large array with values from the small array, by repeat copying the small array into the large array until it is full (so that large[0] = large[13... | [
"c#",
"arrays",
".net-2.0"
] | 3 | 2 | 8,154 | 4 | 0 | 2008-10-10T03:42:52.603000 | 2009-01-17T14:51:27.970000 |
190,049 | 190,079 | Using LIMIT when searching by a unique field | Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(32) NOT NULL, `username` varchar(16) NOT NULL, `password` char(32) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ); Is there any use in using the LIMIT keyword when searching by user... | I've always been told and read that you should include the LIMIT everytime you only want 1 result. This just tells the DB that it should stop so matter what. In your case, you're probably right it doesn't make a difference, but I think it's better just to always do than always deciding and leaving it out one time when ... | Using LIMIT when searching by a unique field Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(32) NOT NULL, `username` varchar(16) NOT NULL, `password` char(32) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ); Is there any use in u... | TITLE:
Using LIMIT when searching by a unique field
QUESTION:
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(32) NOT NULL, `username` varchar(16) NOT NULL, `password` char(32) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ); Is ... | [
"sql",
"indexing"
] | 3 | 2 | 180 | 3 | 0 | 2008-10-10T03:44:15.330000 | 2008-10-10T03:55:25.137000 |
190,054 | 190,117 | How to query a model based off the controller name | I've been refactoring my models and controllers in an effort to remove code duplication, and so far it seems to be all peachy creamy. Currently I've got a bit of code that is common to two of my controllers, like so: def process_filters # Filter hash we're going to pass to the model filter_to_use = {}
# To process fil... | You can move this code into module, mixin this module in all controllers you need and use self.class variable inside module to figure out concrete controller name. With this name you can use standard string functions (e.g. capitalize) and Kernel.const_get function to get classes by their names. | How to query a model based off the controller name I've been refactoring my models and controllers in an effort to remove code duplication, and so far it seems to be all peachy creamy. Currently I've got a bit of code that is common to two of my controllers, like so: def process_filters # Filter hash we're going to pas... | TITLE:
How to query a model based off the controller name
QUESTION:
I've been refactoring my models and controllers in an effort to remove code duplication, and so far it seems to be all peachy creamy. Currently I've got a bit of code that is common to two of my controllers, like so: def process_filters # Filter hash ... | [
"ruby-on-rails",
"ruby"
] | 2 | 2 | 1,689 | 2 | 0 | 2008-10-10T03:45:54.653000 | 2008-10-10T04:20:53.413000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.