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
105,174
105,265
How do you deal with configuration management of Database Tables?
How do you deal with source control management and automated deployment (configuration management) of database tables. I work in a SQL Server environment and it's pretty easy to script out drop and create files for stored procedures/triggers/functions even jobs. It's also easy to handle scripting out the creation of a ...
You can automatically create the initial creation script, but ALTER scripts really need to be hand-coded on a case-by-case basis, because in practice you need to do custom stuff in them. In any case, you'll need some way of creating apply and rollback scripts for each change, and have an installer script which runs the...
How do you deal with configuration management of Database Tables? How do you deal with source control management and automated deployment (configuration management) of database tables. I work in a SQL Server environment and it's pretty easy to script out drop and create files for stored procedures/triggers/functions ev...
TITLE: How do you deal with configuration management of Database Tables? QUESTION: How do you deal with source control management and automated deployment (configuration management) of database tables. I work in a SQL Server environment and it's pretty easy to script out drop and create files for stored procedures/tri...
[ "sql", "sql-server", "database", "t-sql" ]
5
1
2,535
6
0
2008-09-19T20:16:32.590000
2008-09-19T20:24:26.813000
105,177
108,128
Ruby Soap4R Web Service, .NET Consumer
How do I generate WSDL from a Web Service in Ruby using Soap4R (SOAP::RPC::StandaloneServer) that would be consumed from.NET?
There's not a way to do this through SOAP4R, unfortunately. SOAP4R is more for interacting with SOAP endpoints, or generating your own through a WSDL specification. The only Ruby code I know that does this comes from ActionWebService, which was part of Rails, pre-Rails 2. If you install the gem actionwebservice (you'll...
Ruby Soap4R Web Service, .NET Consumer How do I generate WSDL from a Web Service in Ruby using Soap4R (SOAP::RPC::StandaloneServer) that would be consumed from.NET?
TITLE: Ruby Soap4R Web Service, .NET Consumer QUESTION: How do I generate WSDL from a Web Service in Ruby using Soap4R (SOAP::RPC::StandaloneServer) that would be consumed from.NET? ANSWER: There's not a way to do this through SOAP4R, unfortunately. SOAP4R is more for interacting with SOAP endpoints, or generating yo...
[ "ruby", "web-services", "soap4r" ]
4
2
1,582
1
0
2008-09-19T20:16:36.240000
2008-09-20T13:18:24.410000
105,198
105,650
Locking in C#
I'm still a little unclear and when to wrap a lock around some code. My general rule-of-thumb is to wrap an operation in a lock when it reads or writes to a static variable. But when a static variable is ONLY read (e.g. it's a readonly that is set during type initialization), accessing it doesn't need to be wrapped in ...
Since none of the code you've written modifies the static field after initialization, there is no need for any locking. Just replacing the string with a new value won't need synchronization either, unless the new value depends on the results of a read of the old value. Static fields aren't the only things that need syn...
Locking in C# I'm still a little unclear and when to wrap a lock around some code. My general rule-of-thumb is to wrap an operation in a lock when it reads or writes to a static variable. But when a static variable is ONLY read (e.g. it's a readonly that is set during type initialization), accessing it doesn't need to ...
TITLE: Locking in C# QUESTION: I'm still a little unclear and when to wrap a lock around some code. My general rule-of-thumb is to wrap an operation in a lock when it reads or writes to a static variable. But when a static variable is ONLY read (e.g. it's a readonly that is set during type initialization), accessing i...
[ "c#", "multithreading", "concurrency", "synchronization" ]
14
23
9,135
7
0
2008-09-19T20:19:01.273000
2008-09-19T21:10:36.110000
105,212
105,249
Recursively list all files in a directory including files in symlink directories
Suppose I have a directory /dir inside which there are 3 symlinks to other directories /dir/dir11, /dir/dir12, and /dir/dir13. I want to list all the files in dir including the ones in dir11, dir12 and dir13. To be more generic, I want to list all files including the ones in the directories which are symlinks. find., l...
The -L option to ls will accomplish what you want. It dereferences symbolic links. So your command would be: ls -LR You can also accomplish this with find -follow The -follow option directs find to follow symbolic links to directories. On Mac OS X use find -L as -follow has been deprecated.
Recursively list all files in a directory including files in symlink directories Suppose I have a directory /dir inside which there are 3 symlinks to other directories /dir/dir11, /dir/dir12, and /dir/dir13. I want to list all the files in dir including the ones in dir11, dir12 and dir13. To be more generic, I want to ...
TITLE: Recursively list all files in a directory including files in symlink directories QUESTION: Suppose I have a directory /dir inside which there are 3 symlinks to other directories /dir/dir11, /dir/dir12, and /dir/dir13. I want to list all the files in dir including the ones in dir11, dir12 and dir13. To be more g...
[ "linux" ]
189
285
507,996
8
0
2008-09-19T20:20:32.360000
2008-09-19T20:23:23.290000
105,223
105,543
What opensource CMS: generates clean xhtml, is skinable with css, and has a lightweight markup content editor?
See title. By lightweight markup I mean something like markdown or wikitext.
Well, silverstripe http://www.silverstripe.com/ is thought to be a good option for people who care about web standards, as is modx http://modxcms.com/ For a lighter editor, check out textpattern.com which uses textile (like markdown). If you're on rails, http://webby.rubyforge.org/ might do the trick. http://www.madeby...
What opensource CMS: generates clean xhtml, is skinable with css, and has a lightweight markup content editor? See title. By lightweight markup I mean something like markdown or wikitext.
TITLE: What opensource CMS: generates clean xhtml, is skinable with css, and has a lightweight markup content editor? QUESTION: See title. By lightweight markup I mean something like markdown or wikitext. ANSWER: Well, silverstripe http://www.silverstripe.com/ is thought to be a good option for people who care about ...
[ "language-agnostic", "content-management-system" ]
3
8
570
7
0
2008-09-19T20:21:20.863000
2008-09-19T20:54:24.497000
105,252
105,339
How do I convert between big-endian and little-endian values in C++?
How do I convert between big-endian and little-endian values in C++? For clarity, I have to translate binary data (double-precision floating point values and 32-bit and 64-bit integers) from one CPU architecture to another. This doesn't involve networking, so ntoh() and similar functions won't work here. Note: The answ...
If you're using Visual C++ do the following: You include intrin.h and call the following functions: For 16 bit numbers: unsigned short _byteswap_ushort(unsigned short value); For 32 bit numbers: unsigned long _byteswap_ulong(unsigned long value); For 64 bit numbers: unsigned __int64 _byteswap_uint64(unsigned __int64 va...
How do I convert between big-endian and little-endian values in C++? How do I convert between big-endian and little-endian values in C++? For clarity, I have to translate binary data (double-precision floating point values and 32-bit and 64-bit integers) from one CPU architecture to another. This doesn't involve networ...
TITLE: How do I convert between big-endian and little-endian values in C++? QUESTION: How do I convert between big-endian and little-endian values in C++? For clarity, I have to translate binary data (double-precision floating point values and 32-bit and 64-bit integers) from one CPU architecture to another. This does...
[ "c++", "endianness" ]
267
219
431,992
35
0
2008-09-19T20:23:36.363000
2008-09-19T20:31:38.887000
105,307
106,082
Thinking of learning Maven
I have a side project I do = in Java. It's a pretty straight-forward webapp. It runs in Tomcat on a Linux Server and uses a MySQL database. The majority of the code was written with the Spring Framework. It has a lot of Unit Tests in place. When I'm coding it's in Eclipse. When I deploy the application I run a few shel...
Your project does not sound like a project appropriate for Maven. You seem to have a working development environment. Why set up another one? It will just give you one more project file to maintain which breaks the good ol' DRY principle.
Thinking of learning Maven I have a side project I do = in Java. It's a pretty straight-forward webapp. It runs in Tomcat on a Linux Server and uses a MySQL database. The majority of the code was written with the Spring Framework. It has a lot of Unit Tests in place. When I'm coding it's in Eclipse. When I deploy the a...
TITLE: Thinking of learning Maven QUESTION: I have a side project I do = in Java. It's a pretty straight-forward webapp. It runs in Tomcat on a Linux Server and uses a MySQL database. The majority of the code was written with the Spring Framework. It has a lot of Unit Tests in place. When I'm coding it's in Eclipse. W...
[ "java", "maven-2" ]
8
4
3,370
10
0
2008-09-19T20:27:38.147000
2008-09-19T22:15:36.673000
105,308
111,010
How do I use mod_rewrite to change the path and filename of a URL
I want to take the url: http://www.mydomain.com/signup-12345 And actually give them: http://www.mydomain.com/signup/?aff=12345 I have NO history with mod_rewrite, HELP!
Something that I found relatively hard to find out was how to do the reverse of what you are doing, whereby you need to find out the value of part of the query string. So for example: If you wanted to rewrite the Url: http://www.example.com/signup- old -script. asp? aff =12345 to: http://www.example.com/signup- new -sc...
How do I use mod_rewrite to change the path and filename of a URL I want to take the url: http://www.mydomain.com/signup-12345 And actually give them: http://www.mydomain.com/signup/?aff=12345 I have NO history with mod_rewrite, HELP!
TITLE: How do I use mod_rewrite to change the path and filename of a URL QUESTION: I want to take the url: http://www.mydomain.com/signup-12345 And actually give them: http://www.mydomain.com/signup/?aff=12345 I have NO history with mod_rewrite, HELP! ANSWER: Something that I found relatively hard to find out was how...
[ "apache", "mod-rewrite" ]
2
2
2,558
3
0
2008-09-19T20:27:39.007000
2008-09-21T13:23:04.203000
105,310
105,366
Where'd my generic ActionLink go?
Moved from preview 2 to preview 5 and now my Html.ActionLink calls are all failing. It appears that the generic version has been replaced with a non-type safe version. // used to work <%= Html.ActionLink (c => c.Index(), "Home")%> // what appears I can only do now <%= Html.ActionLink ("Index", "Home")%> Why did The Gu ...
Don't blame the GU, it's my fault. That method has been moved to MvcFutures. Here's a blog post that provides the foundation for why this change was made.
Where'd my generic ActionLink go? Moved from preview 2 to preview 5 and now my Html.ActionLink calls are all failing. It appears that the generic version has been replaced with a non-type safe version. // used to work <%= Html.ActionLink (c => c.Index(), "Home")%> // what appears I can only do now <%= Html.ActionLink (...
TITLE: Where'd my generic ActionLink go? QUESTION: Moved from preview 2 to preview 5 and now my Html.ActionLink calls are all failing. It appears that the generic version has been replaced with a non-type safe version. // used to work <%= Html.ActionLink (c => c.Index(), "Home")%> // what appears I can only do now <%=...
[ "asp.net", "asp.net-mvc" ]
4
7
1,776
1
0
2008-09-19T20:28:02.407000
2008-09-19T20:34:17.943000
105,311
105,348
What are table-driven methods?
What is a "table-driven method"? As mentioned by Bill Gates in the second Windows Vista commercial at 1:05.
Table-driven methods are schemes that allow you to look up information in a table rather than using logic statements (i.e. case, if). In simple cases, it's quicker and easier to use logic statements, but as the logic chain becomes more complex, table-driven code is simpler than complicated logic, easier to modify and m...
What are table-driven methods? What is a "table-driven method"? As mentioned by Bill Gates in the second Windows Vista commercial at 1:05.
TITLE: What are table-driven methods? QUESTION: What is a "table-driven method"? As mentioned by Bill Gates in the second Windows Vista commercial at 1:05. ANSWER: Table-driven methods are schemes that allow you to look up information in a table rather than using logic statements (i.e. case, if). In simple cases, it'...
[ "design-patterns", "table-driven" ]
13
21
21,198
3
0
2008-09-19T20:28:10.033000
2008-09-19T20:32:22.693000
105,326
107,125
Gsoap Error in C++
I am using gsoap to create a soap server in C++. Messages are routed through a bus written in Java. Both the server and the bus are multithreaded. Everything works well sending one message at a time through the system. If I start 3 clients each sending messages as fast as possible everything is fine for about 3500 mess...
I believe you've got a resource leak in threadGO. After copying the soap struct with soap_copy(), I believe it needs to be freed by calling all of: soap_destroy(x); soap_end(x); soap_free(x); Specifically, the missing call to soap_done() (which is called from soap_free() ) calls soap_closesock(), which closes the socke...
Gsoap Error in C++ I am using gsoap to create a soap server in C++. Messages are routed through a bus written in Java. Both the server and the bus are multithreaded. Everything works well sending one message at a time through the system. If I start 3 clients each sending messages as fast as possible everything is fine ...
TITLE: Gsoap Error in C++ QUESTION: I am using gsoap to create a soap server in C++. Messages are routed through a bus written in Java. Both the server and the bus are multithreaded. Everything works well sending one message at a time through the system. If I start 3 clients each sending messages as fast as possible e...
[ "java", "c++", "soap", "gsoap" ]
0
1
2,980
1
0
2008-09-19T20:30:31.557000
2008-09-20T04:40:47.977000
105,330
105,376
Automated way to detect tests that can't fail, checked in to get by minmum code coverage?
I have a dev, that will get around our code coverage by writing tests that never fail. The code is just atrocious, but the tests never catch it because they assert(true). I code review, but I can't do everyones work for them, all the time. How do you get people like this motivated to make good software? Is there a buil...
Real motiviation comes from within. Some people will game the system every chance they get sometimes for no other reason than they can. Others do it simply because they are hacks. That said, assuming your the manager, have a "come to jesus" meeting with the dev. If that still doesn't work, there's always the door. If y...
Automated way to detect tests that can't fail, checked in to get by minmum code coverage? I have a dev, that will get around our code coverage by writing tests that never fail. The code is just atrocious, but the tests never catch it because they assert(true). I code review, but I can't do everyones work for them, all ...
TITLE: Automated way to detect tests that can't fail, checked in to get by minmum code coverage? QUESTION: I have a dev, that will get around our code coverage by writing tests that never fail. The code is just atrocious, but the tests never catch it because they assert(true). I code review, but I can't do everyones w...
[ "testing", "build-automation" ]
3
3
203
8
0
2008-09-19T20:30:50.497000
2008-09-19T20:35:16.913000
105,349
105,926
Bash prompt in OS X terminal broken
I am using bash in os X Terminal app, and my custom $PS1 breaks when I scroll through my history. PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\n\[${red}\$${NC}\]" also tried PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\r\n[${red}\$${NC}]" The problem seems to be in the newline. I have used this bash prompt on Slackware no prob.
You need the [ and ] arond every escape sequence; do $BLUE and the like include these? If not, they need to be bracketed with these calls.
Bash prompt in OS X terminal broken I am using bash in os X Terminal app, and my custom $PS1 breaks when I scroll through my history. PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\n\[${red}\$${NC}\]" also tried PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\r\n[${red}\$${NC}]" The problem seems to be in the newline. I have used thi...
TITLE: Bash prompt in OS X terminal broken QUESTION: I am using bash in os X Terminal app, and my custom $PS1 breaks when I scroll through my history. PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\n\[${red}\$${NC}\]" also tried PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\r\n[${red}\$${NC}]" The problem seems to be in the newlin...
[ "macos", "bash", "unix" ]
7
9
4,309
6
0
2008-09-19T20:32:30.290000
2008-09-19T21:48:56.877000
105,372
105,402
How to enumerate an enum?
How can you enumerate an enum in C#? E.g. the following code does not compile: public enum Suit { Spades, Hearts, Clubs, Diamonds } public void EnumerateAllSuitsDemoMethod() { foreach (Suit suit in Suit) { DoSomething(suit); } } And it gives the following compile-time error: 'Suit' is a 'type' but is used like a 'vari...
Update: If you're using.NET 5 or newer, use this solution. foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit))) { } Note: The cast to (Suit[]) is not strictly necessary, but it does make the code 0.5 ns faster.
How to enumerate an enum? How can you enumerate an enum in C#? E.g. the following code does not compile: public enum Suit { Spades, Hearts, Clubs, Diamonds } public void EnumerateAllSuitsDemoMethod() { foreach (Suit suit in Suit) { DoSomething(suit); } } And it gives the following compile-time error: 'Suit' is a 'type...
TITLE: How to enumerate an enum? QUESTION: How can you enumerate an enum in C#? E.g. the following code does not compile: public enum Suit { Spades, Hearts, Clubs, Diamonds } public void EnumerateAllSuitsDemoMethod() { foreach (Suit suit in Suit) { DoSomething(suit); } } And it gives the following compile-time error:...
[ "c#", ".net", "loops", "enums", "enumeration" ]
4,378
5,287
1,035,122
36
0
2008-09-19T20:34:50.797000
2008-09-19T20:37:18.187000
105,389
105,419
How do you store/share online your personal documents?
For photos, I use Flickr. But for other documents...Which web based online application (hosted or to install on your personal web site) do you use for PDF or word files? If there is a user management it would be also great (for example you decide that some persons, or everyone, can see some of your documents...).
Google Docs? It is capable of storing PDFs but your word documents will be converted to the the google doc format. (which then can be converted back to Word or RTF or PDF etc'
How do you store/share online your personal documents? For photos, I use Flickr. But for other documents...Which web based online application (hosted or to install on your personal web site) do you use for PDF or word files? If there is a user management it would be also great (for example you decide that some persons,...
TITLE: How do you store/share online your personal documents? QUESTION: For photos, I use Flickr. But for other documents...Which web based online application (hosted or to install on your personal web site) do you use for PDF or word files? If there is a user management it would be also great (for example you decide ...
[ "sharing", "documents", "storage" ]
1
4
806
7
0
2008-09-19T20:36:28.953000
2008-09-19T20:39:09.650000
105,408
105,585
3rd party controls for MS SQL 2005 Reporting Services
Can anyone recommend a good 3rd party control(s) for MS SQL 2005 Reporting Services. If you know some open library or implementation of such controls that could be very useful too.
Dundas do great RS add-ins if you have the budget: http://www.dundas.com/index.aspx
3rd party controls for MS SQL 2005 Reporting Services Can anyone recommend a good 3rd party control(s) for MS SQL 2005 Reporting Services. If you know some open library or implementation of such controls that could be very useful too.
TITLE: 3rd party controls for MS SQL 2005 Reporting Services QUESTION: Can anyone recommend a good 3rd party control(s) for MS SQL 2005 Reporting Services. If you know some open library or implementation of such controls that could be very useful too. ANSWER: Dundas do great RS add-ins if you have the budget: http://...
[ "reporting-services", "reportingservices-2005" ]
2
3
1,650
2
0
2008-09-19T20:38:02.087000
2008-09-19T20:59:55.497000
105,418
105,448
What port is a given program using?
I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer? PS - before you downmod this for not being a programming question, I'm looking for the program to test some n...
netstat -b -a lists the ports in use and gives you the executable that's using each one. I believe you need to be in the administrator group to do this, and I don't know what security implications there are on Vista. I usually add -n as well to make it a little faster, but adding -b can make it quite slow. Edit: If you...
What port is a given program using? I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer? PS - before you downmod this for not being a programming question, I'm lo...
TITLE: What port is a given program using? QUESTION: I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer? PS - before you downmod this for not being a programmin...
[ "windows", "networking" ]
100
150
228,289
12
0
2008-09-19T20:39:04.407000
2008-09-19T20:41:49.283000
105,477
105,508
Malloc inside a function call appears to be getting freed on return?
I think I've got it down to the most basic case: int main(int argc, char ** argv) { int * arr; foo(arr); printf("car[3]=%d\n",arr[3]); free (arr); return 1; } void foo(int * arr) { arr = (int*) malloc( sizeof(int)*25 ); arr[3] = 69; } The output is this: >./a.out car[3]=-1869558540 a.out(4100) malloc: *** error for o...
You pass the pointer by value, not by reference, so whatever you do with arr inside foo will not make a difference outside the foo-function. As m_pGladiator wrote one way is to declare a reference to pointer like this (only possible in C++ btw. C does not know about references): int main(int argc, char ** argv) { int *...
Malloc inside a function call appears to be getting freed on return? I think I've got it down to the most basic case: int main(int argc, char ** argv) { int * arr; foo(arr); printf("car[3]=%d\n",arr[3]); free (arr); return 1; } void foo(int * arr) { arr = (int*) malloc( sizeof(int)*25 ); arr[3] = 69; } The output is ...
TITLE: Malloc inside a function call appears to be getting freed on return? QUESTION: I think I've got it down to the most basic case: int main(int argc, char ** argv) { int * arr; foo(arr); printf("car[3]=%d\n",arr[3]); free (arr); return 1; } void foo(int * arr) { arr = (int*) malloc( sizeof(int)*25 ); arr[3] = 69...
[ "c", "pointers", "malloc" ]
16
47
19,553
5
0
2008-09-19T20:44:51.413000
2008-09-19T20:48:17.473000
105,479
105,647
How do you maintain separate webservices for dev/stage/production
We want to maintain 3 webservices for the different steps of deployment, but how do we define in our application which service to use? Do we just maintain 3 web references and ifdef the uses of them somehow?
As others have mentioned you'll want to stash this information in a config file. In fact, I'd suggest using a different configuration file for each environment. This will address the inevitable problem of having multiple settings for each environment, e.g. you might have separate settings for the web service URL and we...
How do you maintain separate webservices for dev/stage/production We want to maintain 3 webservices for the different steps of deployment, but how do we define in our application which service to use? Do we just maintain 3 web references and ifdef the uses of them somehow?
TITLE: How do you maintain separate webservices for dev/stage/production QUESTION: We want to maintain 3 webservices for the different steps of deployment, but how do we define in our application which service to use? Do we just maintain 3 web references and ifdef the uses of them somehow? ANSWER: As others have ment...
[ "c#", ".net", "asp.net", "web-services" ]
4
4
4,375
8
0
2008-09-19T20:45:03.723000
2008-09-19T21:10:24.300000
105,480
108,769
How do I stop Blend 2.5 June Preview replacing Canvas.ZIndex with Panel.ZIndex on SL1.0 XAML?
I have a Silverlight 1.0 application that I edit with Blend 2.5. Whenever I touch a UIElement in the designer that has a Canvas attribute such as Canvas.ZIndex="1", when it updates the XAML, it changes the Canvas prefix to Panel, leaving Panel.ZIndex="1", causing the page to fail to load. How do I make it stop the insa...
Looks like it's a reported bug in 2.5, http://social.expression.microsoft.com/forums/en-US/blend/thread/db02b75c-922e-4de1-8943-bd525d9862c0/ Their suggested workaround is to use 2.0 for SL1. Still, I expect there will be a new version of Blend released fairly shortly, since SL2 is likely to be released around PDC this...
How do I stop Blend 2.5 June Preview replacing Canvas.ZIndex with Panel.ZIndex on SL1.0 XAML? I have a Silverlight 1.0 application that I edit with Blend 2.5. Whenever I touch a UIElement in the designer that has a Canvas attribute such as Canvas.ZIndex="1", when it updates the XAML, it changes the Canvas prefix to Pan...
TITLE: How do I stop Blend 2.5 June Preview replacing Canvas.ZIndex with Panel.ZIndex on SL1.0 XAML? QUESTION: I have a Silverlight 1.0 application that I edit with Blend 2.5. Whenever I touch a UIElement in the designer that has a Canvas attribute such as Canvas.ZIndex="1", when it updates the XAML, it changes the Ca...
[ "wpf", "silverlight", "xaml", "blend" ]
0
1
188
1
0
2008-09-19T20:45:15.547000
2008-09-20T17:12:23.117000
105,499
108,532
How to set proxy with credentials to generated WCF client?
I have a problem to connect to my WCF service if customer is using proxy with credentials. I'm unable to find the way to set credential to generated client proxy. If I use the web service, then it is possible to set proxy.
I'm not entirely sure if this is what you are looking for but here you go. MyClient client = new MyClient(); client.ClientCredentials.UserName.UserName = "u"; client.ClientCredentials.UserName.Password = "p";
How to set proxy with credentials to generated WCF client? I have a problem to connect to my WCF service if customer is using proxy with credentials. I'm unable to find the way to set credential to generated client proxy. If I use the web service, then it is possible to set proxy.
TITLE: How to set proxy with credentials to generated WCF client? QUESTION: I have a problem to connect to my WCF service if customer is using proxy with credentials. I'm unable to find the way to set credential to generated client proxy. If I use the web service, then it is possible to set proxy. ANSWER: I'm not ent...
[ "wcf" ]
12
2
20,646
3
0
2008-09-19T20:47:36.227000
2008-09-20T15:45:32.687000
105,504
105,573
Is there any performance benefit with "chaining" statements in .NET?
When retrieving a lookup code value from a table, some folks do this... Dim dtLookupCode As New LookupCodeDataTable() Dim taLookupCode AS New LookupCodeTableAdapter() Dim strDescription As String dtLookupCode = taLookupCode.GetDataByCodeAndValue("EmpStatus", "FULL") strDescription = dtLookupCode.Item(0).Meaning...howe...
Straying from the "inline" part of this, actually, the two sets of code won't compile out to the same thing. The issue comes in with: Dim dtLookupCode As New LookupCodeDataTable() Dim taLookupCode AS New LookupCodeTableAdapter() In VB, this will create new objects with the appropriately-named references. Followed by: d...
Is there any performance benefit with "chaining" statements in .NET? When retrieving a lookup code value from a table, some folks do this... Dim dtLookupCode As New LookupCodeDataTable() Dim taLookupCode AS New LookupCodeTableAdapter() Dim strDescription As String dtLookupCode = taLookupCode.GetDataByCodeAndValue("Emp...
TITLE: Is there any performance benefit with "chaining" statements in .NET? QUESTION: When retrieving a lookup code value from a table, some folks do this... Dim dtLookupCode As New LookupCodeDataTable() Dim taLookupCode AS New LookupCodeTableAdapter() Dim strDescription As String dtLookupCode = taLookupCode.GetDataB...
[ ".net", "performance" ]
3
4
444
11
0
2008-09-19T20:47:55.633000
2008-09-19T20:58:09.743000
105,515
105,565
F# and Enterprise Software
Being a C# developer since version 1.0, F# has captured my free time for the past few weeks. Computers are now sold with 2, 4.. Cores and multi-threading is not always simple to accomplish. At the moment I see that F# has great potential for complicated and or heavy workloads. Do you think that F# will (once RTM) becom...
I think regardless of whether F# becomes import for Enterprise Software being able to isolate pure functional portions of code in any language will be key to using the potential of multi-core computers. For instance Microsoft's Parallel Extensions for.NET are great, but there is still a lot of room to make mistakes by ...
F# and Enterprise Software Being a C# developer since version 1.0, F# has captured my free time for the past few weeks. Computers are now sold with 2, 4.. Cores and multi-threading is not always simple to accomplish. At the moment I see that F# has great potential for complicated and or heavy workloads. Do you think th...
TITLE: F# and Enterprise Software QUESTION: Being a C# developer since version 1.0, F# has captured my free time for the past few weeks. Computers are now sold with 2, 4.. Cores and multi-threading is not always simple to accomplish. At the moment I see that F# has great potential for complicated and or heavy workload...
[ "c#", "f#", "functional-programming", "enterprise" ]
3
2
883
5
0
2008-09-19T20:49:11.293000
2008-09-19T20:57:19.200000
105,522
1,068,424
Compartment items not displayed in DSL diagram
OK, so things have progressed significantly with my DSL since I asked this question a few days ago. As soon as I've refactored my code, I'll post my own answer to that one, but for now, I'm having another problem. I'm dynamically generating sub-diagrams from a DSL-created model, saving those diagrams as images and then...
I've recently faced a related problem, and managed to make it work, so here's the story. The task I was implementing was to load and display a domain model and an associated diagram generated by ActiveWriter's DSL package. Here's how I've implemented the required functionality (all the methods below belong to the Form1...
Compartment items not displayed in DSL diagram OK, so things have progressed significantly with my DSL since I asked this question a few days ago. As soon as I've refactored my code, I'll post my own answer to that one, but for now, I'm having another problem. I'm dynamically generating sub-diagrams from a DSL-created ...
TITLE: Compartment items not displayed in DSL diagram QUESTION: OK, so things have progressed significantly with my DSL since I asked this question a few days ago. As soon as I've refactored my code, I'll post my own answer to that one, but for now, I'm having another problem. I'm dynamically generating sub-diagrams f...
[ "visual-studio", "diagram", "dsl" ]
0
2
827
2
0
2008-09-19T20:50:28.047000
2009-07-01T10:40:45.440000
105,535
105,547
VmWare Primary HDD Expansion
I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5
This link gives two approaches that should help. It looks like this is the most straightforward method: vmware-vdiskmanager -x 12GB path\to\disk.vmdk where 12GB is the desired size of the expanded volume.
VmWare Primary HDD Expansion I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5
TITLE: VmWare Primary HDD Expansion QUESTION: I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5 ANSWER: This link gives two approaches that should help. It looks like this is the most strai...
[ "vmware", "partitioning" ]
3
3
463
5
0
2008-09-19T20:52:50.660000
2008-09-19T20:55:12.013000
105,546
105,633
XAMPP and WAMP in the LAMP, what's the best?
We have got loads of options for php + MySQL + Apache combo... Which is the best pack among these? Lets confine our ideas to WAMP vs XAMPP, is there a better option to go for? I created an online programming contest web app called CodeFire on XAMPP, later I had to switch to WAMP, where none of the php scripts worked pr...
I like XAMPP, personally. I have an install running on a thumbdrive that I carry around that's pretty much my development environment for LAMP web dev on any machine I happen to be at (I'm mostly on Windows client machines). Small, fully-functional, and stable - works really well for my needs.
XAMPP and WAMP in the LAMP, what's the best? We have got loads of options for php + MySQL + Apache combo... Which is the best pack among these? Lets confine our ideas to WAMP vs XAMPP, is there a better option to go for? I created an online programming contest web app called CodeFire on XAMPP, later I had to switch to ...
TITLE: XAMPP and WAMP in the LAMP, what's the best? QUESTION: We have got loads of options for php + MySQL + Apache combo... Which is the best pack among these? Lets confine our ideas to WAMP vs XAMPP, is there a better option to go for? I created an online programming contest web app called CodeFire on XAMPP, later I...
[ "php", "mysql", "apache" ]
55
35
74,248
15
0
2008-09-19T20:54:43.433000
2008-09-19T21:07:13.263000
105,551
105,968
What causes java.io.CharConversionException with EOF or isHexDigit messages in Tomcat?
This exception peppers our production catalina logs on a simple 'getParameter()' call. WARNING: Parameters: Character decoding failed. Parameter skipped. java.io.CharConversionException: EOF at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:82) at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:48...
Just hypothesizing here. Seems like the URL-decoding of parameters or their values fails (URL-encoding means encoding some characters using the %XX or %XXXX notation where XX or XXXX is the hexadecimal code of the character in ISO-8859-1 or Unicode). In the first case the error might be happening because there aren't e...
What causes java.io.CharConversionException with EOF or isHexDigit messages in Tomcat? This exception peppers our production catalina logs on a simple 'getParameter()' call. WARNING: Parameters: Character decoding failed. Parameter skipped. java.io.CharConversionException: EOF at org.apache.tomcat.util.buf.UDecoder.co...
TITLE: What causes java.io.CharConversionException with EOF or isHexDigit messages in Tomcat? QUESTION: This exception peppers our production catalina logs on a simple 'getParameter()' call. WARNING: Parameters: Character decoding failed. Parameter skipped. java.io.CharConversionException: EOF at org.apache.tomcat.ut...
[ "exception", "tomcat", "encoding" ]
12
5
26,791
4
0
2008-09-19T20:55:39.953000
2008-09-19T21:54:23.727000
105,556
105,591
Automatically Generating SQL Schema from XML
We are attempting to use a SQL Server 2003 database for our test records and want a quick way to take NUnit and NAnt output and produce SQL schema and data. Is there a simple way to generate SQL Schema using the XSD file describing these XML documents?
You could use XSD. No, I'm serious. Go to a command prompt and type xsd and press Enter. Here's what you will see (truncated): I:\>xsd Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R).NET Framework, Version 1.0.3705.0] Copyright (C) Microsoft Corporation 1998-2001. All rights reserved. xsd.exe - Util...
Automatically Generating SQL Schema from XML We are attempting to use a SQL Server 2003 database for our test records and want a quick way to take NUnit and NAnt output and produce SQL schema and data. Is there a simple way to generate SQL Schema using the XSD file describing these XML documents?
TITLE: Automatically Generating SQL Schema from XML QUESTION: We are attempting to use a SQL Server 2003 database for our test records and want a quick way to take NUnit and NAnt output and produce SQL schema and data. Is there a simple way to generate SQL Schema using the XSD file describing these XML documents? ANS...
[ "sql", "xml", "unit-testing" ]
2
1
4,379
3
0
2008-09-19T20:56:18.813000
2008-09-19T21:00:43.747000
105,564
105,588
Is it possible to build following SQL query
The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE "%text%" OR description LIKE "%text%" ORDER BY date Would it be possible to rewrite it (without unions or procedures), so that result will look like this: list of books where title matches query ordered by date, followed by: list of books ...
In sql server I would do the following: select * from books where title like '%text%' or description like '%text%' order by case when title like '%text%' then 1 else 2 end, date I'm not sure if you can include columns in ORDER BY in mysql that aren't in the SELECT, but that's the principle I'd use. Otherwise, just incl...
Is it possible to build following SQL query The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE "%text%" OR description LIKE "%text%" ORDER BY date Would it be possible to rewrite it (without unions or procedures), so that result will look like this: list of books where title matches query ...
TITLE: Is it possible to build following SQL query QUESTION: The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE "%text%" OR description LIKE "%text%" ORDER BY date Would it be possible to rewrite it (without unions or procedures), so that result will look like this: list of books where ti...
[ "sql", "mysql", "database" ]
4
18
483
7
0
2008-09-19T20:57:17.220000
2008-09-19T21:00:12.187000
105,572
105,595
A script to change all tables and fields to the utf-8-bin collation in MYSQL
Is there a SQL or PHP script that I can run that will change the default collation in all tables and fields in a database? I can write one myself, but I think that this should be something that readily available at a site like this. If I can come up with one myself before somebody posts one, I will post it myself.
Be careful! If you actually have utf stored as another encoding, you could have a real mess on your hands. Back up first. Then try some of the standard methods: for instance http://www.cesspit.net/drupal/node/898 http://www.hackszine.com/blog/archive/2007/05/mysql_database_migration_latin.html I've had to resort to con...
A script to change all tables and fields to the utf-8-bin collation in MYSQL Is there a SQL or PHP script that I can run that will change the default collation in all tables and fields in a database? I can write one myself, but I think that this should be something that readily available at a site like this. If I can c...
TITLE: A script to change all tables and fields to the utf-8-bin collation in MYSQL QUESTION: Is there a SQL or PHP script that I can run that will change the default collation in all tables and fields in a database? I can write one myself, but I think that this should be something that readily available at a site lik...
[ "php", "sql", "mysql", "utf-8", "collation" ]
57
23
77,379
18
0
2008-09-19T20:58:02.023000
2008-09-19T21:01:16.383000
105,604
105,952
Can I revoke some database privileges from MediaWiki after installation?
I've just installed MediaWiki on a web server. Obviously it needs lots of privileges during installation to set up its database correctly. Now that it's installed can I safely revoke some privileges (e.g. create table, drop table?) Or might it need to create more tables later (when they are first needed?) If not then I...
After the installation, MediaWiki doesn't need to create any more tables. I'd suggest giving the user insert, select, and lock permission. grant select,lock tables,insert on media_wiki_db.* to 'wiki'@'localhost' identified by 'password';
Can I revoke some database privileges from MediaWiki after installation? I've just installed MediaWiki on a web server. Obviously it needs lots of privileges during installation to set up its database correctly. Now that it's installed can I safely revoke some privileges (e.g. create table, drop table?) Or might it nee...
TITLE: Can I revoke some database privileges from MediaWiki after installation? QUESTION: I've just installed MediaWiki on a web server. Obviously it needs lots of privileges during installation to set up its database correctly. Now that it's installed can I safely revoke some privileges (e.g. create table, drop table...
[ "mysql", "mediawiki" ]
6
2
693
2
0
2008-09-19T21:02:54.490000
2008-09-19T21:51:52.953000
105,607
106,817
How do I Extend Blogengine.Net to collect statistics of visitors?
I love BlogEngine. But from what I can se it does not collect the standard information about the visitors I would like to see (referrer, browser-type and so on). When I log in as Admin I have a menu item named "Referrer". I can choose a weekday and then I'll be presented with 1 or 2 rows with "google.com 4 hits, "itmas...
This isn't an extension, but it's what I use to collect all my blogengine.net data and it should be upgrade safe. When you log into the Blogengine.NET admin screens you can go to "Settings> Custome Code > Tracking Script", here you can put your http://www.google.com/analytics/ logging script. Google Analytics provides ...
How do I Extend Blogengine.Net to collect statistics of visitors? I love BlogEngine. But from what I can se it does not collect the standard information about the visitors I would like to see (referrer, browser-type and so on). When I log in as Admin I have a menu item named "Referrer". I can choose a weekday and then ...
TITLE: How do I Extend Blogengine.Net to collect statistics of visitors? QUESTION: I love BlogEngine. But from what I can se it does not collect the standard information about the visitors I would like to see (referrer, browser-type and so on). When I log in as Admin I have a menu item named "Referrer". I can choose a...
[ "blogengine.net", "visitor-statistic" ]
5
9
3,045
6
0
2008-09-19T21:03:27.767000
2008-09-20T02:28:12.040000
105,609
105,963
I need a helper method to compare a char Enum and a char boxed to an object
I have an enum that looks as follows: public enum TransactionStatus { Open = 'O', Closed = 'C'}; and I'm pulling data from the database with a single character indicating - you guessed it - whether 'O' the transaction is open or 'C' the transaction is closed. now because the data comes out of the database as an object ...
static void Main(string[] args) { object val = 'O'; Console.WriteLine(EnumEqual(TransactionStatus.Open, val)); val = 'R'; Console.WriteLine(EnumEqual(DirectionStatus.Left, val)); Console.ReadLine(); } public static bool EnumEqual(Enum e, object boxedValue) { return e.Equals(Enum.ToObject(e.GetType(), (char)boxedValu...
I need a helper method to compare a char Enum and a char boxed to an object I have an enum that looks as follows: public enum TransactionStatus { Open = 'O', Closed = 'C'}; and I'm pulling data from the database with a single character indicating - you guessed it - whether 'O' the transaction is open or 'C' the transac...
TITLE: I need a helper method to compare a char Enum and a char boxed to an object QUESTION: I have an enum that looks as follows: public enum TransactionStatus { Open = 'O', Closed = 'C'}; and I'm pulling data from the database with a single character indicating - you guessed it - whether 'O' the transaction is open ...
[ "c#", "enums", "casting" ]
3
4
1,394
4
0
2008-09-19T21:03:37.860000
2008-09-19T21:53:59.033000
105,613
105,628
Can XPath return only nodes that have a child of X?
Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting dataset would contain the lizard and pig elements from this example: don't care about this not this one either lizard shoul...
Here it is, in all its glory /pets/*[bar] English: Give me all children of pets that have a child bar
Can XPath return only nodes that have a child of X? Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting dataset would contain the lizard and pig elements from this example: do...
TITLE: Can XPath return only nodes that have a child of X? QUESTION: Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting dataset would contain the lizard and pig elements fro...
[ "xml", "xslt", "xpath" ]
37
57
39,912
3
0
2008-09-19T21:04:34.440000
2008-09-19T21:06:27.463000
105,642
106,156
Connection Timeout exception for a query using ADO.Net
Update: Looks like the query does not throw any timeout. The connection is timing out. This is a sample code for executing a query. Sometimes, while executing time consuming queries, it throws a timeout exception. I cannot use any of these techniques: 1) Increase timeout. 2) Run it asynchronously with a callback. This ...
Since you are using ExecuteNonQuery which does not return any rows, you can try this polling based approach. It executes the query in an asyc manner (without callback) but the application will wait (inside a while loop) until the query is complete. From MSDN. This should solve the timeout problem. Please try it out. Bu...
Connection Timeout exception for a query using ADO.Net Update: Looks like the query does not throw any timeout. The connection is timing out. This is a sample code for executing a query. Sometimes, while executing time consuming queries, it throws a timeout exception. I cannot use any of these techniques: 1) Increase t...
TITLE: Connection Timeout exception for a query using ADO.Net QUESTION: Update: Looks like the query does not throw any timeout. The connection is timing out. This is a sample code for executing a query. Sometimes, while executing time consuming queries, it throws a timeout exception. I cannot use any of these techniq...
[ "c#", ".net", "ado.net", "timeout" ]
9
18
17,575
16
0
2008-09-19T21:08:46.410000
2008-09-19T22:33:24.447000
105,645
105,804
Injecting a user account into mySQL
Tackling a strange scenario here. We use a proprietary workstation management application which uses mySQL to store its data. Within the application they provide number of reports, such as which user logged into which machine at what time, all the software products installed on the monitored machines, so on and so fort...
You'll want to use the MySQL password recovery process. Follow these instructions, except replace the password reset query with a query to add a new user. The new user query would be something like: GRANT ALL ON *.* TO 'myuser'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; That will create a new user "myuse...
Injecting a user account into mySQL Tackling a strange scenario here. We use a proprietary workstation management application which uses mySQL to store its data. Within the application they provide number of reports, such as which user logged into which machine at what time, all the software products installed on the m...
TITLE: Injecting a user account into mySQL QUESTION: Tackling a strange scenario here. We use a proprietary workstation management application which uses mySQL to store its data. Within the application they provide number of reports, such as which user logged into which machine at what time, all the software products ...
[ "mysql", "account" ]
5
9
889
5
0
2008-09-19T21:09:32.027000
2008-09-19T21:31:32.300000
105,653
105,706
int matrix with pointers in C - memory allocation confusion
I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my main method the second printf should result in a bus error since it should no...
Just because the memory has been free'd doesn't mean you can't access it! Of course, it's a very bad idea to access it after it's been free'd, but that's why it works in your example. Note that free( *first_matrix ) only free's first_matrix[0], not the other arrays. You probably want some kind of marker to signify the ...
int matrix with pointers in C - memory allocation confusion I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my main method the s...
TITLE: int matrix with pointers in C - memory allocation confusion QUESTION: I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my...
[ "c", "pointers", "memory-management", "matrix" ]
6
9
29,056
7
0
2008-09-19T21:11:17.917000
2008-09-19T21:18:00.320000
105,671
105,678
(any == System.DBNull.Value) vs (any is System.DBNull)
Does any one have a preference on how to check if a value is DBNull? I've found these two statements give me the results I want, but just wondering if there's a preference? if (any is System.DBNull) same as: if (any == System.DBNull.Value) Thanks!
if (any == System.DBNull.Value)... I prefer that one, simply because I read that as comparing values, not types.
(any == System.DBNull.Value) vs (any is System.DBNull) Does any one have a preference on how to check if a value is DBNull? I've found these two statements give me the results I want, but just wondering if there's a preference? if (any is System.DBNull) same as: if (any == System.DBNull.Value) Thanks!
TITLE: (any == System.DBNull.Value) vs (any is System.DBNull) QUESTION: Does any one have a preference on how to check if a value is DBNull? I've found these two statements give me the results I want, but just wondering if there's a preference? if (any is System.DBNull) same as: if (any == System.DBNull.Value) Thanks!...
[ ".net", "null", "dbnull" ]
11
4
5,532
6
0
2008-09-19T21:13:10.410000
2008-09-19T21:14:19.860000
105,676
105,703
Get a list of all computers on a network w/o DNS
Greetings, I need a way (either via C# or in a.bat file) to get a list of all the computers on a given network. Normally, I use "net view", but this tends to work (from my understanding) only within your domain. I need the names (or at least the IP Addresses) of all computers available on my network. Being able to get ...
Nmap is good for this - use the -O option for OS fingerprinting and -oX "filename.xml" for output as xml that you can then parse from c#. A suitable commandline would be (where 192.168.0.0/24 is the subnet to scan): nmap -O -oX "filename.xml" 192.168.0.0/24 leave out the -O if you aren't interested in guessing the OS -...
Get a list of all computers on a network w/o DNS Greetings, I need a way (either via C# or in a.bat file) to get a list of all the computers on a given network. Normally, I use "net view", but this tends to work (from my understanding) only within your domain. I need the names (or at least the IP Addresses) of all comp...
TITLE: Get a list of all computers on a network w/o DNS QUESTION: Greetings, I need a way (either via C# or in a.bat file) to get a list of all the computers on a given network. Normally, I use "net view", but this tends to work (from my understanding) only within your domain. I need the names (or at least the IP Addr...
[ "c#", ".net", "networking", "batch-file" ]
3
7
11,953
4
0
2008-09-19T21:13:56.150000
2008-09-19T21:17:28.840000
105,688
105,740
What XML do I send for a field thats declared as nillable?
I have an application with a REST style interface that takes XML documents via POST from clients. This application is written in Java and uses XML beans to process the posted message. The XML schema definition for a field in the message looks like this: How do I send a null value that meets this spec? I sent but this c...
That's the right way of sending a nil value (assuming that the default namespace and the xsi namespace are set to the correct values, namely "http://www.w3.org/2001/XMLSchema-instance" for xsi.) so it looks like you might have come up against a bug in the CML parser you're using. What's the error message? You might try...
What XML do I send for a field thats declared as nillable? I have an application with a REST style interface that takes XML documents via POST from clients. This application is written in Java and uses XML beans to process the posted message. The XML schema definition for a field in the message looks like this: How do ...
TITLE: What XML do I send for a field thats declared as nillable? QUESTION: I have an application with a REST style interface that takes XML documents via POST from clients. This application is written in Java and uses XML beans to process the posted message. The XML schema definition for a field in the message looks ...
[ "xml", "xsd", "xml-nil" ]
1
0
1,210
3
0
2008-09-19T21:15:24.397000
2008-09-19T21:21:30.670000
105,698
105,772
Is there any way to enable the mousewheel (for scrolling) in Java apps?
Ideally I'd like a way to enable the mouse wheel for scrolling in old compiled java runtime apps, but java code to explicitly utilise it for an individual app would suffice.
Without access to the source code, you can't do it. If you do have access to the source, then do what RichH said.
Is there any way to enable the mousewheel (for scrolling) in Java apps? Ideally I'd like a way to enable the mouse wheel for scrolling in old compiled java runtime apps, but java code to explicitly utilise it for an individual app would suffice.
TITLE: Is there any way to enable the mousewheel (for scrolling) in Java apps? QUESTION: Ideally I'd like a way to enable the mouse wheel for scrolling in old compiled java runtime apps, but java code to explicitly utilise it for an individual app would suffice. ANSWER: Without access to the source code, you can't do...
[ "java", "scroll", "mouse", "mousewheel" ]
2
0
549
5
0
2008-09-19T21:16:37.610000
2008-09-19T21:26:31.143000
105,702
106,212
Making a beta code for a public django site
I'm about to put a beta version of the site I'm working on up on the web. It needs to have a beta code to restrict access. The site is written in django. I don't want to change the fundamental Auth system to accommodate a beta code, and I don't care particularly that the security of the beta code is iron-clad, just tha...
Start with this Django snippet, but modify it to check request.session['has_beta_access']. If they don't have it, then have it return a redirect to a "enter beta code" page that, when posted to with the right code, sets that session variable to True. Making it a public beta then just consists of removing that middlewar...
Making a beta code for a public django site I'm about to put a beta version of the site I'm working on up on the web. It needs to have a beta code to restrict access. The site is written in django. I don't want to change the fundamental Auth system to accommodate a beta code, and I don't care particularly that the secu...
TITLE: Making a beta code for a public django site QUESTION: I'm about to put a beta version of the site I'm working on up on the web. It needs to have a beta code to restrict access. The site is written in django. I don't want to change the fundamental Auth system to accommodate a beta code, and I don't care particul...
[ "python", "django", "authentication", "django-authentication" ]
11
21
1,483
7
0
2008-09-19T21:17:20.820000
2008-09-19T22:43:40.303000
105,721
105,734
How do I move to end of line in Vim?
I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on?
Just the $ (dollar sign) key. You can use A to move to the end of the line and switch to editing mode (Append). To jump to the last non-blank character, you can press g then _ keys. The opposite of A is I (Insert mode at beginning of line), as an aside. Pressing just the ^ will place your cursor at the first non-white-...
How do I move to end of line in Vim? I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on?
TITLE: How do I move to end of line in Vim? QUESTION: I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on? ANSWER: Just the $ (dollar sign) key. You can use A to move to the end of the line and switch t...
[ "vim", "editor", "keyboard-shortcuts", "vi" ]
1,421
2,432
996,547
16
0
2008-09-19T21:19:47.227000
2008-09-19T21:20:48.503000
105,724
105,753
Can't figure out what this SubString.PadLeft is doing
In this code I am debugging, I have this code snipit: ddlExpYear.SelectedItem.Value.Substring(2).PadLeft(2, '0'); What does this return? I really can't run this too much as it is part of a live credit card application. The DropDownList as you could imagine from the name contains the 4-digit year. UPDATE: Thanks everyon...
It takes the last two digits of the year and pads the left side with zeroes to a maximum of 2 characters. Looks like a "just in case" for expiration years ending in 08, 07, etc., making sure that the leading zero is present.
Can't figure out what this SubString.PadLeft is doing In this code I am debugging, I have this code snipit: ddlExpYear.SelectedItem.Value.Substring(2).PadLeft(2, '0'); What does this return? I really can't run this too much as it is part of a live credit card application. The DropDownList as you could imagine from the ...
TITLE: Can't figure out what this SubString.PadLeft is doing QUESTION: In this code I am debugging, I have this code snipit: ddlExpYear.SelectedItem.Value.Substring(2).PadLeft(2, '0'); What does this return? I really can't run this too much as it is part of a live credit card application. The DropDownList as you could...
[ "c#", "substring", "padleft" ]
0
2
2,416
11
0
2008-09-19T21:19:53.483000
2008-09-19T21:24:08.027000
105,725
106,650
How to write a self reproducing code (prints the source on exec)?
I have seen a lot of C/C++ based solutions to this problem where we have to write a program that upon execution prints its own source. some solutions -- http://www.cprogramming.com/challenges/solutions/self_print.html Quine Page solution in many languages There are many more solutions on the net, each different from th...
Aside from cheating¹ there is no difference between compiled and interpreted languages. The generic approach to quines is quite easy. First, whatever the program looks like, at some point it has to print something: print... However, what should it print? Itself. So it needs to print the "print" command: print "print......
How to write a self reproducing code (prints the source on exec)? I have seen a lot of C/C++ based solutions to this problem where we have to write a program that upon execution prints its own source. some solutions -- http://www.cprogramming.com/challenges/solutions/self_print.html Quine Page solution in many language...
TITLE: How to write a self reproducing code (prints the source on exec)? QUESTION: I have seen a lot of C/C++ based solutions to this problem where we have to write a program that upon execution prints its own source. some solutions -- http://www.cprogramming.com/challenges/solutions/self_print.html Quine Page solutio...
[ "programming-languages", "quine" ]
33
55
16,128
10
0
2008-09-19T21:20:03.857000
2008-09-20T01:01:52.530000
105,731
106,421
How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC?
How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC? I have a CDialog based Windows Mobile 6 (touchscreen) Professional app that I am workign on. The default behavior of a CDialog based app in WM6 Professional is to not use any softkeys by default... I want to map the softkeys to "Can...
What's "not working" with the CCommandBar for you? You should be able to add a CCommandBar member to your dialog class, then in teh DIalog's InitDialog you call Create and InsertMenuBar on the command bar - something like this: m_cmdBar.Create(this); m_cmdBar.InsertMenuBar(IDR_MENU_RESRC_ID); Your menu resource might l...
How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC? How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC? I have a CDialog based Windows Mobile 6 (touchscreen) Professional app that I am workign on. The default behavior of a CDialog based app in WM6 ...
TITLE: How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC? QUESTION: How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC? I have a CDialog based Windows Mobile 6 (touchscreen) Professional app that I am workign on. The default behavior of a CDialog...
[ "windows-mobile", "mfc" ]
1
2
875
2
0
2008-09-19T21:20:26.633000
2008-09-19T23:39:18.827000
105,754
110,080
Best practices for configuring Apache / Tomcat
We are currently using Apache 2.2.3 and Tomcat 5 (Embedded in JBoss 4.2.2) using mod_proxy_jk as the connector. Can someone shed some light on the the correct way to calculate / configure the values below (as well as anything else that may be relevant). Both Apache and Tomcat are running on separate machines and have c...
You should consider the workload the servers might get. The most important factor might be the number of simultaneously connected clients at peak times. Try to determine it and tune your settings in a way where: there are enough processing threads in both Apache and Tomcat that they don't need to spawn new threads when...
Best practices for configuring Apache / Tomcat We are currently using Apache 2.2.3 and Tomcat 5 (Embedded in JBoss 4.2.2) using mod_proxy_jk as the connector. Can someone shed some light on the the correct way to calculate / configure the values below (as well as anything else that may be relevant). Both Apache and Tom...
TITLE: Best practices for configuring Apache / Tomcat QUESTION: We are currently using Apache 2.2.3 and Tomcat 5 (Embedded in JBoss 4.2.2) using mod_proxy_jk as the connector. Can someone shed some light on the the correct way to calculate / configure the values below (as well as anything else that may be relevant). B...
[ "java", "apache", "tomcat", "jboss", "mod-proxy" ]
18
8
19,197
3
0
2008-09-19T21:24:30.587000
2008-09-21T02:44:18.063000
105,770
105,793
.NET String.Format() to add commas in thousands place for a number
I want to add a comma in the thousands place for a number. Would String.Format() be the correct path to take? What format would I use?
$"{1234:n}"; // Output: 1,234.00 $"{9876:n0}"; // No digits after the decimal point. Output: 9,876
.NET String.Format() to add commas in thousands place for a number I want to add a comma in the thousands place for a number. Would String.Format() be the correct path to take? What format would I use?
TITLE: .NET String.Format() to add commas in thousands place for a number QUESTION: I want to add a comma in the thousands place for a number. Would String.Format() be the correct path to take? What format would I use? ANSWER: $"{1234:n}"; // Output: 1,234.00 $"{9876:n0}"; // No digits after the decimal point. Output...
[ "c#", ".net", "string", "format" ]
1,049
1,526
970,284
23
0
2008-09-19T21:26:21.643000
2008-09-19T21:29:06.970000
105,771
106,283
Detecting when ChucK child shred has finished
Is it possible to determine when a ChucK child shred has finished executing if you have a reference to the child shred? For example, in this code: // define function go() fun void go() { // insert code } // spork another, store reference to new shred in offspring spork ~ go() => Shred @ offspring; Is it possible to de...
I'd say so, let me quote from the "VERSIONS" file from the latest release; - (added) int Shred.done() // is the shred done? int Shred.running() // is the shred running? I'm not 100% sure what "running" is supposed to refer to (perhaps I misunderstand it?) but "done" seems to suit your needs; ================== 8<======...
Detecting when ChucK child shred has finished Is it possible to determine when a ChucK child shred has finished executing if you have a reference to the child shred? For example, in this code: // define function go() fun void go() { // insert code } // spork another, store reference to new shred in offspring spork ~ g...
TITLE: Detecting when ChucK child shred has finished QUESTION: Is it possible to determine when a ChucK child shred has finished executing if you have a reference to the child shred? For example, in this code: // define function go() fun void go() { // insert code } // spork another, store reference to new shred in o...
[ "chuck" ]
2
4
154
1
0
2008-09-19T21:26:25.323000
2008-09-19T23:03:03.453000
105,776
105,798
How do I restore a dump file from mysqldump?
I was given a MySQL database file that I need to restore as a database on my Windows Server 2008 machine. I tried using MySQL Administrator, but I got the following error: The selected file was generated by mysqldump and cannot be restored by this application. How do I get this working?
It should be as simple as running this: mysql -u -p < db_backup.dump If the dump is of a single database you may have to add a line at the top of the file: USE; If it was a dump of many databases, the use statements are already in there. To run these commands, open up a command prompt (in Windows) and cd to the directo...
How do I restore a dump file from mysqldump? I was given a MySQL database file that I need to restore as a database on my Windows Server 2008 machine. I tried using MySQL Administrator, but I got the following error: The selected file was generated by mysqldump and cannot be restored by this application. How do I get t...
TITLE: How do I restore a dump file from mysqldump? QUESTION: I was given a MySQL database file that I need to restore as a database on my Windows Server 2008 machine. I tried using MySQL Administrator, but I got the following error: The selected file was generated by mysqldump and cannot be restored by this applicati...
[ "mysql", "sql", "database" ]
669
680
1,057,636
19
0
2008-09-19T21:27:00.673000
2008-09-19T21:29:38.840000
105,788
105,921
good postgresql client for windows?
coming back to postgresql after several years of oracle... what are the state-of-the art postgresql administrative/ddl generating/data inserting frontends on windows? it would be nice if it had integration for postgis as well. it should be standalone or alternatively a plugin for intellij idea thinking back, all the wi...
I like Postgresql Maestro. I also use their version for MySql. I'm pretty statisfied with their product. Or you can use the free tool PgAdmin.
good postgresql client for windows? coming back to postgresql after several years of oracle... what are the state-of-the art postgresql administrative/ddl generating/data inserting frontends on windows? it would be nice if it had integration for postgis as well. it should be standalone or alternatively a plugin for int...
TITLE: good postgresql client for windows? QUESTION: coming back to postgresql after several years of oracle... what are the state-of-the art postgresql administrative/ddl generating/data inserting frontends on windows? it would be nice if it had integration for postgis as well. it should be standalone or alternativel...
[ "postgresql" ]
85
16
151,853
9
0
2008-09-19T21:28:40.857000
2008-09-19T21:47:54.303000
105,816
105,990
How do I access a char ** through ffi in plt-scheme?
I'm mocking about with plt-scheme's ffi and I have a C-function that returns a char ** (array of strings). If I declare my function as (_fun _pointer -> _pointer), how do I convert the result to a list of strings in scheme? Here are the relevant C-declarations: typedef char **MYSQL_ROW; /* return data as array of strin...
I think that what you want is the cvector: http://docs.plt-scheme.org/foreign/Derived_Utilities.html#(part._foreign~3acvector) A cvector of _string/utf-8 or whichever encoding you need seems reasanable. But that's from a quick survey of the docs - I haven't tried this myself. Please let me know if it works!
How do I access a char ** through ffi in plt-scheme? I'm mocking about with plt-scheme's ffi and I have a C-function that returns a char ** (array of strings). If I declare my function as (_fun _pointer -> _pointer), how do I convert the result to a list of strings in scheme? Here are the relevant C-declarations: typed...
TITLE: How do I access a char ** through ffi in plt-scheme? QUESTION: I'm mocking about with plt-scheme's ffi and I have a C-function that returns a char ** (array of strings). If I declare my function as (_fun _pointer -> _pointer), how do I convert the result to a list of strings in scheme? Here are the relevant C-d...
[ "mysql", "c", "lisp", "scheme" ]
2
1
470
3
0
2008-09-19T21:33:32.263000
2008-09-19T21:57:44.483000
105,830
105,995
SEO and hard links with dynamic URLs
With ASP.NET MVC (or using HttpHandlers) you can dynamically generate URLs, like the one in this question, which includes the title. What happens if the title changes (for example, editing it) and there's a link pointing to the page from another site, or Google's Pagerank was calculated for that URL? I guess it's all l...
I use the same system as is in place here, everything after the number in the URL is not used in the db query, then I 301 redirect anything else to be the title. In other words, if the title changed, then it would redirect to the correct place. I do it in PHP rather than htaccess as it's easier to manage more complex i...
SEO and hard links with dynamic URLs With ASP.NET MVC (or using HttpHandlers) you can dynamically generate URLs, like the one in this question, which includes the title. What happens if the title changes (for example, editing it) and there's a link pointing to the page from another site, or Google's Pagerank was calcul...
TITLE: SEO and hard links with dynamic URLs QUESTION: With ASP.NET MVC (or using HttpHandlers) you can dynamically generate URLs, like the one in this question, which includes the title. What happens if the title changes (for example, editing it) and there's a link pointing to the page from another site, or Google's P...
[ "seo", "httphandler", "httpmodule", "dynamic-url", "dynamic-links" ]
3
4
884
7
0
2008-09-19T21:35:25.647000
2008-09-19T21:58:32.923000
105,834
105,897
Does the JVM prevent tail call optimizations?
I saw this quote on the question: What is a good functional language on which to build a web service? Scala in particular doesn't support tail-call elimination except in self-recursive functions, which limits the kinds of composition you can do (this is a fundamental limitation of the JVM). Is this true? If so, what is...
This post: Recursion or Iteration? might help. In short, tail call optimization is hard to do in the JVM because of the security model and the need to always have a stack trace available. These requirements could in theory be supported, but it would probably require a new bytecode (see John Rose's informal proposal ). ...
Does the JVM prevent tail call optimizations? I saw this quote on the question: What is a good functional language on which to build a web service? Scala in particular doesn't support tail-call elimination except in self-recursive functions, which limits the kinds of composition you can do (this is a fundamental limita...
TITLE: Does the JVM prevent tail call optimizations? QUESTION: I saw this quote on the question: What is a good functional language on which to build a web service? Scala in particular doesn't support tail-call elimination except in self-recursive functions, which limits the kinds of composition you can do (this is a ...
[ "java", "jvm", "scala", "tail-recursion" ]
100
77
25,567
5
0
2008-09-19T21:35:35.130000
2008-09-19T21:44:48.400000
105,838
106,130
Real-world examples of recursion
What are real-world problems where a recursive approach is the natural solution besides depth-first search (DFS)? (I don't consider Tower of Hanoi, Fibonacci number, or factorial real-world problems. They are a bit contrived in my mind.)
There are lots of mathy examples here, but you wanted a real world example, so with a bit of thinking, this is possibly the best I can offer: You find a person who has contracted a given contageous infection, which is non fatal, and fixes itself quickly( Type A), Except for one in 5 people ( We'll call these type B ) w...
Real-world examples of recursion What are real-world problems where a recursive approach is the natural solution besides depth-first search (DFS)? (I don't consider Tower of Hanoi, Fibonacci number, or factorial real-world problems. They are a bit contrived in my mind.)
TITLE: Real-world examples of recursion QUESTION: What are real-world problems where a recursive approach is the natural solution besides depth-first search (DFS)? (I don't consider Tower of Hanoi, Fibonacci number, or factorial real-world problems. They are a bit contrived in my mind.) ANSWER: There are lots of math...
[ "recursion" ]
116
64
145,337
55
0
2008-09-19T21:36:12.477000
2008-09-19T22:25:42.717000
105,852
106,031
Conditional logging with minimal cyclomatic complexity
After reading " What’s your/a good limit for cyclomatic complexity? ", I realize many of my colleagues were quite annoyed with this new QA policy on our project: no more 10 cyclomatic complexity per function. Meaning: no more than 10 'if', 'else', 'try', 'catch' and other code workflow branching statement. Right. As I ...
In Python you pass the formatted values as parameters to the logging function. String formatting is only applied if logging is enabled. There's still the overhead of a function call, but that's minuscule compared to formatting. log.info ("a = %s, b = %s", a, b) You can do something like this for any language with varia...
Conditional logging with minimal cyclomatic complexity After reading " What’s your/a good limit for cyclomatic complexity? ", I realize many of my colleagues were quite annoyed with this new QA policy on our project: no more 10 cyclomatic complexity per function. Meaning: no more than 10 'if', 'else', 'try', 'catch' an...
TITLE: Conditional logging with minimal cyclomatic complexity QUESTION: After reading " What’s your/a good limit for cyclomatic complexity? ", I realize many of my colleagues were quite annoyed with this new QA policy on our project: no more 10 cyclomatic complexity per function. Meaning: no more than 10 'if', 'else',...
[ "language-agnostic", "logging", "coding-style", "cyclomatic-complexity" ]
77
33
28,957
12
0
2008-09-19T21:38:36.793000
2008-09-19T22:06:12.153000
105,884
106,146
Running an MVC application through IIS results in "Directory listing denied"
I have an.Net MVC application which runs fine if I use the build in Visual Studio Webserver. If I use the projects property pages to switch to IIS as the webserver and create a virtual directory for my project, any request I send to the server results in a "Directory listing denied" failure. Does anyone know a solution...
It's an issue with 'extensionless' urls prior to IIS7. It needs either an ISAPI filter or duplicate routes in the routing table with a.mvc extension. Try ScottGu's blog at weblogs.asp.net.
Running an MVC application through IIS results in "Directory listing denied" I have an.Net MVC application which runs fine if I use the build in Visual Studio Webserver. If I use the projects property pages to switch to IIS as the webserver and create a virtual directory for my project, any request I send to the server...
TITLE: Running an MVC application through IIS results in "Directory listing denied" QUESTION: I have an.Net MVC application which runs fine if I use the build in Visual Studio Webserver. If I use the projects property pages to switch to IIS as the webserver and create a virtual directory for my project, any request I ...
[ "asp.net-mvc", "visual-studio", "iis", "webproject" ]
2
0
2,098
2
0
2008-09-19T21:43:26.907000
2008-09-19T22:31:19.240000
105,932
106,010
How to record window position in Windows Forms application settings
It seems like a standard requirement: next time the user launches the application, open the window in the same position and state as it was before. Here's my wish list: Window position same as it was Unless the screen has resized and the old position is now off screen. Splitters should retain their position Tab contain...
My other option is to write more custom code around the application settings and execute it on formLoad and formClosed. This doesn't use data binding. Drawbacks: More code to write. Very fiddly. The order you set the properties on formLoad is confusing. For example, you have to make sure you've set the window size befo...
How to record window position in Windows Forms application settings It seems like a standard requirement: next time the user launches the application, open the window in the same position and state as it was before. Here's my wish list: Window position same as it was Unless the screen has resized and the old position i...
TITLE: How to record window position in Windows Forms application settings QUESTION: It seems like a standard requirement: next time the user launches the application, open the window in the same position and state as it was before. Here's my wish list: Window position same as it was Unless the screen has resized and ...
[ "c#", ".net", "winforms", "settings" ]
24
18
21,025
8
0
2008-09-19T21:49:40.820000
2008-09-19T22:01:33.867000
105,935
106,322
Most efficient way to see if an item is or is not in a listbox control
This request is based in MS Access VBA. I would like to know what the most efficient way is, to see if an item exists in a listbox control.
Here is a sample function that might be adapted to suit. Function CheckForItem(strItem, ListB As ListBox) As Boolean Dim rs As DAO.Recordset Dim db As Database Dim tdf As TableDef Set db = CurrentDb CheckForItem = False Select Case ListB.RowSourceType Case "Value List" CheckForItem = InStr(ListB.RowSource, strItem) ...
Most efficient way to see if an item is or is not in a listbox control This request is based in MS Access VBA. I would like to know what the most efficient way is, to see if an item exists in a listbox control.
TITLE: Most efficient way to see if an item is or is not in a listbox control QUESTION: This request is based in MS Access VBA. I would like to know what the most efficient way is, to see if an item exists in a listbox control. ANSWER: Here is a sample function that might be adapted to suit. Function CheckForItem(str...
[ "vba", "ms-access", "listbox", "controls" ]
0
2
5,912
3
0
2008-09-19T21:50:35.953000
2008-09-19T23:14:06.453000
105,942
106,264
Simple VB.NET using Google Search API?
Can anyone point me to a good, simple, example of a Google API (AJAX Search API I suppose?) that can be implemented in VB.net (2008)? I have tried to sign up for a Google API key but it wants a URL from which the search will be executed from. I dont have a URL for this example. I tried http://localhost but then was tol...
If you're running a Google API locally for development or test purposes, you can use an internal IP address - it doesn't have to be URL that's exposed to the Internet. For example, I have development machines running the Google Maps API using addresses in the 192.168.0.xxx range. This allows them to be accessed from an...
Simple VB.NET using Google Search API? Can anyone point me to a good, simple, example of a Google API (AJAX Search API I suppose?) that can be implemented in VB.net (2008)? I have tried to sign up for a Google API key but it wants a URL from which the search will be executed from. I dont have a URL for this example. I ...
TITLE: Simple VB.NET using Google Search API? QUESTION: Can anyone point me to a good, simple, example of a Google API (AJAX Search API I suppose?) that can be implemented in VB.net (2008)? I have tried to sign up for a Google API key but it wants a URL from which the search will be executed from. I dont have a URL fo...
[ "vb.net", "visual-studio-2008", "search", "google-api" ]
1
2
4,129
2
0
2008-09-19T21:51:17.527000
2008-09-19T22:55:53.533000
105,950
105,965
How do I set the default database in Sql Server from code?
I can't seem to figure out how to set the default database in Sql Server from code. This can be either.Net code or T-Sql (T-Sql would be nice since it would be easy to use in any language). I searched Google and could only find how to do it in Sql Server Management Studio.
from: http://doc.ddart.net/mssql/sql70/sp_da-di_6.htm sp_defaultdb [@loginame =] 'login', [@defdb =] 'database'
How do I set the default database in Sql Server from code? I can't seem to figure out how to set the default database in Sql Server from code. This can be either.Net code or T-Sql (T-Sql would be nice since it would be easy to use in any language). I searched Google and could only find how to do it in Sql Server Manage...
TITLE: How do I set the default database in Sql Server from code? QUESTION: I can't seem to figure out how to set the default database in Sql Server from code. This can be either.Net code or T-Sql (T-Sql would be nice since it would be easy to use in any language). I searched Google and could only find how to do it in...
[ "sql-server", "database", "sql-server-2000" ]
13
14
23,533
4
0
2008-09-19T21:51:52.033000
2008-09-19T21:54:04.150000
105,971
105,999
Can I pass an arbitrary block of commands to a bash function?
I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function: function conditional-do { if [ -f $1 ] then echo "Doing stuff" $2 else echo "File doesn't exist!" end } Now, when I want to execute this,...
This should be readable to most C programmers: function file_exists { if ( [ -e $1 ] ) then echo "Doing stuff" else echo "File $1 doesn't exist" false fi } file_exists filename && ( echo "Do your stuff..." ) or the one-liner file_exists filename && echo "Do your stuff..." Now, if you really want the code to be run fro...
Can I pass an arbitrary block of commands to a bash function? I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function: function conditional-do { if [ -f $1 ] then echo "Doing stuff" $2 else echo...
TITLE: Can I pass an arbitrary block of commands to a bash function? QUESTION: I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function: function conditional-do { if [ -f $1 ] then echo "Doing s...
[ "bash" ]
7
6
3,123
3
0
2008-09-19T21:54:35.317000
2008-09-19T21:59:13.700000
105,996
106,013
How to get scientific results from non-experimental data (datamining?)
I want to obtain maximum performance out of a process with many variables, many of which cannot be controlled. I cannot run thousands of experiments, so it'd be nice if I could run hundreds of experiments and vary many controllable parameters collect data on many parameters indicating performance 'correct,' as much as ...
It sounds like you want to do some regression analysis. You certainly have plenty of data! Regression analysis is an extremely common modeling technique in statistics and science. (It could be argued that statistics is the art and science of regression analysis.) There are many statistics packages out there to do the c...
How to get scientific results from non-experimental data (datamining?) I want to obtain maximum performance out of a process with many variables, many of which cannot be controlled. I cannot run thousands of experiments, so it'd be nice if I could run hundreds of experiments and vary many controllable parameters collec...
TITLE: How to get scientific results from non-experimental data (datamining?) QUESTION: I want to obtain maximum performance out of a process with many variables, many of which cannot be controlled. I cannot run thousands of experiments, so it'd be nice if I could run hundreds of experiments and vary many controllable...
[ "algorithm", "data-mining" ]
4
2
315
3
0
2008-09-19T21:58:41.423000
2008-09-19T22:03:01.820000
105,998
106,165
How do I get the value of the jdbc.batch_size property at runtime for a Web application using Spring MVC and Hibernate?
According to what I have found so far, I can use the following code: LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean)super.getApplicationContext().getBean("&sessionFactory"); System.out.println(sessionFactory.getConfiguration().buildSettings().getJdbcBatchSize()); but then I get a Hibernate Exception:...
Try the following (I can't test it since I don't use Spring): System.out.println(sessionFactory.getConfiguration().getProperty("hibernate.jdbc.batch_size"))
How do I get the value of the jdbc.batch_size property at runtime for a Web application using Spring MVC and Hibernate? According to what I have found so far, I can use the following code: LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean)super.getApplicationContext().getBean("&sessionFactory"); System....
TITLE: How do I get the value of the jdbc.batch_size property at runtime for a Web application using Spring MVC and Hibernate? QUESTION: According to what I have found so far, I can use the following code: LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean)super.getApplicationContext().getBean("&session...
[ "java", "hibernate", "spring" ]
4
3
4,445
2
0
2008-09-19T21:59:11.750000
2008-09-19T22:34:55.550000
106,000
106,028
Which SharePoint 2007 features are not available to Office 2003 users?
I have been tasked with coming up with a compatibility guide for SharePoint 2007 comparing Office 2003 and Office 2007. Does anyone know where to find such a list? I have been searching for awhile but I cannot seem to find a comprehensive list. Thanks:)
There is an entire MS white paper on Office integration with SharePoint: http://download.microsoft.com/download/5/d/c/5dcfc15a-c31e-4a14-93cf-b44bce3e447e/Microsoft%20Office%20and%20SharePoint%20Integration%20White%20Paper.doc
Which SharePoint 2007 features are not available to Office 2003 users? I have been tasked with coming up with a compatibility guide for SharePoint 2007 comparing Office 2003 and Office 2007. Does anyone know where to find such a list? I have been searching for awhile but I cannot seem to find a comprehensive list. Than...
TITLE: Which SharePoint 2007 features are not available to Office 2003 users? QUESTION: I have been tasked with coming up with a compatibility guide for SharePoint 2007 comparing Office 2003 and Office 2007. Does anyone know where to find such a list? I have been searching for awhile but I cannot seem to find a compre...
[ "sharepoint", "ms-office" ]
1
1
1,697
2
0
2008-09-19T21:59:35.010000
2008-09-19T22:05:23.093000
106,001
106,014
Parameterized SQL Columns?
I have some code which utilizes parameterized queries to prevent against injection, but I also need to be able to dynamically construct the query regardless of the structure of the table. What is the proper way to do this? Here's an example, say I have a table with columns Name, Address, Telephone. I have a web page wh...
Instead of passing the column names, just pass an identifier that you code will translate to a column name using a hardcoded table. This means you don't need to worry about malicious data being passed, since all the data is either translated legally, or is known to be invalid. Psudoish code: @columns = qw/Name Address ...
Parameterized SQL Columns? I have some code which utilizes parameterized queries to prevent against injection, but I also need to be able to dynamically construct the query regardless of the structure of the table. What is the proper way to do this? Here's an example, say I have a table with columns Name, Address, Tele...
TITLE: Parameterized SQL Columns? QUESTION: I have some code which utilizes parameterized queries to prevent against injection, but I also need to be able to dynamically construct the query regardless of the structure of the table. What is the proper way to do this? Here's an example, say I have a table with columns N...
[ "sql-injection", "parameterized" ]
9
7
3,053
6
0
2008-09-19T21:59:35.727000
2008-09-19T22:03:17.480000
106,033
106,101
How do I call a .NET assembly from C/C++?
Suppose I am writing an application in C++ and C#. I want to write the low level parts in C++ and write the high level logic in C#. How can I load a.NET assembly from my C++ program and start calling methods and accessing the properties of my C# classes?
[Guid("123565C4-C5FA-4512-A560-1D47F9FDFA20")] public interface IConfig { [DispId(1)] string Destination{ get; } [DispId(2)] void Unserialize(); [DispId(3)] void Serialize(); } [ComVisible(true)] [Guid("12AC8095-BD27-4de8-A30B-991940666927")] [ClassInterface(ClassInterfaceType.None)] public sealed class Config: ICon...
How do I call a .NET assembly from C/C++? Suppose I am writing an application in C++ and C#. I want to write the low level parts in C++ and write the high level logic in C#. How can I load a.NET assembly from my C++ program and start calling methods and accessing the properties of my C# classes?
TITLE: How do I call a .NET assembly from C/C++? QUESTION: Suppose I am writing an application in C++ and C#. I want to write the low level parts in C++ and write the high level logic in C#. How can I load a.NET assembly from my C++ program and start calling methods and accessing the properties of my C# classes? ANSW...
[ "c#", ".net", "c++" ]
28
13
23,379
9
0
2008-09-19T22:06:37.597000
2008-09-19T22:18:59.753000
106,038
106,051
how can I debug exe with soem switch flags from command prompt
for e.g from command prompt I need to launch the exe with some switch flags under debugger. How do I do it? This is an exe from c/c++ and built using VS2005 environment that I need debug. I pass some flags to this exe to perform some stuff.
You'll need to give more information about your development environment to get a specific answer. For example, with a C# project in Visual Studio, you can right-click the project->Properties and then fill out the "Command line arguments" field in the "Debug" tab.
how can I debug exe with soem switch flags from command prompt for e.g from command prompt I need to launch the exe with some switch flags under debugger. How do I do it? This is an exe from c/c++ and built using VS2005 environment that I need debug. I pass some flags to this exe to perform some stuff.
TITLE: how can I debug exe with soem switch flags from command prompt QUESTION: for e.g from command prompt I need to launch the exe with some switch flags under debugger. How do I do it? This is an exe from c/c++ and built using VS2005 environment that I need debug. I pass some flags to this exe to perform some stuff...
[ "batch-file", "debugging", "command", "prompt" ]
1
3
572
2
0
2008-09-19T22:06:57.223000
2008-09-19T22:09:38.840000
106,045
106,073
Best approach to web service powered by a daemon
I am relatively new to web services and am wondering what the standard "best approach" is. Basically, the way things work is I need to have a task running the background constantly. The the web service will connect to the daemon and return with an appropriate response. Currently, the communication is over unix domain s...
That's pretty much the best practice. You may be familiar with this pattern from other web applications: The daemon is frequently a database.:)
Best approach to web service powered by a daemon I am relatively new to web services and am wondering what the standard "best approach" is. Basically, the way things work is I need to have a task running the background constantly. The the web service will connect to the daemon and return with an appropriate response. C...
TITLE: Best approach to web service powered by a daemon QUESTION: I am relatively new to web services and am wondering what the standard "best approach" is. Basically, the way things work is I need to have a task running the background constantly. The the web service will connect to the daemon and return with an appro...
[ "linux", "web-services" ]
2
3
836
1
0
2008-09-19T22:08:51.103000
2008-09-19T22:14:03.697000
106,053
106,140
How can I make a batch file to act like a simple grep using Perl?
I already know the obvious answer to this question: "just download ". However, I work in an environment with strict controls by the local IT staff as to what we're allowed to have on our computers. Suffice it to say: I have access to Perl on Windows XP. Here's a quick Perl script I came up with that does what I want, b...
I wrote this a while back: @rem = '--*-Perl-*-- @echo off perl -x -S %0 %* goto endofperl @rem -- BEGIN PERL -- '; #!d:/Perl/bin/perl.exe -w #line 10 use strict; #use Test::Setup; use Getopt::Long; Getopt::Long::Configure ("bundling"); my $ignore_case = 0; my $number_line = 0; my $invert_results = 0; my $verbose = 0...
How can I make a batch file to act like a simple grep using Perl? I already know the obvious answer to this question: "just download ". However, I work in an environment with strict controls by the local IT staff as to what we're allowed to have on our computers. Suffice it to say: I have access to Perl on Windows XP. ...
TITLE: How can I make a batch file to act like a simple grep using Perl? QUESTION: I already know the obvious answer to this question: "just download ". However, I work in an environment with strict controls by the local IT staff as to what we're allowed to have on our computers. Suffice it to say: I have access to Pe...
[ "windows", "perl", "batch-file" ]
10
5
18,095
6
0
2008-09-19T22:10:05.920000
2008-09-19T22:29:39.930000
106,067
106,096
regular expression to replace two (or more) consecutive characters by only one?
In java, which regular expression can be used to replace these, for example: before: aaabbb after: ab before: 14442345 after: 142345 thanks!
In perl s/(.)\1+/$1/g; Does the trick, I assume if java has perl compatible regexps it should work too. Edit: Here is what it means s { (.) # match any charater ( and capture it ) \1 # if it is followed by itself + # One or more times }{$1}gx; # And replace the whole things by the first captured character (with g modif...
regular expression to replace two (or more) consecutive characters by only one? In java, which regular expression can be used to replace these, for example: before: aaabbb after: ab before: 14442345 after: 142345 thanks!
TITLE: regular expression to replace two (or more) consecutive characters by only one? QUESTION: In java, which regular expression can be used to replace these, for example: before: aaabbb after: ab before: 14442345 after: 142345 thanks! ANSWER: In perl s/(.)\1+/$1/g; Does the trick, I assume if java has perl compati...
[ "java", "regex" ]
22
38
25,997
8
0
2008-09-19T22:12:56.630000
2008-09-19T22:17:24.890000
106,081
106,653
How to create an AxHost solely in code [C#]
I'm using a COM Wrapper to interact with Windows Media Player. The it is using an AxHost to somehow wrap the player, for me it's all just magic under the hood^^ The AxHost.AttachInterfaces looks like this protected override void AttachInterfaces() { try { //Get the IOleObject for Windows Media Player. IOleObject oleObj...
FYI: nobody stops you from using a hidden window in your console application. You'll not be able to host the media player in a non-windows application - it requires hosting. If you want to play some music you can use the Media Graphs to create a graph that renders (plays) your music file - it'll not require any extra h...
How to create an AxHost solely in code [C#] I'm using a COM Wrapper to interact with Windows Media Player. The it is using an AxHost to somehow wrap the player, for me it's all just magic under the hood^^ The AxHost.AttachInterfaces looks like this protected override void AttachInterfaces() { try { //Get the IOleObject...
TITLE: How to create an AxHost solely in code [C#] QUESTION: I'm using a COM Wrapper to interact with Windows Media Player. The it is using an AxHost to somehow wrap the player, for me it's all just magic under the hood^^ The AxHost.AttachInterfaces looks like this protected override void AttachInterfaces() { try { //...
[ "c#", "activex", "ocx" ]
2
1
3,415
1
0
2008-09-19T22:15:29.497000
2008-09-20T01:02:19.687000
106,086
113,749
In MATLAB, can a class method act as a uicontrol callback without being public?
In MATLAB 2008a, is there a way to allow a class method to act as a uicontrol callback function without having to make the method public? Conceptually, the method should not be public because it should never be called by a user of the class. It should only be called as a result of a UI event triggering a callback. Howe...
Storing the function handle of the callback as a private property seems to workaround the problem. Try this: classdef MyClass properties handle; end properties (Access=private) callback; end methods function this = MyClass(args) this.callback = @myCallbackMethod; this.handle = uicontrol('Callback',... {@(src, event)m...
In MATLAB, can a class method act as a uicontrol callback without being public? In MATLAB 2008a, is there a way to allow a class method to act as a uicontrol callback function without having to make the method public? Conceptually, the method should not be public because it should never be called by a user of the class...
TITLE: In MATLAB, can a class method act as a uicontrol callback without being public? QUESTION: In MATLAB 2008a, is there a way to allow a class method to act as a uicontrol callback function without having to make the method public? Conceptually, the method should not be public because it should never be called by a...
[ "user-interface", "matlab", "callback", "oop", "access-control" ]
7
8
3,369
1
0
2008-09-19T22:16:02.910000
2008-09-22T08:10:20.297000
106,117
106,170
GCC - "expected unqualified-id before ')' token"
Please bear with me, I'm just learning C++. I'm trying to write my header file (for class) and I'm running into an odd error. cards.h:21: error: expected unqualified-id before ')' token cards.h:22: error: expected `)' before "str" cards.h:23: error: expected `)' before "r" What does "expected unqualified-id before ')' ...
Your issue is your #define. You did #define Card, so now everywhere Card is seen as a token, it will be replaced. Usually a #define Token with no additional token, as in #define Token Replace will use the value 1. Remove the #define Card, it's making line 22 read: 1(); or ();, which is causing the complaint.
GCC - "expected unqualified-id before ')' token" Please bear with me, I'm just learning C++. I'm trying to write my header file (for class) and I'm running into an odd error. cards.h:21: error: expected unqualified-id before ')' token cards.h:22: error: expected `)' before "str" cards.h:23: error: expected `)' before "...
TITLE: GCC - "expected unqualified-id before ')' token" QUESTION: Please bear with me, I'm just learning C++. I'm trying to write my header file (for class) and I'm running into an odd error. cards.h:21: error: expected unqualified-id before ')' token cards.h:22: error: expected `)' before "str" cards.h:23: error: exp...
[ "c++" ]
7
13
72,336
4
0
2008-09-19T22:23:34.657000
2008-09-19T22:36:08.620000
106,134
273,875
Tools to enable translation of A-Box ontology data
Does anyone know of any tools capable of defining a declarative mapping from T-Box structures from one ontology to another, which when executed can effect translation of A-Box instance data from one ontology's form to another's? I have recently written such a tool to meet my needs, but I was wondering if I reinvented t...
I've used SPARQL CONSTRUCT queries where I query on one model and construct new statements with properties from a different namespace. I save these and then load them into the target model. I have found this to be flexible but there are many places where I'd like to do additional processing on literals. I have also wan...
Tools to enable translation of A-Box ontology data Does anyone know of any tools capable of defining a declarative mapping from T-Box structures from one ontology to another, which when executed can effect translation of A-Box instance data from one ontology's form to another's? I have recently written such a tool to m...
TITLE: Tools to enable translation of A-Box ontology data QUESTION: Does anyone know of any tools capable of defining a declarative mapping from T-Box structures from one ontology to another, which when executed can effect translation of A-Box instance data from one ontology's form to another's? I have recently writte...
[ "rdf", "semantic-web", "owl", "ontology" ]
0
1
335
2
0
2008-09-19T22:27:13.023000
2008-11-07T22:40:35.547000
106,137
106,153
Where do you put your CSS Margins?
When you want to add whitespace between HTML elements (using CSS), to which element do you attach it? I'm regularly in situations along these lines: This is the heading This is a paragraph Here's another heading This is a footer Now, say I wanted 1em of space between each of these elements, but none above the first h1 ...
I tend to use a bottom margin on elements when I want them to have space before the next element, and then to use a ".last" class in the css to remove the margin from the last element. This is the heading This is a paragraph Here's another heading This is a footer div { margin-bottom: 1em; } p { margin-bottom: 1em; } h...
Where do you put your CSS Margins? When you want to add whitespace between HTML elements (using CSS), to which element do you attach it? I'm regularly in situations along these lines: This is the heading This is a paragraph Here's another heading This is a footer Now, say I wanted 1em of space between each of these ele...
TITLE: Where do you put your CSS Margins? QUESTION: When you want to add whitespace between HTML elements (using CSS), to which element do you attach it? I'm regularly in situations along these lines: This is the heading This is a paragraph Here's another heading This is a footer Now, say I wanted 1em of space between...
[ "css", "margin" ]
17
7
3,007
9
0
2008-09-19T22:28:15.737000
2008-09-19T22:32:55.740000
106,164
5,567,432
ClickOnce Online-Only Application as a TS RemoteApp
I've attempted just about everything to get our ClickOnce VB.NET app to run under Terminal Services as a RemoteApp. I have a batch file that runs the.application file for the app. This works fine via RDP desktop session on the terminal server. As a TS RemoteApp, however, well... not so much. I get a quick flash of comm...
The Key to getting it to work is to use Windows Explorer "C:\windows\explorer.exe". This process is the base process when you login to a full session. If you setup the RemoteApp to use Windows Explorer and the command line argument of the path to the.application file for the ClickOnce application then it will work when...
ClickOnce Online-Only Application as a TS RemoteApp I've attempted just about everything to get our ClickOnce VB.NET app to run under Terminal Services as a RemoteApp. I have a batch file that runs the.application file for the app. This works fine via RDP desktop session on the terminal server. As a TS RemoteApp, howev...
TITLE: ClickOnce Online-Only Application as a TS RemoteApp QUESTION: I've attempted just about everything to get our ClickOnce VB.NET app to run under Terminal Services as a RemoteApp. I have a batch file that runs the.application file for the app. This works fine via RDP desktop session on the terminal server. As a T...
[ "vb.net", "clickonce", "remoteapp" ]
3
8
12,687
8
0
2008-09-19T22:34:47.467000
2011-04-06T13:49:45.533000
106,175
121,635
VB.NET - How to get the instance used by a With statement in the immediate window
VB.NET has a very handy "with" statement, but it also lets you use it on an unnamed variable, like this: With New FancyClass().Level = "SuperSpiffy".Style = Slimming.Execute() End With Is there a way to get at the "hidden" instance, so I can view its properties in the Immediate window? I doubt I'll get it in the watch ...
As answered, the simple answer is "no". But isn't another way to do it: instead of declaring and then cleaning up the variable is to use the "Using". Using fc as new FancyClass() With fc.Level = "SuperSpiffy".Style = Slimming.Execute() End With End Using Then you can use fc in the immediate window and don't have to rem...
VB.NET - How to get the instance used by a With statement in the immediate window VB.NET has a very handy "with" statement, but it also lets you use it on an unnamed variable, like this: With New FancyClass().Level = "SuperSpiffy".Style = Slimming.Execute() End With Is there a way to get at the "hidden" instance, so I ...
TITLE: VB.NET - How to get the instance used by a With statement in the immediate window QUESTION: VB.NET has a very handy "with" statement, but it also lets you use it on an unnamed variable, like this: With New FancyClass().Level = "SuperSpiffy".Style = Slimming.Execute() End With Is there a way to get at the "hidde...
[ "vb.net", "visual-studio", "debugging", "immediate-window" ]
1
1
862
4
0
2008-09-19T22:37:09.193000
2008-09-23T15:13:57.837000
106,179
106,223
Regular expression to match DNS hostname or IP Address?
Does anyone have a regular expression handy that will match any legal DNS hostname or IP address? It's easy to write one that works 95% of the time, but I'm hoping to get something that's well tested to exactly match the latest RFC specs for DNS hostnames.
You can use the following regular expressions separately or by combining them in a joint OR expression. ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"; ValidHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za...
Regular expression to match DNS hostname or IP Address? Does anyone have a regular expression handy that will match any legal DNS hostname or IP address? It's easy to write one that works 95% of the time, but I'm hoping to get something that's well tested to exactly match the latest RFC specs for DNS hostnames.
TITLE: Regular expression to match DNS hostname or IP Address? QUESTION: Does anyone have a regular expression handy that will match any legal DNS hostname or IP address? It's easy to write one that works 95% of the time, but I'm hoping to get something that's well tested to exactly match the latest RFC specs for DNS ...
[ "regex", "dns" ]
411
592
439,425
23
0
2008-09-19T22:38:01.703000
2008-09-19T22:45:58.237000
106,201
106,218
How can I run an OpenGL application installed on a linux machine from my windows machine?
In the spirit of being helpful, this is a problem I had and solved, so I will answer the question here. Problem I have: An application that has to be installed on on Redhat or SuSE enterprise. It has huge system requirements and requires OpenGL. It is part of a suite of tools that need to operate together on one machin...
Solution I installed two pieces of software: PuTTY XMing-mesa The mesa part is important. PuTTY configuration Connection->Seconds Between Keepalives: 30 Connection->Enable TCP Keepalives: Yes Connection->SSH->X11->Enable X11 forwarding: Yes Connection->SSH->X11->X display location: localhost:0:0 Lauching Run Xming whi...
How can I run an OpenGL application installed on a linux machine from my windows machine? In the spirit of being helpful, this is a problem I had and solved, so I will answer the question here. Problem I have: An application that has to be installed on on Redhat or SuSE enterprise. It has huge system requirements and r...
TITLE: How can I run an OpenGL application installed on a linux machine from my windows machine? QUESTION: In the spirit of being helpful, this is a problem I had and solved, so I will answer the question here. Problem I have: An application that has to be installed on on Redhat or SuSE enterprise. It has huge system ...
[ "linux", "opengl", "x11", "system-administration", "putty" ]
7
11
18,573
5
0
2008-09-19T22:41:21.073000
2008-09-19T22:45:11.500000
106,206
106,226
Fastest way to remove non-numeric characters from a VARCHAR in SQL Server
I'm writing an import utility that is using phone numbers as a unique key within the import. I need to check that the phone number does not already exist in my DB. The problem is that phone numbers in the DB could have things like dashes and parenthesis and possibly other things. I wrote a function to remove these thin...
I may misunderstand, but you've got two sets of data to remove the strings from one for current data in the database and then a new set whenever you import. For updating the existing records, I would just use SQL, that only has to happen once. However, SQL isn't optimized for this sort of operation, since you said you ...
Fastest way to remove non-numeric characters from a VARCHAR in SQL Server I'm writing an import utility that is using phone numbers as a unique key within the import. I need to check that the phone number does not already exist in my DB. The problem is that phone numbers in the DB could have things like dashes and pare...
TITLE: Fastest way to remove non-numeric characters from a VARCHAR in SQL Server QUESTION: I'm writing an import utility that is using phone numbers as a unique key within the import. I need to check that the phone number does not already exist in my DB. The problem is that phone numbers in the DB could have things li...
[ "sql", "sql-server", "performance", "optimization" ]
74
17
215,538
16
0
2008-09-19T22:42:41.613000
2008-09-19T22:46:41.060000
106,237
106,277
Calculate the Hilbert value of a point for use in a Hilbert R-Tree?
I have an application where a Hilbert R-Tree (wikipedia) (citeseer) would seem to be an appropriate data structure. Specifically, it requires reasonably fast spatial queries over a data set that will experience a lot of updates. However, as far as I can see, none of the descriptions of the algorithms for this data stru...
Fun question! I did a bit of googling, and the good news is, I've found an implementation of Hilbert Value. The potentially bad news is, it's in Haskell... http://www.serpentine.com/blog/2007/01/11/two-dimensional-spatial-hashing-with-space-filling-curves/ It also proposes a Lebesgue distance metric you might be able t...
Calculate the Hilbert value of a point for use in a Hilbert R-Tree? I have an application where a Hilbert R-Tree (wikipedia) (citeseer) would seem to be an appropriate data structure. Specifically, it requires reasonably fast spatial queries over a data set that will experience a lot of updates. However, as far as I ca...
TITLE: Calculate the Hilbert value of a point for use in a Hilbert R-Tree? QUESTION: I have an application where a Hilbert R-Tree (wikipedia) (citeseer) would seem to be an appropriate data structure. Specifically, it requires reasonably fast spatial queries over a data set that will experience a lot of updates. Howev...
[ "data-structures", "fractals" ]
21
9
7,819
8
0
2008-09-19T22:48:47.763000
2008-09-19T23:01:28.277000
106,251
106,294
How do I write a custom validation method with parameters for my ActiveRecord model?
In my model I have: validate:my_custom_validation def my_custom_validation errors.add_to_base("error message") if condition.exists? end I would like to add some parameters to mycustomer vaildation like so: validate:my_custom_validation,:parameter1 => x,:parameter2 => y How do I write the mycustomvalidation function to...
Validators usualy have an array parameter indicating, first, the fields to validate and lastly (if it exists) a hash with the options. In your example::my_custom_validation, parameter1: x, parameter2: y:my_custom_validation would be a field name, while parameter1: x, parameter2: y would be a hash: { parameter1: x, para...
How do I write a custom validation method with parameters for my ActiveRecord model? In my model I have: validate:my_custom_validation def my_custom_validation errors.add_to_base("error message") if condition.exists? end I would like to add some parameters to mycustomer vaildation like so: validate:my_custom_validatio...
TITLE: How do I write a custom validation method with parameters for my ActiveRecord model? QUESTION: In my model I have: validate:my_custom_validation def my_custom_validation errors.add_to_base("error message") if condition.exists? end I would like to add some parameters to mycustomer vaildation like so: validate:m...
[ "ruby-on-rails", "ruby" ]
16
7
16,344
3
0
2008-09-19T22:51:47.897000
2008-09-19T23:05:43.773000
106,275
106,282
How to get a distinct list of words used in all Field Records using MS SQL?
If I have a table field named 'description', what would be the SQL (using MS SQL) to get a list of records of all distinct words used in this field. For example: If the table contains the following for the 'description' field: Record1 "The dog jumped over the fence." Record2 "The giant tripped on the fence."... The SQL...
I do not think you can do this with a SELECT. The best chance is to write a user defined function that returns a table with all the words and then do SELECT DISTINCT on it. Disclaimer: Function dbo.Split is from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648 CREATE TABLE test ( id int identity(1, 1) not null, d...
How to get a distinct list of words used in all Field Records using MS SQL? If I have a table field named 'description', what would be the SQL (using MS SQL) to get a list of records of all distinct words used in this field. For example: If the table contains the following for the 'description' field: Record1 "The dog ...
TITLE: How to get a distinct list of words used in all Field Records using MS SQL? QUESTION: If I have a table field named 'description', what would be the SQL (using MS SQL) to get a list of records of all distinct words used in this field. For example: If the table contains the following for the 'description' field:...
[ "sql", "sql-server" ]
3
8
9,486
5
0
2008-09-19T23:00:41.760000
2008-09-19T23:02:53.330000
106,299
106,449
How do I plan an enterprise level web application?
I'm at a point in my freelance career where I've developed several web applications for small to medium sized businesses that support things such as project management, booking/reservations, and email management. I like the work but find that eventually my applications get to a point where the overhear for maintenance ...
Although there are certainly good articles on that topic, none of them is a substitute of real-world experience. Maintainability is nothing you can plan straight ahead, except on very small projects. It is something you need to take care of during the whole project. In fact, creating loads of classes and infrastructure...
How do I plan an enterprise level web application? I'm at a point in my freelance career where I've developed several web applications for small to medium sized businesses that support things such as project management, booking/reservations, and email management. I like the work but find that eventually my applications...
TITLE: How do I plan an enterprise level web application? QUESTION: I'm at a point in my freelance career where I've developed several web applications for small to medium sized businesses that support things such as project management, booking/reservations, and email management. I like the work but find that eventual...
[ "frameworks" ]
10
9
4,338
6
0
2008-09-19T23:06:43.070000
2008-09-19T23:48:25.060000
106,310
120,356
How can I best connect Seam and GWT in a stateful web application?
We have a web application that was implemented using GWT. What it presents is fetched from a Jboss/Seam server using the remoting mechanism, and this works fine. However, the application is now extended to support sessions and users. The Seam GWT service doesn't seem to provide a way to let me log in such that Seam can...
It turns out that things are "just working" as I hoped. By using Seam's Identity and login mechanism, I can access the current logged in user via Identity.instance().getUsername(); in the service code that gets requests from the GWT portion of the application. I tried to put a @Restrict annotation on the service, but t...
How can I best connect Seam and GWT in a stateful web application? We have a web application that was implemented using GWT. What it presents is fetched from a Jboss/Seam server using the remoting mechanism, and this works fine. However, the application is now extended to support sessions and users. The Seam GWT servic...
TITLE: How can I best connect Seam and GWT in a stateful web application? QUESTION: We have a web application that was implemented using GWT. What it presents is fetched from a Jboss/Seam server using the remoting mechanism, and this works fine. However, the application is now extended to support sessions and users. T...
[ "java", "gwt", "jboss", "seam", "java-ee-5" ]
2
3
2,191
2
0
2008-09-19T23:10:01.440000
2008-09-23T11:09:36.770000
106,329
106,357
How do you programmatically identify the number of references to a method with C#
I've recently inherited C# console application that is in need of some pruning and clean up. Long story short, the app consists of a single class containing over 110,000 lines of code. Yup, over 110,000 lines in a single class. And, of course, the app is core to our business, running 'round the clock updating data used...
You could try to use NDepend if you just need to extract some stats about your class. Note that this tool relies on Mono.Cecil internally to inspect assemblies.
How do you programmatically identify the number of references to a method with C# I've recently inherited C# console application that is in need of some pruning and clean up. Long story short, the app consists of a single class containing over 110,000 lines of code. Yup, over 110,000 lines in a single class. And, of co...
TITLE: How do you programmatically identify the number of references to a method with C# QUESTION: I've recently inherited C# console application that is in need of some pruning and clean up. Long story short, the app consists of a single class containing over 110,000 lines of code. Yup, over 110,000 lines in a single...
[ "c#", "refactoring" ]
6
14
3,045
10
0
2008-09-19T23:15:18.480000
2008-09-19T23:22:35.590000
106,336
106,351
How do I find out what type each object is in a ArrayList<Object>?
I have a ArrayList made up of different elements imported from a db, made up of strings, numbers, doubles and ints. Is there a way to use a reflection type technique to find out what each type of data each element holds? FYI: The reason that there is so many types of data is that this is a piece of java code being writ...
In C#: Fixed with recommendation from Mike ArrayList list =...; // List list =...; foreach (object o in list) { if (o is int) { HandleInt((int)o); } else if (o is string) { HandleString((string)o); }... } In Java: ArrayList list =...; for (Object o: list) { if (o instanceof Integer)) { handleInt((Integer o).intValue())...
How do I find out what type each object is in a ArrayList<Object>? I have a ArrayList made up of different elements imported from a db, made up of strings, numbers, doubles and ints. Is there a way to use a reflection type technique to find out what each type of data each element holds? FYI: The reason that there is so...
TITLE: How do I find out what type each object is in a ArrayList<Object>? QUESTION: I have a ArrayList made up of different elements imported from a db, made up of strings, numbers, doubles and ints. Is there a way to use a reflection type technique to find out what each type of data each element holds? FYI: The reaso...
[ "java", "generics", "reflection", "arraylist" ]
88
102
271,935
12
0
2008-09-19T23:17:11.720000
2008-09-19T23:20:42.850000
106,347
107,503
Secure a DLL file with a license file
What is the best way to secure the use/loading of a DLL with a license file?
A couple of things you might want to consider: Check sum the DLL. Using a cryptographic hash function, you can store this inside the license file or inside the DLL. This provides a verification method to determined if my original DLL file is unhacked, or if it is the license file for this DLL. A few simple byte swappin...
Secure a DLL file with a license file What is the best way to secure the use/loading of a DLL with a license file?
TITLE: Secure a DLL file with a license file QUESTION: What is the best way to secure the use/loading of a DLL with a license file? ANSWER: A couple of things you might want to consider: Check sum the DLL. Using a cryptographic hash function, you can store this inside the license file or inside the DLL. This provides...
[ "c++", "dll", "licensing" ]
14
5
12,504
3
0
2008-09-19T23:19:58.263000
2008-09-20T07:21:43.257000
106,383
106,469
C# - Can publicly inherited methods be hidden (e.g. made private to derived class)
Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance. e.g. public DerivedClass: BaseClass {} Now I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override methods A and B to be private in DerivedClass so that only method C is exposed to ...
It's not possible, why? In C#, it is forced upon you that if you inherit public methods, you must make them public. Otherwise they expect you not to derive from the class in the first place. Instead of using the is-a relationship, you would have to use the has-a relationship. The language designers don't allow this on ...
C# - Can publicly inherited methods be hidden (e.g. made private to derived class) Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance. e.g. public DerivedClass: BaseClass {} Now I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override...
TITLE: C# - Can publicly inherited methods be hidden (e.g. made private to derived class) QUESTION: Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance. e.g. public DerivedClass: BaseClass {} Now I want to develop a method C in DerivedClass that uses A and B. Is there a ...
[ "c#", "class", "derived" ]
74
87
57,844
10
0
2008-09-19T23:29:04.357000
2008-09-19T23:56:51
106,387
106,399
Is it possible to detect 32 bit vs 64 bit in a bash script?
I am writing a bash script to deal with some installations in an automated way... I have the possibility of getting one such program in 32 or 64 bit binary... is it possible to detect the machine architecture from bash so I can select the correct binary? This will be for Ubuntu machines.
Does uname -a give you anything you can use? I don't have a 64-bit machine to test on. Note from Mike Stone: This works, though specifically uname -m Will give "x86_64" for 64 bit, and something else for other 32 bit types (in my 32 bit VM, it's "i686").
Is it possible to detect 32 bit vs 64 bit in a bash script? I am writing a bash script to deal with some installations in an automated way... I have the possibility of getting one such program in 32 or 64 bit binary... is it possible to detect the machine architecture from bash so I can select the correct binary? This ...
TITLE: Is it possible to detect 32 bit vs 64 bit in a bash script? QUESTION: I am writing a bash script to deal with some installations in an automated way... I have the possibility of getting one such program in 32 or 64 bit binary... is it possible to detect the machine architecture from bash so I can select the cor...
[ "bash" ]
74
54
48,008
8
0
2008-09-19T23:29:36.963000
2008-09-19T23:33:04.037000
106,395
107,696
Flash toggle snapping
long, long ago in a galaxy far far away, You used to be able to toggle snapping in Flash with the ctrl key. Let's say you were dragging the end of a line very close to another object. You could very easily hold the ctrl key down to shut off the snapping and get it in there nice and close without the snap. At some point...
I don't think there is, I've scoured the docs and could not find anything about it. The weird thing is also that you can't set a keyboard shortcut for toggling it. The option is there, but it's grayed out for some reason. The best I could manage was setting a shortcut for the object-snapping (since that's what i use th...
Flash toggle snapping long, long ago in a galaxy far far away, You used to be able to toggle snapping in Flash with the ctrl key. Let's say you were dragging the end of a line very close to another object. You could very easily hold the ctrl key down to shut off the snapping and get it in there nice and close without t...
TITLE: Flash toggle snapping QUESTION: long, long ago in a galaxy far far away, You used to be able to toggle snapping in Flash with the ctrl key. Let's say you were dragging the end of a line very close to another object. You could very easily hold the ctrl key down to shut off the snapping and get it in there nice a...
[ "flash" ]
0
0
378
1
0
2008-09-19T23:31:15.023000
2008-09-20T09:14:17.150000
106,396
106,434
Accessing an image in the projects resources?
How do I access an image during run time that I have added to the projects resources? I would like to be able to do something like this: if (value) { picBox1.image = Resources.imageA; } else { picBox2.image = Resources.imageB; }
something.Image = Namespace.ProjectName.Properties.Resources.ImageName;
Accessing an image in the projects resources? How do I access an image during run time that I have added to the projects resources? I would like to be able to do something like this: if (value) { picBox1.image = Resources.imageA; } else { picBox2.image = Resources.imageB; }
TITLE: Accessing an image in the projects resources? QUESTION: How do I access an image during run time that I have added to the projects resources? I would like to be able to do something like this: if (value) { picBox1.image = Resources.imageA; } else { picBox2.image = Resources.imageB; } ANSWER: something.Image = ...
[ "c#", ".net" ]
2
4
275
1
0
2008-09-19T23:31:21.200000
2008-09-19T23:42:27.133000
106,402
106,743
Can Spring Parse and Inject Properties Files?
I already know how to: Load properties files into my Spring configuration using: Build properties objects on the fly using: some value But what I cant do, and would be really useful, is to have Spring load a properties file and then build the matching properties object. I could then inject this into a bean in the norma...
Take a look at util:properties Then, to inject the Properties into your Spring-managed Bean, it's as simple as this: @Resource(name = "myProperties") private Properties myProperties;
Can Spring Parse and Inject Properties Files? I already know how to: Load properties files into my Spring configuration using: Build properties objects on the fly using: some value But what I cant do, and would be really useful, is to have Spring load a properties file and then build the matching properties object. I c...
TITLE: Can Spring Parse and Inject Properties Files? QUESTION: I already know how to: Load properties files into my Spring configuration using: Build properties objects on the fly using: some value But what I cant do, and would be really useful, is to have Spring load a properties file and then build the matching prop...
[ "java", "spring", "configuration-files" ]
12
17
17,056
1
0
2008-09-19T23:34:02.163000
2008-09-20T01:45:38.243000
106,414
107,171
How to refer to the path to an assembly in the GAC within registry entries added by a Windows Installer package?
I have a.NET assembly that contains classes to be registered as ServicedComponent through EnterpriseServices (COM+) and invoked through COM RPC by a third-party application. Therefore, I need to both add it to the GAC and add a registry entry under HKEY_CLASSES_ROOT\CLSID\{clsid}\CodeBase with the path to the assembly ...
If you have a component per file, which you should anyway, the KeyPath of the component points to the location where the file gets installed (in this case the GAC). You can use the component key as a token in the value field of the entry in the Registry table in your MSI. Assuming you have an assembly with a File key i...
How to refer to the path to an assembly in the GAC within registry entries added by a Windows Installer package? I have a.NET assembly that contains classes to be registered as ServicedComponent through EnterpriseServices (COM+) and invoked through COM RPC by a third-party application. Therefore, I need to both add it ...
TITLE: How to refer to the path to an assembly in the GAC within registry entries added by a Windows Installer package? QUESTION: I have a.NET assembly that contains classes to be registered as ServicedComponent through EnterpriseServices (COM+) and invoked through COM RPC by a third-party application. Therefore, I ne...
[ "c#", "com", "64-bit", "windows-installer", "com+" ]
1
2
3,410
1
0
2008-09-19T23:36:58.550000
2008-09-20T05:02:01.953000
106,425
106,438
Load external JS from bookmarklet?
How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner.
2015 Update Content security policy will prevent this from working in many sites now. For example, the code below won't work on Facebook. 2008 answer Use a bookmarklet that creates a script tag which includes your external JS. As a sample: javascript:(function(){document.body.appendChild(document.createElement('script'...
Load external JS from bookmarklet? How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner.
TITLE: Load external JS from bookmarklet? QUESTION: How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner. ANSWER: 2015 Update Content security policy will prevent this from working in many sites now. For example, the cod...
[ "javascript", "load", "external", "bookmarklet" ]
75
100
23,610
5
0
2008-09-19T23:39:49.433000
2008-09-19T23:43:19.050000
106,437
511,912
EJB3 Transaction Propagation
I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote { @PersistenceContext(unitName="myPC") private EntityManager mgr; @TransationAttribute(TransactionAttributeType.SUPPORTED) public void processObjects(List objs) { // this method just processes...
Another way to do it is actually having both methods on the same bean - and having an @EJB reference to itself! Something like that: // supposing processObjects defined on MyStatelessRemote1 and process defined on MyStatelessLocal1 @Stateless @TransationAttribute(TransactionAttributeType.NOT_SUPPORTED) public class MyS...
EJB3 Transaction Propagation I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote { @PersistenceContext(unitName="myPC") private EntityManager mgr; @TransationAttribute(TransactionAttributeType.SUPPORTED) public void processObjects(List objs) { ...
TITLE: EJB3 Transaction Propagation QUESTION: I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote { @PersistenceContext(unitName="myPC") private EntityManager mgr; @TransationAttribute(TransactionAttributeType.SUPPORTED) public void processObj...
[ "transactions", "jakarta-ee", "ejb-3.0" ]
26
24
18,555
8
0
2008-09-19T23:43:08.520000
2009-02-04T15:46:23.633000
106,439
110,990
Requiring users to update .NET
I'm working on some production software, using C# on the.NET framework. I really would like to be able to use LINQ on the project. I believe it requires.NET version 3.5 (correct me if I'm wrong). This application is a commercial software app, required to run on a client's work PC. Is it reasonable to assume they have.N...
To use LINQ, as you have said, you need to have.NET 3.5. Just to confirm this, the Wikipedia page for LINQ says: Language Integrated Query (LINQ, pronounced "link") is a Microsoft.NET Framework component that adds native data querying capabilities to.NET languages using a syntax reminiscent of SQL. Many of the concepts...
Requiring users to update .NET I'm working on some production software, using C# on the.NET framework. I really would like to be able to use LINQ on the project. I believe it requires.NET version 3.5 (correct me if I'm wrong). This application is a commercial software app, required to run on a client's work PC. Is it r...
TITLE: Requiring users to update .NET QUESTION: I'm working on some production software, using C# on the.NET framework. I really would like to be able to use LINQ on the project. I believe it requires.NET version 3.5 (correct me if I'm wrong). This application is a commercial software app, required to run on a client'...
[ "c#", ".net", "linq", "client-applications" ]
1
4
373
10
0
2008-09-19T23:43:58.347000
2008-09-21T13:10:46.823000
106,444
106,552
Enabling editing of primary key field in ASP.NET Dynamic Data / LINQ to SQL
If you have a table with a compound primary key that is composed of a foreign key and other table columns, how do you get ASP.NET Dynamic Data to allow the non-foreign primary key table columns to be editable?
LINQ to SQL does not support changing the primary key of an entity even without using Dynamic Data.
Enabling editing of primary key field in ASP.NET Dynamic Data / LINQ to SQL If you have a table with a compound primary key that is composed of a foreign key and other table columns, how do you get ASP.NET Dynamic Data to allow the non-foreign primary key table columns to be editable?
TITLE: Enabling editing of primary key field in ASP.NET Dynamic Data / LINQ to SQL QUESTION: If you have a table with a compound primary key that is composed of a foreign key and other table columns, how do you get ASP.NET Dynamic Data to allow the non-foreign primary key table columns to be editable? ANSWER: LINQ to...
[ ".net", "asp.net", "linq-to-sql", "dynamic-data" ]
3
2
2,530
4
0
2008-09-19T23:45:50.980000
2008-09-20T00:26:30.303000
106,453
116,954
How do I redirect Tornado / VXWorks shell output?
I've been working on an embedded C/C++ project recently using the shell in Tornado 2 as a way of debugging what's going on in our kit. The only problem with this approach is that it's a complicated system and as a result, has a fair bit of output. Tornado 'helpfully' scrolls the window every time some new information a...
here is another potential way: -> saveFd = open("myfile.txt",0x102, 0777 ) -> oldFd = ioGlobalStdGet(1) -> ioGlobalStdSet(1, saveFd) -> runmytest()... -> ioGlobalStdSet(1, oldFd) this will redirect all stdout activity to the file you opened. You might have to play around with the file name of the open to make it write ...
How do I redirect Tornado / VXWorks shell output? I've been working on an embedded C/C++ project recently using the shell in Tornado 2 as a way of debugging what's going on in our kit. The only problem with this approach is that it's a complicated system and as a result, has a fair bit of output. Tornado 'helpfully' sc...
TITLE: How do I redirect Tornado / VXWorks shell output? QUESTION: I've been working on an embedded C/C++ project recently using the shell in Tornado 2 as a way of debugging what's going on in our kit. The only problem with this approach is that it's a complicated system and as a result, has a fair bit of output. Torn...
[ "shell", "redirect", "embedded", "vxworks" ]
3
5
10,116
4
0
2008-09-19T23:51:26.613000
2008-09-22T19:27:04.337000