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
168,455
168,488
How do you post to an iframe?
How do you post data to an iframe?
Depends what you mean by "post data". You can use the HTML target="" attribute on a tag, so it could be as simple as: If that's not it, or you're after something more complex, please edit your question to include more detail. There is a known bug with Internet Explorer that only occurs when you're dynamically creating ...
How do you post to an iframe? How do you post data to an iframe?
TITLE: How do you post to an iframe? QUESTION: How do you post data to an iframe? ANSWER: Depends what you mean by "post data". You can use the HTML target="" attribute on a tag, so it could be as simple as: If that's not it, or you're after something more complex, please edit your question to include more detail. Th...
[ "post", "iframe" ]
314
462
469,054
5
0
2008-10-03T19:18:53.700000
2008-10-03T19:28:18.953000
168,481
170,062
What's the difference between ASP.Net MVC Routing and the new ASP.Net DynamicData Site routing?
I've only started playing with both ASP.Net MVC and the new-to-VS2008 Dynamic Data Website Templates. I note that they both use routing in their URL handling, and I'm given to understand that because of routing, ASP.Net MVC won't work under IIS6. However my DynamicData site works just fine on IIS6. I've had to temporar...
ASP.NET MVC does indeed work under IIS6 (and IIS5 for that matter) as long as you enable wildcard mappings to ASP.NET. I have deployed MVC applications to production using IIS6, so I can guarantree that it's possible. The key difference is that all URLs in DynamicData end in a file with an ASPX extension so, regardless...
What's the difference between ASP.Net MVC Routing and the new ASP.Net DynamicData Site routing? I've only started playing with both ASP.Net MVC and the new-to-VS2008 Dynamic Data Website Templates. I note that they both use routing in their URL handling, and I'm given to understand that because of routing, ASP.Net MVC ...
TITLE: What's the difference between ASP.Net MVC Routing and the new ASP.Net DynamicData Site routing? QUESTION: I've only started playing with both ASP.Net MVC and the new-to-VS2008 Dynamic Data Website Templates. I note that they both use routing in their URL handling, and I'm given to understand that because of rou...
[ "asp.net-mvc", "visual-studio-2008", ".net-3.5", "asp.net-dynamic-data" ]
0
5
1,639
3
0
2008-10-03T19:26:10.347000
2008-10-04T09:44:48.850000
168,486
168,546
What's your #1 way to be careful with a live database?
For my customer I occasionally do work in their live database in order to fix a problem they have created for themselves, or in order to fix bad data that my product's bugs created. Much like Unix root access, it's just dangerous. What lessons should I learn ahead of time? What is the #1 thing you do to be careful abou...
Three things I've learned the hard way over the years... First, if you're doing updates or deletes on live data, first write a SELECT query with the WHERE clause you'll be using. Make sure it works. Make sure it's correct. Then prepend the UPDATE/DELETE statement to the known working WHERE clause. You never want to hav...
What's your #1 way to be careful with a live database? For my customer I occasionally do work in their live database in order to fix a problem they have created for themselves, or in order to fix bad data that my product's bugs created. Much like Unix root access, it's just dangerous. What lessons should I learn ahead ...
TITLE: What's your #1 way to be careful with a live database? QUESTION: For my customer I occasionally do work in their live database in order to fix a problem they have created for themselves, or in order to fix bad data that my product's bugs created. Much like Unix root access, it's just dangerous. What lessons sho...
[ "database" ]
80
101
9,700
52
0
2008-10-03T19:27:51.340000
2008-10-03T19:38:03.083000
168,487
201,053
Unauthorized Sharepoint WSDL from ColdFusion 8
How do I solve the error: Unable to read WSDL from URL: https://workflowtest.site.edu/_vti_bin/Lists.asmx?WSDL. Error: 401 Unauthorized. I can successfully view the WSDL from the browser using the same user account. I'm not sure which authentication is being used (Basic or Integrated). How would I find that out? The co...
CFInvoke can only pass basic authentication, not windows integrated authentication. Sharepoint won't be able to downgrade to basic authentication since sharepoint needs to know who is calling the services to check authentication and authorization of the data being requested. Your best bet here is to create an asp.net p...
Unauthorized Sharepoint WSDL from ColdFusion 8 How do I solve the error: Unable to read WSDL from URL: https://workflowtest.site.edu/_vti_bin/Lists.asmx?WSDL. Error: 401 Unauthorized. I can successfully view the WSDL from the browser using the same user account. I'm not sure which authentication is being used (Basic or...
TITLE: Unauthorized Sharepoint WSDL from ColdFusion 8 QUESTION: How do I solve the error: Unable to read WSDL from URL: https://workflowtest.site.edu/_vti_bin/Lists.asmx?WSDL. Error: 401 Unauthorized. I can successfully view the WSDL from the browser using the same user account. I'm not sure which authentication is be...
[ "web-services", "sharepoint", "iis", "authentication", "coldfusion" ]
3
4
5,300
5
0
2008-10-03T19:28:12.667000
2008-10-14T12:59:17.893000
168,523
168,822
Win32_LogicalDisk fails for floppies
Using an idea from Bob King idea I wrote the following method. It works great on CD's, removable drives, regular drives. However for a floppy it always return "Not Available". Any ideas? public static void TestFloppy( char driveLetter ) { using( var searcher = new ManagementObjectSearcher( @"SELECT * FROM Win32_Logical...
I'm sorry that I don't have a better answer, but I used to do the same thing (use the ManagementObjectSearcher) and found that everytime the code ran the floppy drive would do some sort of seek/init sequence. So instead I changed to the below and interate: ManagementClass comp = new ManagementClass(scope, new Managemen...
Win32_LogicalDisk fails for floppies Using an idea from Bob King idea I wrote the following method. It works great on CD's, removable drives, regular drives. However for a floppy it always return "Not Available". Any ideas? public static void TestFloppy( char driveLetter ) { using( var searcher = new ManagementObjectSe...
TITLE: Win32_LogicalDisk fails for floppies QUESTION: Using an idea from Bob King idea I wrote the following method. It works great on CD's, removable drives, regular drives. However for a floppy it always return "Not Available". Any ideas? public static void TestFloppy( char driveLetter ) { using( var searcher = new ...
[ ".net", "wmi" ]
0
1
460
1
0
2008-10-03T19:33:20.673000
2008-10-03T20:45:31.217000
168,530
169,426
Where are some good resources for learning the new features of Perl 5.10?
I didn't realize until recently that Perl 5.10 had significant new features and I was wondering if anyone could give me some good resources for learning about those. I searched for them on Google and all I found was some slides and a quick overview. Some of the features (to me at least) would be nice if they had more e...
There's been a string of articles in Perl Tips about Perl 5.10: Regular Expressions in Perl 5.10 Perl 5.10: Defined-or and state Switch (given and when) Perl 5.10 and Hash::Util::FieldHash Smart-match in Perl 5.10 There are also my What's new in Perl 5.10 slides on Perl Training Australia's presentations page, but sinc...
Where are some good resources for learning the new features of Perl 5.10? I didn't realize until recently that Perl 5.10 had significant new features and I was wondering if anyone could give me some good resources for learning about those. I searched for them on Google and all I found was some slides and a quick overvi...
TITLE: Where are some good resources for learning the new features of Perl 5.10? QUESTION: I didn't realize until recently that Perl 5.10 had significant new features and I was wondering if anyone could give me some good resources for learning about those. I searched for them on Google and all I found was some slides ...
[ "perl", "perl5.10" ]
14
13
414
6
0
2008-10-03T19:34:17.053000
2008-10-04T00:30:03.320000
168,531
168,625
A Question of Greedy vs. Negated Character Classes in Regex
I have a very large file that looks like this (see below). I have two basic choices of regex to use on it (I know there may be others but I'm really trying to compare Greedy and Negated Char Class) methods. ftp: [^\D]{1,} ftp: (\d)+ ftp: \d+ Note: what if I took off the parense around the \d? Now + is greedy which forc...
Both your expressions have the same greediness. As others have said here, except for the capturing group they will execute in the same way. Also in this case greediness won't matter much at the execution speed since you don't have anything following \d*. In this case the expression will simply process all the digits it...
A Question of Greedy vs. Negated Character Classes in Regex I have a very large file that looks like this (see below). I have two basic choices of regex to use on it (I know there may be others but I'm really trying to compare Greedy and Negated Char Class) methods. ftp: [^\D]{1,} ftp: (\d)+ ftp: \d+ Note: what if I to...
TITLE: A Question of Greedy vs. Negated Character Classes in Regex QUESTION: I have a very large file that looks like this (see below). I have two basic choices of regex to use on it (I know there may be others but I'm really trying to compare Greedy and Negated Char Class) methods. ftp: [^\D]{1,} ftp: (\d)+ ftp: \d+ ...
[ "regex", "regex-greedy" ]
1
2
1,016
6
0
2008-10-03T19:34:33.480000
2008-10-03T19:57:05.150000
168,557
168,684
RESTifying URLs
At work here, we have a box serving XML feeds to business partners. Requests for our feeds are customized by specifying query string parameters and values. Some of these parameters are required, but many are not. For example, we've require all requests to specify a GUID to identify the partner, and a request can either...
You should leave optional query parameters in the Query string. There is no "rule" in REST that says there cannot be a query string. Actually, it's quite the opposite. The query string should be used to alter the view of the representation you are transferring back to the client. Stick to "Entities with Representable S...
RESTifying URLs At work here, we have a box serving XML feeds to business partners. Requests for our feeds are customized by specifying query string parameters and values. Some of these parameters are required, but many are not. For example, we've require all requests to specify a GUID to identify the partner, and a re...
TITLE: RESTifying URLs QUESTION: At work here, we have a box serving XML feeds to business partners. Requests for our feeds are customized by specifying query string parameters and values. Some of these parameters are required, but many are not. For example, we've require all requests to specify a GUID to identify the...
[ "http", "rest", "query-string" ]
7
4
858
2
0
2008-10-03T19:40:55.777000
2008-10-03T20:15:06.597000
168,559
168,584
Python - How do I convert "an OS-level handle to an open file" to a file object?
tempfile.mkstemp() returns: a tuple containing an OS-level handle to an open file (as would be returned by os.open()) and the absolute pathname of that file, in that order. How do I convert that OS-level handle to a file object? The documentation for os.open() states: To wrap a file descriptor in a "file object", use f...
You can use os.write(tup[0], "foo\n") to write to the handle. If you want to open the handle for writing you need to add the "w" mode f = os.fdopen(tup[0], "w") f.write("foo")
Python - How do I convert "an OS-level handle to an open file" to a file object? tempfile.mkstemp() returns: a tuple containing an OS-level handle to an open file (as would be returned by os.open()) and the absolute pathname of that file, in that order. How do I convert that OS-level handle to a file object? The docume...
TITLE: Python - How do I convert "an OS-level handle to an open file" to a file object? QUESTION: tempfile.mkstemp() returns: a tuple containing an OS-level handle to an open file (as would be returned by os.open()) and the absolute pathname of that file, in that order. How do I convert that OS-level handle to a file ...
[ "python", "temporary-files", "mkstemp", "fdopen" ]
61
60
23,536
6
0
2008-10-03T19:41:04.963000
2008-10-03T19:47:17.260000
168,560
168,641
Best Practices for Performing Sequential Operations
What is the best way to perform a couple of tasks together and if one task fails then the next tasks should not be completed? I know if it were the database operations then I should have used Transactions but I am talking about different types of operations like the following: All tasks must pass: SendEmail ArchiveRepo...
Exceptions are generally good for this sort of thing. Pseudo-Java/JavaScript/C++ code: try { if (!SendEmail()) { throw "Could not send e-mail"; } if (!ArchiveReportsInDatabase()) { throw "Could not archive reports in database"; } if (!CreateAFile()) { throw "Could not create file"; }... } catch (Exception) { LogErro...
Best Practices for Performing Sequential Operations What is the best way to perform a couple of tasks together and if one task fails then the next tasks should not be completed? I know if it were the database operations then I should have used Transactions but I am talking about different types of operations like the f...
TITLE: Best Practices for Performing Sequential Operations QUESTION: What is the best way to perform a couple of tasks together and if one task fails then the next tasks should not be completed? I know if it were the database operations then I should have used Transactions but I am talking about different types of ope...
[ "transactions" ]
3
0
484
10
0
2008-10-03T19:41:13.170000
2008-10-03T20:00:31.180000
168,575
169,078
Call Web Services Using Ajax or Silverlight? Which performs best?
I'm building an ASP.NET AJAX application that uses JavaScript to call web services to get its data, and also uses Silverlights Isolated Storage to cache the data on the client machine. Ultimately once the data is downloaded it is passed to JavaScript which displays in on the page using the HTML DOM. What I'm trying to ...
Since Silverlight can handle JSON and XML based services, the format of the response is totally irrelevant. What you must consider, however, is the following: 1) Silverlight is approximately 1000 times faster than JavaScript 2) If your web service is natively SOAP based, Visual Studio can generate a proxy for you, so t...
Call Web Services Using Ajax or Silverlight? Which performs best? I'm building an ASP.NET AJAX application that uses JavaScript to call web services to get its data, and also uses Silverlights Isolated Storage to cache the data on the client machine. Ultimately once the data is downloaded it is passed to JavaScript whi...
TITLE: Call Web Services Using Ajax or Silverlight? Which performs best? QUESTION: I'm building an ASP.NET AJAX application that uses JavaScript to call web services to get its data, and also uses Silverlights Isolated Storage to cache the data on the client machine. Ultimately once the data is downloaded it is passed...
[ "javascript", "ajax", "silverlight", "web-services", "asp.net-ajax" ]
2
3
1,620
4
0
2008-10-03T19:46:20.990000
2008-10-03T22:06:40.553000
168,589
168,595
How do I concatenate files in a subdirectory with Unix find execute and cat into a single file?
I can do this: $ find.../b./b/foo./c./c/foo And this: $ find. -type f -exec cat {} \; This is in b. This is in c. But not this: $ find. -type f -exec cat > out.txt {} \; Why not?
find's -exec argument runs the command you specify once for each file it finds. Try: $ find. -type f -exec cat {} \; > out.txt or: $ find. -type f | xargs cat > out.txt xargs converts its standard input into command-line arguments for the command you specify. If you're worried about embedded spaces in filenames, try: $...
How do I concatenate files in a subdirectory with Unix find execute and cat into a single file? I can do this: $ find.../b./b/foo./c./c/foo And this: $ find. -type f -exec cat {} \; This is in b. This is in c. But not this: $ find. -type f -exec cat > out.txt {} \; Why not?
TITLE: How do I concatenate files in a subdirectory with Unix find execute and cat into a single file? QUESTION: I can do this: $ find.../b./b/foo./c./c/foo And this: $ find. -type f -exec cat {} \; This is in b. This is in c. But not this: $ find. -type f -exec cat > out.txt {} \; Why not? ANSWER: find's -exec argum...
[ "unix", "command-line" ]
10
30
22,560
8
0
2008-10-03T19:47:46.230000
2008-10-03T19:50:08.627000
168,593
168,692
Bad habits of your Scrum Master
Scrum is quite popular dev.process these days and often Project Manager suddenly gets new title (Scrum Master). However it should be not just a new title, but new habits and new paradigm. What are the bad habits of your Scrum master?
The big bad habit our Scrum Master had at first was thinking we would take care of our own impediments. That's one of the things the Scrum Master is supposed to do but she left it to us until it got unmanageable. The other thing we've dealt with is the Scrum Master thinking they were in charge of riding the developers'...
Bad habits of your Scrum Master Scrum is quite popular dev.process these days and often Project Manager suddenly gets new title (Scrum Master). However it should be not just a new title, but new habits and new paradigm. What are the bad habits of your Scrum master?
TITLE: Bad habits of your Scrum Master QUESTION: Scrum is quite popular dev.process these days and often Project Manager suddenly gets new title (Scrum Master). However it should be not just a new title, but new habits and new paradigm. What are the bad habits of your Scrum master? ANSWER: The big bad habit our Scrum...
[ "agile", "scrum" ]
18
10
9,064
12
0
2008-10-03T19:49:47.270000
2008-10-03T20:16:59.573000
168,594
168,614
What is the command line syntax to delete files in Perforce?
I am creating some build scripts that interact with Perforce and I would like to mark for delete a few files. What exactly is the P4 syntax using the command line?
p4 delete filename (output of p4 help delete) delete -- Open an existing file to delete it from the depot p4 delete [ -c changelist# ] [ -n ] file... Opens a file that currently exists in the depot for deletion. If the file is present on the client it is removed. If a pending changelist number is given with the -c flag...
What is the command line syntax to delete files in Perforce? I am creating some build scripts that interact with Perforce and I would like to mark for delete a few files. What exactly is the P4 syntax using the command line?
TITLE: What is the command line syntax to delete files in Perforce? QUESTION: I am creating some build scripts that interact with Perforce and I would like to mark for delete a few files. What exactly is the P4 syntax using the command line? ANSWER: p4 delete filename (output of p4 help delete) delete -- Open an exis...
[ "command-line", "syntax", "file", "perforce" ]
3
9
10,315
4
0
2008-10-03T19:49:48.083000
2008-10-03T19:53:52.100000
168,610
168,626
Can you get a Windows (AD) username in PHP?
I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?
Check the AUTH_USER request variable. This will be empty if your web app allows anonymous access, but if your server's using basic or Windows integrated authentication, it will contain the username of the authenticated user. In an Active Directory domain, if your clients are running Internet Explorer and your web serve...
Can you get a Windows (AD) username in PHP? I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?
TITLE: Can you get a Windows (AD) username in PHP? QUESTION: I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible? ANSWER: Check the AUT...
[ "php", "windows", "authentication" ]
50
50
188,700
17
0
2008-10-03T19:53:12.723000
2008-10-03T19:57:20.110000
168,639
168,652
Escaping a String from getting regex parsed in Java
In Java, suppose I have a String variable S, and I want to search for it inside of another String T, like so: if (T.matches(S))... (note: the above line was T.contains() until a few posts pointed out that that method does not use regexes. My bad.) But now suppose S may have unsavory characters in it. For instance, let ...
String.contains does not use regex, so there isn't a problem in this case. Where a regex is required, rather rejecting strings with regex special characters, use java.util.regex.Pattern.quote to escape them.
Escaping a String from getting regex parsed in Java In Java, suppose I have a String variable S, and I want to search for it inside of another String T, like so: if (T.matches(S))... (note: the above line was T.contains() until a few posts pointed out that that method does not use regexes. My bad.) But now suppose S ma...
TITLE: Escaping a String from getting regex parsed in Java QUESTION: In Java, suppose I have a String variable S, and I want to search for it inside of another String T, like so: if (T.matches(S))... (note: the above line was T.contains() until a few posts pointed out that that method does not use regexes. My bad.) Bu...
[ "java", "regex", "string", "escaping" ]
14
21
12,171
6
0
2008-10-03T19:59:43.227000
2008-10-03T20:04:49.910000
168,646
168,655
What are the best steps to start programming with TDD with C#?
I want to start working with TDD but I don't know really where to start. We coding with.NET (C#/ASP.NET).
See the questions Why should I practice Test Driven Development and how should I start?, Moving existing code to Test Driven Development, What is unit testing? and What is TDD?
What are the best steps to start programming with TDD with C#? I want to start working with TDD but I don't know really where to start. We coding with.NET (C#/ASP.NET).
TITLE: What are the best steps to start programming with TDD with C#? QUESTION: I want to start working with TDD but I don't know really where to start. We coding with.NET (C#/ASP.NET). ANSWER: See the questions Why should I practice Test Driven Development and how should I start?, Moving existing code to Test Driven...
[ "c#", ".net", "tdd" ]
6
3
572
4
0
2008-10-03T20:02:48.417000
2008-10-03T20:06:23.400000
168,659
168,666
Getting the currently logged-in windows user
I found this via google: http://www.mvps.org/access/api/api0008.htm '******************** Code Start ************************** ' This code was originally written by Dev Ashish. ' It is not to be altered or distributed, ' except as part of an application. ' You are free to use it in any application, ' provided the copy...
You could also use Environ$ but the method specified by the question is better. Users/Applications can change the environment variables.
Getting the currently logged-in windows user I found this via google: http://www.mvps.org/access/api/api0008.htm '******************** Code Start ************************** ' This code was originally written by Dev Ashish. ' It is not to be altered or distributed, ' except as part of an application. ' You are free to u...
TITLE: Getting the currently logged-in windows user QUESTION: I found this via google: http://www.mvps.org/access/api/api0008.htm '******************** Code Start ************************** ' This code was originally written by Dev Ashish. ' It is not to be altered or distributed, ' except as part of an application. '...
[ "vba", "ms-access", "winapi" ]
11
7
42,553
7
0
2008-10-03T20:07:36.487000
2008-10-03T20:10:24.953000
168,667
168,674
How to write acceptance tests
How would you go about introducing acceptance tests into a team using the.NET framework? What tools are available for this purpose? Thanks!
You might want to take a look at FitNesse, which is meant to be a way for Acceptance tests to look like a wiki document (so that they can be read and written by QA or project managers) http://fitnesse.org/ Here's a good intro http://ablog.apress.com/?p=735
How to write acceptance tests How would you go about introducing acceptance tests into a team using the.NET framework? What tools are available for this purpose? Thanks!
TITLE: How to write acceptance tests QUESTION: How would you go about introducing acceptance tests into a team using the.NET framework? What tools are available for this purpose? Thanks! ANSWER: You might want to take a look at FitNesse, which is meant to be a way for Acceptance tests to look like a wiki document (so...
[ ".net", "testing", "acceptance-testing" ]
3
5
2,117
2
0
2008-10-03T20:10:48.710000
2008-10-03T20:12:55.447000
168,672
168,689
How do I get back a 2 digit representation of a number in SQL 2000
I have a table on SQL2000 with a numeric column and I need the select to return a 01, 02, 03... It currently returns 1,2,3,...10,11... Thanks.
Does this work? SELECT REPLACE(STR(mycolumn, 2), ' ', '0') From http://foxtricks.blogspot.com/2007/07/zero-padding-numeric-value-in-transact.html
How do I get back a 2 digit representation of a number in SQL 2000 I have a table on SQL2000 with a numeric column and I need the select to return a 01, 02, 03... It currently returns 1,2,3,...10,11... Thanks.
TITLE: How do I get back a 2 digit representation of a number in SQL 2000 QUESTION: I have a table on SQL2000 with a numeric column and I need the select to return a 01, 02, 03... It currently returns 1,2,3,...10,11... Thanks. ANSWER: Does this work? SELECT REPLACE(STR(mycolumn, 2), ' ', '0') From http://foxtricks.bl...
[ "sql-server" ]
1
7
502
4
0
2008-10-03T20:12:37.740000
2008-10-03T20:16:08.623000
168,676
172,820
Recommended books on Desktop Application development using MVC
I'm looking for recommendations on books about MVC on the desktop. If they use Java, that is a bonus. Some background: I'm writing a desktop application in Java. It's an audio application that has a number of views and a central model called a Library with playlists, effects lists and a folder structure to organize the...
I've had the same problem: it really takes a lot of discipline to write a (non trivial) swing app, because all the listeners and events and asynchronous processing make up really fast for a big pile of unmaintainable code. I found that classic MVC isn't enough, you have to look into more specific patterns like Presenta...
Recommended books on Desktop Application development using MVC I'm looking for recommendations on books about MVC on the desktop. If they use Java, that is a bonus. Some background: I'm writing a desktop application in Java. It's an audio application that has a number of views and a central model called a Library with ...
TITLE: Recommended books on Desktop Application development using MVC QUESTION: I'm looking for recommendations on books about MVC on the desktop. If they use Java, that is a bonus. Some background: I'm writing a desktop application in Java. It's an audio application that has a number of views and a central model call...
[ "java", "model-view-controller", "desktop" ]
9
9
7,693
6
0
2008-10-03T20:13:13.620000
2008-10-05T23:16:00.240000
168,681
176,228
Time Travel functions in postgresql
Can anyone recommend for/against the time-travel functions in postgresql's contrib/spi module? Is there an example available anywhere? Tnx
The argument for time-travel would be being able to look at tables that are updated often at an earlier insertion/deletion point. Say a table of stock prices for a firms investment portfolio. The argument against would be the extra storage space it eats up. Here is an Example of use.
Time Travel functions in postgresql Can anyone recommend for/against the time-travel functions in postgresql's contrib/spi module? Is there an example available anywhere? Tnx
TITLE: Time Travel functions in postgresql QUESTION: Can anyone recommend for/against the time-travel functions in postgresql's contrib/spi module? Is there an example available anywhere? Tnx ANSWER: The argument for time-travel would be being able to look at tables that are updated often at an earlier insertion/dele...
[ "postgresql", "time-travel" ]
11
5
4,836
2
0
2008-10-03T20:14:40.093000
2008-10-06T21:15:27.283000
168,706
168,740
How do you specify a particular JRE for a Browser applet?
I have an third-party applet that requires JRE v1.5_12 to work correctly. THe user is installing JRE v1.6.07 or better. It used to be with 1.5 and below, that I could have multiple JRE's on the machine and specify which one to use - but with 1.6 that apepars to be broken. How do I tell the browser I want to use v1.5_12...
For security reasons, you can no longer force it to use older JRE's. Say release 12 has a huge security hole, and everyone installs release 13 to patch it. Evil java applets could just say "run with release 12 please" and then carry out their exploits, rendering the patches useless. Most likely you have some code with ...
How do you specify a particular JRE for a Browser applet? I have an third-party applet that requires JRE v1.5_12 to work correctly. THe user is installing JRE v1.6.07 or better. It used to be with 1.5 and below, that I could have multiple JRE's on the machine and specify which one to use - but with 1.6 that apepars to ...
TITLE: How do you specify a particular JRE for a Browser applet? QUESTION: I have an third-party applet that requires JRE v1.5_12 to work correctly. THe user is installing JRE v1.6.07 or better. It used to be with 1.5 and below, that I could have multiple JRE's on the machine and specify which one to use - but with 1....
[ "applet", "java" ]
11
14
14,323
2
0
2008-10-03T20:20:08.303000
2008-10-03T20:25:02.130000
168,720
168,784
Questions when moving from MbUnit to MsTest
Our team is looking to switch from using mbunit to mstest, but there appears to be some disconnect between the two. Does anyone know how to simulate the CombinatorialTest and Factory attributes from mbunit when using mstest? I think that is our only stumbling block before doing the switch.
As far as I'm aware, you basically need to write a test method that generates all of the combinations (or calls the factory and iterates through the items) that calls your original test (now no longer a test method) a bunch of times. Unfortunately, these do not show up as individual tests in results - they show up as j...
Questions when moving from MbUnit to MsTest Our team is looking to switch from using mbunit to mstest, but there appears to be some disconnect between the two. Does anyone know how to simulate the CombinatorialTest and Factory attributes from mbunit when using mstest? I think that is our only stumbling block before doi...
TITLE: Questions when moving from MbUnit to MsTest QUESTION: Our team is looking to switch from using mbunit to mstest, but there appears to be some disconnect between the two. Does anyone know how to simulate the CombinatorialTest and Factory attributes from mbunit when using mstest? I think that is our only stumblin...
[ "unit-testing", "mstest", "factory", "mbunit" ]
5
5
608
1
0
2008-10-03T20:22:40.373000
2008-10-03T20:35:35.447000
168,724
168,807
Generate table relationship diagram from existing schema (SQL Server)
Is there a way to produce a diagram showing existing tables and their relationships given a connection to a database? This is for SQL Server 2008 Express Edition.
Yes you can use SQL Server 2008 itself but you need to install SQL Server Management Studio Express (if not installed ). Just right Click on Database Diagrams and create new diagram. Select the exisiting tables and if you have specified the references in your tables properly. You will be able to see the complete diagra...
Generate table relationship diagram from existing schema (SQL Server) Is there a way to produce a diagram showing existing tables and their relationships given a connection to a database? This is for SQL Server 2008 Express Edition.
TITLE: Generate table relationship diagram from existing schema (SQL Server) QUESTION: Is there a way to produce a diagram showing existing tables and their relationships given a connection to a database? This is for SQL Server 2008 Express Edition. ANSWER: Yes you can use SQL Server 2008 itself but you need to insta...
[ "sql-server", "database", "diagram" ]
204
162
421,125
9
0
2008-10-03T20:23:06.330000
2008-10-03T20:43:32.513000
168,736
168,832
How do you set a default value for a MySQL Datetime column?
How do you set a default value for a MySQL Datetime column? In SQL Server it's getdate(). What is the equivalant for MySQL? I'm using MySQL 5.x if that is a factor.
IMPORTANT EDIT: It is now possible to achieve this with DATETIME fields since MySQL 5.6.5, take a look at the other post below... Previous versions can't do that with DATETIME... But you can do it with TIMESTAMP: mysql> create table test (str varchar(32), ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP); Query OK, 0 rows affect...
How do you set a default value for a MySQL Datetime column? How do you set a default value for a MySQL Datetime column? In SQL Server it's getdate(). What is the equivalant for MySQL? I'm using MySQL 5.x if that is a factor.
TITLE: How do you set a default value for a MySQL Datetime column? QUESTION: How do you set a default value for a MySQL Datetime column? In SQL Server it's getdate(). What is the equivalant for MySQL? I'm using MySQL 5.x if that is a factor. ANSWER: IMPORTANT EDIT: It is now possible to achieve this with DATETIME fie...
[ "mysql", "datetime" ]
1,037
989
1,655,258
28
0
2008-10-03T20:24:30.523000
2008-10-03T20:48:00.650000
168,798
178,131
How do I create a ColdFusion web service client that uses WS-Security?
I've exposed several web services in our product using Java and WS-Security. One of our customers wants to consume the web service using ColdFusion. Does ColdFusion support WS-Security? Can I get around it by writing a Java client and using that in ColdFusion? (I don't know much about ColdFusion).
I'm assuming you mean you need to pass the security in as part of the SOAP header. Here's a sample on how to connect to a.Net service. Same approach should apply w/ Java, just the url's would be different. Hope this is what you needed.
How do I create a ColdFusion web service client that uses WS-Security? I've exposed several web services in our product using Java and WS-Security. One of our customers wants to consume the web service using ColdFusion. Does ColdFusion support WS-Security? Can I get around it by writing a Java client and using that in ...
TITLE: How do I create a ColdFusion web service client that uses WS-Security? QUESTION: I've exposed several web services in our product using Java and WS-Security. One of our customers wants to consume the web service using ColdFusion. Does ColdFusion support WS-Security? Can I get around it by writing a Java client ...
[ "web-services", "coldfusion", "ws-security" ]
3
5
3,747
3
0
2008-10-03T20:40:49.807000
2008-10-07T12:01:55.577000
168,802
168,811
Where can I find a tutorial to get started learning jQuery?
Where is a good place to get started learning how to use jQuery? It seems to be all the rage nowadays. I know some basics of JavaScript but I'm by no means an expert.
Officially from jQuery http://docs.jquery.com/Tutorials Or try anything on this site that compiles a bunch of jQuery learning material: http://www.noupe.com/tutorial/51-best-of-jquery-tutorials-and-examples.html
Where can I find a tutorial to get started learning jQuery? Where is a good place to get started learning how to use jQuery? It seems to be all the rage nowadays. I know some basics of JavaScript but I'm by no means an expert.
TITLE: Where can I find a tutorial to get started learning jQuery? QUESTION: Where is a good place to get started learning how to use jQuery? It seems to be all the rage nowadays. I know some basics of JavaScript but I'm by no means an expert. ANSWER: Officially from jQuery http://docs.jquery.com/Tutorials Or try any...
[ "jquery" ]
22
17
9,168
13
0
2008-10-03T20:42:01.347000
2008-10-03T20:44:14.073000
168,826
168,860
How do you access ViewState collection from PreviousPage on cross-page postback?
In ASP.net 2.0, the PreviousPage property of a web page does not have a ViewState collection. I want to use this collection to transfer information between pages.
View State is exclusive to the page. If you want to transfer items, you can persist the data in a database, file, forms auth ticket or other cookie (Dont use Session or HttpContext.Current.Cache if you can help it) do a cross page post - from your first page, post back to the second page (and get the details from HttpC...
How do you access ViewState collection from PreviousPage on cross-page postback? In ASP.net 2.0, the PreviousPage property of a web page does not have a ViewState collection. I want to use this collection to transfer information between pages.
TITLE: How do you access ViewState collection from PreviousPage on cross-page postback? QUESTION: In ASP.net 2.0, the PreviousPage property of a web page does not have a ViewState collection. I want to use this collection to transfer information between pages. ANSWER: View State is exclusive to the page. If you want ...
[ "asp.net" ]
3
1
3,600
4
0
2008-10-03T20:47:07.560000
2008-10-03T20:54:54.097000
168,827
172,347
What to use for membership in ASP.NET
I'm not very experienced at using ASP.NET, but I've used built in membership providers for simple WebForms application, and I found them PITA when trying to extend the way they work (add/remove few fields and redo controls accordingly). Now I'm preparing for MVC (ASP.NET MVC or Monorail based) project, and I'm thinking...
The Membership Provider in ASP.NET is very handy and extensible. It's simple to use the "off the shelf" features like Active Directory, SQL Server, and OpenLDAP. The main advantage is the ability to not reinvent the wheel. If your needs are more nuanced than that you can build your own provider by extending overriding ...
What to use for membership in ASP.NET I'm not very experienced at using ASP.NET, but I've used built in membership providers for simple WebForms application, and I found them PITA when trying to extend the way they work (add/remove few fields and redo controls accordingly). Now I'm preparing for MVC (ASP.NET MVC or Mon...
TITLE: What to use for membership in ASP.NET QUESTION: I'm not very experienced at using ASP.NET, but I've used built in membership providers for simple WebForms application, and I found them PITA when trying to extend the way they work (add/remove few fields and redo controls accordingly). Now I'm preparing for MVC (...
[ "asp.net", "architecture", "asp.net-membership" ]
5
13
3,290
4
0
2008-10-03T20:47:12.740000
2008-10-05T17:49:41.333000
168,833
168,844
Database Design: A proper table design for large number of column values
I wish to perform an experiment many different times. After every trial, I am left with a "large" set of output statistics -- let's say, 1000. I would like to store the outputs of my experiments in a table, but what's the best way...? Option 1 Have a table with 1000 columns. Seems like a bad idea. What if the number of...
Option 2, with ID, TrialID, StatisticID, StatisticValue With proper indexing, it will perform fairly well (you can use PIVOT to get the values out on columns fairly easily in SQL Server 2005). When the statistics are different datatypes, the problem becomes more interesting, but in many cases, I just up-size the dataty...
Database Design: A proper table design for large number of column values I wish to perform an experiment many different times. After every trial, I am left with a "large" set of output statistics -- let's say, 1000. I would like to store the outputs of my experiments in a table, but what's the best way...? Option 1 Hav...
TITLE: Database Design: A proper table design for large number of column values QUESTION: I wish to perform an experiment many different times. After every trial, I am left with a "large" set of output statistics -- let's say, 1000. I would like to store the outputs of my experiments in a table, but what's the best wa...
[ "database-design" ]
1
7
2,542
7
0
2008-10-03T20:48:01.693000
2008-10-03T20:51:20.253000
168,837
168,845
How should I convert Java code to C# code?
I'm porting a Java library to C#. I'm using Visual Studio 2008, so I don't have the discontinued Microsoft Java Language Conversion Assistant program (JLCA). My approach is to create a new solution with a similar project structure to the Java library, and to then copy the java code into a c# file and convert it to vali...
Your doing it in the only sane way you can...the biggest help will be this document from Dare Obasanjo that lists the differences between the two languages: http://www.25hoursaday.com/CsharpVsJava.html BTW, change all getter and setter methods into properties...No need to have the C# library function just the same as t...
How should I convert Java code to C# code? I'm porting a Java library to C#. I'm using Visual Studio 2008, so I don't have the discontinued Microsoft Java Language Conversion Assistant program (JLCA). My approach is to create a new solution with a similar project structure to the Java library, and to then copy the java...
TITLE: How should I convert Java code to C# code? QUESTION: I'm porting a Java library to C#. I'm using Visual Studio 2008, so I don't have the discontinued Microsoft Java Language Conversion Assistant program (JLCA). My approach is to create a new solution with a similar project structure to the Java library, and to ...
[ "c#", "java" ]
6
3
11,338
5
0
2008-10-03T20:48:55.857000
2008-10-03T20:51:21.017000
168,838
168,974
Color scaling function
I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. Basically the function should return color based on the value inputted. Any ideas?
Basically, the general method for smooth transition between two values is the following function: function transition(value, maximum, start_point, end_point): return start_point + (end_point - start_point)*value/maximum That given, you define a function that does the transition for triplets (RGB, HSV etc). function tra...
Color scaling function I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. Basically the function should return color based on the value inputted. Any ideas?
TITLE: Color scaling function QUESTION: I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. Basically the function should return color based on the value inputted. Any ideas? ANSWER: Basically, the general method f...
[ "colors", "interpolation" ]
15
17
18,742
8
0
2008-10-03T20:49:06.263000
2008-10-03T21:26:19.713000
168,868
170,096
How to get 'Next Page' link with Scrubyt
I'm trying to use Scrubyt to get the details from this page http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php?section=events. I've managed to get the titles and detail URLs from the list, but I can't use next_page to get the scraper to go to the next page. I assume that's cause I'm not using the correct pat...
Try this with a slightly different URL: fetch 'http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php' scrubyt seems to be having issues with "?section=events" query on the end of the URL. When it looks for the next page it is trying to return this URL: http://www.nuffieldtheatre.co.uk/cn/events/?pageNum_rsSearc...
How to get 'Next Page' link with Scrubyt I'm trying to use Scrubyt to get the details from this page http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php?section=events. I've managed to get the titles and detail URLs from the list, but I can't use next_page to get the scraper to go to the next page. I assume t...
TITLE: How to get 'Next Page' link with Scrubyt QUESTION: I'm trying to use Scrubyt to get the details from this page http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php?section=events. I've managed to get the titles and detail URLs from the list, but I can't use next_page to get the scraper to go to the nex...
[ "ruby", "scrubyt" ]
0
2
818
1
0
2008-10-03T20:56:10.633000
2008-10-04T10:34:51.870000
168,891
168,982
Is it faster to sort a list after inserting items or adding them to a sorted list
If I have a sorted list (say quicksort to sort), if I have a lot of values to add, is it better to suspend sorting, and add them to the end, then sort, or use binary chop to place the items correctly while adding them. Does it make a difference if the items are random, or already more or less in order?
If you add enough items that you're effectively building the list from scratch, you should be able to get better performance by sorting the list afterwards. If items are mostly in order, you can tweak both incremental update and regular sorting to take advantage of that, but frankly, it usually isn't worth the trouble....
Is it faster to sort a list after inserting items or adding them to a sorted list If I have a sorted list (say quicksort to sort), if I have a lot of values to add, is it better to suspend sorting, and add them to the end, then sort, or use binary chop to place the items correctly while adding them. Does it make a diff...
TITLE: Is it faster to sort a list after inserting items or adding them to a sorted list QUESTION: If I have a sorted list (say quicksort to sort), if I have a lot of values to add, is it better to suspend sorting, and add them to the end, then sort, or use binary chop to place the items correctly while adding them. D...
[ "algorithm", "sorting", "list" ]
98
52
74,898
13
0
2008-10-03T21:02:19.963000
2008-10-03T21:29:12.627000
168,897
169,958
What's better in regards to performance? type[,] or type[][]?
Is it more performant to have a bidimensional array ( type[,] ) or an array of arrays ( type[][] ) in C#? Particularly for initial allocation and item access
Of course, if all else fails... test it! Following gives (in "Release", at the console): Size 1000, Repeat 1000 int[,] set: 3460 int[,] get: 4036 (chk=1304808064) int[][] set: 2441 int[][] get: 1283 (chk=1304808064) So a jagged array is quicker, at least in this test. Interesting! However, it is a relatively small fact...
What's better in regards to performance? type[,] or type[][]? Is it more performant to have a bidimensional array ( type[,] ) or an array of arrays ( type[][] ) in C#? Particularly for initial allocation and item access
TITLE: What's better in regards to performance? type[,] or type[][]? QUESTION: Is it more performant to have a bidimensional array ( type[,] ) or an array of arrays ( type[][] ) in C#? Particularly for initial allocation and item access ANSWER: Of course, if all else fails... test it! Following gives (in "Release", a...
[ "c#", "performance", "arrays" ]
5
6
457
4
0
2008-10-03T21:04:23.797000
2008-10-04T08:10:32.363000
168,901
168,922
Count the items from a IEnumerable<T> without iterating?
private IEnumerable Tables { get { yield return "Foo"; yield return "Bar"; } } Let's say I want iterate on those and write something like processing #n of #m. Is there a way I can find out the value of m without iterating before my main iteration? I hope I made myself clear.
IEnumerable doesn't support this. This is by design. IEnumerable uses lazy evaluation to get the elements you ask for just before you need them. If you want to know the number of items without iterating over them you can use ICollection, it has a Count property.
Count the items from a IEnumerable<T> without iterating? private IEnumerable Tables { get { yield return "Foo"; yield return "Bar"; } } Let's say I want iterate on those and write something like processing #n of #m. Is there a way I can find out the value of m without iterating before my main iteration? I hope I made m...
TITLE: Count the items from a IEnumerable<T> without iterating? QUESTION: private IEnumerable Tables { get { yield return "Foo"; yield return "Bar"; } } Let's say I want iterate on those and write something like processing #n of #m. Is there a way I can find out the value of m without iterating before my main iteratio...
[ "c#", ".net", "ienumerable" ]
369
392
491,974
23
0
2008-10-03T21:05:03.580000
2008-10-03T21:08:33.977000
168,912
169,036
Show Only One Element with JQuery
I need to show only one element at a time when a link is clicked on. Right now I'm cheating by hiding everything again and then toggling the element clicked on. This works, unless i want EVERYTHING to disappear again. Short of adding a "Hide All" button/link what can i do? I would like to be able to click on the link a...
$("#linkgarykhit").click(function(){ if($("#infogarykhit").css('display')!= 'none'){ $("#infogarykhit").hide(); }else{ $("#infocontent *").hide(); $("#infogarykhit").show(); } return false; }); We could also DRY this up a bit: function toggleInfoContent(id){ if($('#' + id).css('display')!= 'none'){ $('#' + id).hide(); ...
Show Only One Element with JQuery I need to show only one element at a time when a link is clicked on. Right now I'm cheating by hiding everything again and then toggling the element clicked on. This works, unless i want EVERYTHING to disappear again. Short of adding a "Hide All" button/link what can i do? I would like...
TITLE: Show Only One Element with JQuery QUESTION: I need to show only one element at a time when a link is clicked on. Right now I'm cheating by hiding everything again and then toggling the element clicked on. This works, unless i want EVERYTHING to disappear again. Short of adding a "Hide All" button/link what can ...
[ "javascript", "jquery" ]
2
2
6,366
4
0
2008-10-03T21:07:20.390000
2008-10-03T21:50:39.493000
168,924
169,009
How to render contextual difference between two timestamps in JavaScript?
Let's say I've got two strings in JavaScript: var date1 = '2008-10-03T20:24Z' var date2 = '2008-10-04T12:24Z' How would I come to a result like so: '4 weeks ago' or 'in about 15 minutes' (should support past and future). There are solutions out there for the past diffs, but I've yet to find one with support for future ...
Looking at the solutions you linked... it is actually as simple as my frivolous comment! Here's a version of the Zach Leatherman code that prepends "In " for future dates for you. As you can see, the changes are very minor. function humane_date(date_str){ var time_formats = [ [60, 'Just Now'], [90, '1 Minute'], // 60*1...
How to render contextual difference between two timestamps in JavaScript? Let's say I've got two strings in JavaScript: var date1 = '2008-10-03T20:24Z' var date2 = '2008-10-04T12:24Z' How would I come to a result like so: '4 weeks ago' or 'in about 15 minutes' (should support past and future). There are solutions out t...
TITLE: How to render contextual difference between two timestamps in JavaScript? QUESTION: Let's say I've got two strings in JavaScript: var date1 = '2008-10-03T20:24Z' var date2 = '2008-10-04T12:24Z' How would I come to a result like so: '4 weeks ago' or 'in about 15 minutes' (should support past and future). There a...
[ "javascript", "jquery", "datetime", "time" ]
5
7
2,010
2
0
2008-10-03T21:08:55.660000
2008-10-03T21:41:17.203000
168,926
169,095
Does anyone know of a php framework that would handle progressive enhancement for Flash/Flex content?
Ok, I'm using the term "Progressive Enhancement" kind of loosely here but basically I have a Flash-based website that supports deep linking and loads content dynamically - what I'd like to do is provide alternate content (text) for those either not having Flash and for search engine bots. So, for a user with flash they...
There's an inherent problem with what you're trying to achieve. The URL hash (or anchor) is client-side only - that token is not sent to the server. This means the only way (that I know of) to load the content you need for example.com/#some_page is to use AJAX, which can read the hash and then request the page-specific...
Does anyone know of a php framework that would handle progressive enhancement for Flash/Flex content? Ok, I'm using the term "Progressive Enhancement" kind of loosely here but basically I have a Flash-based website that supports deep linking and loads content dynamically - what I'd like to do is provide alternate conte...
TITLE: Does anyone know of a php framework that would handle progressive enhancement for Flash/Flex content? QUESTION: Ok, I'm using the term "Progressive Enhancement" kind of loosely here but basically I have a Flash-based website that supports deep linking and loads content dynamically - what I'd like to do is provi...
[ "php", "apache-flex", "flash", "actionscript-3", "progressive-enhancement" ]
0
1
230
3
0
2008-10-03T21:09:14.863000
2008-10-03T22:13:48.340000
168,931
168,948
Unit testing the app.config file with NUnit
When you guys are unit testing an application that relies on values from an app.config file? How do you test that those values are read in correctly and how your program reacts to incorrect values entered into a config file? It would be ridiculous to have to modify the config file for the NUnit app, but I can't read in...
I usually isolate external dependencies like reading a config file in their own facade-class with very little functionality. In tests I can create a mock version of this class that implements and use that instead of the real config file. You can create your own mockup's or use a framework like moq or rhino mocks for th...
Unit testing the app.config file with NUnit When you guys are unit testing an application that relies on values from an app.config file? How do you test that those values are read in correctly and how your program reacts to incorrect values entered into a config file? It would be ridiculous to have to modify the config...
TITLE: Unit testing the app.config file with NUnit QUESTION: When you guys are unit testing an application that relies on values from an app.config file? How do you test that those values are read in correctly and how your program reacts to incorrect values entered into a config file? It would be ridiculous to have to...
[ ".net", "unit-testing", "nunit" ]
61
46
28,057
13
0
2008-10-03T21:10:50.713000
2008-10-03T21:16:03.573000
168,938
175,358
How do I include IBM XLC template *.c files in the make dependency file?
For the XLC compiler, templated code goes in a *.c file. Then when your program is compiled that uses the template functions, the compiler finds the template definisions in the.c file and instantiates them. The problem is that these.c files are not by default included when doing an xlC -qmakedepend to generate the buil...
In short, the answer is to migrate off using the XLC's tempinc utility. The tempinc utility requires you to set up your files with the template declarations in your header (.h or.hpp) file and your implementations in a.c file (this extension is mandatory). As the compiler finds template instantiations, it will put expl...
How do I include IBM XLC template *.c files in the make dependency file? For the XLC compiler, templated code goes in a *.c file. Then when your program is compiled that uses the template functions, the compiler finds the template definisions in the.c file and instantiates them. The problem is that these.c files are no...
TITLE: How do I include IBM XLC template *.c files in the make dependency file? QUESTION: For the XLC compiler, templated code goes in a *.c file. Then when your program is compiled that uses the template functions, the compiler finds the template definisions in the.c file and instantiates them. The problem is that th...
[ "c++", "makefile", "xlc" ]
0
1
844
1
0
2008-10-03T21:13:02.703000
2008-10-06T17:42:12.753000
168,951
196,236
Parallel HTTP requests in PHP using PECL HTTP classes [Answer: HttpRequestPool class]
The HttpRequestPool class provides a solution. Many thanks to those who pointed this out. A brief tutorial can be found at: http://www.phptutorial.info/?HttpRequestPool-construct Problem I'd like to make concurrent/parallel/simultaneous HTTP requests in PHP. I'd like to avoid consecutive requests as: a set of requests ...
I'm pretty sure HttpRequestPool is what you're looking for. To elaborate a little, you can use forking to achieve what you're looking for, but that seems unnecessarily complex and not very useful in a HTML context. While I haven't tested, this code should be it: // let $requests be an array of requests to send $pool = ...
Parallel HTTP requests in PHP using PECL HTTP classes [Answer: HttpRequestPool class] The HttpRequestPool class provides a solution. Many thanks to those who pointed this out. A brief tutorial can be found at: http://www.phptutorial.info/?HttpRequestPool-construct Problem I'd like to make concurrent/parallel/simultaneo...
TITLE: Parallel HTTP requests in PHP using PECL HTTP classes [Answer: HttpRequestPool class] QUESTION: The HttpRequestPool class provides a solution. Many thanks to those who pointed this out. A brief tutorial can be found at: http://www.phptutorial.info/?HttpRequestPool-construct Problem I'd like to make concurrent/p...
[ "php", "http", "parallel-processing", "pecl", "simultaneous" ]
11
10
7,227
6
0
2008-10-03T21:18:08.450000
2008-10-12T22:53:38.477000
168,956
169,141
Yahoo Username Regex
I need a (php) regex to match Yahoo's username rules: Use 4 to 32 characters and start with a letter. You may use letters, numbers, underscores, and one dot (.).
/^[A-Za-z](?=[A-Za-z0-9_.]{3,31}$)[a-zA-Z0-9_]*\.?[a-zA-Z0-9_]*$/ Or a little shorter: /^[a-z](?=[\w.]{3,31}$)\w*\.?\w*$/i
Yahoo Username Regex I need a (php) regex to match Yahoo's username rules: Use 4 to 32 characters and start with a letter. You may use letters, numbers, underscores, and one dot (.).
TITLE: Yahoo Username Regex QUESTION: I need a (php) regex to match Yahoo's username rules: Use 4 to 32 characters and start with a letter. You may use letters, numbers, underscores, and one dot (.). ANSWER: /^[A-Za-z](?=[A-Za-z0-9_.]{3,31}$)[a-zA-Z0-9_]*\.?[a-zA-Z0-9_]*$/ Or a little shorter: /^[a-z](?=[\w.]{3,31}$)...
[ "php", "regex", "validation", "yahoo" ]
9
16
6,355
4
0
2008-10-03T21:19:21.320000
2008-10-03T22:25:52.153000
168,961
169,010
Does a pom.xml.template tell me everything I need to know to use the project as a dependency
I'm trying to add the lucene sandbox contribution called term-highlighter to my pom.xml. I'm not really that familiar with Maven, but the code has a pom.xml.template which seems to imply if I add a dependency that looks like: org.apache.lucene lucene-highlighter It might work. Can someone help me out in adding a lucene...
You have to add the version number, but you only have to do it once in a project structure. That is, if the version number is defined in a parent pom, you don't have to give the version number again. (But you don't even have to provide the dependency in this case since the dependency will be inherited anyways.)
Does a pom.xml.template tell me everything I need to know to use the project as a dependency I'm trying to add the lucene sandbox contribution called term-highlighter to my pom.xml. I'm not really that familiar with Maven, but the code has a pom.xml.template which seems to imply if I add a dependency that looks like: o...
TITLE: Does a pom.xml.template tell me everything I need to know to use the project as a dependency QUESTION: I'm trying to add the lucene sandbox contribution called term-highlighter to my pom.xml. I'm not really that familiar with Maven, but the code has a pom.xml.template which seems to imply if I add a dependency ...
[ "lucene", "maven-2", "lucene-highlighter" ]
0
3
1,708
2
0
2008-10-03T21:23:07.660000
2008-10-03T21:41:30.510000
168,963
168,977
Stop jQuery .load response from being cached
I have the following code making a GET request on a URL: $('#searchButton').click(function() { $('#inquiry').load('/portal/?f=searchBilling&pid=' + $('#query').val()); }); But the returned result is not always reflected. For example, I made a change in the response that spit out a stack trace but the stack trace did no...
You have to use a more complex function like $.ajax() if you want to control caching on a per-request basis. Or, if you just want to turn it off for everything, put this at the top of your script: $.ajaxSetup ({ // Disable caching of AJAX responses cache: false });
Stop jQuery .load response from being cached I have the following code making a GET request on a URL: $('#searchButton').click(function() { $('#inquiry').load('/portal/?f=searchBilling&pid=' + $('#query').val()); }); But the returned result is not always reflected. For example, I made a change in the response that spit...
TITLE: Stop jQuery .load response from being cached QUESTION: I have the following code making a GET request on a URL: $('#searchButton').click(function() { $('#inquiry').load('/portal/?f=searchBilling&pid=' + $('#query').val()); }); But the returned result is not always reflected. For example, I made a change in the ...
[ "jquery", "ajax", "caching" ]
247
426
175,200
14
0
2008-10-03T21:23:59.593000
2008-10-03T21:26:45.140000
168,979
169,454
Static and dynamic library linking
In C++, static library A is linked into dynamic libraries B and C. If a class, Foo, is used in A which is defined in B, will C link if it doesn't use Foo? I thought the answer was yes, but I am now running into a problem with xlc_r7 where library C says Foo is an undefined symbol, which it is as far as C is concerned. ...
When you statically link, two modules become one. So when you compile C and link A into it, its as if you had copied all the source code of A into the source code of C, then compiled the combined source. So C.dll includes A, which has a dependency on B via Foo. You'll need to link C to B's link library in order to sati...
Static and dynamic library linking In C++, static library A is linked into dynamic libraries B and C. If a class, Foo, is used in A which is defined in B, will C link if it doesn't use Foo? I thought the answer was yes, but I am now running into a problem with xlc_r7 where library C says Foo is an undefined symbol, whi...
TITLE: Static and dynamic library linking QUESTION: In C++, static library A is linked into dynamic libraries B and C. If a class, Foo, is used in A which is defined in B, will C link if it doesn't use Foo? I thought the answer was yes, but I am now running into a problem with xlc_r7 where library C says Foo is an und...
[ "c++", "linker", "aix" ]
2
4
2,085
5
0
2008-10-03T21:27:09.337000
2008-10-04T00:53:39.607000
168,985
169,039
Restoring UI settings in C# WinForms - which event to respond to?
When is the proper time to restore the UI layout settings of a System.Windows.Forms.Control? I tried this: FooBarGadget control = new FooBarGadget(); parent.Controls.Add(control); control.FobnicatorWidth = lastLayoutSettings.FobWidth; No cigar. Reason? control isn't finished laying out its internals; it's in its defaul...
If you're creating this control as part of loading a new Form, a good place to reload saved settings would be in Form.OnLoad (or respond to the the Form.Load event). Another event that might be helpful is Control.HandleCreated, which happens when the underlying window of your control is created. If neither of these hel...
Restoring UI settings in C# WinForms - which event to respond to? When is the proper time to restore the UI layout settings of a System.Windows.Forms.Control? I tried this: FooBarGadget control = new FooBarGadget(); parent.Controls.Add(control); control.FobnicatorWidth = lastLayoutSettings.FobWidth; No cigar. Reason? c...
TITLE: Restoring UI settings in C# WinForms - which event to respond to? QUESTION: When is the proper time to restore the UI layout settings of a System.Windows.Forms.Control? I tried this: FooBarGadget control = new FooBarGadget(); parent.Controls.Add(control); control.FobnicatorWidth = lastLayoutSettings.FobWidth; N...
[ "c#", "winforms", "user-interface", "layout" ]
1
2
919
1
0
2008-10-03T21:30:56.630000
2008-10-03T21:51:19.350000
168,992
169,054
Make <h1> tag the same maximum width regardless of capitalization of text within
I'm trying to display a series of titles varying from 60 characters to 160 or so and the capitalization varies, some of it all caps, some half caps. When it's mostly lowercase the whole 160 characters of text fits in the width I want, but when it starts getting more caps (they must be wider), it starts over flowing. Is...
Control the Overflow The real trick is just setting a limit on size of the text box, and making sure that there aren't overflow problems. You can use overflow: hidden to take care of this, and display: block the element in order to give it the exact dimensions you need. Monospace is Optional Yes, you can use a monospac...
Make <h1> tag the same maximum width regardless of capitalization of text within I'm trying to display a series of titles varying from 60 characters to 160 or so and the capitalization varies, some of it all caps, some half caps. When it's mostly lowercase the whole 160 characters of text fits in the width I want, but ...
TITLE: Make <h1> tag the same maximum width regardless of capitalization of text within QUESTION: I'm trying to display a series of titles varying from 60 characters to 160 or so and the capitalization varies, some of it all caps, some half caps. When it's mostly lowercase the whole 160 characters of text fits in the ...
[ "html", "css", "fonts" ]
4
9
20,769
7
0
2008-10-03T21:33:47.297000
2008-10-03T21:56:30.900000
169,008
169,021
Regex for parsing directory and filename
I'm trying to write a regex that will parse out the directory and filename of a fully qualified path using matching groups. so... /var/log/xyz/10032008.log would recognize group 1 to be "/var/log/xyz" and group 2 to be "10032008.log" Seems simple but I can't get the matching groups to work for the life of me. NOTE: As ...
Try this: ^(.+)\/([^\/]+)$ EDIT: escaped the forward slash to prevent problems when copy/pasting the Regex
Regex for parsing directory and filename I'm trying to write a regex that will parse out the directory and filename of a fully qualified path using matching groups. so... /var/log/xyz/10032008.log would recognize group 1 to be "/var/log/xyz" and group 2 to be "10032008.log" Seems simple but I can't get the matching gro...
TITLE: Regex for parsing directory and filename QUESTION: I'm trying to write a regex that will parse out the directory and filename of a fully qualified path using matching groups. so... /var/log/xyz/10032008.log would recognize group 1 to be "/var/log/xyz" and group 2 to be "10032008.log" Seems simple but I can't ge...
[ "regex", "parsing" ]
46
54
248,148
9
0
2008-10-03T21:41:07.547000
2008-10-03T21:44:56.760000
169,034
169,709
Memory leaking with [NSKeyedUnarchiver decodeObjectForKey]
Every time I call this method my NSMutableData is leaking and I cannot figure out how to plug it. theData's retain count is upped by one after the decoder is allocated and initialized and I have no idea why. I am stuck with a retain count of 2 at the end of the method and attempting to release it causes an app crash. -...
I would suggest replacing this line: venueIOList = [[decoder decodeObjectForKey:inKey] mutableCopy]; with: ListClassName *decodedList = [decoder decodeObjectForKey:inKey]; self.venueIOList = decodedList; This makes the memory management of decodedList clear. It is considered best practice to assign instance variables u...
Memory leaking with [NSKeyedUnarchiver decodeObjectForKey] Every time I call this method my NSMutableData is leaking and I cannot figure out how to plug it. theData's retain count is upped by one after the decoder is allocated and initialized and I have no idea why. I am stuck with a retain count of 2 at the end of the...
TITLE: Memory leaking with [NSKeyedUnarchiver decodeObjectForKey] QUESTION: Every time I call this method my NSMutableData is leaking and I cannot figure out how to plug it. theData's retain count is upped by one after the decoder is allocated and initialized and I have no idea why. I am stuck with a retain count of 2...
[ "objective-c", "cocoa" ]
3
3
7,553
5
0
2008-10-03T21:49:07.343000
2008-10-04T03:58:55.287000
169,058
171,134
Memory leak detection while running unit tests
I've got a Win32 C++ app with a suite of unit tests. After the unit tests have finished running, I'd like a human-readable report on any unfreed memory to be automatically generated. Ideally, the report will have a stack with files & line number info for each unfreed allocation. It would be nice to have them generated ...
I played around with the CRT Debug Heap functions Mike B pointed out, but ultimately I wasn't satisfied just getting the address of the leaked memory. Getting the stacks like UMDH provides makes debugging so much faster. So, in my main() function now I launch UMDH using CreateProcess before and after I run the tests to...
Memory leak detection while running unit tests I've got a Win32 C++ app with a suite of unit tests. After the unit tests have finished running, I'd like a human-readable report on any unfreed memory to be automatically generated. Ideally, the report will have a stack with files & line number info for each unfreed alloc...
TITLE: Memory leak detection while running unit tests QUESTION: I've got a Win32 C++ app with a suite of unit tests. After the unit tests have finished running, I'd like a human-readable report on any unfreed memory to be automatically generated. Ideally, the report will have a stack with files & line number info for ...
[ "c++", "winapi", "memory-leaks" ]
4
0
3,484
5
0
2008-10-03T21:58:28.370000
2008-10-04T22:45:32.797000
169,071
169,097
Designing a GUI
How would you, as a developer with little (or no) artistic inclination, design a GUI for an application? In particular, I'm thinking about desktop apps but anything that relates to Web apps is welcome as well. I find it extremely hard to design something that both I and potential users find pleasing. I can look up colo...
The first thing you need to do is get out of your developer-point-of-view. We tend to think in terms of forms, controls, buttons, lists, grids etc. And this tends to push us to solutions that are not always optimal for the user. Users don't want to use our software. (except when you're programming games) They just want...
Designing a GUI How would you, as a developer with little (or no) artistic inclination, design a GUI for an application? In particular, I'm thinking about desktop apps but anything that relates to Web apps is welcome as well. I find it extremely hard to design something that both I and potential users find pleasing. I ...
TITLE: Designing a GUI QUESTION: How would you, as a developer with little (or no) artistic inclination, design a GUI for an application? In particular, I'm thinking about desktop apps but anything that relates to Web apps is welcome as well. I find it extremely hard to design something that both I and potential users...
[ "user-interface", "desktop" ]
12
22
2,207
11
0
2008-10-03T22:04:10.603000
2008-10-03T22:15:01.283000
169,080
169,093
Is there a way to change something in Tool->Options via a macro?
I'd like to be able to toggle easily between two values for "maximum number of parallel project builds" in Visual Studio 2008 (in Tools->Options->Projects and Solutions->Build and Run). (When I'm planning on doing concurrent work I'd like to reduce it from 4 to 3.) I'm not too well versed in writing macros for the IDE....
It appears to be impossible, according to the MSDN page for Determining Names of Property Items in Tools Options Pages If it was possible, it would have been something like this: Dim p = DTE.Properties("ProjectsAndSolutions","BuildAndRun") p.Item("MaxNumParallelBuilds")
Is there a way to change something in Tool->Options via a macro? I'd like to be able to toggle easily between two values for "maximum number of parallel project builds" in Visual Studio 2008 (in Tools->Options->Projects and Solutions->Build and Run). (When I'm planning on doing concurrent work I'd like to reduce it fro...
TITLE: Is there a way to change something in Tool->Options via a macro? QUESTION: I'd like to be able to toggle easily between two values for "maximum number of parallel project builds" in Visual Studio 2008 (in Tools->Options->Projects and Solutions->Build and Run). (When I'm planning on doing concurrent work I'd lik...
[ "visual-studio", "visual-studio-2008" ]
3
3
335
2
0
2008-10-03T22:06:57.790000
2008-10-03T22:13:27.513000
169,107
169,135
Is there a "poor man's" alternative to RedGate for scripting out entire database schema?
I'm in a situation where I would to generate a script for a database that I could run on another server and get a database identical to the original one, but without any of the data. In essence, I want to end up with a big create script that captures the database schema. I am working in an environment that has SQL Serv...
Run SQL Server Management Studio, right click on the database and select Script Database as > Create to > file That's for SQL Server 2005. SQL Server 2000 Enterprise Manager has a similar command. Just right-click on the database > All Tasks > Generate Scripts. EDIT: In SQL Server 2005, you can select "Database" in the...
Is there a "poor man's" alternative to RedGate for scripting out entire database schema? I'm in a situation where I would to generate a script for a database that I could run on another server and get a database identical to the original one, but without any of the data. In essence, I want to end up with a big create s...
TITLE: Is there a "poor man's" alternative to RedGate for scripting out entire database schema? QUESTION: I'm in a situation where I would to generate a script for a database that I could run on another server and get a database identical to the original one, but without any of the data. In essence, I want to end up w...
[ "sql-server", "sql-server-2000", "sqltools" ]
19
12
17,674
10
0
2008-10-03T22:18:19.127000
2008-10-03T22:24:56.147000
169,121
169,140
Binding a socket to port 80 in ansi c
When I try to bind port 80 to a socket in c, i always get the error, that I don't have permission to use this port. is there an easy way to get this permission?
Usually only the superuser (root) can bind to 'privileged' ports (i.e. those port numbers below 1024). This means that you either have to run your program as root or make your executable 'suid root'. Both of these have security consequences so you may want to consider using the suid approach and relinquishing superuser...
Binding a socket to port 80 in ansi c When I try to bind port 80 to a socket in c, i always get the error, that I don't have permission to use this port. is there an easy way to get this permission?
TITLE: Binding a socket to port 80 in ansi c QUESTION: When I try to bind port 80 to a socket in c, i always get the error, that I don't have permission to use this port. is there an easy way to get this permission? ANSWER: Usually only the superuser (root) can bind to 'privileged' ports (i.e. those port numbers belo...
[ "c", "networking", "sockets", "webserver" ]
8
17
6,883
9
0
2008-10-03T22:21:29.947000
2008-10-03T22:25:43.883000
169,146
169,159
unexpected T_CONCAT_EQUAL
I'm getting an unexpected T_CONCAT_EQUAL error on a line of the following form: $arg1.= "arg2".$arg3."arg4"; I'm using PHP5. I could simply go an do the following: $arg1 = $arg1."arg2".$arg3."arg4"; but I'd like to know whats going wrong in the first place. Any ideas? Thanks, sweeney
This would happen when $arg1 is undefined (doesn't have a value, was never set.)
unexpected T_CONCAT_EQUAL I'm getting an unexpected T_CONCAT_EQUAL error on a line of the following form: $arg1.= "arg2".$arg3."arg4"; I'm using PHP5. I could simply go an do the following: $arg1 = $arg1."arg2".$arg3."arg4"; but I'd like to know whats going wrong in the first place. Any ideas? Thanks, sweeney
TITLE: unexpected T_CONCAT_EQUAL QUESTION: I'm getting an unexpected T_CONCAT_EQUAL error on a line of the following form: $arg1.= "arg2".$arg3."arg4"; I'm using PHP5. I could simply go an do the following: $arg1 = $arg1."arg2".$arg3."arg4"; but I'd like to know whats going wrong in the first place. Any ideas? Thanks,...
[ "php", "string", "concatenation" ]
3
7
7,153
3
0
2008-10-03T22:28:31.587000
2008-10-03T22:34:19.810000
169,150
169,152
Set server or workstation GC
How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection?
Have a look here. I recommend giving the entire series of blog posts a good read - very informative.
Set server or workstation GC How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection?
TITLE: Set server or workstation GC QUESTION: How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection? ANSWER: Have a look here. I recommend giving the entire series of blog posts a good read - very informative.
[ "garbage-collection", "clr" ]
4
4
1,775
2
0
2008-10-03T22:30:25.997000
2008-10-03T22:32:16.757000
169,155
169,280
SetCursor reverts after a mouse move
I am using SetCursor to set the system cursor to my own image. The code looks something like this: // member on some class HCURSOR _cursor; // at init time _cursor = LoadCursorFromFile("somefilename.cur"); // in some function SetCursor(_cursor); When I do this the cursor does change, but on the first mouse move messa...
It seems that I have two options. The first is the one that Mark Ransom suggested here, which is to respond to the windows WM_SETCURSOR message and call SetCursor at that time based on where the mouse is. Normally windows will only send you WM_SETCURSOR when the cursor is over your window, so you would only set the cur...
SetCursor reverts after a mouse move I am using SetCursor to set the system cursor to my own image. The code looks something like this: // member on some class HCURSOR _cursor; // at init time _cursor = LoadCursorFromFile("somefilename.cur"); // in some function SetCursor(_cursor); When I do this the cursor does chan...
TITLE: SetCursor reverts after a mouse move QUESTION: I am using SetCursor to set the system cursor to my own image. The code looks something like this: // member on some class HCURSOR _cursor; // at init time _cursor = LoadCursorFromFile("somefilename.cur"); // in some function SetCursor(_cursor); When I do this th...
[ "windows", "user-interface" ]
8
10
7,847
5
0
2008-10-03T22:32:55.757000
2008-10-03T23:18:06.853000
169,157
190,529
How do I disable the "smart insert" function that is bound to the Tab key in the Visual Studio emacs mode?
In both the Visual Studio emacs mode and the default mode the tab key is bound to Edit.InsertTab. However, in the emacs mode the tab button jumps to where it expects the next line to start instead of inserting a tab. Is there a way to disable this "smart insert" while keeping the emacs key bindings?
Man, I found it for you:))) In customization of keyboard shortcuts it is Edit.IncreaseLineIndent. Set your own key and be happy. (BTW, I cannot set the Tab key explicitly. Even changing CurrentSettings.vssettings did not help. But it is different story...)
How do I disable the "smart insert" function that is bound to the Tab key in the Visual Studio emacs mode? In both the Visual Studio emacs mode and the default mode the tab key is bound to Edit.InsertTab. However, in the emacs mode the tab button jumps to where it expects the next line to start instead of inserting a t...
TITLE: How do I disable the "smart insert" function that is bound to the Tab key in the Visual Studio emacs mode? QUESTION: In both the Visual Studio emacs mode and the default mode the tab key is bound to Edit.InsertTab. However, in the emacs mode the tab button jumps to where it expects the next line to start instea...
[ "visual-studio", "emacs" ]
3
3
1,183
1
0
2008-10-03T22:33:08.127000
2008-10-10T08:36:10.777000
169,164
169,700
Should I convert from MooTools to jQuery?
I have a fairly large codebase that depends on MooTools v1.11 and am about to convert to version 1.2. Since this is a pretty major overhaul, I've toyed with the idea of converting to jQuery. Anyone have advice on whether to update to jQuery or just stick with MooTools? I mostly use MooTools for Ajax, drag and drop, and...
If you're upgrading anyway, then it may be worth looking into. jQuery seems to be well on its way to becoming the One True Javascript library (given that MS and others have decided to embrace it), so if this is code you intend to work on for a while, then it's probably a good idea to switch at some point (if only becau...
Should I convert from MooTools to jQuery? I have a fairly large codebase that depends on MooTools v1.11 and am about to convert to version 1.2. Since this is a pretty major overhaul, I've toyed with the idea of converting to jQuery. Anyone have advice on whether to update to jQuery or just stick with MooTools? I mostly...
TITLE: Should I convert from MooTools to jQuery? QUESTION: I have a fairly large codebase that depends on MooTools v1.11 and am about to convert to version 1.2. Since this is a pretty major overhaul, I've toyed with the idea of converting to jQuery. Anyone have advice on whether to update to jQuery or just stick with ...
[ "javascript", "jquery", "mootools" ]
18
17
7,908
16
0
2008-10-03T22:35:39.653000
2008-10-04T03:49:33.997000
169,186
169,353
Asp.Net 2 Custom Server Controls Properties
I am having a very hard time finding a standard pattern / best practice that deals with rendering child controls inside a composite based on a property value. Here is a basic scenario. I have a Composite Control that has two child controls, a textbox and a dropdown. Lets say there is a property that toggles which child...
You use ViewState to store property value so that it persists between postbacks but you have to do it correctly. public virtual bool ShowDropdown { get { object o = ViewState["ShowDropdown"]; if (o!= null) return (bool)o; return false; // Default value } set { bool oldValue = ShowDropdown; if (value!= oldValue) { ViewS...
Asp.Net 2 Custom Server Controls Properties I am having a very hard time finding a standard pattern / best practice that deals with rendering child controls inside a composite based on a property value. Here is a basic scenario. I have a Composite Control that has two child controls, a textbox and a dropdown. Lets say ...
TITLE: Asp.Net 2 Custom Server Controls Properties QUESTION: I am having a very hard time finding a standard pattern / best practice that deals with rendering child controls inside a composite based on a property value. Here is a basic scenario. I have a Composite Control that has two child controls, a textbox and a d...
[ "asp.net", "custom-server-controls", "composite" ]
1
3
698
2
0
2008-10-03T22:44:43.143000
2008-10-03T23:49:22.513000
169,193
169,210
Scroll of a texbox always on bottom
There is a way to keep the scroll on bottom for a multi line textbox? Something like in the vb6 txtfoo.selstart=len(txtfoo.text) I'm trying with txtfoo.selectionstart=txtfoo.text.length without success. Regards.
Ok, I found that the solution was to use txtfoo.AppendText instead of txtfoo.text+="something"
Scroll of a texbox always on bottom There is a way to keep the scroll on bottom for a multi line textbox? Something like in the vb6 txtfoo.selstart=len(txtfoo.text) I'm trying with txtfoo.selectionstart=txtfoo.text.length without success. Regards.
TITLE: Scroll of a texbox always on bottom QUESTION: There is a way to keep the scroll on bottom for a multi line textbox? Something like in the vb6 txtfoo.selstart=len(txtfoo.text) I'm trying with txtfoo.selectionstart=txtfoo.text.length without success. Regards. ANSWER: Ok, I found that the solution was to use txtf...
[ "c#", "winforms" ]
4
7
2,077
3
0
2008-10-03T22:47:33.747000
2008-10-03T22:56:55.367000
169,194
170,972
How to communicate with an Arduino over its serial interface in C++ on Linux?
I have an RFID reader connected to an Arduino board. I'd like to connect to it over its serial interface, and whenever the RFID reader omits a signal ( when it has read an (RF)ID ), I'd like to retrieve it in my C++ program. I already have the code for simply printing the RFID to serial from the Arduino. What I don't k...
I found the Boost::Asio library, which reads from serial interfaces asynchronously. Boost::Asio Documentation
How to communicate with an Arduino over its serial interface in C++ on Linux? I have an RFID reader connected to an Arduino board. I'd like to connect to it over its serial interface, and whenever the RFID reader omits a signal ( when it has read an (RF)ID ), I'd like to retrieve it in my C++ program. I already have th...
TITLE: How to communicate with an Arduino over its serial interface in C++ on Linux? QUESTION: I have an RFID reader connected to an Arduino board. I'd like to connect to it over its serial interface, and whenever the RFID reader omits a signal ( when it has read an (RF)ID ), I'd like to retrieve it in my C++ program....
[ "c++", "linux", "serial-port", "arduino", "rfid" ]
7
3
11,430
4
0
2008-10-03T22:47:43.480000
2008-10-04T20:45:12.230000
169,212
217,640
Server-side Report in Crystal 2008?
I am looking to integrate Crystal Reports 2008 into a Windows Forms application. I would like to avoid direct connections from my client application to the database, while giving the user the "complete" report experience. Is it possible to for Crystal Reports 2008 to execute a report on a server into a client-side Wind...
I don't know if it is exactly what you are after, but I can think of 2 ways you could fudge it: You can set up your report so that the 'database' is an XSD file, with no knowledge of the real backend. Then at runtime you push the data to the report. // Create an instance at runtime appropriate to your environment - exa...
Server-side Report in Crystal 2008? I am looking to integrate Crystal Reports 2008 into a Windows Forms application. I would like to avoid direct connections from my client application to the database, while giving the user the "complete" report experience. Is it possible to for Crystal Reports 2008 to execute a report...
TITLE: Server-side Report in Crystal 2008? QUESTION: I am looking to integrate Crystal Reports 2008 into a Windows Forms application. I would like to avoid direct connections from my client application to the database, while giving the user the "complete" report experience. Is it possible to for Crystal Reports 2008 t...
[ "winforms", "crystal-reports" ]
0
1
739
3
0
2008-10-03T22:58:04.100000
2008-10-20T06:13:53.357000
169,216
169,246
If you are using getters and setters, how should you name the private member variables?
As kind of a follow up to this question about prefixes, I agree with most people on the thread that prefixes are bad. But what about if you are using getters and setters? Then you need to differeniate the publicly accessible getter name from the privately stored variable. I normally just use an underscore, but is there...
This is a completely subjective question. There is no "better" way. One way is: private int _x; public get x():int { return _x; } public set x(int val):void { _x = val; } Another is: private int x; public get X():int { return x; } public set X(int val):void { x = val; } Neither is the right answer. Each has style advan...
If you are using getters and setters, how should you name the private member variables? As kind of a follow up to this question about prefixes, I agree with most people on the thread that prefixes are bad. But what about if you are using getters and setters? Then you need to differeniate the publicly accessible getter ...
TITLE: If you are using getters and setters, how should you name the private member variables? QUESTION: As kind of a follow up to this question about prefixes, I agree with most people on the thread that prefixes are bad. But what about if you are using getters and setters? Then you need to differeniate the publicly ...
[ "setter", "getter", "prefixes" ]
4
6
723
6
0
2008-10-03T22:59:07.670000
2008-10-03T23:07:52.567000
169,217
169,226
C# equivalent of the IsNull() function in SQL Server
In SQL Server you can use the IsNull() function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#. For example, I want to do something like: myNewValue = IsNull(myValue, new MyValue()); instead of: if (myValue == null) myValue = new MyValue(); myNewVa...
It's called the null coalescing (?? ) operator: myNewValue = myValue?? new MyValue();
C# equivalent of the IsNull() function in SQL Server In SQL Server you can use the IsNull() function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#. For example, I want to do something like: myNewValue = IsNull(myValue, new MyValue()); instead of: ...
TITLE: C# equivalent of the IsNull() function in SQL Server QUESTION: In SQL Server you can use the IsNull() function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#. For example, I want to do something like: myNewValue = IsNull(myValue, new MyValu...
[ "c#", ".net", "sql-server", "isnull" ]
124
229
234,197
10
0
2008-10-03T22:59:18.153000
2008-10-03T23:01:24.233000
169,220
169,872
Initializing C# auto-properties
I'm used to writing classes like this: public class foo { private string mBar = "bar"; public string Bar { get { return mBar; } set { mBar = value; } } //... other methods, no constructor... } Converting Bar to an auto-property seems convenient and concise, but how can I retain the initialization without adding a const...
Update - the answer below was written before C# 6 came along. In C# 6 you can write: public class Foo { public string Bar { get; set; } = "bar"; } You can also write read-only automatically-implemented properties, which are only writable in the constructor (but can also be given a default initial value): public class F...
Initializing C# auto-properties I'm used to writing classes like this: public class foo { private string mBar = "bar"; public string Bar { get { return mBar; } set { mBar = value; } } //... other methods, no constructor... } Converting Bar to an auto-property seems convenient and concise, but how can I retain the initi...
TITLE: Initializing C# auto-properties QUESTION: I'm used to writing classes like this: public class foo { private string mBar = "bar"; public string Bar { get { return mBar; } set { mBar = value; } } //... other methods, no constructor... } Converting Bar to an auto-property seems convenient and concise, but how can ...
[ "c#", "initialization", "automatic-properties" ]
218
259
201,589
4
0
2008-10-03T22:59:53.393000
2008-10-04T06:38:02.283000
169,222
169,396
How do you get a System.Web.HttpWebRequest object to use SSL 2.0?
I don't know if I have all the information needed to phrase this question well, so bear with me. I have a local web page (local meaning 192.168.*) that is protected with a self-signed SSL cert. I'm trying to access this page using a System.Net.HttpWebRequest object, but I'm running into a weird problem. If this page is...
I've hit this issue myself when dealing with Ssl3, though I'm not sure if the same advice would work for SSL2? To work around the issue I set the Ssl3 flag on the security protocol like so: ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; Check out these links for more details: system.net.servicepointm...
How do you get a System.Web.HttpWebRequest object to use SSL 2.0? I don't know if I have all the information needed to phrase this question well, so bear with me. I have a local web page (local meaning 192.168.*) that is protected with a self-signed SSL cert. I'm trying to access this page using a System.Net.HttpWebReq...
TITLE: How do you get a System.Web.HttpWebRequest object to use SSL 2.0? QUESTION: I don't know if I have all the information needed to phrase this question well, so bear with me. I have a local web page (local meaning 192.168.*) that is protected with a self-signed SSL cert. I'm trying to access this page using a Sys...
[ "c#", ".net", "ssl", "httpwebrequest" ]
8
16
17,677
1
0
2008-10-03T23:00:30.880000
2008-10-04T00:10:32.533000
169,233
169,299
MySQL: Conditionally selecting next and previous rows
http://thedailywtf.com/Articles/The-Hot-Room.aspx You see how at the bottom there're links to the next and previous articles ("Unprepared For Divide_By_Zero" and "A Completely Different Game")? How do I do that, but selecting the next and previous non-private articles? This works for selecting the next article: SELECT ...
Or extending Jeremy's answer... In one query (SELECT * FROM articles WHERE id >? AND private IS NULL ORDER BY id ASC LIMIT 1) UNION (SELECT * FROM articles WHERE id <? AND private IS NULL ORDER BY id DESC LIMIT 1)
MySQL: Conditionally selecting next and previous rows http://thedailywtf.com/Articles/The-Hot-Room.aspx You see how at the bottom there're links to the next and previous articles ("Unprepared For Divide_By_Zero" and "A Completely Different Game")? How do I do that, but selecting the next and previous non-private articl...
TITLE: MySQL: Conditionally selecting next and previous rows QUESTION: http://thedailywtf.com/Articles/The-Hot-Room.aspx You see how at the bottom there're links to the next and previous articles ("Unprepared For Divide_By_Zero" and "A Completely Different Game")? How do I do that, but selecting the next and previous ...
[ "mysql" ]
5
9
2,827
4
0
2008-10-03T23:04:46.957000
2008-10-03T23:23:45.077000
169,274
169,305
Is this an acceptable way to make a simple "scheduler" in C#?
I'm making a simple scheduler with C# in.Net. All it does is execute a simple select statement on a table in a SQL Server DB once per minute (this does not need to scale or anything... the db does not have a high load). Here is my proposed implementation: static void Main(string[] args) { while (true) { System.Threadin...
While it is technically legal you are probably better of using a timer. They are not much more code to set up and you can let the runtime take care of spawning new threads. If you ever needed to use this again in another program it would also create a performance bottleneck where a timer would not. The timer will add m...
Is this an acceptable way to make a simple "scheduler" in C#? I'm making a simple scheduler with C# in.Net. All it does is execute a simple select statement on a table in a SQL Server DB once per minute (this does not need to scale or anything... the db does not have a high load). Here is my proposed implementation: st...
TITLE: Is this an acceptable way to make a simple "scheduler" in C#? QUESTION: I'm making a simple scheduler with C# in.Net. All it does is execute a simple select statement on a table in a SQL Server DB once per minute (this does not need to scale or anything... the db does not have a high load). Here is my proposed ...
[ "c#", "sql-server", "scheduling" ]
1
4
1,088
3
0
2008-10-03T23:16:21.443000
2008-10-03T23:26:49.860000
169,276
169,295
Is the #region directive really useful in .NET?
After maintaining lots of code littered with #region (in both C# and VB.NET), it seems to me that this construct is just a bunch of "make work" for the programmer. It's work to PUT the dang things into the code, and then they make searching and reading code very annoying. What are the benefits? Why do coders go to the ...
A similar question has already been asked. but... I would say not anymore. It was originally intended to hide generated code from WinForms in early versions of.NET. With partial classes the need seems to go away. IMHO it gets way overused now as an organizational construct and has no compiler value whatsoever. It's all...
Is the #region directive really useful in .NET? After maintaining lots of code littered with #region (in both C# and VB.NET), it seems to me that this construct is just a bunch of "make work" for the programmer. It's work to PUT the dang things into the code, and then they make searching and reading code very annoying....
TITLE: Is the #region directive really useful in .NET? QUESTION: After maintaining lots of code littered with #region (in both C# and VB.NET), it seems to me that this construct is just a bunch of "make work" for the programmer. It's work to PUT the dang things into the code, and then they make searching and reading c...
[ ".net", "coding-style" ]
18
22
7,829
17
0
2008-10-03T23:16:52.487000
2008-10-03T23:22:41.867000
169,277
169,286
Can I use Collections.EMPTY_LIST wihout an UncheckedException?
Is there a Generics Friendly way of using Collection.EMPTY_LIST in my Java Program. I know I could just declare one myself, but I'm just curious to know if there's a way in the JDK to do this. Something like users = Collections.EMPTY_LIST;
By doing the following: List users = Collections.emptyList(); The type of the returned list from Collections.emptyList(); will be inferred as a String due to the left-hand-side of the assignment. However, if you prefer to not have this inference, you can define it explicitly by doing the following: List users = Collect...
Can I use Collections.EMPTY_LIST wihout an UncheckedException? Is there a Generics Friendly way of using Collection.EMPTY_LIST in my Java Program. I know I could just declare one myself, but I'm just curious to know if there's a way in the JDK to do this. Something like users = Collections.EMPTY_LIST;
TITLE: Can I use Collections.EMPTY_LIST wihout an UncheckedException? QUESTION: Is there a Generics Friendly way of using Collection.EMPTY_LIST in my Java Program. I know I could just declare one myself, but I'm just curious to know if there's a way in the JDK to do this. Something like users = Collections.EMPTY_LIST;...
[ "generics", "java" ]
15
33
7,959
3
0
2008-10-03T23:16:54.047000
2008-10-03T23:18:55.023000
169,303
169,878
How to run untrusted Ruby code inside a safe sandbox?
I want to be able to run unstrusted ruby code. I want to be able to pass variables to said untrusted code that it may use. I also want said code to return a result to me. Here is a conceptual example of what I am thinking input = "sweet" output = nil Thread.start { $SAFE = 4 #... untrusted code goes here, it uses the i...
$SAFE is not enough; you need to be at least at the level of Why's freaky sandbox. However, I don't know if that sandbox code is actively maintained or if he/they ever solved the holes such as infinite loops, etc. Unsafe generally means hostile. If you can relax from hostile to, say, 'naive', and depending upon the req...
How to run untrusted Ruby code inside a safe sandbox? I want to be able to run unstrusted ruby code. I want to be able to pass variables to said untrusted code that it may use. I also want said code to return a result to me. Here is a conceptual example of what I am thinking input = "sweet" output = nil Thread.start { ...
TITLE: How to run untrusted Ruby code inside a safe sandbox? QUESTION: I want to be able to run unstrusted ruby code. I want to be able to pass variables to said untrusted code that it may use. I also want said code to return a result to me. Here is a conceptual example of what I am thinking input = "sweet" output = n...
[ "ruby" ]
17
12
5,089
4
0
2008-10-03T23:26:42.433000
2008-10-04T06:49:43.837000
169,329
169,341
Extending Java Web Applications with plugins
I have this web application that has grown to an unmanageable mess. I want to split it into a common "framework" part (that still includes web stuff like pages and images) and several modules that add extra functionality and screens. I want this refactoring to also be useful as a plugin system for third-party extension...
I have been tinkering with the idea of using OSGi to solve the same problem you are describing. In particular I am looking at using Spring Dynamic Modules.
Extending Java Web Applications with plugins I have this web application that has grown to an unmanageable mess. I want to split it into a common "framework" part (that still includes web stuff like pages and images) and several modules that add extra functionality and screens. I want this refactoring to also be useful...
TITLE: Extending Java Web Applications with plugins QUESTION: I have this web application that has grown to an unmanageable mess. I want to split it into a common "framework" part (that still includes web stuff like pages and images) and several modules that add extra functionality and screens. I want this refactoring...
[ "java", "tomcat", "servlets", "modularity" ]
7
4
6,310
8
0
2008-10-03T23:37:34.113000
2008-10-03T23:44:23.710000
169,330
169,348
Simple way to programmatically get all stored procedures
Is there a way to get stored procedures from a SQL Server 2005 Express database using C#? I would like to export all of this data in the same manner that you can script it our using SQL Server Management Studio, without having to install the GUI. I've seen some references to do thing via the PowerShell but in the end a...
Just read the output of SELECT NAME from SYS.PROCEDURES, then call EXEC sp_HelpText SPNAME for each stored procedure, you'll get a record set with one line of text per row.
Simple way to programmatically get all stored procedures Is there a way to get stored procedures from a SQL Server 2005 Express database using C#? I would like to export all of this data in the same manner that you can script it our using SQL Server Management Studio, without having to install the GUI. I've seen some r...
TITLE: Simple way to programmatically get all stored procedures QUESTION: Is there a way to get stored procedures from a SQL Server 2005 Express database using C#? I would like to export all of this data in the same manner that you can script it our using SQL Server Management Studio, without having to install the GUI...
[ "c#", "sql-server", "sql-server-2005", "stored-procedures" ]
12
6
30,358
12
0
2008-10-03T23:37:55.593000
2008-10-03T23:46:59.930000
169,332
169,333
Is there a timer class in C# that isn't in the Windows.Forms namespace?
I want to use a timer in my simple.NET application written in C#. The only one I can find is the Windows.Forms.Timer class. I don't want to reference this namespace just for my console application. Is there a C# timer (or timer like) class for use in console applications?
System.Timers.Timer And as MagicKat says: System.Threading.Timer You can see the differences here: http://intellitect.com/system-windows-forms-timer-vs-system-threading-timer-vs-system-timers-timer/ And you can see MSDN examples here: http://msdn.microsoft.com/en-us/library/system.timers.timer(VS.80).aspx And here: htt...
Is there a timer class in C# that isn't in the Windows.Forms namespace? I want to use a timer in my simple.NET application written in C#. The only one I can find is the Windows.Forms.Timer class. I don't want to reference this namespace just for my console application. Is there a C# timer (or timer like) class for use ...
TITLE: Is there a timer class in C# that isn't in the Windows.Forms namespace? QUESTION: I want to use a timer in my simple.NET application written in C#. The only one I can find is the Windows.Forms.Timer class. I don't want to reference this namespace just for my console application. Is there a C# timer (or timer li...
[ "c#", ".net", "scheduling", "timer" ]
18
29
23,194
6
0
2008-10-03T23:38:19.917000
2008-10-03T23:39:02.223000
169,334
201,758
Padding - Encryption algorithm
I'm writing an implementation of the XXTEA encryption algorithm that works on "streams", ie, can be used like: crypt mykey < myfile > output. One of the requisites is that it doesn't have access to the file at all (it only reads an fixed size block until find an EOF). The algorithm needs that the data bytes is multiple...
Reading the question it looks like the security aspect of this is moot. Simply put, you have an api that expects a multiple of 4 bytes as input, which you dont always have. Appending up to 3 bytes onto any binary stream is dangerous if you can't make guarantees that the binary stream doesn't care. Appending 0's onto th...
Padding - Encryption algorithm I'm writing an implementation of the XXTEA encryption algorithm that works on "streams", ie, can be used like: crypt mykey < myfile > output. One of the requisites is that it doesn't have access to the file at all (it only reads an fixed size block until find an EOF). The algorithm needs ...
TITLE: Padding - Encryption algorithm QUESTION: I'm writing an implementation of the XXTEA encryption algorithm that works on "streams", ie, can be used like: crypt mykey < myfile > output. One of the requisites is that it doesn't have access to the file at all (it only reads an fixed size block until find an EOF). Th...
[ "c", "cryptography", "stream", "padding" ]
3
2
2,271
4
0
2008-10-03T23:39:43.017000
2008-10-14T15:54:51.987000
169,342
443,459
Why isn't my custom WCF behavior extension element type being found?
I have a solution that contains two projects. One project is an ASP.NET Web Application Project, and one is a class library. The web application has a project reference to the class library. Neither of these is strongly-named. In the class library, which I'll call "Framework," I have an endpoint behavior (an IEndpointB...
Per the workaround that Microsoft posted on the Connect issue I filed for this, it's a known issue and there won't be any solution for it, at least in the current release: The reason for failing to add a new service item: When adding a new item and updating the configuration file, the system will try to load configurat...
Why isn't my custom WCF behavior extension element type being found? I have a solution that contains two projects. One project is an ASP.NET Web Application Project, and one is a class library. The web application has a project reference to the class library. Neither of these is strongly-named. In the class library, wh...
TITLE: Why isn't my custom WCF behavior extension element type being found? QUESTION: I have a solution that contains two projects. One project is an ASP.NET Web Application Project, and one is a class library. The web application has a project reference to the class library. Neither of these is strongly-named. In the...
[ ".net", "wcf", "exception", "wcf-extensions" ]
49
22
44,333
11
0
2008-10-03T23:44:35.113000
2009-01-14T15:54:44.057000
169,362
169,406
How can I compress a folder and email the compressed file in Python?
I would like to compress a folder and all its sub-folders/files, and email the zip file as an attachment. What would be the best way to achieve this with Python?
You can use the zipfile module to compress the file using the zip standard, the email module to create the email with the attachment, and the smtplib module to send it - all using only the standard library. Python - Batteries Included If you don't feel like programming and would rather ask a question on stackoverflow.o...
How can I compress a folder and email the compressed file in Python? I would like to compress a folder and all its sub-folders/files, and email the zip file as an attachment. What would be the best way to achieve this with Python?
TITLE: How can I compress a folder and email the compressed file in Python? QUESTION: I would like to compress a folder and all its sub-folders/files, and email the zip file as an attachment. What would be the best way to achieve this with Python? ANSWER: You can use the zipfile module to compress the file using the ...
[ "python" ]
7
19
10,502
3
0
2008-10-03T23:53:35.343000
2008-10-04T00:17:28.480000
169,378
169,399
Method can be made static, but should it?
ReSharper likes to point out multiple functions per ASP.NET page that could be made static. Does it help me if I do make them static? Should I make them static and move them to a utility class?
Static methods versus Instance methods Static and instance members of the C# Language Specification explains the difference. Generally, static methods can provide a very small performance enhancement over instance methods, but only in somewhat extreme situations (see this answer for some more details on that). Rule CA1...
Method can be made static, but should it? ReSharper likes to point out multiple functions per ASP.NET page that could be made static. Does it help me if I do make them static? Should I make them static and move them to a utility class?
TITLE: Method can be made static, but should it? QUESTION: ReSharper likes to point out multiple functions per ASP.NET page that could be made static. Does it help me if I do make them static? Should I make them static and move them to a utility class? ANSWER: Static methods versus Instance methods Static and instanc...
[ "c#", ".net", "refactoring", "resharper", "static-methods" ]
420
273
84,191
14
0
2008-10-04T00:01:49.183000
2008-10-04T00:12:50.767000
169,381
169,414
What is the best way to install a C# windows service that doesn't require running installutil manually?
I'd like to package a C# windows service project so it can be easily installed by anyone without having to use installutil command prompt utility? Is there an easy way to configure a Visual Studio setup project to do that similar to how winforms applications are installed?
I like to create a install project to get a nice and clean MSI installer, this should help you: http://support.microsoft.com/kb/816169 And codeproject has a good example too: http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx
What is the best way to install a C# windows service that doesn't require running installutil manually? I'd like to package a C# windows service project so it can be easily installed by anyone without having to use installutil command prompt utility? Is there an easy way to configure a Visual Studio setup project to do...
TITLE: What is the best way to install a C# windows service that doesn't require running installutil manually? QUESTION: I'd like to package a C# windows service project so it can be easily installed by anyone without having to use installutil command prompt utility? Is there an easy way to configure a Visual Studio s...
[ "windows-services", "setup-project", "installutil" ]
3
2
6,987
3
0
2008-10-04T00:03:52.190000
2008-10-04T00:20:02.437000
169,398
169,413
Change SQL Server 2005 Server Collation
I need to set up an instance of SQL Server 2005 with SQL_Latin1_General_CP850_Bin as the server collation (the vendor did not take into accounting looking at DB collation for a bunch of things so stored procedures and temp tables default to the server level and the default collation will not work). During the install f...
I think you're looking at instructions for SQL Server 2008. See the article here for instructions for 2005.
Change SQL Server 2005 Server Collation I need to set up an instance of SQL Server 2005 with SQL_Latin1_General_CP850_Bin as the server collation (the vendor did not take into accounting looking at DB collation for a bunch of things so stored procedures and temp tables default to the server level and the default collat...
TITLE: Change SQL Server 2005 Server Collation QUESTION: I need to set up an instance of SQL Server 2005 with SQL_Latin1_General_CP850_Bin as the server collation (the vendor did not take into accounting looking at DB collation for a bunch of things so stored procedures and temp tables default to the server level and ...
[ "sql-server-2005", "collation" ]
1
2
14,224
2
0
2008-10-04T00:12:10.283000
2008-10-04T00:19:49.100000
169,404
169,439
C++ template destructors for both primitive and complex data types
In a related question I asked about creating a generic container. Using polymorphic templates seems like the right way to go. However, I can't for the life of me figure out how a destructor should be written. I want the owner of the memory allocated to be the containers even if the example constructor takes in an array...
I'd recommend if you want to store pointers to complex types, that you use your container as: MyContainer >, and for primitive types just use MyContainer. The shared_ptr should take care of deleting the complex type appropriately when it is destructed. And nothing fancy will happen when the primitive type is destructed...
C++ template destructors for both primitive and complex data types In a related question I asked about creating a generic container. Using polymorphic templates seems like the right way to go. However, I can't for the life of me figure out how a destructor should be written. I want the owner of the memory allocated to ...
TITLE: C++ template destructors for both primitive and complex data types QUESTION: In a related question I asked about creating a generic container. Using polymorphic templates seems like the right way to go. However, I can't for the life of me figure out how a destructor should be written. I want the owner of the me...
[ "c++", "templates" ]
2
5
4,242
5
0
2008-10-04T00:15:37.797000
2008-10-04T00:40:43.567000
169,420
169,447
Generic Java Framework to Manage Bidirectional Associations and Inverse Updates
I've been looking for a generic way to deal with bidirectional associations and a way to handle the inverse updates in manual written Java code. For those who don't know what I'm talking about, here is an example. Below it are my current results of (unsatisfying) solutions. public class A { public B getB(); public void...
google collections (from google's internal code) -- http://code.google.com/p/google-collections/ is Java Generics compatible(not only compatible, uses generics very well) Class BiMap -- http://google-collections.googlecode.com/svn/trunk/javadoc/index.html?http://google-collections.googlecode.com/svn/trunk/javadoc/com/g...
Generic Java Framework to Manage Bidirectional Associations and Inverse Updates I've been looking for a generic way to deal with bidirectional associations and a way to handle the inverse updates in manual written Java code. For those who don't know what I'm talking about, here is an example. Below it are my current re...
TITLE: Generic Java Framework to Manage Bidirectional Associations and Inverse Updates QUESTION: I've been looking for a generic way to deal with bidirectional associations and a way to handle the inverse updates in manual written Java code. For those who don't know what I'm talking about, here is an example. Below it...
[ "java", "associations", "bidirectional", "inverse" ]
1
5
1,863
4
0
2008-10-04T00:26:29.630000
2008-10-04T00:47:44.253000
169,428
169,458
PHP DateTime microseconds always returns 0
this code always returns 0 in PHP 5.2.5 for microseconds: format("Y-m-d\TH:i:s.u"). "\n";?> Output: [root@www1 ~]$ php date_test.php 2008-10-03T20:31:26.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10...
This seems to work, although it seems illogical that http://us.php.net/date documents the microsecond specifier yet doesn't really support it: function getTimestamp() { return date("Y-m-d\TH:i:s"). substr((string)microtime(), 1, 8); }
PHP DateTime microseconds always returns 0 this code always returns 0 in PHP 5.2.5 for microseconds: format("Y-m-d\TH:i:s.u"). "\n";?> Output: [root@www1 ~]$ php date_test.php 2008-10-03T20:31:26.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.0000...
TITLE: PHP DateTime microseconds always returns 0 QUESTION: this code always returns 0 in PHP 5.2.5 for microseconds: format("Y-m-d\TH:i:s.u"). "\n";?> Output: [root@www1 ~]$ php date_test.php 2008-10-03T20:31:26.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-1...
[ "php", "datetime" ]
75
27
51,536
19
0
2008-10-04T00:32:07.840000
2008-10-04T00:57:22.487000
169,435
201,761
Eclipse's WTP translation output
How can I view the intermediate translation done to JSP and JSPX pages by WTP? I'm getting weird syntax errors in my Problems tab of Eclipse in a project that has plenty of.jspx pages. They don't affect anything in the running application (Tomcat 6.0) and they appeared only over the last 2 weeks, after an update. The r...
Right now you'd have to add the separate automated tests download to do this, and only in the 3.1 branch, but it enables a "Show Translation" command through Ctrl+Shift+9. Beware that the translation generated isn't 100% the same as the server would create at runtime--it's not intended to be executed. Also, the most re...
Eclipse's WTP translation output How can I view the intermediate translation done to JSP and JSPX pages by WTP? I'm getting weird syntax errors in my Problems tab of Eclipse in a project that has plenty of.jspx pages. They don't affect anything in the running application (Tomcat 6.0) and they appeared only over the las...
TITLE: Eclipse's WTP translation output QUESTION: How can I view the intermediate translation done to JSP and JSPX pages by WTP? I'm getting weird syntax errors in my Problems tab of Eclipse in a project that has plenty of.jspx pages. They don't affect anything in the running application (Tomcat 6.0) and they appeared...
[ "eclipse", "jsp", "eclipse-wtp", "stripes", "jspx" ]
3
2
507
3
0
2008-10-04T00:34:21.097000
2008-10-14T15:58:07.377000
169,453
331,179
Bad Gateway 502 error with Apache mod_proxy and Tomcat
We're running a web app on Tomcat 6 and Apache mod_proxy 2.2.3. Seeing a lot of 502 errors like this: Bad Gateway! The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /the/page.do. Reason: Error reading from remote server If you think this is a server...
So, answering my own question here. We ultimately determined that we were seeing 502 and 503 errors in the load balancer due to Tomcat threads timing out. In the short term we increased the timeout. In the longer term, we fixed the app problems that were causing the timeouts in the first place. Why Tomcat timeouts were...
Bad Gateway 502 error with Apache mod_proxy and Tomcat We're running a web app on Tomcat 6 and Apache mod_proxy 2.2.3. Seeing a lot of 502 errors like this: Bad Gateway! The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /the/page.do. Reason: Error r...
TITLE: Bad Gateway 502 error with Apache mod_proxy and Tomcat QUESTION: We're running a web app on Tomcat 6 and Apache mod_proxy 2.2.3. Seeing a lot of 502 errors like this: Bad Gateway! The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /the/page.d...
[ "java", "apache", "tomcat", "mod-proxy" ]
56
15
235,710
10
0
2008-10-04T00:51:54.433000
2008-12-01T15:30:52.560000
169,459
169,462
Should I lock an ISAM table to insert a value into a unique key field?
I have an ISAm table in mySql that was created similar to this: create table mytable ( id int not null auto_increment primary key, name varchar(64) not null ); create unique index nameIndex on mytable (name); I have multiple processes inserting rows into this table. If two processes try to insert the same "name", I wa...
Do not bother locking, your index will prevent duplicates. You should handle the error code from your application. MySQL should return an error code of 1062 (or SQLSTATE 23000) when your unique key constraint is violated.
Should I lock an ISAM table to insert a value into a unique key field? I have an ISAm table in mySql that was created similar to this: create table mytable ( id int not null auto_increment primary key, name varchar(64) not null ); create unique index nameIndex on mytable (name); I have multiple processes inserting row...
TITLE: Should I lock an ISAM table to insert a value into a unique key field? QUESTION: I have an ISAm table in mySql that was created similar to this: create table mytable ( id int not null auto_increment primary key, name varchar(64) not null ); create unique index nameIndex on mytable (name); I have multiple proce...
[ "mysql", "unique", "isam" ]
1
4
517
2
0
2008-10-04T00:58:06.977000
2008-10-04T01:00:09.143000
169,470
174,300
Does the iPhone timeout if a function takes too long to execute?
I have a function in which I get en external resource from the web using cocoa's Url object. And it works fine on the simulator, but occasionally fails on the device itself (it's a google query so the resource obviously does exist). Which leads me to believe that there is some internal timeout barrier on the hardware, ...
iPhone imposes a timeout for application launch. So if you perform an extensive processing in applicationDidFinishLaunching: for instance, the application will be terminated and a crash log will be produced. Unfortunately I've found no mention of it in the official documentation. After the launch process has completed,...
Does the iPhone timeout if a function takes too long to execute? I have a function in which I get en external resource from the web using cocoa's Url object. And it works fine on the simulator, but occasionally fails on the device itself (it's a google query so the resource obviously does exist). Which leads me to beli...
TITLE: Does the iPhone timeout if a function takes too long to execute? QUESTION: I have a function in which I get en external resource from the web using cocoa's Url object. And it works fine on the simulator, but occasionally fails on the device itself (it's a google query so the resource obviously does exist). Whic...
[ "iphone", "cocoa" ]
4
5
7,092
5
0
2008-10-04T01:06:55.370000
2008-10-06T13:31:36.223000
169,483
169,504
C# & Win32 notify when separate window is closing / closed
Is there a way to attach an event to a foreign / separate window from an.NET process that when the foreign window is closed or is about to close my application can be notified? I found this http://msdn.microsoft.com/en-us/library/ms229658.aspx But that seems to only be for the.NET compact framework. I am looking for so...
There's an article on CodeProject that looks at using global hooks to receive windows messages from other applications. Can you wait for the process to exit? Or are you stuck needing to poll and check that you can still Find the window?
C# & Win32 notify when separate window is closing / closed Is there a way to attach an event to a foreign / separate window from an.NET process that when the foreign window is closed or is about to close my application can be notified? I found this http://msdn.microsoft.com/en-us/library/ms229658.aspx But that seems to...
TITLE: C# & Win32 notify when separate window is closing / closed QUESTION: Is there a way to attach an event to a foreign / separate window from an.NET process that when the foreign window is closed or is about to close my application can be notified? I found this http://msdn.microsoft.com/en-us/library/ms229658.aspx...
[ "c#", ".net", "winapi", "events" ]
1
4
1,877
2
0
2008-10-04T01:13:17.087000
2008-10-04T01:32:29.670000
169,497
169,601
Best Dual HD Set up for Development
I've got a machine I'm going to be using for development, and it has two 7200 RPM 160 GB SATA HDs in it. The information I've found on the net so far seems to be a bit conflicted about which things (OS, Swap files, Programs, Solution/Source code/Other data) I should be installing on how many partitions on which drives ...
Mark one drive as being your warehouse, put all of your source code, data, assets, etc. on there and back it up regularly. You'll want this to be stable and easy to recover. You can even switch My Documents to live here if wanted. The other drive should contain the OS, drivers, and all applications. This makes it easy ...
Best Dual HD Set up for Development I've got a machine I'm going to be using for development, and it has two 7200 RPM 160 GB SATA HDs in it. The information I've found on the net so far seems to be a bit conflicted about which things (OS, Swap files, Programs, Solution/Source code/Other data) I should be installing on ...
TITLE: Best Dual HD Set up for Development QUESTION: I've got a machine I'm going to be using for development, and it has two 7200 RPM 160 GB SATA HDs in it. The information I've found on the net so far seems to be a bit conflicted about which things (OS, Swap files, Programs, Solution/Source code/Other data) I should...
[ "hardware", "hard-drive" ]
0
1
419
9
0
2008-10-04T01:30:04.760000
2008-10-04T02:38:45.853000
169,506
169,554
Obtain form input fields using jQuery?
I have a form with many input fields. When I catch the submit form event with jQuery, is it possible to get all the input fields of that form in an associative array?
$('#myForm').submit(function() { // get all the inputs into an array. var $inputs = $('#myForm:input'); // not sure if you wanted this, but I thought I'd add it. // get an associative array of just the values. var values = {}; $inputs.each(function() { values[this.name] = $(this).val(); }); }); Thanks to the tip from...
Obtain form input fields using jQuery? I have a form with many input fields. When I catch the submit form event with jQuery, is it possible to get all the input fields of that form in an associative array?
TITLE: Obtain form input fields using jQuery? QUESTION: I have a form with many input fields. When I catch the submit form event with jQuery, is it possible to get all the input fields of that form in an associative array? ANSWER: $('#myForm').submit(function() { // get all the inputs into an array. var $inputs = $('...
[ "javascript", "jquery" ]
450
572
751,921
26
0
2008-10-04T01:34:56.420000
2008-10-04T02:01:49.500000
169,511
169,517
How do I iterate over a range of numbers defined by variables in Bash?
How do I iterate over a range of numbers in Bash when the range is given by a variable? I know I can do this (called "sequence expression" in the Bash documentation ): for i in {1..5}; do echo $i; done Which gives: 1 2 3 4 5 Yet, how can I replace either of the range endpoints with a variable? This doesn't work: END=5 ...
for i in $(seq 1 $END); do echo $i; done edit: I prefer seq over the other methods because I can actually remember it;)
How do I iterate over a range of numbers defined by variables in Bash? How do I iterate over a range of numbers in Bash when the range is given by a variable? I know I can do this (called "sequence expression" in the Bash documentation ): for i in {1..5}; do echo $i; done Which gives: 1 2 3 4 5 Yet, how can I replace e...
TITLE: How do I iterate over a range of numbers defined by variables in Bash? QUESTION: How do I iterate over a range of numbers in Bash when the range is given by a variable? I know I can do this (called "sequence expression" in the Bash documentation ): for i in {1..5}; do echo $i; done Which gives: 1 2 3 4 5 Yet, h...
[ "bash", "shell", "for-loop", "syntax" ]
2,176
2,397
1,761,993
20
0
2008-10-04T01:38:43.777000
2008-10-04T01:41:55.673000
169,512
169,672
What is the simplest way to set up a BIRT report viewer for a xulrunner application?
I recently began using BIRT and have developed a report to use with my xulrunner application. What I haven't yet figured out is how I should deploy the viewer. It seems like BIRT mostly targets Java applications, so there are instructions for deploying on J2EE, JBoss, and other technologies -- with which I am not famil...
It appears that there is a genReport.bat file in the run-time somewhere that can generate reports from the command line. This appears to be what I need, and this article describes it.
What is the simplest way to set up a BIRT report viewer for a xulrunner application? I recently began using BIRT and have developed a report to use with my xulrunner application. What I haven't yet figured out is how I should deploy the viewer. It seems like BIRT mostly targets Java applications, so there are instructi...
TITLE: What is the simplest way to set up a BIRT report viewer for a xulrunner application? QUESTION: I recently began using BIRT and have developed a report to use with my xulrunner application. What I haven't yet figured out is how I should deploy the viewer. It seems like BIRT mostly targets Java applications, so t...
[ "reporting", "xul", "birt", "xulrunner" ]
7
7
3,040
2
0
2008-10-04T01:40:30.107000
2008-10-04T03:17:59.223000
169,529
169,533
How to efficiently filter a large LIstViewItemCollection?
So I have a ListView with an upper limit of about 1000 items. I need to be able to filter these items using a textbox's TextChanged event. I have some code that works well for a smaller number of items (~400), but when I need to re-display a full list of all 1000 items, it takes about 4 seconds. I am not creating new L...
There are two things to address this: Turn off sorting while manipulating the list contents. Hide the list so it doesn't try to paint. The 1st point is the biggest performance gain in list manipulation out of these two. To achieve this, just set the ListViewItemSorter to null for the duration of the modification and se...
How to efficiently filter a large LIstViewItemCollection? So I have a ListView with an upper limit of about 1000 items. I need to be able to filter these items using a textbox's TextChanged event. I have some code that works well for a smaller number of items (~400), but when I need to re-display a full list of all 100...
TITLE: How to efficiently filter a large LIstViewItemCollection? QUESTION: So I have a ListView with an upper limit of about 1000 items. I need to be able to filter these items using a textbox's TextChanged event. I have some code that works well for a smaller number of items (~400), but when I need to re-display a fu...
[ "c#", ".net", "winforms", "performance", "listview" ]
1
2
5,122
4
0
2008-10-04T01:50:58.277000
2008-10-04T01:54:10.017000
169,562
169,613
Proper nullable type checking in C#?
Ok, my actual problem was this: I was implementing an IList. When I got to CopyTo(Array array, int index), this was my solution: void ICollection.CopyTo(Array array, int index) { // Bounds checking, etc here. if (!(array.GetValue(0) is T)) throw new ArgumentException("Cannot cast to this type of Array."); // Handle cop...
The only way to be sure is with reflection, but 90% of the time you can avoid the cost of that by using array is T[]. Most people are going to pass a properly typed array in, so that will do. But, you should always provide the code to do the reflection check as well, just in case. Here's what my general boiler-plate lo...
Proper nullable type checking in C#? Ok, my actual problem was this: I was implementing an IList. When I got to CopyTo(Array array, int index), this was my solution: void ICollection.CopyTo(Array array, int index) { // Bounds checking, etc here. if (!(array.GetValue(0) is T)) throw new ArgumentException("Cannot cast to...
TITLE: Proper nullable type checking in C#? QUESTION: Ok, my actual problem was this: I was implementing an IList. When I got to CopyTo(Array array, int index), this was my solution: void ICollection.CopyTo(Array array, int index) { // Bounds checking, etc here. if (!(array.GetValue(0) is T)) throw new ArgumentExcepti...
[ "c#", "casting", "nullable" ]
4
3
2,125
4
0
2008-10-04T02:05:02.083000
2008-10-04T02:47:33.183000
169,573
170,392
Open source Java library to produce webpage thumbnails server-side
I am searching for an open source Java library to generate thumbnails for a given URL. I need to bundle this capability, rather than call out to external services, such as Amazon or websnapr. http://www.webrenderer.com/ was mentioned in this post: Server generated web screenshots, but it is a commercial solution. I'm h...
The first thing that comes to mind is using AWT to capture a screen grab (see code below). You could look at capturing the JEditorPane, the JDIC WebBrowser control or the SWT Browser (via the AWT embedding support ). The latter two embed native browsers (IE, Firefox), so introduce dependencies; the JEditorPane HTML sup...
Open source Java library to produce webpage thumbnails server-side I am searching for an open source Java library to generate thumbnails for a given URL. I need to bundle this capability, rather than call out to external services, such as Amazon or websnapr. http://www.webrenderer.com/ was mentioned in this post: Serve...
TITLE: Open source Java library to produce webpage thumbnails server-side QUESTION: I am searching for an open source Java library to generate thumbnails for a given URL. I need to bundle this capability, rather than call out to external services, such as Amazon or websnapr. http://www.webrenderer.com/ was mentioned i...
[ "java", "open-source", "thumbnails" ]
14
6
13,337
4
0
2008-10-04T02:13:05.983000
2008-10-04T14:12:08.810000
169,574
169,690
Keeping dot files synched across machines?
Like most *nix people, I tend to play with my tools and get them configured just the way that I like them. This was all well and good until recently. As I do more and more work, I tend to log onto more and more machines, and have more and more stuff that's configured great on my home machine, but not necessarily on my ...
I've had pretty good luck keeping my files under a revision control system. It's not for everyone, but most programmers should be able to appreciate the benefits. Read Keeping Your Life in Subversion for an excellent description, including how to handle non-dotfile configuration (like cron jobs via the svnfix script ) ...
Keeping dot files synched across machines? Like most *nix people, I tend to play with my tools and get them configured just the way that I like them. This was all well and good until recently. As I do more and more work, I tend to log onto more and more machines, and have more and more stuff that's configured great on ...
TITLE: Keeping dot files synched across machines? QUESTION: Like most *nix people, I tend to play with my tools and get them configured just the way that I like them. This was all well and good until recently. As I do more and more work, I tend to log onto more and more machines, and have more and more stuff that's co...
[ "unix", "configuration-files" ]
23
17
6,222
19
0
2008-10-04T02:15:41.797000
2008-10-04T03:37:49.107000
169,590
169,666
How can I detect a held down mouse button over a PictureBox?
I need to fire an event when the mouse is above a PictureBox with the mouse button already clicked and held down. Problems: The MouseDown and MouseEnter event handlers do not work together very well. For instance once a mouse button is clicked and held down, C# will fire the MouseDown event handler, but when the cursor...
When the mouse is pressed down most controls will then Control.Capture the mouse input. This means that all MouseMove events are sent to the original control that captured rather than the control the mouse happens to be over. This continues until the mouse loses capture which typically happens on the mouse up. If you r...
How can I detect a held down mouse button over a PictureBox? I need to fire an event when the mouse is above a PictureBox with the mouse button already clicked and held down. Problems: The MouseDown and MouseEnter event handlers do not work together very well. For instance once a mouse button is clicked and held down, ...
TITLE: How can I detect a held down mouse button over a PictureBox? QUESTION: I need to fire an event when the mouse is above a PictureBox with the mouse button already clicked and held down. Problems: The MouseDown and MouseEnter event handlers do not work together very well. For instance once a mouse button is click...
[ "c#", "winforms", "mouse", "picturebox" ]
10
13
42,132
8
0
2008-10-04T02:27:55.207000
2008-10-04T03:15:54.673000