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
166,330
166,341
Parameterized Sql queries
This is a nut I'm cracking these days Application I'm working on has some advanced processing towards SQL. One of the operations selects various metadata on the objects in the current context from different tables, based on the item names in the collection. For this, a range of "select...from...where...in()" is execute...
Hrm, without knowing context and more about the data and how you are using the results and performance issues, i will try to suggest an alternative. Could you possibly split into multiple queries? Do the same as you do now, but instead of building a query with 2100+ in items, build two with 1050 in each, and then merge...
Parameterized Sql queries This is a nut I'm cracking these days Application I'm working on has some advanced processing towards SQL. One of the operations selects various metadata on the objects in the current context from different tables, based on the item names in the collection. For this, a range of "select...from....
TITLE: Parameterized Sql queries QUESTION: This is a nut I'm cracking these days Application I'm working on has some advanced processing towards SQL. One of the operations selects various metadata on the objects in the current context from different tables, based on the item names in the collection. For this, a range ...
[ "c#", ".net", "sql-server-2005", "ado.net" ]
2
1
767
7
0
2008-10-03T10:56:54.970000
2008-10-03T11:00:45.540000
166,340
682,020
Recommendations on a free library to be used for zipping files
I need to zip and password-protect a file. Is there a good (free) library for this? This needs to be opened by a third party, so the password protection needs to work with standard tools.
UPDATE 2020: There are other choices now, notably Zip4J. After much searching, I've found three approaches: A freely available set of source code, suitable for a single file zip. However, there is no license. Usage is AesZipOutputStream.zipAndEcrypt(...). http://merkert.de/de/info/zipaes/src.zip ( https://forums.oracle...
Recommendations on a free library to be used for zipping files I need to zip and password-protect a file. Is there a good (free) library for this? This needs to be opened by a third party, so the password protection needs to work with standard tools.
TITLE: Recommendations on a free library to be used for zipping files QUESTION: I need to zip and password-protect a file. Is there a good (free) library for this? This needs to be opened by a third party, so the password protection needs to work with standard tools. ANSWER: UPDATE 2020: There are other choices now, ...
[ "java", "encryption", "zip" ]
78
38
78,708
9
0
2008-10-03T11:00:26.133000
2009-03-25T15:05:49.853000
166,347
166,854
How do I use Ruby for shell scripting?
I have some simple shell scripting tasks that I want to do For example: Selecting a file in the working directory from a list of the files matching some regular expression. I know that I can do this sort of thing using standard bash and grep but I would be nice to be able to hack quick scripts that will work in windows...
By default, you already have access to Dir and File, which are pretty useful by themselves. Dir['*.rb'] #basic globs Dir['**/*.rb'] #** == any depth of directory, including current dir. #=> array of relative names File.expand_path('~/file.txt') #=> "/User/mat/file.txt" File.dirname('dir/file.txt') #=> 'dir' File.basen...
How do I use Ruby for shell scripting? I have some simple shell scripting tasks that I want to do For example: Selecting a file in the working directory from a list of the files matching some regular expression. I know that I can do this sort of thing using standard bash and grep but I would be nice to be able to hack ...
TITLE: How do I use Ruby for shell scripting? QUESTION: I have some simple shell scripting tasks that I want to do For example: Selecting a file in the working directory from a list of the files matching some regular expression. I know that I can do this sort of thing using standard bash and grep but I would be nice t...
[ "ruby", "shell", "scripting" ]
172
152
136,984
13
0
2008-10-03T11:03:06.720000
2008-10-03T13:30:59.110000
166,349
167,234
Experiences using software load balancing vs. a hardware load balancer?
The ASP.NET application that I am currently responsible for at my day job has hit its limit in terms of its ability to scale inside a single server. Obviously we are working toward moving session out of process and the test and hopefully deploy date draws near. I would like to draw on the experiencies of people using t...
I have some experience with load balanced solutions, however it really depends how your network and software are designed as to which is the best solution for you to go for. In terms of solutions I've encountered: Built in load balancing in windows works well for most cases, although you need to ensure your application...
Experiences using software load balancing vs. a hardware load balancer? The ASP.NET application that I am currently responsible for at my day job has hit its limit in terms of its ability to scale inside a single server. Obviously we are working toward moving session out of process and the test and hopefully deploy dat...
TITLE: Experiences using software load balancing vs. a hardware load balancer? QUESTION: The ASP.NET application that I am currently responsible for at my day job has hit its limit in terms of its ability to scale inside a single server. Obviously we are working toward moving session out of process and the test and ho...
[ "asp.net", "scalability", "web-farm" ]
5
2
4,515
4
0
2008-10-03T11:04:17.903000
2008-10-03T14:46:13.623000
166,354
167,060
Calculate Throughput
I have a the following scenarios. I am trying to calculate throughput of the java's XSLT transformer. I have 10 threrads, each iterates 1000 times. The task of the thread is to read the XML and XSLT file and trasnform it and write to a new file. I want to calculate the TPS. Can you please suggest the way to calculate T...
Well, you want to start a timer at the beginning and stop it when all threads complete. That gives you elapsed time = end time - begin time. Transactions = 10 threads * 1000 iterations = 10000. TPS = 10000 / elapsed time. The easiest way to do this kind of timing is with a CyclicBarrier. Here's a good writeup of using ...
Calculate Throughput I have a the following scenarios. I am trying to calculate throughput of the java's XSLT transformer. I have 10 threrads, each iterates 1000 times. The task of the thread is to read the XML and XSLT file and trasnform it and write to a new file. I want to calculate the TPS. Can you please suggest t...
TITLE: Calculate Throughput QUESTION: I have a the following scenarios. I am trying to calculate throughput of the java's XSLT transformer. I have 10 threrads, each iterates 1000 times. The task of the thread is to read the XML and XSLT file and trasnform it and write to a new file. I want to calculate the TPS. Can yo...
[ "java", "performance" ]
5
5
6,216
1
0
2008-10-03T11:06:13.187000
2008-10-03T14:10:00.220000
166,356
166,572
What are some best practices for OpenGL coding (esp. w.r.t. object orientation)?
This semester, I took a course in computer graphics at my University. At the moment, we're starting to get into some of the more advanced stuff like heightmaps, averaging normals, tesselation etc. I come from an object-oriented background, so I'm trying to put everything we do into reusable classes. I've had good succe...
The most practical approach seems to be to ignore most of OpenGL functionality that is not directly applicable (or is slow, or not hardware accelerated, or is a no longer a good match for the hardware). OOP or not, to render some scene those are various types and entities that you usually have: Geometry (meshes). Most ...
What are some best practices for OpenGL coding (esp. w.r.t. object orientation)? This semester, I took a course in computer graphics at my University. At the moment, we're starting to get into some of the more advanced stuff like heightmaps, averaging normals, tesselation etc. I come from an object-oriented background,...
TITLE: What are some best practices for OpenGL coding (esp. w.r.t. object orientation)? QUESTION: This semester, I took a course in computer graphics at my University. At the moment, we're starting to get into some of the more advanced stuff like heightmaps, averaging normals, tesselation etc. I come from an object-or...
[ "c++", "opengl", "oop" ]
53
74
20,033
5
0
2008-10-03T11:07:08.567000
2008-10-03T12:28:22.967000
166,360
166,369
Writing a generic class to handle built-in types
Not too practical maybe, but still interesting. Having some abstract question on matrix multiplication I have quickly implemented a matrix for ints, then tested my assumptions. And here I noticed that just int matrix is not good, if I occasionally want to use it with decimal or double. Of course, I could try just to ca...
For this you need generic maths. Luckily I have done this. Usage would be similar to this "complex" (i.e. x+iy) example. The Operator class is now part of MiscUtil.
Writing a generic class to handle built-in types Not too practical maybe, but still interesting. Having some abstract question on matrix multiplication I have quickly implemented a matrix for ints, then tested my assumptions. And here I noticed that just int matrix is not good, if I occasionally want to use it with dec...
TITLE: Writing a generic class to handle built-in types QUESTION: Not too practical maybe, but still interesting. Having some abstract question on matrix multiplication I have quickly implemented a matrix for ints, then tested my assumptions. And here I noticed that just int matrix is not good, if I occasionally want ...
[ "c#", ".net", "generics", "oop" ]
2
5
884
2
0
2008-10-03T11:09:10.997000
2008-10-03T11:12:29.307000
166,363
166,367
Can you control whether a variable's type is dynamic or static in VB9?
I would like to use VB9 but am not sure what syntax to use to say that I want a variable to be statically typed as in C#'s: var foo = new Whatever(); In previous versions of VB: Dim foo = New Whatever() created a dynamically typed variable. Is there a way to get static typing without actually writing the type in VB9?
Yes, you can control this behaviour through the Option directives at the beginning of each file or in the project settings: Option Strict Off ' The following is dynamically typed: ' Dim x = "Hello" Option Strict On Option Infer On ' This is statically typed: ' Dim x = "Hello" It's best-practice to set Option Strict O...
Can you control whether a variable's type is dynamic or static in VB9? I would like to use VB9 but am not sure what syntax to use to say that I want a variable to be statically typed as in C#'s: var foo = new Whatever(); In previous versions of VB: Dim foo = New Whatever() created a dynamically typed variable. Is there...
TITLE: Can you control whether a variable's type is dynamic or static in VB9? QUESTION: I would like to use VB9 but am not sure what syntax to use to say that I want a variable to be statically typed as in C#'s: var foo = new Whatever(); In previous versions of VB: Dim foo = New Whatever() created a dynamically typed ...
[ "vb.net", "types", "syntax" ]
4
3
169
1
0
2008-10-03T11:09:57.893000
2008-10-03T11:12:08.183000
166,370
166,671
What deployment directories do you use for Rails applications (deploying to a debian box)?
I wonder what's the best deployment directory for Rails apps? Some developers use directories such as /u/apps/#{appname}. Are there any advantages when using /u/apps/#{appname} instead of /var/www/#{appname} or other OS default directories? Obviously I want to pick the directory with the best security properties and th...
As other people have said, it really doesn't matter where you keep your applications - the thing that does matter is that you're consistent about it, so that whichever server you're on, its just a case of going to the usual location. I think the only reason people use /u/apps/#{appname} is that it's Capistrano's defaul...
What deployment directories do you use for Rails applications (deploying to a debian box)? I wonder what's the best deployment directory for Rails apps? Some developers use directories such as /u/apps/#{appname}. Are there any advantages when using /u/apps/#{appname} instead of /var/www/#{appname} or other OS default d...
TITLE: What deployment directories do you use for Rails applications (deploying to a debian box)? QUESTION: I wonder what's the best deployment directory for Rails apps? Some developers use directories such as /u/apps/#{appname}. Are there any advantages when using /u/apps/#{appname} instead of /var/www/#{appname} or ...
[ "ruby-on-rails", "ruby", "linux", "deployment", "mongrel" ]
10
5
1,946
6
0
2008-10-03T11:12:38.370000
2008-10-03T12:53:29.513000
166,379
872,123
Immutable functional objects in highly mutable domain
I'm currently learning functional programming in my spare time with Scala, and I have an idle newbie question. I can see the elegance of having immutable objects when doing something like calculating a Haar wavelet transform - i.e. when the data itself being represented by the objects doesn't change. But I saw a blog w...
To me it would seem like there would be a ginormous swarm of new instances each 'tick'. Indeed, that is the case. I have a Haskell application that reads a market data feed (about five million messages over the course of a six-hour trading day, for the data in which we're interested) and maintains "current state" for v...
Immutable functional objects in highly mutable domain I'm currently learning functional programming in my spare time with Scala, and I have an idle newbie question. I can see the elegance of having immutable objects when doing something like calculating a Haar wavelet transform - i.e. when the data itself being represe...
TITLE: Immutable functional objects in highly mutable domain QUESTION: I'm currently learning functional programming in my spare time with Scala, and I have an idle newbie question. I can see the elegance of having immutable objects when doing something like calculating a Haar wavelet transform - i.e. when the data it...
[ "functional-programming", "immutability" ]
25
16
2,416
8
0
2008-10-03T11:16:26.850000
2009-05-16T10:12:02.203000
166,411
167,140
Retrieve list of defined roles in java ee 5
I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it? I am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but not defined (or spelled differently) in the web.xml file.
As far as I know, there's no way do do this within the Servlet API. However, you can parse web.xml directly and extract the values yourself. I used dom4j below, but you can use whatever XML processing stuff you like: protected List getSecurityRoles() { List roles = new ArrayList (); ServletContext sc = this.getServletC...
Retrieve list of defined roles in java ee 5 I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it? I am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but not defined (or sp...
TITLE: Retrieve list of defined roles in java ee 5 QUESTION: I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it? I am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but ...
[ "java", "security", "jakarta-ee" ]
2
2
1,194
2
0
2008-10-03T11:29:33.827000
2008-10-03T14:29:19.353000
166,417
166,464
How do you handle multiple selection in a drop down style control?
I have a WinForms application with a view where the user selects a single time span from a list of predefined time spans in a ComboBox, with it's DropDownStyle property set to DropDownList. Now, the requirements have changed. The users are going to need the ability to make multiple selections from the list of time span...
I agree with @Thomas Owens on the usability aspect. If you are selecting multiple items then the user should be able to see all of the items that are selected. Maybe a checked list box will work for this. If you still have you heart set on using a drop down type of control take a look at the DevExpress editors toolkit....
How do you handle multiple selection in a drop down style control? I have a WinForms application with a view where the user selects a single time span from a list of predefined time spans in a ComboBox, with it's DropDownStyle property set to DropDownList. Now, the requirements have changed. The users are going to need...
TITLE: How do you handle multiple selection in a drop down style control? QUESTION: I have a WinForms application with a view where the user selects a single time span from a list of predefined time spans in a ComboBox, with it's DropDownStyle property set to DropDownList. Now, the requirements have changed. The users...
[ ".net", "winforms", "user-interface", "controls" ]
7
6
18,733
6
0
2008-10-03T11:31:38.427000
2008-10-03T11:45:47.670000
166,426
166,463
additional fields in NHibernate many-to-many relation tables
when i have a many-to.many relation with nhibernate and let nhibernate generate my db schema, it adds an aditional table that contains the primary keys of the related entities. is it possible to add additional fields to this and access them without having to hassle around with sql manually?
I don't think thats possible. If you are saying that the relation has some state than in essence it is an object in it's own right and should be treated (mapped) as such.
additional fields in NHibernate many-to-many relation tables when i have a many-to.many relation with nhibernate and let nhibernate generate my db schema, it adds an aditional table that contains the primary keys of the related entities. is it possible to add additional fields to this and access them without having to ...
TITLE: additional fields in NHibernate many-to-many relation tables QUESTION: when i have a many-to.many relation with nhibernate and let nhibernate generate my db schema, it adds an aditional table that contains the primary keys of the related entities. is it possible to add additional fields to this and access them ...
[ "c#", ".net", "nhibernate" ]
3
6
2,248
3
0
2008-10-03T11:35:36.967000
2008-10-03T11:45:22.210000
166,472
169,048
How to use Maven Modules without svn:externals?
I have never quite understood how/why I would use Maven modules (reactor builds). We have tens of libraries that we share (as dependencies) among our products, and between libraries as well. If we were to switch to making them Maven modules, how would we set it up, both in SVN and in our working copies? Do Maven module...
I guess that's a problem with subversion. Which forces you to create a folder structure for branching. Other version control systems allow branching without visibility in the folder structure, where maven modules can be created more easily. I work with a product of more than 250 modules, and they reside in "logical" ma...
How to use Maven Modules without svn:externals? I have never quite understood how/why I would use Maven modules (reactor builds). We have tens of libraries that we share (as dependencies) among our products, and between libraries as well. If we were to switch to making them Maven modules, how would we set it up, both i...
TITLE: How to use Maven Modules without svn:externals? QUESTION: I have never quite understood how/why I would use Maven modules (reactor builds). We have tens of libraries that we share (as dependencies) among our products, and between libraries as well. If we were to switch to making them Maven modules, how would we...
[ "maven-2", "build-automation" ]
1
1
1,665
2
0
2008-10-03T11:47:04.173000
2008-10-03T21:54:49.907000
166,482
166,496
PHP - Custom error handling. Redirected 404 is being hijacked by AVG Anti-Virus. How to stop?
I have a website which uses the custom 404 error handling in PHP/Apache to display specific pages. e.g. http://metachat.org/recent I've a feeling this is a bad way of doing this, but it's code I inherited... Although the page displays correctly on most browsers, I'm getting a situation where AVG Anti-Virus is hijacking...
There's no way other than using URL rewriting (mod_rewrite) or creating the missing pages. What's happening is that the client requests a page which doesn't exist. Apache is configured to serve a special page upon 404 errors, but it still sends the 404 status code, then AVG traps that. So, you could do something like: ...
PHP - Custom error handling. Redirected 404 is being hijacked by AVG Anti-Virus. How to stop? I have a website which uses the custom 404 error handling in PHP/Apache to display specific pages. e.g. http://metachat.org/recent I've a feeling this is a bad way of doing this, but it's code I inherited... Although the page ...
TITLE: PHP - Custom error handling. Redirected 404 is being hijacked by AVG Anti-Virus. How to stop? QUESTION: I have a website which uses the custom 404 error handling in PHP/Apache to display specific pages. e.g. http://metachat.org/recent I've a feeling this is a bad way of doing this, but it's code I inherited... ...
[ "php", "http-headers", "http-status-code-404", "antivirus" ]
1
4
2,074
3
0
2008-10-03T11:54:30.930000
2008-10-03T11:59:34.053000
166,491
166,662
detect svn changes in a .bat
I have a.bat and inside the.bat i would like to execute a special code if there's some modification inside the svn repository (for example, compile).
For Win 2000 and later, this would assign the last output row from the svn status commmand to the svnOut variable and then test if the variable contains anything: @echo off set svnOut= set svnDir=C:Your\path\to\svn\dir\to\check for /F "tokens=*" %%I in ('svn status %svnDir%') do set svnOut=%%I if "%svnOut%"=="" ( echo...
detect svn changes in a .bat I have a.bat and inside the.bat i would like to execute a special code if there's some modification inside the svn repository (for example, compile).
TITLE: detect svn changes in a .bat QUESTION: I have a.bat and inside the.bat i would like to execute a special code if there's some modification inside the svn repository (for example, compile). ANSWER: For Win 2000 and later, this would assign the last output row from the svn status commmand to the svnOut variable ...
[ "svn" ]
9
6
5,513
5
0
2008-10-03T11:58:02.123000
2008-10-03T12:51:34.387000
166,503
167,157
UTF-8 in Windows
How do I set the code page to UTF-8 in a C Windows program? I have a third party library that uses fopen to open files. I can use wcstombs to convert my Unicode filenames to the current code page, however if the user has a filename with a character outside the code page then this breaks. Ideally I would just call _setm...
Unfortunately, there is no way to make Unicode the current codepage in Windows. The CP_UTF7 and CP_UTF8 constants are pseudo-codepages, used only in MultiByteToWideChar and WideCharToMultiByte conversion functions, like Ben mentioned. Your problem is similar to that of the fstream C++ classes. The fstream constructors ...
UTF-8 in Windows How do I set the code page to UTF-8 in a C Windows program? I have a third party library that uses fopen to open files. I can use wcstombs to convert my Unicode filenames to the current code page, however if the user has a filename with a character outside the code page then this breaks. Ideally I woul...
TITLE: UTF-8 in Windows QUESTION: How do I set the code page to UTF-8 in a C Windows program? I have a third party library that uses fopen to open files. I can use wcstombs to convert my Unicode filenames to the current code page, however if the user has a filename with a character outside the code page then this brea...
[ "c", "windows", "winapi", "unicode", "utf-8" ]
27
26
14,703
4
0
2008-10-03T12:02:32.940000
2008-10-03T14:32:08.643000
166,506
166,520
Finding local IP addresses using Python's stdlib
How can I find local IP addresses (i.e. 192.168.x.x or 10.0.x.x) in Python platform independently and using only the standard library?
import socket socket.gethostbyname(socket.gethostname()) This won't work always (returns 127.0.0.1 on machines having the hostname in /etc/hosts as 127.0.0.1 ), a paliative would be what gimel shows, use socket.getfqdn() instead. Of course your machine needs a resolvable hostname.
Finding local IP addresses using Python's stdlib How can I find local IP addresses (i.e. 192.168.x.x or 10.0.x.x) in Python platform independently and using only the standard library?
TITLE: Finding local IP addresses using Python's stdlib QUESTION: How can I find local IP addresses (i.e. 192.168.x.x or 10.0.x.x) in Python platform independently and using only the standard library? ANSWER: import socket socket.gethostbyname(socket.gethostname()) This won't work always (returns 127.0.0.1 on machine...
[ "python", "networking", "ip-address" ]
730
569
986,723
50
0
2008-10-03T12:03:36.963000
2008-10-03T12:06:50.653000
166,508
167,278
Unix shell events?
Is there any way so that i can echo password when asked for in unix shell without use of external binaries? Something like simple function triggered when password prompt is displayed
Short answer: no. Slightly longer answer: the usual shells, sh, ksh, csh, tcsh, bash do not have any hooks for you to hang actions on (OK, so bash2 has context sensitive tab-completion). On the other hand. The shell is just a program. You can replace it. If you can really say what you want to do you can hack and existi...
Unix shell events? Is there any way so that i can echo password when asked for in unix shell without use of external binaries? Something like simple function triggered when password prompt is displayed
TITLE: Unix shell events? QUESTION: Is there any way so that i can echo password when asked for in unix shell without use of external binaries? Something like simple function triggered when password prompt is displayed ANSWER: Short answer: no. Slightly longer answer: the usual shells, sh, ksh, csh, tcsh, bash do not...
[ "unix", "shell", "passwords", "prompt" ]
0
1
192
2
0
2008-10-03T12:04:31.440000
2008-10-03T14:56:31
166,518
166,558
SQL Server 2005 Computed Column Result From Aggregate Of Another Table Field's Value
Sorry for the long question title. I guess I'm on to a loser on this one but on the off chance. Is it possible to make the calculation of a calculated field in a table the result of an aggregate function applied to a field in another table. i.e. You have a table called 'mug', this has a child called 'color' (which make...
you can't have a computed column directly reference a different table, but you can have it reference a user defined function. here's a link to a example of implementing a solution like this. http://www.sqlservercentral.com/articles/User-Defined+functions/complexcomputedcolumns/2397/
SQL Server 2005 Computed Column Result From Aggregate Of Another Table Field's Value Sorry for the long question title. I guess I'm on to a loser on this one but on the off chance. Is it possible to make the calculation of a calculated field in a table the result of an aggregate function applied to a field in another t...
TITLE: SQL Server 2005 Computed Column Result From Aggregate Of Another Table Field's Value QUESTION: Sorry for the long question title. I guess I'm on to a loser on this one but on the off chance. Is it possible to make the calculation of a calculated field in a table the result of an aggregate function applied to a ...
[ "sql-server-2005", "t-sql", "aggregate-functions", "calculated-columns" ]
5
7
5,310
2
0
2008-10-03T12:05:41.077000
2008-10-03T12:23:13.773000
166,530
167,399
Does NetworkStream.DataAvailable see buffered data?
Does NetworkStream.DataAvailable know whether the sender's send buffer is empty? Or does it simply indicate whether the receiver's read buffer has data? My assumption is the latter... Specifically, for some socket work involving an ongoing conversation, I currently use a length-prefix so the the receiver knows exactly ...
One side of a connection is not going to know whether the other side's send buffer is empty. DataAvailable only indicates whether there is incoming data to be read. You could use that prior to Read(), but it alone doesn't give you the information you want. It doesn't tell you the beginning and ending of each batch. I'v...
Does NetworkStream.DataAvailable see buffered data? Does NetworkStream.DataAvailable know whether the sender's send buffer is empty? Or does it simply indicate whether the receiver's read buffer has data? My assumption is the latter... Specifically, for some socket work involving an ongoing conversation, I currently us...
TITLE: Does NetworkStream.DataAvailable see buffered data? QUESTION: Does NetworkStream.DataAvailable know whether the sender's send buffer is empty? Or does it simply indicate whether the receiver's read buffer has data? My assumption is the latter... Specifically, for some socket work involving an ongoing conversati...
[ ".net", "stream", "networkstream" ]
6
5
2,659
2
0
2008-10-03T12:10:51.347000
2008-10-03T15:22:51.023000
166,542
166,581
Using boost in embedded system with memory limitation
We are using c++ to develop an application that runs in Windows CE 4 on an embedded system. One of our constraint is that all the memory used by the application shall be allocated during startup only. We wrote a lot of containers and algorithms that are using only preallocated memory instead of allocating new one. Do y...
You could write your own allocator for the container, which allocates from a fixed size static buffer. Depending on the usage patterns of the container the allocator could be as simple as incrementing a pointer (e.g. when you only insert stuff into the container once at app startup, and don't continuously add/remove el...
Using boost in embedded system with memory limitation We are using c++ to develop an application that runs in Windows CE 4 on an embedded system. One of our constraint is that all the memory used by the application shall be allocated during startup only. We wrote a lot of containers and algorithms that are using only p...
TITLE: Using boost in embedded system with memory limitation QUESTION: We are using c++ to develop an application that runs in Windows CE 4 on an embedded system. One of our constraint is that all the memory used by the application shall be allocated during startup only. We wrote a lot of containers and algorithms tha...
[ "c++", "boost", "embedded", "windows-ce" ]
11
6
10,623
6
0
2008-10-03T12:18:57.103000
2008-10-03T12:32:31.943000
166,544
166,593
Reuse Edit Control as Command Window
This is a GUI application (actually MFC). I need a command window with the ability to display a prompt like such: Name of favorite porn star: The user should be able to enter text after the prompt like such: Name of favorite porn star: Raven Riley But I need to prevent the user from moving the cursor into the prompt ar...
I think you'd be better off creating a subclass of CEdit and limiting filtering key-presses. I suppose the hard part is not letting the user move the caret to the prompt area, but you can probably write some code to make sure the caret always get sent back to where it belongs (the input part). Anyway, if you really, re...
Reuse Edit Control as Command Window This is a GUI application (actually MFC). I need a command window with the ability to display a prompt like such: Name of favorite porn star: The user should be able to enter text after the prompt like such: Name of favorite porn star: Raven Riley But I need to prevent the user from...
TITLE: Reuse Edit Control as Command Window QUESTION: This is a GUI application (actually MFC). I need a command window with the ability to display a prompt like such: Name of favorite porn star: The user should be able to enter text after the prompt like such: Name of favorite porn star: Raven Riley But I need to pre...
[ "windows", "winapi", "visual-c++", "mfc" ]
0
3
544
2
0
2008-10-03T12:19:55.527000
2008-10-03T12:36:15.663000
166,545
166,552
Finding a public facing IP address in Python?
How can I find the public facing IP for my net work in Python?
This will fetch your remote IP address import urllib ip = urllib.urlopen('http://automation.whatismyip.com/n09230945.asp').read() If you don't want to rely on someone else, then just upload something like this PHP script: and change the URL in the Python or if you prefer ASP: <% Dim UserIPAddress UserIPAddress = Reques...
Finding a public facing IP address in Python? How can I find the public facing IP for my net work in Python?
TITLE: Finding a public facing IP address in Python? QUESTION: How can I find the public facing IP for my net work in Python? ANSWER: This will fetch your remote IP address import urllib ip = urllib.urlopen('http://automation.whatismyip.com/n09230945.asp').read() If you don't want to rely on someone else, then just u...
[ "python", "ip-address" ]
21
13
18,666
8
0
2008-10-03T12:20:07.117000
2008-10-03T12:22:07.410000
166,550
166,564
What to put in the IF block and what to put in the ELSE block?
This is a minor style question, but every bit of readability you add to your code counts. So if you've got: if (condition) then { // do stuff } else { // do other stuff } How do you decide if it's better like that, or like this: if (!condition) then { // do other stuff { else { // do stuff } My heuristics are: Keep the...
I prefer to put the most common path first, and I am a strong believer in nesting reduction so I will break, continue, or return instead of elsing whenever possible. I generally prefer to test against positive conditions, or invert [and name] negative conditions as a positive. if (condition) return; DoSomething(); I h...
What to put in the IF block and what to put in the ELSE block? This is a minor style question, but every bit of readability you add to your code counts. So if you've got: if (condition) then { // do stuff } else { // do other stuff } How do you decide if it's better like that, or like this: if (!condition) then { // do...
TITLE: What to put in the IF block and what to put in the ELSE block? QUESTION: This is a minor style question, but every bit of readability you add to your code counts. So if you've got: if (condition) then { // do stuff } else { // do other stuff } How do you decide if it's better like that, or like this: if (!condi...
[ "coding-style", "function-exit" ]
12
18
1,677
23
0
2008-10-03T12:21:24.337000
2008-10-03T12:26:13.063000
166,557
166,571
A good database modeling tool?
Could you guys recommend me a good db modeling tool? Mainly for SQL Server... thanks!
If it is for SQL Server I like the DB Diagram from SQL Server Management Studio.
A good database modeling tool? Could you guys recommend me a good db modeling tool? Mainly for SQL Server... thanks!
TITLE: A good database modeling tool? QUESTION: Could you guys recommend me a good db modeling tool? Mainly for SQL Server... thanks! ANSWER: If it is for SQL Server I like the DB Diagram from SQL Server Management Studio.
[ "database-design" ]
33
12
69,749
18
0
2008-10-03T12:23:13.227000
2008-10-03T12:28:02.343000
166,565
166,585
HTTP response splitting
I'm trying to handle this possible exploit and wondering what is the best way to do it? should i use apache's common-validator and create a list of known allowed symbols and use that?
From the wikipedia article: The generic solution is to URL-encode strings before inclusion into HTTP headers such as Location or Set-Cookie. Typical examples of sanitization include casting to integer, or aggressive regular expression replacement. It is worth noting that although this is not a PHP specific problem, the...
HTTP response splitting I'm trying to handle this possible exploit and wondering what is the best way to do it? should i use apache's common-validator and create a list of known allowed symbols and use that?
TITLE: HTTP response splitting QUESTION: I'm trying to handle this possible exploit and wondering what is the best way to do it? should i use apache's common-validator and create a list of known allowed symbols and use that? ANSWER: From the wikipedia article: The generic solution is to URL-encode strings before incl...
[ "validation", "response", "split" ]
1
1
1,313
3
0
2008-10-03T12:26:33.610000
2008-10-03T12:33:11.380000
166,575
166,592
Flash IDE - Find a symbol in the library
I've inherited a flash project (my first) that has many existing symbols in the library. They are organized in a large complex hierarchy of folders. Often, I find a reference to a symbol in actionscript code, but can't find the symbol in the library. The "Find" feature only searches for instances of a symbol. If none e...
This will be helpful http://www.gskinner.com/products/panelpack1/gSearch.php
Flash IDE - Find a symbol in the library I've inherited a flash project (my first) that has many existing symbols in the library. They are organized in a large complex hierarchy of folders. Often, I find a reference to a symbol in actionscript code, but can't find the symbol in the library. The "Find" feature only sear...
TITLE: Flash IDE - Find a symbol in the library QUESTION: I've inherited a flash project (my first) that has many existing symbols in the library. They are organized in a large complex hierarchy of folders. Often, I find a reference to a symbol in actionscript code, but can't find the symbol in the library. The "Find"...
[ "flash", "ide" ]
0
0
591
1
0
2008-10-03T12:29:37.223000
2008-10-03T12:36:11.327000
166,607
166,619
How do I find the version of Apache running without access to the command line?
I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line access, although I can browse the install location via FTP. I have tried HEAD and do not get a version number reported. If I ...
The method Connect to port 80 on the host and send it HEAD / HTTP/1.0 This needs to be followed by carriage-return + line-feed twice You'll get back something like this HTTP/1.1 200 OK Date: Fri, 03 Oct 2008 12:39:43 GMT Server: Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.0 PHP/5.2.6-1ubuntu4 with Suhosin-Patch mod_perl/2.0.4 ...
How do I find the version of Apache running without access to the command line? I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line access, although I can browse the install loc...
TITLE: How do I find the version of Apache running without access to the command line? QUESTION: I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line access, although I can brow...
[ "apache" ]
81
138
280,110
11
0
2008-10-03T12:38:30.713000
2008-10-03T12:40:31.757000
166,615
166,629
Can I add a PHP array key without an assigned value in a class variable?
I am currently plowing my way through IBM's tutorial on CakePHP At one point I run into this snippet of code: array( 'className' => 'Product', 'conditions'=>, // is this allowed? 'order'=>, // same thing here 'foreignKey'=>'dealer_id' ) ); }?> When I run it I get the following error-message: "Parse error: syntax error,...
Assign the value null instead of leaving anything out. The manual says isset() will return FALSE if testing a variable that has been set to NULL array( 'className' => 'Product', 'conditions' => null, 'order' => null, 'foreignKey' => 'dealer_id' ) ); }?> This works fine.
Can I add a PHP array key without an assigned value in a class variable? I am currently plowing my way through IBM's tutorial on CakePHP At one point I run into this snippet of code: array( 'className' => 'Product', 'conditions'=>, // is this allowed? 'order'=>, // same thing here 'foreignKey'=>'dealer_id' ) ); }?> Whe...
TITLE: Can I add a PHP array key without an assigned value in a class variable? QUESTION: I am currently plowing my way through IBM's tutorial on CakePHP At one point I run into this snippet of code: array( 'className' => 'Product', 'conditions'=>, // is this allowed? 'order'=>, // same thing here 'foreignKey'=>'deale...
[ "php", "arrays", "cakephp" ]
2
8
10,529
2
0
2008-10-03T12:39:53.863000
2008-10-03T12:42:58.507000
166,617
166,699
"CURLE_OUT_OF_MEMORY" error when posting via https
I am attempting to write an application that uses libCurl to post soap requests to a secure web service. This Windows application is built against libCurl version 7.19.0 which, in turn, is built against openssl-0.9.8i. The pertinent curl related code follows: FILE *input_file = fopen(current->post_file_name.c_str(), "r...
After further investigation, I found that this error was due to a failure to initialise the openSSL library by calling SSL_library_init().
"CURLE_OUT_OF_MEMORY" error when posting via https I am attempting to write an application that uses libCurl to post soap requests to a secure web service. This Windows application is built against libCurl version 7.19.0 which, in turn, is built against openssl-0.9.8i. The pertinent curl related code follows: FILE *inp...
TITLE: "CURLE_OUT_OF_MEMORY" error when posting via https QUESTION: I am attempting to write an application that uses libCurl to post soap requests to a secure web service. This Windows application is built against libCurl version 7.19.0 which, in turn, is built against openssl-0.9.8i. The pertinent curl related code ...
[ "c++", "curl", "https", "openssl" ]
5
3
5,571
3
0
2008-10-03T12:40:14.237000
2008-10-03T12:58:37.710000
166,639
166,719
What kind of damage could one do with a payment gateway API login and transaction key?
Currently, I'm in the process of hiring a web developer who will be working on a site that processes credit cards. While he won't have the credentials to log into the payment gateway's UI he will have access to the API login and transaction key since it's embedded in the application's code. I'd like to be aware of all ...
Do they really need access to your production sites? Don't store the key in your code, store it in your production database, or on a file on the production server.
What kind of damage could one do with a payment gateway API login and transaction key? Currently, I'm in the process of hiring a web developer who will be working on a site that processes credit cards. While he won't have the credentials to log into the payment gateway's UI he will have access to the API login and tran...
TITLE: What kind of damage could one do with a payment gateway API login and transaction key? QUESTION: Currently, I'm in the process of hiring a web developer who will be working on a site that processes credit cards. While he won't have the credentials to log into the payment gateway's UI he will have access to the ...
[ "security", "payment-gateway", "credit-card", "authorize.net" ]
3
5
673
9
0
2008-10-03T12:45:44.430000
2008-10-03T13:02:29.513000
166,641
166,903
Is using size() for the 2nd expression in a for construct always bad?
In the following example should I expect that values.size() will be called every time around the loop? In which case it might make sense to introduce a temporary vectorSize variable. Or should a modern compiler be able to optimize the calls away by recognising that the vector size cannot change. double sumVector(const ...
Here's one way to do it that makes it explicit - size() is called only once. for (size_t ii = 0, count = values.size(); ii < count; ++ii) Edit: I've been asked to actually answer the question, so here's my best shot. A compiler generally won't optimize a function call, because it doesn't know if it will get a different...
Is using size() for the 2nd expression in a for construct always bad? In the following example should I expect that values.size() will be called every time around the loop? In which case it might make sense to introduce a temporary vectorSize variable. Or should a modern compiler be able to optimize the calls away by r...
TITLE: Is using size() for the 2nd expression in a for construct always bad? QUESTION: In the following example should I expect that values.size() will be called every time around the loop? In which case it might make sense to introduce a temporary vectorSize variable. Or should a modern compiler be able to optimize t...
[ "c++" ]
8
14
678
16
0
2008-10-03T12:47:23.303000
2008-10-03T13:39:26.147000
166,658
166,859
How to make some NAnt tasks quiet?
I am using MailLogger to send a message about a failed/successful release. I would like to make the mail body simple and easy to read. How can I suppress output for some particular tasks?
Another option would be to use the xmllogger instead of the maillogger, to output an xml file which can then be processed using a xslt stylesheet. Use the stylesheet to filter out information you don't need. If you want it to be mailed to your inbox you could use the mail task from nant and include the transformed file...
How to make some NAnt tasks quiet? I am using MailLogger to send a message about a failed/successful release. I would like to make the mail body simple and easy to read. How can I suppress output for some particular tasks?
TITLE: How to make some NAnt tasks quiet? QUESTION: I am using MailLogger to send a message about a failed/successful release. I would like to make the mail body simple and easy to read. How can I suppress output for some particular tasks? ANSWER: Another option would be to use the xmllogger instead of the maillogger...
[ "nant" ]
2
1
1,125
2
0
2008-10-03T12:50:52.517000
2008-10-03T13:31:25.973000
166,661
1,338,625
Agent-based modeling resources
I would like to know what kind of toolkits, languages, libraries exist for agent-based modeling and what are the pros/cons of them? Some examples of what I am thinking of are Swarm, Repast, and MASS.
I found a survey from June 2009 that answer your question: Survey of Agent Based Modelling and Simulation Tools Au. R.J. Allan Abstract Agent Based Modelling and Simulation is a computationally demanding technique based on discrete event simulation and having its origins in genetic algorithms. It is a powerful techniqu...
Agent-based modeling resources I would like to know what kind of toolkits, languages, libraries exist for agent-based modeling and what are the pros/cons of them? Some examples of what I am thinking of are Swarm, Repast, and MASS.
TITLE: Agent-based modeling resources QUESTION: I would like to know what kind of toolkits, languages, libraries exist for agent-based modeling and what are the pros/cons of them? Some examples of what I am thinking of are Swarm, Repast, and MASS. ANSWER: I found a survey from June 2009 that answer your question: Sur...
[ "modeling", "toolkit", "agent-based-modeling", "multi-agent" ]
10
8
2,872
10
0
2008-10-03T12:51:18.317000
2009-08-27T02:54:53.103000
166,692
353,903
What is the best standard to use for business document exchange (invoices, POs etc)?
If I need to implement sending and receiving of business documents from system to system (invoices, POs, remittance advice, etc) what standard would you recommend for best interop and why? It could be XML or otherwise.
I would look at (in this order): Industry-specific formats. Always your best choice if you have a homogeneous trading group. cXML or XCBL if you want an XML solution with an established standard. X12 if you have unlimited time, money, and willing partners. custom XML only if you have requirements outside a standard or ...
What is the best standard to use for business document exchange (invoices, POs etc)? If I need to implement sending and receiving of business documents from system to system (invoices, POs, remittance advice, etc) what standard would you recommend for best interop and why? It could be XML or otherwise.
TITLE: What is the best standard to use for business document exchange (invoices, POs etc)? QUESTION: If I need to implement sending and receiving of business documents from system to system (invoices, POs, remittance advice, etc) what standard would you recommend for best interop and why? It could be XML or otherwise...
[ "xml", "interop", "x12", "invoice", "purchase-order" ]
4
7
1,683
6
0
2008-10-03T12:56:29.883000
2008-12-09T19:22:13.960000
166,712
166,734
How to show the loading indicator in the top status bar
I have noticed that some apps like Safari and Mail show a loading indicator in the status bar (the bar at the very top of the phone) when they are accessing the network. Is there a way to do the same thing in SDK apps, or is this an Apple only thing?
It's in UIApplication: For Objective C: Start: [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; End: [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; For swift: Start UIApplication.shared.isNetworkActivityIndicatorVisible = true End UIApplication.shared.isNetworkActivityIn...
How to show the loading indicator in the top status bar I have noticed that some apps like Safari and Mail show a loading indicator in the status bar (the bar at the very top of the phone) when they are accessing the network. Is there a way to do the same thing in SDK apps, or is this an Apple only thing?
TITLE: How to show the loading indicator in the top status bar QUESTION: I have noticed that some apps like Safari and Mail show a loading indicator in the status bar (the bar at the very top of the phone) when they are accessing the network. Is there a way to do the same thing in SDK apps, or is this an Apple only th...
[ "ios", "cocoa-touch" ]
123
217
49,607
8
0
2008-10-03T13:00:50.343000
2008-10-03T13:06:14.293000
166,718
166,880
Unable to serialize a property on a control
Background I am trying to create a copy of a business object I have created in VB.NET. I have implemented the ICloneable interface and in the Clone function, I create a copy of the object by serializing it with a BinaryFormatter and then de-serializing straight back out into another object which I return from the funct...
Do you have an event that the UI is subscribing to? A {Foo}Changed event if data-binding, or perhaps INotifyPropertyChanged? You might have to mark the event backing field as [NonSerialized] (or however attributes look in VB - I'm a C# person...). If you are using field-like-events (i.e. the abbreviated syntax without ...
Unable to serialize a property on a control Background I am trying to create a copy of a business object I have created in VB.NET. I have implemented the ICloneable interface and in the Clone function, I create a copy of the object by serializing it with a BinaryFormatter and then de-serializing straight back out into ...
TITLE: Unable to serialize a property on a control QUESTION: Background I am trying to create a copy of a business object I have created in VB.NET. I have implemented the ICloneable interface and in the Clone function, I create a copy of the object by serializing it with a BinaryFormatter and then de-serializing strai...
[ ".net", "vb.net", "serialization" ]
2
2
3,173
3
0
2008-10-03T13:02:17.827000
2008-10-03T13:35:08.400000
166,722
202,354
How do you find which database a table is located in, of which you know the name (e.g. dbo.mytable1), in Microsoft SQL Server Management Studio 2005?
I know the name of the table I want to find. I'm using Microsoft SQL Server Management Studio 2005, and I want to search all databases in the database server that I'm attached to in the studio. Is this possible? Do I need to query the system tables?
As above but use system function not system tables EXEC sp_MSForEachDB 'USE [?] IF OBJECT_ID(''dbo.mytable'') IS NOT NULL PRINT ''?'''
How do you find which database a table is located in, of which you know the name (e.g. dbo.mytable1), in Microsoft SQL Server Management Studio 2005? I know the name of the table I want to find. I'm using Microsoft SQL Server Management Studio 2005, and I want to search all databases in the database server that I'm att...
TITLE: How do you find which database a table is located in, of which you know the name (e.g. dbo.mytable1), in Microsoft SQL Server Management Studio 2005? QUESTION: I know the name of the table I want to find. I'm using Microsoft SQL Server Management Studio 2005, and I want to search all databases in the database s...
[ "sql-server", "database", "sql-server-2005" ]
1
3
380
4
0
2008-10-03T13:03:00.993000
2008-10-14T18:51:25.623000
166,742
166,799
Robot simulation environments
I would like to make a list of remarkable robot simulation environments including advantages and disadvantages of them. Some examples I know of are Webots and Player/Stage.
This made me remember the breve project. breve is a free, open-source software package which makes it easy to build 3D simulations of multi-agent systems and artificial life. There is also a wikipage listing Robotics simulators
Robot simulation environments I would like to make a list of remarkable robot simulation environments including advantages and disadvantages of them. Some examples I know of are Webots and Player/Stage.
TITLE: Robot simulation environments QUESTION: I would like to make a list of remarkable robot simulation environments including advantages and disadvantages of them. Some examples I know of are Webots and Player/Stage. ANSWER: This made me remember the breve project. breve is a free, open-source software package whi...
[ "simulation", "environment", "robotics" ]
15
4
5,702
12
0
2008-10-03T13:07:22.310000
2008-10-03T13:19:27.667000
166,744
172,760
Best Linux distribution for running Mono
I'm a.Net developer and would like to investigate building and running our framework on Mono. If the initial project is successful I will happily invest in an OS learning curve, but right now I want to focus on getting things up and running and seeing the code working. What would be the best distribution to start with,...
I work for Novell, so I am going to recommend OpenSUSE as the distribution to use for Mono of course. When you use OpenSUSE, not only you get Mono, but there are hundreds of open source libraries and.NET based applications that we have ported and make available through our update system. Additionally, many of the previ...
Best Linux distribution for running Mono I'm a.Net developer and would like to investigate building and running our framework on Mono. If the initial project is successful I will happily invest in an OS learning curve, but right now I want to focus on getting things up and running and seeing the code working. What woul...
TITLE: Best Linux distribution for running Mono QUESTION: I'm a.Net developer and would like to investigate building and running our framework on Mono. If the initial project is successful I will happily invest in an OS learning curve, but right now I want to focus on getting things up and running and seeing the code ...
[ ".net", "linux", "mono" ]
24
37
11,512
11
0
2008-10-03T13:07:44.260000
2008-10-05T22:18:34.223000
166,750
166,758
Should I have a dedicated primary key field?
I'm designing a small SQL database to be used by a web application. Let's say a particular table has a Name field for which no two rows will be allowed to have the same value. However, users will be able to change the Name field at any time. The primary key from this table will be used as a foreign key in other tables....
I would use a generated PK myself, just for the reasons you mentioned. Also, indexing and comparing by integer is faster than comparing by strings. You can put a unique index on the name field too without making it a primary key.
Should I have a dedicated primary key field? I'm designing a small SQL database to be used by a web application. Let's say a particular table has a Name field for which no two rows will be allowed to have the same value. However, users will be able to change the Name field at any time. The primary key from this table w...
TITLE: Should I have a dedicated primary key field? QUESTION: I'm designing a small SQL database to be used by a web application. Let's say a particular table has a Name field for which no two rows will be allowed to have the same value. However, users will be able to change the Name field at any time. The primary key...
[ "database-design", "primary-key" ]
18
25
5,007
12
0
2008-10-03T13:08:36.707000
2008-10-03T13:10:29.700000
166,752
166,762
C# compiler number literals
Does anyone know the full list of C# compiler number literal modifiers? By default declaring '0' makes it an Int32 and '0.0' makes it a 'Double'. I can use the literal modifier 'f' at the end to ensure something is treated as a 'Single' instead. For example like this... var x = 0; // x is Int32 var y = 0f; // y is Sing...
var y = 0f; // y is single var z = 0d; // z is double var r = 0m; // r is decimal var i = 0U; // i is unsigned int var j = 0L; // j is long (note capital L for clarity) var k = 0UL; // k is unsigned long (note capital L for clarity) From the C# specification 2.4.4.2 Integer literals and 2.4.4.3 Real literals. Take note...
C# compiler number literals Does anyone know the full list of C# compiler number literal modifiers? By default declaring '0' makes it an Int32 and '0.0' makes it a 'Double'. I can use the literal modifier 'f' at the end to ensure something is treated as a 'Single' instead. For example like this... var x = 0; // x is In...
TITLE: C# compiler number literals QUESTION: Does anyone know the full list of C# compiler number literal modifiers? By default declaring '0' makes it an Int32 and '0.0' makes it a 'Double'. I can use the literal modifier 'f' at the end to ensure something is treated as a 'Single' instead. For example like this... var...
[ "c#", "compiler-construction" ]
40
74
17,116
3
0
2008-10-03T13:09:27.737000
2008-10-03T13:11:21.350000
166,764
167,000
Compare view with stream
I use ClearCase. I have a snapshot view. Is there a way to compare this view with stream to find changed files? In TortoiseSVN this is called "Check for modifications" and shows all difference between local copy and what we have in the repo.
I'm not sure about Clear Case's own possibilities, but you always can make a view of that stream and compare your original view with created one using any file/folder comparison tool. I use Araxis Merge for that. There is also an open source tool: WinMerge
Compare view with stream I use ClearCase. I have a snapshot view. Is there a way to compare this view with stream to find changed files? In TortoiseSVN this is called "Check for modifications" and shows all difference between local copy and what we have in the repo.
TITLE: Compare view with stream QUESTION: I use ClearCase. I have a snapshot view. Is there a way to compare this view with stream to find changed files? In TortoiseSVN this is called "Check for modifications" and shows all difference between local copy and what we have in the repo. ANSWER: I'm not sure about Clear C...
[ "view", "stream", "compare", "clearcase" ]
0
1
812
2
0
2008-10-03T13:12:00.273000
2008-10-03T13:55:51.340000
166,768
167,684
Using sIFR in nyroModal lightbox
I'm using sIFR in a page that's being popped up in a nyroModal lightbox, but when the page is displayed, the sIFR objects aren't being shown. What do I need to do to get them to show?
The idea will be to use the endShowContent callback from nyroModal to sIFR your text. $.fn.nyroModal.settings.endShowContent = function(elts, settings) { $('YOUR SELECTOR', elts.content).media(function(el, options) { // What you need to do }); }; Hope it will help. If you still have some trouble, come on the google cod...
Using sIFR in nyroModal lightbox I'm using sIFR in a page that's being popped up in a nyroModal lightbox, but when the page is displayed, the sIFR objects aren't being shown. What do I need to do to get them to show?
TITLE: Using sIFR in nyroModal lightbox QUESTION: I'm using sIFR in a page that's being popped up in a nyroModal lightbox, but when the page is displayed, the sIFR objects aren't being shown. What do I need to do to get them to show? ANSWER: The idea will be to use the endShowContent callback from nyroModal to sIFR y...
[ "sifr", "lightbox", "nyromodal" ]
0
1
806
1
0
2008-10-03T13:12:21.693000
2008-10-03T16:18:09.883000
166,772
168,153
How to update Firefox 2 compatible extensions using IFRAME to Firefox 3?
I am trying to update a custom firefox extension that I created for some tasks at work. Basically it is a sidebar that pulls up one of our webpages in an iframe for various purposes. When moving to Firefox 3 the iframe won't appear at all. Below is an example of the XUL files that contains extension specific code inclu...
Set flex="1" on the iframe The XUL code for sidebar is not an overlay, it's a document loaded inside an iframe (look at the Firefox main window in the DOM inspector). So the root element should be, not. This, combined with the flex="1", should make the page display. You usually want to put type="content" or type="conte...
How to update Firefox 2 compatible extensions using IFRAME to Firefox 3? I am trying to update a custom firefox extension that I created for some tasks at work. Basically it is a sidebar that pulls up one of our webpages in an iframe for various purposes. When moving to Firefox 3 the iframe won't appear at all. Below i...
TITLE: How to update Firefox 2 compatible extensions using IFRAME to Firefox 3? QUESTION: I am trying to update a custom firefox extension that I created for some tasks at work. Basically it is a sidebar that pulls up one of our webpages in an iframe for various purposes. When moving to Firefox 3 the iframe won't appe...
[ "firefox", "xul" ]
2
2
1,468
2
0
2008-10-03T13:14:04.230000
2008-10-03T18:11:48.263000
166,796
166,814
How do you manage .vcproj files in source control which are changed by multiple developers?
We use Subversion as our source control system and store the VisualStudio project files (vcproj) in the source control system as is normal I think. With Subversion we don't use any form of file locking, so if two developers are working on the same project at the same time and both add files to the project, or change se...
I've found that option 2 (edit the files by hand) generally works fairly well, as long as you're using a good diff tool (I use WinMerge ). The main problem I've run into is that Visual Studio will sometimes reorder the file. But, if you have a good diff/merge tool then it should be able to differentiate between changed...
How do you manage .vcproj files in source control which are changed by multiple developers? We use Subversion as our source control system and store the VisualStudio project files (vcproj) in the source control system as is normal I think. With Subversion we don't use any form of file locking, so if two developers are ...
TITLE: How do you manage .vcproj files in source control which are changed by multiple developers? QUESTION: We use Subversion as our source control system and store the VisualStudio project files (vcproj) in the source control system as is normal I think. With Subversion we don't use any form of file locking, so if t...
[ "visual-studio", "svn", "merge" ]
8
4
3,139
7
0
2008-10-03T13:18:24.987000
2008-10-03T13:22:44.213000
166,823
167,163
Java: Newbie-ish inheritance question
Suppose I have a base class B, and a derived class D. I wish to have a method foo() within my base class that returns a new object of whatever type the instance is. So, for example, if I call B.foo() it returns an object of type B, while if I call D.foo() it returns an object of type D; meanwhile, the implementation re...
Don't. Make the "foo" method abstract. abstract class B { public abstract B foo(); } Or receive an abstract factory through the base class constructor: abstract class B { private final BFactory factory; protected B(BFactory factory) { this.factory = factory; } public B foo() { return factory.create(); } } interface BFa...
Java: Newbie-ish inheritance question Suppose I have a base class B, and a derived class D. I wish to have a method foo() within my base class that returns a new object of whatever type the instance is. So, for example, if I call B.foo() it returns an object of type B, while if I call D.foo() it returns an object of ty...
TITLE: Java: Newbie-ish inheritance question QUESTION: Suppose I have a base class B, and a derived class D. I wish to have a method foo() within my base class that returns a new object of whatever type the instance is. So, for example, if I call B.foo() it returns an object of type B, while if I call D.foo() it retur...
[ "java", "inheritance", "types", "derived-class", "base-class" ]
3
3
507
8
0
2008-10-03T13:24:07.347000
2008-10-03T14:33:13.870000
166,831
166,870
Why is "The referenced component 'X' could not be found." considered a warning?
I wonder, why the hell... did the VS team consider that NOT finding a project reference as a non crucial thing? The referenced component 'X' could not be found. should be considered an error... and nothing else. Is there a way (without turning 'Treat all warnings as errors' on) to get this warning as an error in VS2008...
That warning comes from the project system, not the compiler. The project system doesn't know whether or not the reference will actually be needed when the code is compiled. I've run into several cases (all involving multiple platforms and conditional compilation) where this features allows you to maintain a single pro...
Why is "The referenced component 'X' could not be found." considered a warning? I wonder, why the hell... did the VS team consider that NOT finding a project reference as a non crucial thing? The referenced component 'X' could not be found. should be considered an error... and nothing else. Is there a way (without turn...
TITLE: Why is "The referenced component 'X' could not be found." considered a warning? QUESTION: I wonder, why the hell... did the VS team consider that NOT finding a project reference as a non crucial thing? The referenced component 'X' could not be found. should be considered an error... and nothing else. Is there a...
[ "visual-studio-2008", "reference", "warnings" ]
0
3
4,717
3
0
2008-10-03T13:26:09.793000
2008-10-03T13:32:53.740000
166,836
166,929
Separating Demo data in Live system
If we put aside the rights and wrongs of putting demo data into a live system for a minute (that's a whole separate discussion!), we are being asked to store some demo data in our live system so that it can be credibly demonstrated without the appearance of smoke + mirrors (we want to use the same login page for exampl...
FWIW, we're looking at using Oracle's row level security / virtual private database feature to seperate the demo data from the rest.
Separating Demo data in Live system If we put aside the rights and wrongs of putting demo data into a live system for a minute (that's a whole separate discussion!), we are being asked to store some demo data in our live system so that it can be credibly demonstrated without the appearance of smoke + mirrors (we want t...
TITLE: Separating Demo data in Live system QUESTION: If we put aside the rights and wrongs of putting demo data into a live system for a minute (that's a whole separate discussion!), we are being asked to store some demo data in our live system so that it can be credibly demonstrated without the appearance of smoke + ...
[ "oracle" ]
1
1
258
4
0
2008-10-03T13:26:44.080000
2008-10-03T13:42:21.677000
166,841
166,853
XML add <a> hyperlink
I have a xml blob that's checked against a schema in sql 2005. My website uses xsl to transform and display the blob. How do I add a hyperlink to the xml (in any node) without the sql 2005 schema complaining a node was found in the wrong place? Or the xsl thinking that the hyperlink is a valid xml node? thank you
I'm guessing you aren't encoding the < and > characters correctly. You need to use < and >
XML add <a> hyperlink I have a xml blob that's checked against a schema in sql 2005. My website uses xsl to transform and display the blob. How do I add a hyperlink to the xml (in any node) without the sql 2005 schema complaining a node was found in the wrong place? Or the xsl thinking that the hyperlink is a valid xml...
TITLE: XML add <a> hyperlink QUESTION: I have a xml blob that's checked against a schema in sql 2005. My website uses xsl to transform and display the blob. How do I add a hyperlink to the xml (in any node) without the sql 2005 schema complaining a node was found in the wrong place? Or the xsl thinking that the hyperl...
[ "sql-server", "xml", "sql-server-2005", "schema", "hyperlink" ]
0
2
5,588
2
0
2008-10-03T13:28:37.820000
2008-10-03T13:30:57.893000
166,843
166,874
Architecture for easy update of application
I have a system in place which applies calculations to a set of numbers (the specifics aren't really relevant). There are a number of sets of calculations which can be applied by the system users and new sets are added frequently. Currently when a new set of calculations need to be added to the system they are added in...
Since you're redoing it in.Net, just put the calculations in plugins. Use reflection to load and examine these assemblies at runtime and present the user with functions. Divil has a good (but fairly old now) article on writing plugin based applications. It will help you out: http://divil.co.uk/net/articles/plugins/plug...
Architecture for easy update of application I have a system in place which applies calculations to a set of numbers (the specifics aren't really relevant). There are a number of sets of calculations which can be applied by the system users and new sets are added frequently. Currently when a new set of calculations need...
TITLE: Architecture for easy update of application QUESTION: I have a system in place which applies calculations to a set of numbers (the specifics aren't really relevant). There are a number of sets of calculations which can be applied by the system users and new sets are added frequently. Currently when a new set of...
[ "vb.net", "architecture", "vb6" ]
1
3
435
2
0
2008-10-03T13:28:58.647000
2008-10-03T13:33:32.443000
166,844
166,951
How to wait on another process's status in .NET?
I'm working on an integration testing project in.NET. The testing framework executable starts a service and then needs to wait for the service to complete an operation. What is the best approach for the exe to wait on the service to complete its task (the service itself will not exit upon task completion)? Both process...
You can pass a Semaphore name to the service on the command line (or via some other mechanism, like hard coding ), and then wait on the service to Release() it, by calling WaitOne() in your exe. App code: Semaphore s = new Semaphore(1, 1, "MyNamedSemaphore"); // start service, passing the string "MyNamedSemaphore" s.Wa...
How to wait on another process's status in .NET? I'm working on an integration testing project in.NET. The testing framework executable starts a service and then needs to wait for the service to complete an operation. What is the best approach for the exe to wait on the service to complete its task (the service itself ...
TITLE: How to wait on another process's status in .NET? QUESTION: I'm working on an integration testing project in.NET. The testing framework executable starts a service and then needs to wait for the service to complete an operation. What is the best approach for the exe to wait on the service to complete its task (t...
[ ".net", "synchronization", "process" ]
3
5
893
4
0
2008-10-03T13:29:24.870000
2008-10-03T13:45:55.680000
166,855
167,296
C# preg_replace?
What is the PHP preg_replace in C#? I have an array of string that I would like to replace by an other array of string. Here is an example in PHP. How can I do something like that in C# without using.Replace("old","new"). $patterns[0] = '/=C0/'; $patterns[1] = '/=E9/'; $patterns[2] = '/=C9/'; $replacements[0] = 'à'; $...
public static class StringManipulation { public static string PregReplace(string input, string[] pattern, string[] replacements) { if (replacements.Length!= pattern.Length) throw new ArgumentException("Replacement and Pattern Arrays must be balanced"); for (int i = 0; i < pattern.Length; i++) { input = Regex.Replace(i...
C# preg_replace? What is the PHP preg_replace in C#? I have an array of string that I would like to replace by an other array of string. Here is an example in PHP. How can I do something like that in C# without using.Replace("old","new"). $patterns[0] = '/=C0/'; $patterns[1] = '/=E9/'; $patterns[2] = '/=C9/'; $replace...
TITLE: C# preg_replace? QUESTION: What is the PHP preg_replace in C#? I have an array of string that I would like to replace by an other array of string. Here is an example in PHP. How can I do something like that in C# without using.Replace("old","new"). $patterns[0] = '/=C0/'; $patterns[1] = '/=E9/'; $patterns[2] = ...
[ "c#", ".net", ".net-2.0", "preg-replace" ]
2
3
11,682
5
0
2008-10-03T13:30:59.127000
2008-10-03T15:00:10.773000
166,876
166,886
Best place to put application data?
Possible Duplicate: VS2008 Setup Project: Shared (By All Users) Application Data Files? Please can someone advice what is the best place (path) to put some application data which should be accessible and editable by all users. This is considering both Windows XP and Windows Vista and i expect that change in any file of...
VS2008 Setup Project: Shared (By All Users) Application Data Files?
Best place to put application data? Possible Duplicate: VS2008 Setup Project: Shared (By All Users) Application Data Files? Please can someone advice what is the best place (path) to put some application data which should be accessible and editable by all users. This is considering both Windows XP and Windows Vista and...
TITLE: Best place to put application data? QUESTION: Possible Duplicate: VS2008 Setup Project: Shared (By All Users) Application Data Files? Please can someone advice what is the best place (path) to put some application data which should be accessible and editable by all users. This is considering both Windows XP and...
[ "windows", "windows-vista", "windows-xp", "filesystems" ]
7
2
4,263
10
0
2008-10-03T13:33:49.917000
2008-10-03T13:36:15.590000
166,884
166,907
Array versus linked-list
Why would someone want to use a linked-list over an array? Coding a linked-list is, no doubt, a bit more work than using an array and one may wonder what would justify the additional effort. I think insertion of new elements is trivial in a linked-list but it's a major chore in an array. Are there other advantages to u...
It's easier to store data of different sizes in a linked list. An array assumes every element is exactly the same size. As you mentioned, it's easier for a linked list to grow organically. An array's size needs to be known ahead of time, or re-created when it needs to grow. Shuffling a linked list is just a matter of c...
Array versus linked-list Why would someone want to use a linked-list over an array? Coding a linked-list is, no doubt, a bit more work than using an array and one may wonder what would justify the additional effort. I think insertion of new elements is trivial in a linked-list but it's a major chore in an array. Are th...
TITLE: Array versus linked-list QUESTION: Why would someone want to use a linked-list over an array? Coding a linked-list is, no doubt, a bit more work than using an array and one may wonder what would justify the additional effort. I think insertion of new elements is trivial in a linked-list but it's a major chore i...
[ "arrays", "data-structures", "linked-list", "language-agnostic" ]
218
154
251,214
34
0
2008-10-03T13:35:53.110000
2008-10-03T13:40:05.723000
166,895
167,284
Different dependencies for different build profiles
Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles? e.g. mvn -P debug mvn -P release I'd like to pick up a different dependency jar file in one profile that has the same class names and different implementations of the same interfaces.
To quote the Maven documentation on this: A profile element contains both an optional activation (a profile trigger) and the set of changes to be made to the POM if that profile has been activated. For example, a project built for a test environment may point to a different database than that of the final deployment. O...
Different dependencies for different build profiles Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles? e.g. mvn -P debug mvn -P release I'd like to pick up a different dependency jar file in one profile that has the same class names and different implementations of th...
TITLE: Different dependencies for different build profiles QUESTION: Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles? e.g. mvn -P debug mvn -P release I'd like to pick up a different dependency jar file in one profile that has the same class names and different imp...
[ "java", "maven-2", "build-process", "dependencies" ]
144
209
110,899
2
0
2008-10-03T13:37:42.920000
2008-10-03T14:57:41.277000
166,897
168,092
Formatting a double in JSF
I have a problem similar to the one found here: JSF selectItem label formatting. What I want to do is to accept a double as a value for my and display it with two decimals. Can this be done in an easy way? I've tried using but that seems to be applied on the value from the inputText that is sent to the server and not o...
If I'm not misunderstanding your requirement, I was able to achieve formatting of the value in the input box during the rendering of the view with: I was using the Standard Faces Components in my vendor-branded Eclipse so I'm assuming the pattern attribute is part of standard JSF.
Formatting a double in JSF I have a problem similar to the one found here: JSF selectItem label formatting. What I want to do is to accept a double as a value for my and display it with two decimals. Can this be done in an easy way? I've tried using but that seems to be applied on the value from the inputText that is s...
TITLE: Formatting a double in JSF QUESTION: I have a problem similar to the one found here: JSF selectItem label formatting. What I want to do is to accept a double as a value for my and display it with two decimals. Can this be done in an easy way? I've tried using but that seems to be applied on the value from the i...
[ "jsf", "formatting", "decimal" ]
11
15
36,845
3
0
2008-10-03T13:37:52.873000
2008-10-03T17:53:15.290000
166,941
168,964
How to get Selenium working with PHP/Firefox3 on Linux
I am trying to get Selenium RC working with Firefox 3 on Linux with PHP/Apache but am experiencing problems. Here's what I've done: I have installed the Firefox Selenium-IDE extension. On the web server (which in my case is actually the same machine running Firefox), I've started the Selenium server with: java -jar sel...
I'm not sure of the etiquette of answering your own question... but having experimented in a trial-and-error way, here's how I've managed to get Selenium working with PHP/Firefox3 on Ubuntu. I downloaded RC and copied the php client directory to /usr/share/php as 'Selenium' I navigated to the Selenium Server directory ...
How to get Selenium working with PHP/Firefox3 on Linux I am trying to get Selenium RC working with Firefox 3 on Linux with PHP/Apache but am experiencing problems. Here's what I've done: I have installed the Firefox Selenium-IDE extension. On the web server (which in my case is actually the same machine running Firefox...
TITLE: How to get Selenium working with PHP/Firefox3 on Linux QUESTION: I am trying to get Selenium RC working with Firefox 3 on Linux with PHP/Apache but am experiencing problems. Here's what I've done: I have installed the Firefox Selenium-IDE extension. On the web server (which in my case is actually the same machi...
[ "php", "testing", "selenium", "firefox-3" ]
6
12
14,625
2
0
2008-10-03T13:44:24.687000
2008-10-03T21:24:12.293000
166,944
167,200
Calling Python in PHP
I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac. I don't want to go through the minor trouble of installing mod_python or mod_wsgi on my Mac, so I was just going to do a system() or popen() from PHP ...
Depending on what you are doing, system() or popen() may be perfect. Use system() if the Python script has no output, or if you want the Python script's output to go directly to the browser. Use popen() if you want to write data to the Python script's standard input, or read data from the Python script's standard outpu...
Calling Python in PHP I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac. I don't want to go through the minor trouble of installing mod_python or mod_wsgi on my Mac, so I was just going to do a system(...
TITLE: Calling Python in PHP QUESTION: I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac. I don't want to go through the minor trouble of installing mod_python or mod_wsgi on my Mac, so I was just goi...
[ "php", "python" ]
88
113
192,762
10
0
2008-10-03T13:44:41.003000
2008-10-03T14:40:12.107000
166,962
167,513
Release COM Components
Is it really necessary to release COM components from Office PIA, when you don't need them anymore by invoking Marshal.ReleaseComObject(..)? I found various and contradictory advices on this topic on the web. In my opinion, since Outlook PIA is always returning a new references to its interfaces as returning values fro...
With Microsoft Office, in general, you do need to explicitly release your references, which can be safely done in two stages: (1) First release all the minor object to which you do not hold a named object variable via a call to GC.Collect() and then GC.WaitForPendingFinalizers(). (You need to call this twice, if the ob...
Release COM Components Is it really necessary to release COM components from Office PIA, when you don't need them anymore by invoking Marshal.ReleaseComObject(..)? I found various and contradictory advices on this topic on the web. In my opinion, since Outlook PIA is always returning a new references to its interfaces ...
TITLE: Release COM Components QUESTION: Is it really necessary to release COM components from Office PIA, when you don't need them anymore by invoking Marshal.ReleaseComObject(..)? I found various and contradictory advices on this topic on the web. In my opinion, since Outlook PIA is always returning a new references ...
[ "c#", ".net", "outlook", "add-in", "pia" ]
5
2
2,327
8
0
2008-10-03T13:48:27.970000
2008-10-03T15:47:16.700000
166,987
168,671
How did you choose your Visual Studio productivity addon?
I'm evaluating Visual Studio productivity addons for my development team, which includes some folks who are very new to C# and some folks who are very experienced. We don't use VB.NET. I personally like ReSharper, but before I suggest something that I personally like, I would like some opinions for and reasoning behind...
I downloaded both resharper and coderush trials. Initially I liked coderush a bit better. It seems a bit more polished and a bit more stable. But eventually I did go with resharper. Mainly because of the unit testing integration. I don't really see why you have to choose for your development team though. In my last com...
How did you choose your Visual Studio productivity addon? I'm evaluating Visual Studio productivity addons for my development team, which includes some folks who are very new to C# and some folks who are very experienced. We don't use VB.NET. I personally like ReSharper, but before I suggest something that I personally...
TITLE: How did you choose your Visual Studio productivity addon? QUESTION: I'm evaluating Visual Studio productivity addons for my development team, which includes some folks who are very new to C# and some folks who are very experienced. We don't use VB.NET. I personally like ReSharper, but before I suggest something...
[ "visual-studio", "code-analysis", "add-on" ]
4
3
2,271
8
0
2008-10-03T13:52:40.377000
2008-10-03T20:12:19.830000
167,002
6,201,971
Perforce repository monitor for Windows
I used to work with Subversion and a system tray tool ( SVN Notifier ) to monitor the repository so I would immediately see when my local copy was not up-to-date anymore, and I am wondering if some equivalent was available for Perforce (on Windows).
If you use the Perforce GUI client, you can setup email notifications for as many folders as you like by going to: Connection > Edit Current User... > Reviews tab Right click each of the locations you're interested in tracking and click "Include Tree" Click OK This assumes the review daemon has already been setup on th...
Perforce repository monitor for Windows I used to work with Subversion and a system tray tool ( SVN Notifier ) to monitor the repository so I would immediately see when my local copy was not up-to-date anymore, and I am wondering if some equivalent was available for Perforce (on Windows).
TITLE: Perforce repository monitor for Windows QUESTION: I used to work with Subversion and a system tray tool ( SVN Notifier ) to monitor the repository so I would immediately see when my local copy was not up-to-date anymore, and I am wondering if some equivalent was available for Perforce (on Windows). ANSWER: If ...
[ "perforce" ]
1
1
765
3
0
2008-10-03T13:56:34.787000
2011-06-01T13:31:15.120000
167,003
167,047
Need a regular expression to match three character strings
I generally stay away from regular expressions because I seldom find a good use for them. But in this case, I don't think I have choice. I need a regex for the following situation. I will be looking at three character strings. It will be a match if the first character is 1-9 or the letters o,n,d (lower or upper) AND th...
Slight variation on a few other answers. Restrict the input to be exactly the matched text. ^[1-9ondOND][123][0-9]$
Need a regular expression to match three character strings I generally stay away from regular expressions because I seldom find a good use for them. But in this case, I don't think I have choice. I need a regex for the following situation. I will be looking at three character strings. It will be a match if the first ch...
TITLE: Need a regular expression to match three character strings QUESTION: I generally stay away from regular expressions because I seldom find a good use for them. But in this case, I don't think I have choice. I need a regex for the following situation. I will be looking at three character strings. It will be a mat...
[ "regex" ]
1
9
9,586
6
0
2008-10-03T13:56:51.853000
2008-10-03T14:06:20.040000
167,004
640,880
Using nmake with wildcards in the makefile
I am attempting to set up an nmake makefile to export our balsamiq mockup files to png files automatically, but I'm afraid I can't make heads nor tails of how to make a generic rule for doing so, without explicitly listing all the files I want exported. This page details the command line syntax for exporting the files,...
NMAKE pattern rules are a lot like GNU make old-school suffix rules. In your case, you had it almost right to begin with, but you were missing the.SUFFIXES declaration. For example:.SUFFIXES:.bmml.png.bmml.png: @echo Building $@ from $< I think this is only part of your solution though, because you also mentioned wanti...
Using nmake with wildcards in the makefile I am attempting to set up an nmake makefile to export our balsamiq mockup files to png files automatically, but I'm afraid I can't make heads nor tails of how to make a generic rule for doing so, without explicitly listing all the files I want exported. This page details the c...
TITLE: Using nmake with wildcards in the makefile QUESTION: I am attempting to set up an nmake makefile to export our balsamiq mockup files to png files automatically, but I'm afraid I can't make heads nor tails of how to make a generic rule for doing so, without explicitly listing all the files I want exported. This ...
[ "png", "export", "nmake", "balsamiq" ]
11
19
9,624
2
0
2008-10-03T13:57:41.537000
2009-03-12T23:28:41.067000
167,007
167,030
Fast compiler error messages in Eclipse
As a new Eclipse user, I am constantly annoyed by how long it takes compiler error messages to display. This is mostly only a problem for long errors that don't fit in the status bar or the "Problems" tab. But I get enough long errors in Java—especially with generics—that this is a nagging issue. (Note: The correct ans...
Well, you can press F2 to display the popup that normally shows javadoc. If there's an error, it will display the error message with available quick fixes. So you can do Ctrl+., F2 repeatedly to achieve what you want.
Fast compiler error messages in Eclipse As a new Eclipse user, I am constantly annoyed by how long it takes compiler error messages to display. This is mostly only a problem for long errors that don't fit in the status bar or the "Problems" tab. But I get enough long errors in Java—especially with generics—that this is...
TITLE: Fast compiler error messages in Eclipse QUESTION: As a new Eclipse user, I am constantly annoyed by how long it takes compiler error messages to display. This is mostly only a problem for long errors that don't fit in the status bar or the "Problems" tab. But I get enough long errors in Java—especially with gen...
[ "java", "eclipse", "ide" ]
3
3
1,375
3
0
2008-10-03T13:58:15.670000
2008-10-03T14:02:04.900000
167,014
167,062
Best practice for creating subversion repositories?
Our team (5-10 developers) plans to adopt Subversion for our.NET (Visual Studio) projects/solutions (VisualSVN Server, TortoiseSVN / VisualSVN). What is the best way to organize a new repository tree? Is it okay to use one big repository or is it better to create different repositories for every solution / product line...
Generally, you want to use a separate repository in any case where you are expecting different access permissions (i.e. some developers should have commit access to one project, but not another, or one project has a public read-only anonymous interface but another doesn't). You want everything in one repository if you ...
Best practice for creating subversion repositories? Our team (5-10 developers) plans to adopt Subversion for our.NET (Visual Studio) projects/solutions (VisualSVN Server, TortoiseSVN / VisualSVN). What is the best way to organize a new repository tree? Is it okay to use one big repository or is it better to create diff...
TITLE: Best practice for creating subversion repositories? QUESTION: Our team (5-10 developers) plans to adopt Subversion for our.NET (Visual Studio) projects/solutions (VisualSVN Server, TortoiseSVN / VisualSVN). What is the best way to organize a new repository tree? Is it okay to use one big repository or is it bet...
[ "visual-studio", "svn", "tortoisesvn", "visualsvn-server", "visualsvn" ]
26
12
9,543
8
0
2008-10-03T13:59:01.690000
2008-10-03T14:10:52.137000
167,018
167,036
Should I use threading and recursion together?
I have been tinkering with BSP trees for a while now and am also playing with threads. When adding a triangle to a BSP tree, an opportunity arises to create a new thread for the purposes of processing data in parallel. insert(triangle, bspnode) {.... else if(triangle spans bspnode) { (frontpiece, backpiece) = plane_spl...
Threads are great if some part of the processing is waiting on something external (user input, I/O, some other processing) - the thread that's waiting can continue to wait, while a thread that isn't waiting forges on ahead. However, for processing-intensive tasks, more threads than processors actually creates overhead....
Should I use threading and recursion together? I have been tinkering with BSP trees for a while now and am also playing with threads. When adding a triangle to a BSP tree, an opportunity arises to create a new thread for the purposes of processing data in parallel. insert(triangle, bspnode) {.... else if(triangle spans...
TITLE: Should I use threading and recursion together? QUESTION: I have been tinkering with BSP trees for a while now and am also playing with threads. When adding a triangle to a BSP tree, an opportunity arises to create a new thread for the purposes of processing data in parallel. insert(triangle, bspnode) {.... else...
[ "multithreading", "recursion" ]
10
14
14,928
3
0
2008-10-03T13:59:28.790000
2008-10-03T14:03:01.450000
167,027
167,037
How do you right-justify text in an HTML textbox?
I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me to right-justify the text displayed in a textbox? It would also be nice if when the user is entering data for it to sta...
Did you try setting the style: input { text-align:right; } Just tested, this works fine (in FF3 at least): Blah You'll probably want to throw a class on these inputs, and use that class as the selector. I would shy away from "rightAligned" or something like that. In a class name, you want to describe what the element's...
How do you right-justify text in an HTML textbox? I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me to right-justify the text displayed in a textbox? It would also be ni...
TITLE: How do you right-justify text in an HTML textbox? QUESTION: I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me to right-justify the text displayed in a textbox? I...
[ "html", "css" ]
75
138
134,733
3
0
2008-10-03T14:01:19.160000
2008-10-03T14:03:47.250000
167,067
167,600
MySQL Limit with Many to Many Relationship
Given a SCHEMA for implementing tags ITEM ItemId, ItemContent TAG TagId, TagName ITEM_TAG ItemId, TagId What is the best way to limit the number of ITEMS to return when selecting with tags? SELECT i.ItemContent, t.TagName FROM item i INNER JOIN ItemTag it ON i.id = it.ItemId INNER JOIN tag t ON t.id = it.TagId is of co...
My second solution uses a MySQL function GROUP_CONCAT() to combine all tags matching the item into a comma-separated string in the result set. SELECT i.ItemContent, GROUP_CONCAT(t.TagName ORDER BY t.TagName) AS TagList FROM item AS i INNER JOIN ItemTag AS it ON i.id = it.ItemId INNER JOIN tag AS t ON t.id = it.TagId GR...
MySQL Limit with Many to Many Relationship Given a SCHEMA for implementing tags ITEM ItemId, ItemContent TAG TagId, TagName ITEM_TAG ItemId, TagId What is the best way to limit the number of ITEMS to return when selecting with tags? SELECT i.ItemContent, t.TagName FROM item i INNER JOIN ItemTag it ON i.id = it.ItemId I...
TITLE: MySQL Limit with Many to Many Relationship QUESTION: Given a SCHEMA for implementing tags ITEM ItemId, ItemContent TAG TagId, TagName ITEM_TAG ItemId, TagId What is the best way to limit the number of ITEMS to return when selecting with tags? SELECT i.ItemContent, t.TagName FROM item i INNER JOIN ItemTag it ON ...
[ "mysql", "database", "tags", "tagging" ]
2
5
1,449
4
0
2008-10-03T14:12:38.217000
2008-10-03T16:03:57.587000
167,074
179,678
Do MembershipProviders in ASP.net MVC affect stylesheet links?
I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to the one generated by a new project with the exception of the name and timeout attr...
Thanks Ian Oxley. The problem wasn't solved with the ResolveClientUrl though. It had to deal with the web.config file. I had code that looked like this: I added a location element below the main one and said that anybody could view that content, and it works now. It turns out that files like the CSS file were not viewa...
Do MembershipProviders in ASP.net MVC affect stylesheet links? I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to the one generated b...
TITLE: Do MembershipProviders in ASP.net MVC affect stylesheet links? QUESTION: I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to t...
[ "css", "asp.net-mvc", "href", "membership-provider" ]
0
0
613
2
0
2008-10-03T14:15:16.933000
2008-10-07T18:08:28.003000
167,079
167,100
Moving existing code to Test Driven Development
Having recently discovered this method of development, I'm finding it a rather nice methodology. So, for my first project, I have a small DLL's worth of code (in C#.NET, for what it's worth), and I want to make a set of tests for this code, but I am a bit lost as to how and where to start. I'm using NUnit, and VS 2008,...
See the book Working Effectively with Legacy Code by Michael Feathers. In summary, it's a lot of work to refactor existing code into testable and tested code; Sometimes it's too much work to be practical. It depends on how large the codebase is, and how much the various classes and functions depend upon each other. Ref...
Moving existing code to Test Driven Development Having recently discovered this method of development, I'm finding it a rather nice methodology. So, for my first project, I have a small DLL's worth of code (in C#.NET, for what it's worth), and I want to make a set of tests for this code, but I am a bit lost as to how a...
TITLE: Moving existing code to Test Driven Development QUESTION: Having recently discovered this method of development, I'm finding it a rather nice methodology. So, for my first project, I have a small DLL's worth of code (in C#.NET, for what it's worth), and I want to make a set of tests for this code, but I am a bi...
[ "c#", "tdd", "nunit" ]
37
58
16,942
5
0
2008-10-03T14:16:04.713000
2008-10-03T14:20:45.157000
167,084
167,102
Detecting Graphic Options in .NET
What is the the best of detecting and later altering the screen resolution and multiple desktop within.net I have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and set the application to that (main objective) and adj...
I would never suggest altering a user's resolution unless you're doing something like a full-screen game, you can use System.Windows.Forms.Screen.PrimaryScreen to give you metrics about that main monitor.
Detecting Graphic Options in .NET What is the the best of detecting and later altering the screen resolution and multiple desktop within.net I have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and set the applicatio...
TITLE: Detecting Graphic Options in .NET QUESTION: What is the the best of detecting and later altering the screen resolution and multiple desktop within.net I have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and ...
[ ".net", "vb.net", "multiple-monitors" ]
0
2
317
2
0
2008-10-03T14:16:54.247000
2008-10-03T14:20:55.047000
167,096
167,105
Is the order of objects returned by FOREACH stable?
Is it safe to assume that two itterations over the same collection will return the objects in the same order? Obviously, it is assumed that the collection has not otherwise been changed.
Short answer - yes. Obviously, though, the order of the items in the collection may not be exactly as they were inserted, depending on the type of collection (a dictionary, for example). But you will get the same results each time you iterate over a single, unmodified collection using a foreach loop.
Is the order of objects returned by FOREACH stable? Is it safe to assume that two itterations over the same collection will return the objects in the same order? Obviously, it is assumed that the collection has not otherwise been changed.
TITLE: Is the order of objects returned by FOREACH stable? QUESTION: Is it safe to assume that two itterations over the same collection will return the objects in the same order? Obviously, it is assumed that the collection has not otherwise been changed. ANSWER: Short answer - yes. Obviously, though, the order of th...
[ "c#", ".net", "collections", "foreach", "ienumerable" ]
19
16
8,618
8
0
2008-10-03T14:19:41.137000
2008-10-03T14:21:27.217000
167,106
167,115
How do I limit which countries can view my website ( PHP )
In there an easy way to do this in PHP. I want to make sure that only web requests from certain countries are able to access my website. Any ideas?
Use an IP geolocation database (some are free) and $_SERVER["REMOTE_ADDR"] to get the visitor's IP address. http://www.maxmind.com/app/geolitecity is a free (less accurate) version of a commercial one.
How do I limit which countries can view my website ( PHP ) In there an easy way to do this in PHP. I want to make sure that only web requests from certain countries are able to access my website. Any ideas?
TITLE: How do I limit which countries can view my website ( PHP ) QUESTION: In there an easy way to do this in PHP. I want to make sure that only web requests from certain countries are able to access my website. Any ideas? ANSWER: Use an IP geolocation database (some are free) and $_SERVER["REMOTE_ADDR"] to get the ...
[ "php", "geolocation" ]
11
13
18,607
6
0
2008-10-03T14:21:37.903000
2008-10-03T14:24:04.323000
167,120
167,134
Removing a subset of a dict from within a list
This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this: a = {1:'', 2:'', 3:'', 4:''} exclusion = [3, 4, 5] # have to build up a new list or the iteration breaks toRemove = [] for var in a.iterkeys(): if var in exclusion: toRemove...
Consider dict.pop: for key in exclusion: a.pop(key, None) The None keeps pop from raising an exception when key isn't a key.
Removing a subset of a dict from within a list This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this: a = {1:'', 2:'', 3:'', 4:''} exclusion = [3, 4, 5] # have to build up a new list or the iteration breaks toRemove = [] for var...
TITLE: Removing a subset of a dict from within a list QUESTION: This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this: a = {1:'', 2:'', 3:'', 4:''} exclusion = [3, 4, 5] # have to build up a new list or the iteration breaks toR...
[ "python", "list", "containers" ]
7
15
3,034
4
0
2008-10-03T14:24:35.383000
2008-10-03T14:28:29.043000
167,129
167,178
C# - IEnumerable to delimited string
What is the functional programming approach to convert an IEnumerable to a delimited string? I know I can use a loop, but I'm trying to wrap my head around functional programming. Here's my example: var selectedValues = from ListItem item in checkboxList.Items where item.Selected select item.Value; var delimitedString...
var delimitedString = selectedValues.Aggregate((x,y) => x + ", " + y);
C# - IEnumerable to delimited string What is the functional programming approach to convert an IEnumerable to a delimited string? I know I can use a loop, but I'm trying to wrap my head around functional programming. Here's my example: var selectedValues = from ListItem item in checkboxList.Items where item.Selected se...
TITLE: C# - IEnumerable to delimited string QUESTION: What is the functional programming approach to convert an IEnumerable to a delimited string? I know I can use a loop, but I'm trying to wrap my head around functional programming. Here's my example: var selectedValues = from ListItem item in checkboxList.Items wher...
[ "c#", "functional-programming" ]
21
20
14,833
8
0
2008-10-03T14:26:49.873000
2008-10-03T14:36:39.010000
167,131
168,878
How to properly use Struts ActionForms, Value Objects, and Entities?
I've inherited a large Java app that uses Struts, Spring, and Hibernate. The classes and interfaces I deal with daily are: Struts Actions, Struts ActionForms, Value Objects, Service Interfaces and Implementations, DAO Interfaces and Implementations, and Entities. I'm pretty clear on the how and why of most of these, ex...
1. Considering the DAO - VO transformation; whether this is usefull depends on how Hibernate is used. If the entire Web request handling is in a single Hibernate session you should not really need separate VO's. If, however, your DAO layer opens a session to retrieve an object and closes the session before you are fini...
How to properly use Struts ActionForms, Value Objects, and Entities? I've inherited a large Java app that uses Struts, Spring, and Hibernate. The classes and interfaces I deal with daily are: Struts Actions, Struts ActionForms, Value Objects, Service Interfaces and Implementations, DAO Interfaces and Implementations, a...
TITLE: How to properly use Struts ActionForms, Value Objects, and Entities? QUESTION: I've inherited a large Java app that uses Struts, Spring, and Hibernate. The classes and interfaces I deal with daily are: Struts Actions, Struts ActionForms, Value Objects, Service Interfaces and Implementations, DAO Interfaces and ...
[ "java", "design-patterns", "architecture", "oop" ]
3
3
5,725
3
0
2008-10-03T14:27:07.157000
2008-10-03T20:58:03.513000
167,152
167,290
Avoiding code change with Microsoft SQLServer and Unicode
How can you get MSSQL server to accept Unicode data by default into a VARCHAR or NVARCHAR column? I know that you can do it by placing a N in front of the string to be placed in the field but to by quite honest this seems a bit archaic in 2008 and particuarily with using SQL Server 2005.
The N syntax is how you specify a unicode string literal in SQL Server. N'Unicode string' 'ANSI string' SQL Server will auto convert between the two when possible, using either a column's collation or the database's collation. So if your string literals don't actually contain unicode characters, you do not need to spec...
Avoiding code change with Microsoft SQLServer and Unicode How can you get MSSQL server to accept Unicode data by default into a VARCHAR or NVARCHAR column? I know that you can do it by placing a N in front of the string to be placed in the field but to by quite honest this seems a bit archaic in 2008 and particuarily w...
TITLE: Avoiding code change with Microsoft SQLServer and Unicode QUESTION: How can you get MSSQL server to accept Unicode data by default into a VARCHAR or NVARCHAR column? I know that you can do it by placing a N in front of the string to be placed in the field but to by quite honest this seems a bit archaic in 2008 ...
[ "sql-server", "unicode", "data-migration" ]
1
4
3,043
4
0
2008-10-03T14:31:38.553000
2008-10-03T14:59:13.397000
167,154
167,218
Logic: Database or Application/2 (constraints check)
This is a specific version of this question. I want to check if I am inserting a duplicate row. Should I check it programmatically in my application layer: if (exists(obj)) { throw new DuplicateObjectException(); } HibernateSessionFactory.getSession().save(obj); or should I catch the exception thrown by the database la...
First, you must have a primary key or unique constraint on the database to enforce this uniqueness properly - no question. Given that the constraint exists, which way should you code in the application? My preference would be to try the insert and catch the exceptions. Because presumably most inserts will succeed, only...
Logic: Database or Application/2 (constraints check) This is a specific version of this question. I want to check if I am inserting a duplicate row. Should I check it programmatically in my application layer: if (exists(obj)) { throw new DuplicateObjectException(); } HibernateSessionFactory.getSession().save(obj); or s...
TITLE: Logic: Database or Application/2 (constraints check) QUESTION: This is a specific version of this question. I want to check if I am inserting a duplicate row. Should I check it programmatically in my application layer: if (exists(obj)) { throw new DuplicateObjectException(); } HibernateSessionFactory.getSession...
[ "database", "business-logic-layer" ]
9
8
1,394
7
0
2008-10-03T14:31:45.870000
2008-10-03T14:44:03.380000
167,159
167,253
How to copy files from one code project to another
I have multiple branches of a project checked out, each under their own directory (pretty standard). src/branch1/some/code/directories src/branch2/some/code/directories I often find myself wanting to copy selected files from one branch to another. An example would be copying cvsignore files, or intellij module files. T...
Use "cp -r --parents" command like this, in branch1 directory find. -name ".cvsignore" -exec cp -r --parents {}../branch2/ \; OR When in the src/ directory, run this script. You can get the variables from command line parameters if you want. SOURCE="branch1/" TARGET="branch2/" PATTERN=".cvsignore" find $SOURCE -name $...
How to copy files from one code project to another I have multiple branches of a project checked out, each under their own directory (pretty standard). src/branch1/some/code/directories src/branch2/some/code/directories I often find myself wanting to copy selected files from one branch to another. An example would be c...
TITLE: How to copy files from one code project to another QUESTION: I have multiple branches of a project checked out, each under their own directory (pretty standard). src/branch1/some/code/directories src/branch2/some/code/directories I often find myself wanting to copy selected files from one branch to another. An ...
[ "macos", "unix" ]
0
1
455
1
0
2008-10-03T14:32:45.507000
2008-10-03T14:51:05.563000
167,193
218,612
JPA and 2 simple tables
I have 2 tables: A s_id(key) name cli type B sa_id(key) s_id user pwd So in Jpa I have: @Entity class A...{ @OneToMany(fetch=FetchType.EAGER) @JoinTable( name="A_B", joinColumns={@JoinColumn(name="a_id", table="a",unique=false)}, inverseJoinColumns={@JoinColumn(name="b_id", table="b", unique=true)} ) Collection getB()...
You do not need a JoinTable for this. If the class B has no reference to class A then the following will suffice @Entity class A...{ @OneToMany(fetch=FetchType.EAGER) Collection getB(){...} } In most cases though you may want a bidirectional relationship in which case B has a reference to A. In that case you will need ...
JPA and 2 simple tables I have 2 tables: A s_id(key) name cli type B sa_id(key) s_id user pwd So in Jpa I have: @Entity class A...{ @OneToMany(fetch=FetchType.EAGER) @JoinTable( name="A_B", joinColumns={@JoinColumn(name="a_id", table="a",unique=false)}, inverseJoinColumns={@JoinColumn(name="b_id", table="b", unique=tr...
TITLE: JPA and 2 simple tables QUESTION: I have 2 tables: A s_id(key) name cli type B sa_id(key) s_id user pwd So in Jpa I have: @Entity class A...{ @OneToMany(fetch=FetchType.EAGER) @JoinTable( name="A_B", joinColumns={@JoinColumn(name="a_id", table="a",unique=false)}, inverseJoinColumns={@JoinColumn(name="b_id", ta...
[ "database", "jpa" ]
2
1
836
3
0
2008-10-03T14:39:10.457000
2008-10-20T14:21:06.727000
167,224
167,255
How to obtain the sign of a Number in ActionScript 3.0?
I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this: var sign = Math.abs(n) / n; But, there is any other way? Better than this?
You'll be in trouble if n == 0... how about this: var sign = n < 0? -1: 1;
How to obtain the sign of a Number in ActionScript 3.0? I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this: var sign = Math.abs(n) / n; But, there is any other way? Better than this?
TITLE: How to obtain the sign of a Number in ActionScript 3.0? QUESTION: I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this: var sign = Math.abs(n) / n; But, there is any other way? Better than this? ANSWER: You'll be in trouble i...
[ "flash", "actionscript-3" ]
4
13
5,562
7
0
2008-10-03T14:44:54.970000
2008-10-03T14:51:52.223000
167,232
168,362
Changing the application pool through a Web Deployment Project
Is there a way to configure a Visual Studio 2005 Web Deployment Project to install an application into a named Application Pool rather than the default app pool for a given web site?
There is a good article describing custom actions here: ScottGu's Blog The question you asked is answered about halfway through the comments by 'Ryan', unfortunately it's in VB, but it shouldn't be hard to translate: Private Sub assignApplicationPool(ByVal WebSite As String, ByVal Vdir As String, ByVal appPool As Strin...
Changing the application pool through a Web Deployment Project Is there a way to configure a Visual Studio 2005 Web Deployment Project to install an application into a named Application Pool rather than the default app pool for a given web site?
TITLE: Changing the application pool through a Web Deployment Project QUESTION: Is there a way to configure a Visual Studio 2005 Web Deployment Project to install an application into a named Application Pool rather than the default app pool for a given web site? ANSWER: There is a good article describing custom actio...
[ "c#", "deployment", "windows-installer", "asp.net-2.0" ]
11
12
7,310
2
0
2008-10-03T14:45:45.467000
2008-10-03T18:58:06.363000
167,242
168,015
How can I wrap a transaction around Membership.CreateUser?
I'm using the asp.net SqlMembershipProvider and LinqToSql in a hobby/learning application. I have some user properties that I'm keeping in LinqtoSql, so my flow is: Membership.CreateUser -> MyClass.AddUserDetails. I'd like to wrap the whole thing in a transaction, so if the myclass bit fails I can roll back the members...
The providers don't explicitly support transactions, I asked for this feature some time ago: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=102268 I think if you use the TransactionScope class it should work, though you will have the overhead of an MSDTC-coordinated transaction.
How can I wrap a transaction around Membership.CreateUser? I'm using the asp.net SqlMembershipProvider and LinqToSql in a hobby/learning application. I have some user properties that I'm keeping in LinqtoSql, so my flow is: Membership.CreateUser -> MyClass.AddUserDetails. I'd like to wrap the whole thing in a transacti...
TITLE: How can I wrap a transaction around Membership.CreateUser? QUESTION: I'm using the asp.net SqlMembershipProvider and LinqToSql in a hobby/learning application. I have some user properties that I'm keeping in LinqtoSql, so my flow is: Membership.CreateUser -> MyClass.AddUserDetails. I'd like to wrap the whole th...
[ "linq-to-sql", "asp.net-membership" ]
3
3
1,760
3
0
2008-10-03T14:48:19.407000
2008-10-03T17:35:14.297000
167,247
167,295
Stopping a function from been overridden in Delphi
How do I stop a function/procedure in a superclass from been overridden in a subclass in Delphi (2007)? I want to mark it so it can not be altered, I believe there is a final keyword but can not for the life of me find the documentation for it, so I am not 100% sure that's what I need.
The keyword is final as you thought. See http://dn.codegear.com/article/34324 and http://blogs.teamb.com/rudyvelthuis/2005/05/13/4311. Also you can mark your class as sealed to prevent anyone from inheriting from it. You need a Delphi version higher than 7. type TSomeClass = class protected procedure SomeVirtualMethod;...
Stopping a function from been overridden in Delphi How do I stop a function/procedure in a superclass from been overridden in a subclass in Delphi (2007)? I want to mark it so it can not be altered, I believe there is a final keyword but can not for the life of me find the documentation for it, so I am not 100% sure th...
TITLE: Stopping a function from been overridden in Delphi QUESTION: How do I stop a function/procedure in a superclass from been overridden in a subclass in Delphi (2007)? I want to mark it so it can not be altered, I believe there is a final keyword but can not for the life of me find the documentation for it, so I a...
[ "delphi", "oop", "class" ]
10
19
2,144
2
0
2008-10-03T14:49:10.093000
2008-10-03T14:59:59.010000
167,252
167,375
How can I access a private key with the ASPNET user account?
I'm having some trouble importing and accessing a private key with the ASPNET user. I know that when one imports a private key (.pfx file) manually, in windows, you get an option to mark the key as exportable. Now, as far as I can tell, this is needed in order to retrieve that private key later on. My problem comes in ...
I believe you need to set the X509KeyStorageFlags.Exportable flag when you import the certificate. You don't show that code, but there is an overload of the Import method with this signature: public override void Import(string fileName, string password, X509KeyStorageFlags keyStorageFlags); or this one: public override...
How can I access a private key with the ASPNET user account? I'm having some trouble importing and accessing a private key with the ASPNET user. I know that when one imports a private key (.pfx file) manually, in windows, you get an option to mark the key as exportable. Now, as far as I can tell, this is needed in orde...
TITLE: How can I access a private key with the ASPNET user account? QUESTION: I'm having some trouble importing and accessing a private key with the ASPNET user. I know that when one imports a private key (.pfx file) manually, in windows, you get an option to mark the key as exportable. Now, as far as I can tell, this...
[ "c#", "encryption", "certificate" ]
1
1
1,175
1
0
2008-10-03T14:50:38.547000
2008-10-03T15:17:01.253000
167,254
167,286
Watching a table for change in MySQL?
Is there a better way to watch for new entries in a table besides selecting from it every n ticks of time or something like that? I have a table that an external program updates very often, and clients can watch for this new data as it arrive, how can I make that without having to set a fixed period of repeatable selec...
In MySQL there's no best way than to poll (you create a specific table to simplify the polling though), in other databases you can have triggers that have impact outside the database. In MySQL triggers can only do stuff inside the database itself (for instance, populating the helper table).
Watching a table for change in MySQL? Is there a better way to watch for new entries in a table besides selecting from it every n ticks of time or something like that? I have a table that an external program updates very often, and clients can watch for this new data as it arrive, how can I make that without having to ...
TITLE: Watching a table for change in MySQL? QUESTION: Is there a better way to watch for new entries in a table besides selecting from it every n ticks of time or something like that? I have a table that an external program updates very often, and clients can watch for this new data as it arrive, how can I make that ...
[ "mysql", "database" ]
27
11
26,378
6
0
2008-10-03T14:51:28.730000
2008-10-03T14:58:18.407000
167,262
194,343
How do you make a web application in Clojure?
I suppose this is a strange question to the huge majority of programmers that work daily with Java. I don't. I know Java-the-language, because I worked on Java projects, but not Java-the-world. I never made a web app from scratch in Java. If I have to do it with Python, Ruby, I know where to go (Django or Rails), but i...
By far the best Clojure web framework I have yet encountered is Compojure: http://github.com/weavejester/compojure/tree/master It's small but powerful, and has beautifully elegant syntax. (It uses Jetty under the hood, but it hides the Servlet API from you unless you want it, which won't be often). Go look at the READM...
How do you make a web application in Clojure? I suppose this is a strange question to the huge majority of programmers that work daily with Java. I don't. I know Java-the-language, because I worked on Java projects, but not Java-the-world. I never made a web app from scratch in Java. If I have to do it with Python, Rub...
TITLE: How do you make a web application in Clojure? QUESTION: I suppose this is a strange question to the huge majority of programmers that work daily with Java. I don't. I know Java-the-language, because I worked on Java projects, but not Java-the-world. I never made a web app from scratch in Java. If I have to do i...
[ "clojure" ]
219
105
55,897
16
0
2008-10-03T14:52:58.087000
2008-10-11T17:23:33.680000
167,302
168,246
non-DB attr_accessor attribute persistence in Rails
I have an application in which attr_accessor is being used to keep temporary data for a model which will be passed to a rake task. Seeing there is not a database field for these attributes and they are not being calculated from database data, will the attr_accessor data persist and be available to the rake task? What h...
I assume you are asking whether data that is stored in attributes of ActiveRecord objects stemming from Web requests will be available when accessing them via a Rake task? No. They won't. That data won't even be available to the next web request. That data won't even be there if you load the same record twice. class Th...
non-DB attr_accessor attribute persistence in Rails I have an application in which attr_accessor is being used to keep temporary data for a model which will be passed to a rake task. Seeing there is not a database field for these attributes and they are not being calculated from database data, will the attr_accessor da...
TITLE: non-DB attr_accessor attribute persistence in Rails QUESTION: I have an application in which attr_accessor is being used to keep temporary data for a model which will be passed to a rake task. Seeing there is not a database field for these attributes and they are not being calculated from database data, will th...
[ "ruby-on-rails", "ruby", "activerecord" ]
0
8
5,175
3
0
2008-10-03T15:02:54.730000
2008-10-03T18:33:51.637000
167,304
167,937
Is it possible to Pivot data using LINQ?
I am wondering if it is possible to use LINQ to pivot data from the following layout: CustID | OrderDate | Qty 1 | 1/1/2008 | 100 2 | 1/2/2008 | 200 1 | 2/2/2008 | 350 2 | 2/28/2008 | 221 1 | 3/12/2008 | 250 2 | 3/15/2008 | 2150 into something like this: CustID | Jan- 2008 | Feb- 2008 | Mar - 2008 | 1 | 100 | 350 | 250...
Something like this? List myList = GetCustData(); var query = myList.GroupBy(c => c.CustId).Select(g => new { CustId = g.Key, Jan = g.Where(c => c.OrderDate.Month == 1).Sum(c => c.Qty), Feb = g.Where(c => c.OrderDate.Month == 2).Sum(c => c.Qty), March = g.Where(c => c.OrderDate.Month == 3).Sum(c => c.Qty) }); GroupBy ...
Is it possible to Pivot data using LINQ? I am wondering if it is possible to use LINQ to pivot data from the following layout: CustID | OrderDate | Qty 1 | 1/1/2008 | 100 2 | 1/2/2008 | 200 1 | 2/2/2008 | 350 2 | 2/28/2008 | 221 1 | 3/12/2008 | 250 2 | 3/15/2008 | 2150 into something like this: CustID | Jan- 2008 | Feb...
TITLE: Is it possible to Pivot data using LINQ? QUESTION: I am wondering if it is possible to use LINQ to pivot data from the following layout: CustID | OrderDate | Qty 1 | 1/1/2008 | 100 2 | 1/2/2008 | 200 1 | 2/2/2008 | 350 2 | 2/28/2008 | 221 1 | 3/12/2008 | 250 2 | 3/15/2008 | 2150 into something like this: CustID...
[ "linq", "pivot-table" ]
186
213
95,006
7
0
2008-10-03T15:03:07.833000
2008-10-03T17:18:11.680000
167,306
167,489
validating and adjusting a treeview label
I've got a treeview control, and have caught its after-label-edit event. I want to be able to validate the user's input and adjust it - if for instance it's too long - but I only seem able to cancel the new value, not change it. Any ideas? I don't want to have to open a new form, the user might be renaming a range of t...
Can't you get the node being edited from the EventArgs, and manually set its text? If this causes the AfterLabelEdit to be fired again, then you should add a flag to exit it if it comes from a manual edit.
validating and adjusting a treeview label I've got a treeview control, and have caught its after-label-edit event. I want to be able to validate the user's input and adjust it - if for instance it's too long - but I only seem able to cancel the new value, not change it. Any ideas? I don't want to have to open a new for...
TITLE: validating and adjusting a treeview label QUESTION: I've got a treeview control, and have caught its after-label-edit event. I want to be able to validate the user's input and adjust it - if for instance it's too long - but I only seem able to cancel the new value, not change it. Any ideas? I don't want to have...
[ "c#", "forms", "treeview" ]
1
1
557
1
0
2008-10-03T15:03:27.537000
2008-10-03T15:42:12.293000
167,323
167,377
How to open a form in a thread and force it to stay open
I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed here. In trying to figure this out I wrote the following simple test program. I simply want it to open a form on a separate thread named "UI thread" and keep the thread running as long as the form is open while ...
On a new thread, call Application.Run passing the form object, this will make the thread run its own message loop while the window is open. Then you can call.Join on that thread to make your main thread wait until the UI thread has terminated, or use a similar trick to wait for that thread to complete. Example: public ...
How to open a form in a thread and force it to stay open I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed here. In trying to figure this out I wrote the following simple test program. I simply want it to open a form on a separate thread named "UI thread" and k...
TITLE: How to open a form in a thread and force it to stay open QUESTION: I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed here. In trying to figure this out I wrote the following simple test program. I simply want it to open a form on a separate thread named...
[ ".net", "winforms", "multithreading" ]
8
14
18,122
6
0
2008-10-03T15:07:27.293000
2008-10-03T15:17:11.410000
167,325
167,345
(Vocal code) Need some help finding text-to-speech addon
I am looking for an addon that can say characters vocally. It is for non-commercial use, and it would be nice if it can vocalize more languages, like asian, english etc... I have googled it, but can't seem to find anything for free use. Update: This is for web use
You could try http://espeak.sourceforge.net/ and make an mp3 of the word, then stream it to a flash application (you could use darwin for the streaming).
(Vocal code) Need some help finding text-to-speech addon I am looking for an addon that can say characters vocally. It is for non-commercial use, and it would be nice if it can vocalize more languages, like asian, english etc... I have googled it, but can't seem to find anything for free use. Update: This is for web us...
TITLE: (Vocal code) Need some help finding text-to-speech addon QUESTION: I am looking for an addon that can say characters vocally. It is for non-commercial use, and it would be nice if it can vocalize more languages, like asian, english etc... I have googled it, but can't seem to find anything for free use. Update: ...
[ "java", "flash", "text-to-speech" ]
2
1
696
5
0
2008-10-03T15:07:37.950000
2008-10-03T15:11:27.973000
167,330
167,353
Class data responsibilities
I have a 'Purchase Order' class. It contains information about a single purchase order. I have a DAO class for database methods. Where should the responsibility reside for the methods that will load and update the purchase order? Should the PurchaseOrder class have '.update', 'insert', 'delete', and '.load' methods tha...
The Purchase Order should be ignorant of the details of its persistence. This is the point of having some sort of data access layer, it handles the management of the object and the object itself can concentrate on just being a purchase order. This also makes the system easier to test, as you can create mock Purchase or...
Class data responsibilities I have a 'Purchase Order' class. It contains information about a single purchase order. I have a DAO class for database methods. Where should the responsibility reside for the methods that will load and update the purchase order? Should the PurchaseOrder class have '.update', 'insert', 'dele...
TITLE: Class data responsibilities QUESTION: I have a 'Purchase Order' class. It contains information about a single purchase order. I have a DAO class for database methods. Where should the responsibility reside for the methods that will load and update the purchase order? Should the PurchaseOrder class have '.update...
[ "design-patterns", "class-design" ]
3
4
372
8
0
2008-10-03T15:08:25.997000
2008-10-03T15:13:04.397000
167,343
167,392
C# Lambda expressions: Why should I use them?
I have quickly read over the Microsoft Lambda Expression documentation. This kind of example has helped me to understand better, though: delegate int del(int i); del myDelegate = x => x * x; int j = myDelegate(5); //j = 25 Still, I don't understand why it's such an innovation. It's just a method that dies when the "met...
Lambda expressions are a simpler syntax for anonymous delegates and can be used everywhere an anonymous delegate can be used. However, the opposite is not true; lambda expressions can be converted to expression trees which allows for a lot of the magic like LINQ to SQL. The following is an example of a LINQ to Objects ...
C# Lambda expressions: Why should I use them? I have quickly read over the Microsoft Lambda Expression documentation. This kind of example has helped me to understand better, though: delegate int del(int i); del myDelegate = x => x * x; int j = myDelegate(5); //j = 25 Still, I don't understand why it's such an innovati...
TITLE: C# Lambda expressions: Why should I use them? QUESTION: I have quickly read over the Microsoft Lambda Expression documentation. This kind of example has helped me to understand better, though: delegate int del(int i); del myDelegate = x => x * x; int j = myDelegate(5); //j = 25 Still, I don't understand why it'...
[ "c#", "c#-3.0", "lambda" ]
321
290
247,612
17
0
2008-10-03T15:11:14.527000
2008-10-03T15:20:38.860000
167,371
167,378
How do I see what files were changed between 2 revisions?
I just want to see what files were modded/added/deleted between 2 arbitrary revisions. How do I do this? Can I do this in tortoise as well?
svn log -v -rX:Y. The -v for "verbose" switch will give you detailed output on which files were affected on that revision. Note that "." assumes you are currently in a working copy directory, but you can also use a URL such as " http://svn.myawesomesoftwareproject.com/trunk/lib/foo.c ". This information can be found by...
How do I see what files were changed between 2 revisions? I just want to see what files were modded/added/deleted between 2 arbitrary revisions. How do I do this? Can I do this in tortoise as well?
TITLE: How do I see what files were changed between 2 revisions? QUESTION: I just want to see what files were modded/added/deleted between 2 arbitrary revisions. How do I do this? Can I do this in tortoise as well? ANSWER: svn log -v -rX:Y. The -v for "verbose" switch will give you detailed output on which files were...
[ "svn", "tortoisesvn" ]
22
42
18,736
7
0
2008-10-03T15:16:11.410000
2008-10-03T15:17:55.323000
167,400
167,456
Eclipse for IntelliJ Idea Users
I have a coworker who is looking to switch from InteilliJ Idea to Eclipse, and is concerned about not knowing the Eclipse set of commands. I was wondering - would anyone have a link to keyboard mappings that can set Eclipse commands to at least sort of match Idea? Have you made this switch? Any "gotchas", tips, or info...
If he definitely want to do this: http://www.jroller.com/ervines/resource/eclipse-intellij-key-bindings.java
Eclipse for IntelliJ Idea Users I have a coworker who is looking to switch from InteilliJ Idea to Eclipse, and is concerned about not knowing the Eclipse set of commands. I was wondering - would anyone have a link to keyboard mappings that can set Eclipse commands to at least sort of match Idea? Have you made this swit...
TITLE: Eclipse for IntelliJ Idea Users QUESTION: I have a coworker who is looking to switch from InteilliJ Idea to Eclipse, and is concerned about not knowing the Eclipse set of commands. I was wondering - would anyone have a link to keyboard mappings that can set Eclipse commands to at least sort of match Idea? Have ...
[ "eclipse", "intellij-idea", "switch-statement", "transition" ]
12
3
6,696
5
0
2008-10-03T15:22:51.990000
2008-10-03T15:35:16.897000
167,413
167,484
Subversion and revision engineering - what are the best web resources to read about?
We are migrationg from CVS to SVN and embracing some kind of revision management in order to enforce order to development/testing/release cycle. We are currently testing, developing and releasing on the same code line, we know its a bad practice and we want to make end to it. What are your experience, know how, suggest...
Subversion makes it easier to branch than CVS (in GIT branches are even cheaper). I recommended that you make branches for major revisions, and have a planned merging of the branches back into the trunk. Be vary careful of going long periods of not merging back into the branch, as you it will become more and more diffi...
Subversion and revision engineering - what are the best web resources to read about? We are migrationg from CVS to SVN and embracing some kind of revision management in order to enforce order to development/testing/release cycle. We are currently testing, developing and releasing on the same code line, we know its a ba...
TITLE: Subversion and revision engineering - what are the best web resources to read about? QUESTION: We are migrationg from CVS to SVN and embracing some kind of revision management in order to enforce order to development/testing/release cycle. We are currently testing, developing and releasing on the same code line...
[ "svn", "revision" ]
0
2
275
3
0
2008-10-03T15:25:23.530000
2008-10-03T15:41:19.363000
167,414
167,555
Is an atomic file rename (with overwrite) possible on Windows?
On POSIX systems rename(2) provides for an atomic rename operation, including overwriting of the destination file if it exists and if permissions allow. Is there any way to get the same semantics on Windows? I know about MoveFileTransacted() on Vista and Server 2008, but I need this to support Win2k and up. The key wor...
Win32 does not guarantee atomic file meta data operations. I'd provide a citation, but there is none - that fact that there's no written or documented guarantee means as much. You're going to have to write your own routines to support this. It's unfortunate, but you can't expect win32 to provide this level of service -...
Is an atomic file rename (with overwrite) possible on Windows? On POSIX systems rename(2) provides for an atomic rename operation, including overwriting of the destination file if it exists and if permissions allow. Is there any way to get the same semantics on Windows? I know about MoveFileTransacted() on Vista and Se...
TITLE: Is an atomic file rename (with overwrite) possible on Windows? QUESTION: On POSIX systems rename(2) provides for an atomic rename operation, including overwriting of the destination file if it exists and if permissions allow. Is there any way to get the same semantics on Windows? I know about MoveFileTransacted...
[ "windows", "winapi", "posix" ]
87
20
33,023
8
0
2008-10-03T15:25:25.433000
2008-10-03T15:55:50.317000