instruction stringlengths 0 30k ⌀ |
|---|
From http://bytes.com/forum/thread274921.html
> Directly no, in large part because you
> cannot simply set the event to null.
>
> Indirectly, you could make the actual
> event private and create a property
> around it that tracks all of the
> delegates being added/subtracted to
> it.
>
> Take the followin... |
try Context.User.Identity.AuthenticationType |
In Python, what is the fastest algorithm for removing duplicates from a list so that all elements are unique *while preserving order*? |
|python| |
For example:
>>> x = [1, 1, 2, 'a', 'a', 3]
>>> unique(x)
[1, 2, 'a', 3]
**Assume list elements are hashable.**
|
|python|algorithm|list| |
For example:
>>> x = [1, 1, 2, 'a', 'a', 3]
>>> unique(x)
[1, 2, 'a', 3]
Assume list elements are hashable.
**Clarification:** The result should keep the first duplicate in the list. For example, [1, 2, 3, 2, 3, 1] becomes [1, 2, 3].
|
Freemarker would do exactly what you need. This is a template engine with a syntax very similar to JSP :
[http://freemarker.org/][1]
[1]: http://freemarker.org/ |
Eclipse 3.3.2/MyEclipse doesn't recognize xml as ant files |
|ant|eclipse| |
Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says "locked by 'Ant Buildfile' content type. |
Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says "locked by 'Ant Buildfile' content type.
The run-as menu is broken. Even if the editor association works run-as doesn't. |
|eclipse|ant| |
Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says "locked by 'Ant Buildfile' content type.
The run-as menu is broken. Even if the editor association works run-as doesn't.
The ... |
|reverse-engineering|uml|sequence-diagram| |
I'm looking for a tool that will reverse engineer into a sequence diagram BUT also provides the ability to filter out calls to certain libraries.
For example, the Netbeans IDE does a fantastic job of this but it includes all calls to String or Integer which clutter up the diagram to the point it is unusable.
An... |
|java|uml|reverse-engineering|sequence-diagram| |
As you mentioned, there are plenty of options available, most of them have all the basic features. If you are looking for a simple setup, most may even be overkill for what you are trying to achieve. Which CMS you choose, may best depend on your preference for the programming language the CMS is using.
For some web... |
DotNetNuke:
* very flexible
* lots of community around it
* community tends to be fairly technical and can be hard to find useful end-user support
* can be difficult to upgrade and to keep current versions available
* fairly easy to program basic modules for
* 100s of available modules (free and pay)
* documen... |
Look for algorithms on color quantization, especially median cut. You'll find many examples with those keywords. |
Look for algorithms on color quantization, especially median cut. You'll find many examples with those keywords. Libraries to do this for you include [ImageMagick][1] which has bindings for many languages.
[1]: http://www.imagemagick.org/ |
Look for algorithms on color quantization, especially median cut. You'll find many examples with those keywords. Libraries to do this for you include [ImageMagick][1] which has bindings for many languages. [JMagick][2] is the Java flavor.
[1]: http://www.imagemagick.org/
[2]: http://sourceforge.net/projects/j... |
Make is very bad at being able to detect actual file changes, as opposed to just updated timestamps.
It sounds to me that the root of the problem is that the bom-checkout always modifies the timestamp of the bom, causing the dependencies to be regenerated. I would probably try to solve this problem instead -- try t... |
For a beginner: g++ --pedantic-errors -Wall
It'll help enforce good programming from the start. |
It's about the same. The difference shouldn't be large enough to be the reason to pick one or the other. Don't try to compare them by writing your own tiny benchmarks (hello world) because you will probably not results that are representative of a real web site generating a more complex page. |
If you want a good PInvoke examples you can look at [PInvoke.net][1]. It has examples of how to call most of win api functions.
Also you can use tool from this article [Clr Inside Out: PInvoke][2] that will translate your .h file to c# wrappers.
[1]: http://www.pinvoke.net/
[2]: http://msdn.microsoft.com/e... |
I think you should only throw an exception when there's nothing you can do to get out of your current state. For example if you are allocating memory and there isn't any to allocate. In the cases you mention you can clearly recover from those states and can return an error code back to your caller accordingly. |
One rule of thumb is to use exceptions in the case of something you couldn't normally predict. Examples are database connectivity, missing file on disk, etc. For scenarios that you can predict, ie users attempting to log in with a bad password you should be using functions that return booleans and know how to handle ... |
C++ is designed RAII in mind. There is really no better way to manage memory in C++ I think.
But be careful not to allocate very big chunks (like buffer objects) on local scope. It can cause stack overflows and, if there is a flaw in bounds checking while using that chunk, you can overwrite other variables or return a... |
network of course :) Use MRTG to get some nice bandwidth graphs, they're just pretty most of the time.. until a spammer finds a hole in your security and it suddenly increases.
Nagios is good for alerting as mentioned, and is easy to get setup. You can then use the mrtg plugin to get alerts for your network traffic ... |
[xml-emitter][1] says it has an RSS 2.0 emitter built in.
[1]: http://www.cliki.net/xml-emitter |
Capistrano is the nicest deployment tool I've seen. Do the architecture changes make it impossible to fix the configs so it works again? |
You can use the Folders collection member of the Outlook.NameSpace object. That way you can iterate through the collection and find your folder by it's name. In case you still want to use GetFolderFromID, you can use [OutlookSpy][1] tool to get the EntryID and StoreID values.
[1]: http://www.dimastr.com/outspy/ |
We keep stored procedures in source control. |
does elmah handle caught exceptions as well |
|asp.net|asp.net2.0| |
I was wondering if something like elmah logged exceptions even when they do not bubble up to the application? I'd like to pop up a message when an exception occurs and still log the exception. Currently I've been putting everything in try catch blocks and spitting out messages, but this gets tedious. |
|.net|asp.net|exception|elmah| |
You can actually catch the condition for a stack overflow using signal handlers.
To do this, you must do two things:
- Setup a signal handler for SIGSEGV (the segfault) using sigaction, to do this set the SO_ONSTACK flag. This instructs the kernel to use an alternative stack when delivering the signal.
-... |
Project in Ruby |
|ruby|desktop-application| |
I've been coding alot of web-stuff all my life, rails lately. And i can always find a website to code, but i'm kind of bored with it. Been taking alot of courses of Java and C lately so i've become a bit interested in desktop application programming.
Problem: I can't for the life of me think of a thing to code for d... |
Java's Swing API is cross platform and relatively simple, and NetBeans is a good GUI builder. |
Place cursor on line, if not at beginning do a CTRL-A, then:
CTRL-K
CTRL-K
CTRL-Y
CTRL-Y
|
You should be able to execute saved DTS packages in MS SQL Server from the application server's command line. Since this is the case, you can use `<cfexecute>` to issue a request to DTSRUNNUI.EXE. ([See example][1]) This is of course assuming you are on a server where the command is available.
[1]: http://www.mss... |
You're looking for [Qt](http://trolltech.com/products/qt). It's a cross-platform C++ GUI framework, and it includes everything you asked for and more.
It's free for open-source projects to use, provided you're using the GPL. |
I would not expect coders to deliver known problems into test let alone to release to a customer.
Mind you, I believe in zero tolerance of bugs. Interestingly I find that it is usually developers/ testers who are keenest to remove all bugs - it is often the project manager and/ or customer who are willing to accept ... |
I'm of the philosophy that the build should be done with a "lowest common denominator" approach. What goes into source control is what is required to do the build. While I develop exclusively in with Eclipse, my build is with ant at the command line.
With respect to source control, I only check in files that are... |
Does the VFW (Video For Windows) API support Alpha Channel Transparency? |
|mfc|visual-c++-6|alpha|channel|vfw| |
Does the VFW (Video For Windows) API support Alpha Channel Transparency? I want to be able to export video with Alpha channel information. How can I do this in VC6? |
I've always keep my unit tests in a seperate project so it compiles to it's own assembly. |
Something like that should work:
interface Node{
}
interface NodeType<T extends Node>{
T createInstance();
}
class Thing implements Node{}
class ThingType implements NodeType<Thing>{
public Thing createInstance() {
return new Thing();
}
}
class UberThing extends Thing{}
class UberThingT... |
scheduled web synchronization with MS Sql Server 2005 |
|sql-server| |
I have settled a web synchronization between SQLSERVER 2005 as publisher and SQLEXPRESS as suscriber. synchronisation is working fine except that I did not find a way to automate the synchro, which I still have to launch manually through internet explorer. Any idea? |
|sql-server| |
I have settled a web synchronization between SQLSERVER 2005 as publisher and SQLEXPRESS as suscriber. Web synchro has to be launched manually through IE interface (menu tools/synchronize) and to be selected among available synchronizations.
Everything is working fine except that I did not find a way to automate the ... |
Fogbugz has a [Command Line Client][1].
[1]: http://support.fogcreek.com/default.asp?W840 |
I'm pretty sure it does; just set the pixel format to RGB32, which should give you an alpha channel to use.
Of course, finding a video compression format that fits all your needs and supports alpha channel is another problem. |
@Peter Hilton,
I'm going to create such system. So I'm wondering whether such system exists. General idea is to keep it as simple as possible: command line utility to manage tasks & simple server wit REST interface. I used dozen different task tracking system and come to conclusion that I don't need fancy UI. It sho... |
Those A objects will only exist until execution reaches the semicolon. So, the calls are safe, but don't try to save the pointer and use it later. Also, the compiler may require bar take a const reference. |
My flavor of choice is to use class identification when css styles are applied to several divs in the same way. If the structure or container is really only applied once, or can inherit its style from the default, I see no reason to use class identification.
So it would depend on whether your div is one of several; ... |
[aspose pdf][1] works pretty well. then again, you have to pay for it
[1]: http://www.aspose.com/ |
Subversion (SVN) is an excellent option for you. It's free, integrates nicely into Windows with TortoiseSVN, and is well-tolerated by users.
We are using it for source code, as well as for document management. |
You could pretty quickly hack together a program that grabs the output of <code>rake routes</code> and then parses the output to put together a list of the URLs.
What I have, typically, done for load testing is to use a tool like [WebLOAD][1] and script several different types of user sessions (or different routes u... |
I'd recommend having a look at SQLite -- full-text search is included in the latest version. |
How do indicate the SQL default library in an IBM iSeries 2 connection string to an AS/400? |
|ibm-midrange|ibm|database| |
I'm connecting to an AS/400 stored procedure layer using the IBM iSeries Access for Windows package. This provides a .NET dll with classes similar to those in the System.Data namespace. As such we use their implementation of the connection class and provide it with a connection string.
Does anyone know how I can ame... |
|.net|database|ibm-midrange|ibm| |
If you have
class B : A
class C : A
And you have
List<B> listB;
List<C> listC;
that you wish to treat as a List of the parent type
Then you should use
List<A> listA = listB.Cast<A>().Concat(listC.Cast<A>()).ToList()
|
You could do the truncate after the 'create if not exists'.
That way it will always exist... and always be empty at that point. |
<a href="http://www.dsource.org/projects/descent">Descent</a>, the Eclipse plugin, should support both (if you have a D supporting debugger installed). I have to admit I haven't tried it in a long time though, and when I did, debugging did _not_ work, using gdb.
See also <a href="http://stackoverflow.com/questions/5... |
I try to adapt to the environment.
When developing for an Windows application, I use the [Windows Vista User Experience Guidelines][1] but when I'm developing an web application I use the appropriate guidelines, because I develop Dutch websites I use the ["Drempelvrij" guidelines][2] which are based on the [Web Cont... |
I try to adapt to the environment.
When developing for an Windows application, I use the [Windows Vista User Experience Guidelines][1] but when I'm developing an web application I use the appropriate guidelines, because I develop Dutch websites I use the ["Drempelvrij" guidelines][2] which are based on the [Web Cont... |
VS 2008 works fine with TFS 2005. There are a couple of exceptions in the Team Build area (which changed massively between 2005 and 2008) but otherwise you will be able to do everything you need to do from the Visual Studio 2008 client.
You need to ensure that you have the 2008 version of the Team Explorer installe... |
How to get all datatype sizes and function stack footprint sizes in a C/C++ project? |
|c++|c|data-structures|size| |
I have a large inherited C/C++ project. Are there any good tools or techniques to produce a report on the "sizeof" of all the datatypes, and a breakdown of the stack footprints of each function in such a project.
|
Software Design Description Practise |
If you know the shape is a rectangle in a plane, you can greatly further constrain the problem. You certainly cannot figure out "which" plane, so you can choose that it is lying on the plane where z=0 and one of the corners is at x=y=0, and the edges are parallel to the x/y axis.
The points in 3d are therefore {0,0,... |
Exception classes are like "normal" classes. You create a new class when it "is" a different type of object, with different fields and different operations.
As a rule of thumb, you should try balance between the number of exceptions and the granularity of the exceptions. If your method throws more than 4-5 different... |
Use prepared statements. |
Whatever you do, do not store it on the server itself (even if you're only using one server, or in a 1+1 failover scenario). It'll put you on a dead end.
I would say, use Database+Memcache for storage/retrieval, it'll keep you out of Zend's grasp (and believe me things do break down at some point with Zend). Since y... |
Reduced to the essential distinction, identity matters for entities, but does not matter for value objects. For example, someone's Name is a value object. A Customer Entity might be composed of a customer Name (value object), List<Order> OrderHistory (List of Entities), and perhaps a default Address (typically a value ... |
What you're asking for is called mixed mode authentication. I've recently used a <a href="http://www.15seconds.com/issue/050203.htm">two entry-point mechanism from Paul Glavich</a> and it works perfectly. I guess it's the most elegant solution for this problem. |
Your best bet is to fire up SQL Server Profiler and see what's going on. Look for high values in the "Writes" column or Spool operators, these are both likely to cause high temp usage.
If it is only the transaction log growing then try this, open transactions prevent the log from being shrunk down as it goes. This ... |
I think you'll find the best resource here: http://www.hpcc.org/datafile/hpil/lif_utils.html
Also, if you're going to use raw dd, LIF format has 77 cylinders vs 80 for a normal floppy. |
Finding differences between versions of a Java class file |
|java|decompiler|class|file-format| |
I am working with a large Java web application from a commercial vendor. I've received a patch from the vendor in the form of a new .class file that is supposed to resolve an issue we're having with the software. In the past, applying patches from this vendor have caused new and completely unrelated problems to arise... |
|java|class|file-format|decompiler| |
I am working with a large Java web application from a commercial vendor. I've received a patch from the vendor in the form of a new .class file that is supposed to resolve an issue we're having with the software. In the past, applying patches from this vendor have caused new and completely unrelated problems to arise... |
It's a by-product of the parser rule that a statement is either a simple statement or a block. i.e. a block can be used wherever a single statement can.
e.g.
if (someCondition)
SimpleStatement();
if (SomeCondition)
{
BlockOfStatements();
}
Others have pointed out that v... |
It's not valuable.<br>
It's a by-product of a the parser rule that statement is either a simple statement or a block. i.e. a block can be used wherever a single statement can.
e.g.
if (someCondition)
SimpleStatement();
if (SomeCondition)
{
BlockOfStatements();
}
Others... |
It's a by-product of a the parser rule that statement is either a simple statement or a block. i.e. a block can be used wherever a single statement can.
e.g.
if (someCondition)
SimpleStatement();
if (SomeCondition)
{
BlockOfStatements();
}
Others have pointed out that v... |
have you tried going into the options in virtual box and changing the network adapter to the VB one? VB is a bit different in it's virtual adapters, you might have to create a new one attached to the nic and then specify that one as the primary nic. |
You are possibly being inhibited by the fact you are running in a VT100/WhateverItsCalled compatible terminal and it just doesn't *have* more than about 16 foreground and 16 background colours. If it did, the lovely library "CaCa" ( ColourAsciiColourArt ) would be much more pleasing to watch than it is.
If you wa... |
Ideally you should be running your java application inside a debugger, thus when an uncaught exception is thrown you can examine the callstack, variables, etc and see exactly what line caused the crash, and perhaps which data is null that got used.
If you can't use a debugger for whatever reason, then compile your a... |