instruction stringlengths 0 30k ⌀ |
|---|
The test suite framework of choice is [Test::Harness](http://search.cpan.org/search?query=test%3A%3Aharness&mode=module), which takes care of controlling a test run, collecting the results, etc.
Various modules exist to provide certain kinds of tests, the most common of which can be found in [Test::Simple](http://se... |
75 images sounds like a lot. If it is a lot of small images, there are ways of bundling many images as one, you might see if you can find a library that does that. Also you can probably force the images to be cached in something like [google gears](http://gears.google.com). |
How do you do time tracking/scheduling/release planning?
Those that help you ship on time? ala FogBugz |
Have you tried ILMerge? <http://research.microsoft.com/~mbarnett/ILMerge.aspx>
>ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. It is freely available for use from the Tools & Utilities page at the Microsoft .NET Framework Developer Center.
I'm not sure if it work... |
Have you tried ILMerge? <http://research.microsoft.com/~mbarnett/ILMerge.aspx>
>ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. It is freely available for use from the Tools & Utilities page at the Microsoft .NET Framework Developer Center.
If you're building the ... |
It probably won't really help you, but my current solution is Zend Studio 5.5 with real-time errors disabled. I can't use the internal debugger on 5.3 projects, but everything else in the IDE still works and the namespace code isn't highlighted as an error. I get to keep the code explorer and syntax highlighting and ju... |
VB.Net doesn't support the "As Any" keyword. You'll need to explicitly specify the type. |
If you are using PHP, you can use [GeSHi][1] to highlight many different languages. I've used it before and it works quite well. A quick googling will also uncover GeSHi plugins for [wordpress][2] and [drupal][3].
I wouldn't consider highlighting to be CPU intensive unless you are intending to display megabytes of i... |
There is a very simple rule: if you want to keep official support from Microsoft, don't change any of the files in the 12 hive that are installed by SharePoint.
I've never encountered a situation where the only solution was to change such a file. For example if you want to change an out-of-the-box user control of Sh... |
I think it depends on the specific data you're talking about.
If the user is trying to recreate code 'ABC', is it the SAME 'ABC' that was in use last time that has now come out of retirement, or is it a completely different 'ABC'?
If it actually refers to the same real-world 'thing', then there may be no harm in ... |
What's the purpose of META-INF? |
|java|meta-inf| |
In Java, you often see a META-INF folder containing some meta files. What is the purpose of this folder and what can I put there? |
vb6 to vb.net declaration |
|vb6|to|vb.net|declaration| |
HOW TO DECLARE "AS ANY" IN VB.NET OR WHAT IS THE EQUIVALENT OF AS ANY IN VB.NET? |
|vb6|vb.net|declaration| |
|vb.net|vb6|declaration| |
How do I declare "as any" in VB.NET, or what is the equivalent? |
I hope I haven't painted myself into a corner. I've gotten what seems to be most of the way through implementing a Makefile and I can't get the last bit to work. I hope someone here can suggest a technique to do what I'm trying to do.
I have what I'll call "bills of materials" in version controlled files in a sour... |
I wouldn't think so, as obfuscating (as I understand it at least) will simply mess around with the method names to make it hard (but not impossible) to understand the code. This won't change the data of the actual key (which I'm guessing you have stored in a constant somewhere).
If you just want to make it somewha... |
MVC .Net and IIS 5 |
|asp.net-mvc|iis|shared-host| |
What is the best way to get hosting of an MVC.Net application to work on IIS 5 (6 or 7). When I tried to publish my MVC application, all I seem to get is 404 errors. Iv done abit of googleing and have found a couple of solutions, but neither seem super elegant, and I worry if they will be unusable once I come to use a ... |
The way I learned it is that this:
if (obj is Foo) {
Foo f = (Foo)obj;
f.doSomething();
}
is slower than this:
Foo f = obj as Foo;
if (f != null) {
f.doSomething();
}
Is it slow enough to matter? Probably not, but it's such a simple thing to pay attention for, t... |
Juan,
I like to think of interfaces as a way to characterize a class. A particular dog breed class, say a YorkshireTerrier, may be a descended of the parent dog class, but it is also implements IFurry, IStubby, and IYippieDog. So the class defines what the class is but the interface tells us things about it.
Th... |
I hope I haven't painted myself into a corner. I've gotten what seems to be most of the way through implementing a Makefile and I can't get the last bit to work. I hope someone here can suggest a technique to do what I'm trying to do.
I have what I'll call "bills of materials" in version controlled files in a sour... |
Well, Session State is a server-side solution, with its own pile of cruft to deal with if you want to avoid ViewState altogether. Really though, using ViewState in a custom control is all fine and good - just be picky about what you store - only store deltas from the declared control state, don't store anything you're... |
Grabbing Users with a specific value in their profile |
|.net|membership|and|roles| |
I'm using membership and roles for authentication in my vb .net application. We have about 5 roles in the application with certain roles filling out a specific profile value. Example is the role is store and the profile value is store number. Obviously if you work for headquarters you don't have a store number so I don... |
|.net|membership|roles| |
you're talking about short circuit evaluation.
Take a look at this article it might help you:
http://beingmarkcohen.com/?p=62
|
not dumb, this isn't something that MySQL does, inserting the empty date values. I do this in perl with a two-step process. First, load all of the data from the query into a hash organised by date. Then, I create a Date::EzDate object and increment it by day, so...
my $current_date = Date::EzDate->new();
... |
The accepted answer is nice but it is **wrong**. Thankfully, the error is a small one. Checking for `IEnumerable` is not enough if you really want to know about the generic version of the interface; there are a lot of classes that implement only the nongeneric interface. I'll give the answer in a minute. First, though,... |
I've used the IsAssignableFrom method when faced with this problem.
Type theTypeWeWant; // From argument or whatever
foreach (object o in myCollection)
{
if (theTypeWeWant.IsAssignableFrom(o.GetType))
return o;
}
Another approach that may or may not work with your problem... |
Writing Solid Code by Steve Maguire. |
C++: When Has The volatile Keyword Ever Helped You? |
|c++|quiz| |
I'd like to know of an example of a problem which was solved by adding the __volatile__ keyword.
I'm sure it has helped *somebody* solve *something*, but I don't know where I would actually apply it.
In my case, it has __never__ been the answer. |
I'm kinda biased as I work on [ActiveMQ](http://activemq.apache.org) but pretty much all of benefits listed for MSMQ above also apply to ActiveMQ really.
Some more benefits of ActiveMQ include
* great support for [cross language client access and multi protocol support](http://activemq.apache.org/cross-language-... |
Exception handling in Delphi |
|delphi|exception| |
Is there a good way to find out which exceptions a procedure/function can raise in Delphi (including it's called procedures/functions)?
In Java you always have to declare which exceptions that can be thrown, but this is not the case in Delphi, which could lead to unhandled exceptions.
Are there any code analysi... |
Multiple return values to indicate success/failure. |
|php|php4| |
**For TCP client side:**
Use gethostbyname to lookup dns name to IP, it will return a hostent structure. Let's call this returned value host.
hostent *host = gethostbyname(HOSTNAME_CSTR);
Fill the socket address structure:
sockaddr_in sock;
sock.sin_family = AF_INET;
sock.sin_port = hton... |
None that I know of using VS 2008 at the moment.
But you might want to check out **[NAnt][1]**. It is made for this kind of work.
[1]: http://nant.sourceforge.net/ |
Do a Google on HoboCopy. It is an open source backup tool for windows that can backup files that are in use using Windows Volume Shadow Service. |
The standard pattern is for your base class to implement IDisposable and the non-virtual Dispose() method, and to implement a virtual Dispose(bool) method, which those classes which hold disposable resources must override. They should always call their base Dispose(bool) method, which will chain up to the top class in ... |
You use a .desktop file for icons under linux. Where to put the icon depends on what distribution and what desktop environment you are using. Since I'm currently running Gnome on Fedora 9, I will answer it in those terms.
An example foo.desktop file would be:
[Desktop Entry]
Encoding=UTF-8
Generic... |
Java Compilation - Is there a way to tell the compiler to ignore parts of my code? |
|java|swing|compilation| |
I maintain a Java Swing application.
For backwards compatibility with java 5 (for Apple machines), we maintain two codebases, 1 using features from Java 6, another without those features.
The code is largely the same, except for 3-4 classes that uses Java 6 features.
I wish to just maintain 1 codebase. Is ther... |
See [wotsit.org][1] for information on file formats for various file types. Example: You can figure out exactly how to write out a .BMP file and how it is composed.
Writing to a database can be done by using a wrapper class in your language, mainly passing it SQL commands.
[1]: http://www.wotsit.org/ |
Yes you can do it, it will be safe
...
until the second programmer comes around and does not understand the same assumptions you have made. That second (or 3rd, 4th, 5th, ...) programmer is likely to start using the object in a non safe way (in the creator thread). The problems caused could be very subtle and diff... |
Yes you can do it, it will be safe
...
until the second programmer comes around and does not understand the same assumptions you have made. That second (or 3rd, 4th, 5th, ...) programmer is likely to start using the object in a non safe way (in the creator thread). The problems caused could be very subtle and diff... |
Why would you need regular expressions here?
INSTR and SUBSTR will do the job perfectly.
But if you convinced you need Regex'es you can use:
[REGEXP\_INSTR](http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions129.htm#i1239887)
[REGEXP\_REPLACE](http://download.oracle.com/docs/cd/B19306_01/... |
I have outlook and gmail, but also a blackberry Curve...
The curve is HORRIBLE at dealing with anything other than plain/text emails. Please have a link near the top to view the email on a website, and consider sending a multipart email that also has a text only section for clients that don't support HTML and such. |
Assistance porting commctrl commands to C# |
|c#|treeview|com| |
In a C++ app, I have an hWnd pointing to a window which contains controls which extend the COM TreeView control.<br>
I use the hWnd to get an HTREEITEM using TreeView_GetRoot(hwnd) from commctrl.h
hwnd points to the window and hItem is return value from TreeView_GetRoot(hwnd). They are used as follows:
int i... |
In a C++ app, I have an hWnd pointing to a window owned by a third party. This window contains controls which extend the COM TreeView control. I am interested in obtaining the CheckState of this control.<br>
I use the hWnd to get an HTREEITEM using TreeView_GetRoot(hwnd) from commctrl.h
hwnd points to the window an... |
|c#|com|treeview| |
In a C++ app, I have an hWnd pointing to a window running in a third party process. This window contains controls which extend the COM TreeView control. I am interested in obtaining the CheckState of this control.<br>
I use the hWnd to get an HTREEITEM using TreeView_GetRoot(hwnd) from commctrl.h
hwnd points to the... |
The previously [accepted answer](#74648) is nice but it is wrong. Thankfully, the error is a small one. Checking for `IEnumerable` is not enough if you really want to know about the generic version of the interface; there are a lot of classes that implement only the nongeneric interface. I'll give the answer in a minut... |
The previously [accepted answer](#74648) is nice but it is wrong. Thankfully, the error is a small one. Checking for `IEnumerable` is not enough if you really want to know about the generic version of the interface; there are a lot of classes that implement only the nongeneric interface. I'll give the answer in a minut... |
strtotime() is useful but it does have some odd behaviors that can pop-up from time to time if you are not just using it to convert a formatted date/time string.
things like "+1 month" or "-3 days" can sometimes not give you what you expect it to output.
|
Here is some T-SQL that gives you the number of years, months, and days since the day specified in @date. It takes into account the fact that DATEDIFF() computes the difference without considering what month or day it is (so the month diff between 8/31 and 9/1 is 1 month) and handles that with a case statement that de... |
I've created a site using the [ASP.NET Login Controls][1] and [Forms Authentication][2] for membership/credentials for an ASP.NET web application. And I'm using a [site map][3] for site navigation.
I have ASP.NET TreeView and Menu navigation controls populated using a SiteMapDataSource. But off-limits administrato... |
If you don't want to send the data in plain text, use encryption !!!
Use some encryption algorithm such as AES, Twofish etc.
You must also take into consideration where your client and server are. If they both are in the same machine, there is no use of using an encryption.
if they are in different machines, u... |
If you don't want to send the data in plain text, use encryption !!!
Use some encryption algorithm such as AES, Twofish etc.
You must also take into consideration where your client and server are. If they both are in the same machine, there is no use of using an encryption. If they are in different machines, use ... |
Smart pointers have a nice way of indicating ownership very clearly. If you're a class or a function:
* if you get a **raw pointer**, you don't own anything. You're allowed to use the pointee, courtesy of your caller, who guarantees that the pointee will stay alive longer than you.
* if you get a **weak_ptr**, ... |
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html
> The META-INF directory
> The following
> files/directories in the META-INF
> directory are recognized and
> interpreted by the Java 2 Platform to
> configure applications, extensions,
> class loaders and services:
>
> * MANIFEST.MF
>
> The man... |
No.
Putting aside the subject of allowing some tags (not really the point of the question), HtmlEncode simply does NOT cover all XSS attacks.
For instance, consider server-generated client-side javascript - the server dynamically outputs htmlencoded values directly into the client-side javascript, htmlencode will... |
Since a lot of people still don't know that you can do:
using (System.IO.StreamReader r = new System.IO.StreamReader(""))
using (System.IO.StreamReader r2 = new System.IO.StreamReader("") {
//code
}
I guess a lot of people still don't know that you can do:
using (System.IO.StreamReade... |
You have to store the values somewhere, so you are limited to the query string and hidden form fields. If you relate that to HTTP, basically it's either GET or POST parameters.
I suppose you could use cookies, but that would be really messy.
|
1. Store your object state in the session context: this will shift the burden of keeping state from the client to the server, which _may_ be acceptable for small-scale intranet apps. For sites on the capital-I Internet, this won't work;
3. AJAX-enable your control: in this case, only state _changes_ need to be po... |
My crystal ball informs me that you have a file named random.py or random.pyc in your working directory. That's shadowing the built-in random module. You need to rename random.py to something like my_random.py and/or remove the random.pyc file.
To tell for sure what's going on, do this:
>>> import random
... |
You probably have a file named random.py or random.pyc in your working directory. That's shadowing the built-in random module. You need to rename random.py to something like my_random.py and/or remove the random.pyc file.
To tell for sure what's going on, do this:
>>> import random
>>> print random.__f... |
If you are willing to consider a debugger other than Visual Studio, [WinDBG][1] can auto-debug child processes (native code only).
[1]: http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx |
I think you still mis-understand controls somewhat. Controls only have the problem you describe when you add them to the page dynamically. If you declare your controls upfront in the aspx code then they build along with the page. |
> rikh Writes:
>> I do my best to always call htmlentities() for anything I am outputing that is derived from user input.
See Joel's essay on [Making Code Look Wrong][1] for help with this
[1]: http://www.joelonsoftware.com/articles/Wrong.html |
Oh, I'm a dumbass, I'm answering a different question from what you asked. When I had to deal with this problem, to fill in missing dates I actually created a reference table that just contained all dates I'm interested in and joined the data table on the date field. It's crude, but it works.
As for output, I'd jus... |
Have you tried adding .aspx to the end of the controller name?
It worked for [this][1].
[1]: http://stackoverflow.com/questions/32757/where-can-i-get-asp-mvc-hosting |
How can I display just a portion of an image in HTML/CSS? |
|html|css|image| |
Let's say I want a way to display just the the center 50x50px of an image that's 250x250px in HTML. How can I do that. Also, is there a way to do this for css:url() references?
<p>
I'm aware of *clip* in CSS, but that seems to only work when used with absolute positioning. |
DannySmurf is correct that you can't hide keys from the person running an application; if the application can get to the keys, so can the person.
However, What you are trying to accomplish exactly?
Depending on what it is, there are often ways to accomplish your goal that don't simply rely on keeping a secret "se... |
The `ArrayList` class in Java has only two data members, a reference to an `Object[]` array and a size—which you need anyway if you don't use an `ArrayList`. So the only advantage to not using an `ArrayList` is saving one object allocation, which is unlikely ever to be a big deal.
If you're creating and disposing of... |
The `ArrayList` class in Java has only two data members, a reference to an `Object[]` array and a size—which you need anyway if you don't use an `ArrayList`. So the only advantage to not using an `ArrayList` is saving one object allocation, which is unlikely ever to be a big deal.
If you're creating and disposing of... |
I too am working on a similar system.
I am going with the gateway/component route. I have looked at several options and settled with this one.
The gateway is basically a component with the specific purpose of bridging Jabber/XMPP with another network. You will have to build most of the things you take for grante... |
Yes you can do it, it will be safe
...
until the second programmer comes around and does not understand the same assumptions you have made. That second (or 3rd, 4th, 5th, ...) programmer is likely to start using the object in a non safe way (in the creator thread). The problems caused could be very subtle and diff... |
Yes you can do it, it will be safe
...
until the second programmer comes around and does not understand the same assumptions you have made. That second (or 3rd, 4th, 5th, ...) programmer is likely to start using the object in a non safe way (in the creator thread). The problems caused could be very subtle and diff... |
Although it has already been said, you can't manipulate PDFs with the built-in libraries of the .NET Framework. I can however recommend [iTextSharp][1], which is a .NET port of the Java iText. I have played around with it, and found it to be a very easy tool to use.
[1]: http:/http://itextsharp.sourceforge.n... |
IIS configurable caching |
|iis|caching|configuration|iis-6|iis7| |
How would one configurably cache files in IIS >= 6?
Example:
- `*.cache.*` => cache nearly forever
- `*.nocache.*` => never cache
An example framework using this naming would be the GWT framework. |
On x86_64, both the Intel compiler and gcc support some intrinsic atomic-operation functions. Here's gcc's documentation of them: http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
The Intel compiler docs also talk about them here: http://softwarecommunity.intel.com/isn/downloads/softwareproducts/pdfs/... |
public class MyVeryBaseClass
{
protected void RealDispose(bool isDisposing)
{
IDisposable tryme = this as IDisposable;
if (tryme != null) // we implement IDisposable
{
this.Dispose();
base.RealDispose(isDisposing);
}
... |