instruction stringlengths 0 30k ⌀ |
|---|
C++ method expansion |
|c++|templates| |
Can you specialize a template method within a template class without specializing the class template parameter?
This seems to compile under Visual Studio 2008 SP1 complier, but not GCC 4.2.4.
#include <iostream>
using namespace std;
template <typename T>
class A
{
private:
te... |
Can you specialize a template method within a template class without specializing the class template parameter?
Please note that the specialization is on the *value* of the template parameter, not its type.
This seems to compile under Visual Studio 2008 SP1 complier, but not GCC 4.2.4.
#include <iostream>
... |
With a bit of JavaScript, you could have the client hash the entered password and a server-generated nonce, and use that in an HTTP GET. |
I have used the Observer pattern (using AspectJ magic) in the past with *some* success, but found that unless you were careful it quickly became a cluster.. uhh.. flick?
It quickly became hard to manage and most importantly extremely hard to debug. |
I have used the Observer pattern (using AspectJ magic) in the past with *some* success, but found that unless you were careful it quickly became a cluster.. uhh.. flick?
It quickly became hard to manage and most importantly extremely hard to debug.
**Edit:**
To expand slightly on my answer, we were using [SWT]... |
|asp.net|webserver|capacity-planning| |
[Negative turing test.][1] Have used this for over a year on WordPress, IP.Board and MediaWiki sites, and have absolutely zero spam. The only catch: you have to think of a question/answer combination that's neither common (otherwise, bots will adapt) nor too domain-specific (otherwise, potential users might not know th... |
Try to add the following style on textarea: **style="white-space: pre"** |
Use prepared statements. These are SQL statements that sent to and parsed by the database server separately from any parameters.
If you use PDO you can work with prepared statements like this:
$preparedStatement = $db->prepare('SELECT * FROM employees WHERE name = :name');
$preparedStatement->execute(a... |
A system that runs performance benchmarks while operating is going to be slower than one that doesn't. If the goal is to optimise speed, why wouldn't you benchmark independently and import the fastest routines once they are proven to be faster?
And your idea of starting routines simultaneously could introduce [rac... |
A system that runs performance benchmarks while operating is going to be slower than one that doesn't. If the goal is to optimise speed, why wouldn't you benchmark independently and import the fastest routines once they are proven to be faster?
And your idea of starting routines simultaneously could introduce [rac... |
As the title states, using Javascript, how can I valid two given dates to ensure that they are a valid range? For example, a valid range could be ensuring that the dates are at least one week apart. |
Heres an example I put up awhile on my lame blog. Say you wanted to update a label from a worker thread. I've got 4 examples of how to update that label from 1 to 50 using delegates, anon delegates and 2 types of lambdas.
private void button2_Click(object sender, EventArgs e)
{
... |
I don't think you can.
Opensource component PDFSharp has that functionality, and a nice [source code sample on file combining][1]
[1]: http://www.pdfsharp.com/PDFsharp/index.php?option=com_content&task=view&id=24&Itemid=35 "source sample" |
How do you detect and print the current drilldown in the CrystalReportViewer control? |
|crystal-reports| |
We use materialized views to speed up things where I work. Most often for reports against the OLTP system. Many of our reports run from a data warehouse, but since we refresh the warehouse overnight, up to the moment data has to come from the OLTP tables. |
Another way to look at it is, a solution is a container for projects. For most of my work , I create each tier as a project within a solution so my tree looks like:
- My Web App or Win App
- Presentation Layer
- files...
- Business Layer
- files...
- Data Access
- files
You... |
In the project I'm working on right now, the interfaces and related base classes go into assemblies that are logically divided among functions. The implementations of these providers and classes go inside a core assembly. The idea being that people who use our API can reference more or one of the API dlls in a clear ... |
@Thomas Owens:
Yes, some (most?) people using Eclipse have more than one workspace. It's what surprised me the most when I first started using Eclipse, so I'm replying here to make this comment more visible. |
A Solution has 0 or many Projects... |
You need to create a new type specifically for holding const Widget& objects. Ie:
<pre>
<code>
struct ConstWidgetHolder
{
ConstWidgetHolder(const Widget &a, const Widget &b, const Widget &c, const Widget &d): A(a), B(b), C(c), D(d){}
const Widget& A;
const Widget& B;
const Widget& C;
co... |
I used their tree for a project. Not bad for free controls. |
I have no way of testing your code right now, but it looks like a bug in JavaScriptSerializer.serialize to me. My guess is that it tries to do some kind of type checking on the array via the CLR and that it doesn't handle an empty array properly.
Have you tried to add an item of a serializable type to the array in ... |
I second metavida's advice to find a third-party library to handle output filtering. Neutralizing HTML characters is a good approach to stopping XSS attacks. However, the code you use to transform metacharacters can be vulnerable to evasion attacks; for instance, if it doesn't properly handle Unicode and internationali... |
Bazaar, by the creators of Ubuntu.
http://bazaar-vcs.org/
Why Choose Bazaar?
http://bazaar-vcs.org/BzrWhy |
Use the 'J' (J for Join; upper-case) command to delete the newline at the end of a line. You'll find it tricky otherwise. |
If you do choose to use the VSSConverter.exe tool that ships with Visual Studio Team Foundation Server, then you should install [TFS 2008 SP1][1] first as it includes a number of improvements as detailed [on this blog by the migration tools team][2].
> Some of the key features of the
> release include:
>
> **Eli... |
In my experience the overhead is minimal, provided that the person writing the queries knows what he/she is doing, and take the usual precautions to ensure the generated queries are optimal, that the necessary indexes are in place etc etc. In other words, the database impact should be the same; there is a minimal but u... |
You could use HTTP Authentication, if supported. |
You could use HTTP Authentication, if supported.
You'd have to add SSL, as all methods, POST, GET and HTTP Auth (well, except Digest HHTP authentication) send plaintext.
GET is basically just like POST, it just has a limit on the amount of data you can send which is usually a lot smaller than POST and a semantic ... |
There are plenty of scenarios, for example if you want to create GUIs for more than one environment. Let's say you have classes for controls (“widgets”) but each environment actually has its own widget set. It's therefore logical to subclass the creation of these widgets for each environment. The way to do this (since,... |
[@Nathan de Vries](http://stackoverflow.com/questions/69982/writing-a-firefox-plugin-for-parsing-a-custom-client-side-language#70239): no, actually, NPAPI plugins you suggested don't let one implement support for `<script type=...>`.
OP: this is not easy, but look for PyDOM and PyXPCOM - language bindings for Python... |
You can use array_slice(), like so:
$elementX = array_slice(functionThatReturnsAnArray(), $x, 1);
Also noticed that end() is not mentioned. It returns the last element of an array. |
I second Python - powerful, simple, performant, and... actually quite fun, compared to perl or bash. Also if you know it, you'll find other uses, it's used in a lot of projects.
And not just as a "classic" scripting language, take for example the twisted project. That's true for Perl too I guess, but I like Python be... |
[PLEAC][1] , has a Python Cookbook , which is very helpful .
[1]: http://pleac.sf.net |
How to write a linter? |
|code-style|verilog|syntax-checking| |
In my day job I, and others on my team write a lot of hardware models in Verilog-AMS, a language supported primarily by commercial vendors and a few opensource simulator projects.
One thing that would make supporting each others code more helpful would be a LINTER that would check our code for common problems and ass... |
Writing a Firefox plugin for parsing a custom client-side language |
|firefox|custom-language|firefox-plugin|language-parsing| |
I had an idea for a client-side language other than JavaScript, and I'd like to look into developing a Firefox plugin that would treat includes of this new language in a page, like <script type="newscript" src="path/script.ns" />, just as if it were a natively supported language. The plugin would do all of the langu... |
When using Business Objects' CrystalReportViewer control, how can you detect and manually print the report the user has currently drilled into? You can print this automatically using the Print() method of the CrystalReportViewer, but I want to be able to do a manual printing of this report.
It is possible to print t... |
Header injection isn't a factor in how you send the mail, it's a factor in how you construct the mail. Check the `email` package, construct the mail with that, serialise it, and send it to `/usr/sbin/sendmail` using the `subprocess` module.
|
Just to clarify what is actually causing this. MySQL by default terminates open connections after 8 hours of inactivity. However the database connection pool will retain connections for longer than that.
So by setting timeBetweenEvictionRunsMillis=300000 you are instructing the connection pool to run through connec... |
I also recommend Module::Build and Module::Starter (with the [TT2 plugin](http://search.cpan.org/perldoc?Module::Starter::Plugin::TT2)). |
Try this;
static IEnumerable<string> CsvParse(string input)
{
// null strings return a one-element enumeration containing null.
if (input == null)
{
yield return null;
yield break;
}
// we will 'eat' bits of the string until it's gone.
String remaining = input;
while (remaining.Le... |
String and StringBuilder are actually both immutable, the StringBuilder has built in buffers which allow its size to be managed more efficiently. When the StringBuilder needs to resize is when it is re-allocated on the heap. By default it is sized to 16 characters, you can set this in the constructor.
eg.
StringB... |
I haven't got access to the source code of my last remoting application, but as far as I can remember we couldn't figure out a way of knowing for definite if the server was up from any of the exceptions we got.
We did check to see if the network was present and warned the user if not (a method on the Environment cla... |
[ADO.Net Data Servcies][1] makes it really easy to build and [consume][2] RESTful web services in the .Net world.
[Guidelines for Building RESTful Web Services][3] has all the info on the resources you need.
This is another useful [blog entry][4]:
The uniform interface constraints describe how a service built fo... |
[ADO.Net Data Servcies][1] makes it really easy to build and [consume][2] RESTful web services in the .Net world.
[Guidelines for Building RESTful Web Services][3] has all the info on the resources you need.
This is another useful [blog entry][4]:
The uniform interface constraints describe how a service built fo... |
I like [ZedGraph][1] it is a free library and produces quality output. You can tweak the anti-aliasing to work the way it looks best to you and it supports a variety of charts and graphs.
[1]: http://zedgraph.org/wiki/index.php?title=Main_Page |
how to detect if I'm compiling code under visual studio 8? |
|c++|visual-studio| |
Is there any way to know if I'm compiling under Microsoft Visual Studio 2008 ? |
Using Lisp in C# |
|lisp|c#| |
As a lot of ppl pointed out in [this question][1], Lisp is mostly used as a learning expirience. Nevertheless, it would be great if I could somehow use my Lisp algorithms and combine them with my C# programs.
In college my profs never could tell me how to use my Lisp routines in a program (no, not writing a GUI in Li... |
|c#|lisp| |
As a lot of people pointed out in [this question][1], Lisp is mostly used as a learning experience. Nevertheless, it would be great if I could somehow use my Lisp algorithms and combine them with my C# programs.
In college my profs never could tell me how to use my Lisp routines in a program (no, not writing a GUI in... |
Set 4 Space Indent in Emacs in Text Mode |
|emacs|indentation| |
I've been unsuccessful in getting Emacs to switch from 8 space tabs to 4 space tabs when I'm using Text mode. I've tried to edit my .emacs file to:
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
No matter how I change my .emacs file (or my buffer's local variables) the tab button always d... |
|emacs|indentation| |
I've been unsuccessful in getting Emacs to switch from 8 space tabs to 4 space tabs when I'm using Text mode. I've tried to edit my .emacs file to:
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;;; And I have tried
(setq indent-tabs-mode nil)
(setq tab-width 4)
No matter... |
Have a certain page on your port 80 server proxy requests to the other port. For example:
http://localhost/proxy?port=7076&url=%2f%3fword%3dfoo
Note the url encoding on the last query string argument value. |
You could use JSONP. This is where you specify a callback with the request, the response from your ajax request gets wrapped with the callback function name. Rather than using XmlHttpRequest you insert a <script type="text/javascript" /> tag into the HTML document with the URL. Then when the response is retrieved the c... |
This is a browser restriction. All javascript calls must be to the same server and port of the home of the script. This will require something server-side to get around. I.E. have the process at `localhost` forward the request to `localhost:7076`. |
Here's C# app i wrote that solves this problem.
takes
[0] a
[1] a
[2] b
[3] c
[4] c
[5] a
[6] c
[7] d
[8] c
[9] d
outputs
a
b
c
a
c
d
Probably looks pretty messy, took me a bit to get my head around the dynamic pattern length bit.
class Program
{... |
Here's C# app i wrote that solves this problem.
**takes**
aabccacdcd
**outputs**
abcacd
Probably looks pretty messy, took me a bit to get my head around the dynamic pattern length bit.
class Program
{
private static List<string> values;
private const int MAX_PATTERN_LEN... |
|firefox| |
From my (rather small) experience developing full-text search engines: I would look up questions which contain some words from query (in your case, query is your question).
Sure, noise words should be ignored and we might want to check query for 'strong' words like 'ASP.Net' to narrow down search scope.
<a href='http... |
[Learn Python in 10 minutes][1]
[1]: http://www.poromenos.org/tutorials/python "Learn Python in 10 minutes" |
ODAC xcopy will get you away with about 45MB.
http://www.oracle.com/technology/software/tech/windows/odpnet/index.html
|
Is it possible to develop DirectX apps in Linux? |
|c++|linux|directx|mingw|wine| |
More out of interest than anything else, but can you compile a DirectX app under linux?
Obviously there's no official SDK, but I was thinking it might be possible with wine.
Presumably wine has an implementation of the DirectX interface in order to run games? Is it possible to link against that?
Failing that, ... |
|c++|linux|directx|wine|mingw| |
More out of interest than anything else, but can you compile a DirectX app under linux?
Obviously there's no official SDK, but I was thinking it might be possible with wine.
Presumably wine has an implementation of the DirectX interface in order to run games? Is it possible to link against that? (edit: This is ca... |
I suppose I might be being a bit picky here but it's important to note DI (Dependency Injection) is a programming pattern and is facilitated by (but does not require) an IoC (Inversion of Control) Framework. IoC Frameworks just make DI much easier, but it's not only DI that they do, they provide a host of other benefit... |
In standard C++, technically there is no way to do this since standard C++ has no conception of files or directories. If you want to expand your net a little bit, you might like to look at using [Boost.FileSystem][1]. This has been accepted for inclusion in TR2, so this gives you the best chance of keeping your impleme... |
In standard C++, technically there is no way to do this since standard C++ has no conception of directories. If you want to expand your net a little bit, you might like to look at using [Boost.FileSystem][1]. This has been accepted for inclusion in TR2, so this gives you the best chance of keeping your implementation a... |
One thing you should be aware of when using __`each`__ is that it has
the side effect of adding "state" to your hash (the hash has to remember
what the "next" key is). When using code like the snippets posted above,
which iterate over the whole hash in one go, this is usually not a
problem. However, you will run in... |
[ADO.Net Data Servcies][1] makes it really easy to build and [consume][2] RESTful web services in the .Net world but nevertheless understanding the concepts is important. Compared to WCF (which added REST support later), ADO.Net Data Services was built primarily for REST.
[Guidelines for Building RESTful Web Service... |
Have I seen a similar concept in practice? No. But I'll propose an approach anyway.
It seems like most of your objectives would be meet by some sort of super source control system, which could be implemented with [CruiseControl][1].
CruiseControl can run unit tests to ensure correctness of the new version.
You... |
Windows Communication Foundation [supports REST model since .NET 3.5][1].
You can find documentation and code samples on MSDN:
[REST and POX][2]
[1]: http://blogs.conchango.com/anthonysteele/archive/2008/03/15/rest-from-wcf-3-5.aspx
[2]: http://msdn.microsoft.com/en-us/library/aa395208.aspx |
Surround your regex with
> (?x: )
so "a b c" becomes "(?x:a b c)
|
It sucks, but it's necessary... Basically what you're going to need to do is proxy your AJAX request through a local proxy - some server side script / page / whatever on the same domain you're on - receive the call and forward it on to the other resource server-side. There might be some IFRAME tricks you could do but I... |
Guillermo Vasconcelos was correct in his answer. There are two FTP modes, Active and Passive. The default [FTP][1] mode is active. Active requires the server to connect back to the client on some TCP/IP port. This does not work with firewalls because chances are that this port would be blocked or if you are behind a Ro... |
The thing that may be throwing you off is the following:
In VS2003, everything had a Project file and a Solution file. If you had a Solution with one Project, you could open the Solution and see the one Project. If you opened the Project, it would try and create a new Solution file to contain the Project. But web pr... |
To get rid of the manual merge step, I could use a separate svn branch (svn://branches/VSS) as follows:
1. Create a working copy of svn://branches/VSS
2. Do a VSS Get Latest on this working copy
3. svn commit
4. svn merge from svn://trunk
5. svn commit
5. Do a VSS diff and checkout all files with differences
6... |
To get rid of the manual merge step, I could use a separate svn branch (svn://branches/VSS) as follows:
1. Create a working copy of svn://branches/VSS
2. Do a VSS Get Latest on this working copy
3. svn commit
4. svn merge from svn://trunk
5. svn commit
5. Do a VSS diff and checkout all files (without overwritin... |
Nothing, really. You'll find a couple warnings on compilation about obsolete methods, but often those are trivial to fix.
You should shoot big and go for 3.5. The water is niiiiiiice in here. |
With unit test suite one can make changes to code while leaving rest of the features intact. Its a great advantage. Do you use Unit test sutie and regression test suite when ever you finish coding new feature. |
I have used `UTL_HTTP` which is simple and works. If you face a challenge with your own package, you can probably find a solution in one of the many wrapper packages around UTL_HTTP on the net (Google "consuming web services from pl/sql", leading you to e.g.
http://www.oracle-base.com/articles/9i/ConsumingWebServices... |
I haven't done xcode in a bit, but I recommend that you disable "Zerolink" and "Load Symbols Lazily"; that will fix most problems. Zerolink is an abomination anyway. |
# Language Name: [ChucK][1]
Moog moog => dac;
4.0 => moog.gain;
for (0 => int i; i < 8; i++) {
<<< factorial(i) >>>;
}
fun int factorial(int n) {
1 => int result;
if (n != 0) {
n * factorial(n - 1) => result;
}
St... |
How do I register a custom type converter in Spring? |