instruction stringlengths 0 30k ⌀ |
|---|
:). I jotted down my skirmish with Excel [here][1]. It also has some links that I found after some heavy searching. Hope it helps.
Basically Excel is a pain even though it can be automated.
[1]: http://madcoderspeak.blogspot.com/2006/07/die-die-excel-you-fiend.html |
Polygon fill modes in GDI and GDI+ |
|winapi|gdi+|gdi| |
The system default polygon fill mode in current device context is `ALTERNATE` (as I've learned from the Petzold book on Windows programming) and this one is used in [`Polygon`][1] Win32 function unless you change the mode with [`SetPolyFillMode`][2].
**My question is**:
Does the GDI+ [`Graphics::FillPolygon`][3] (w... |
Jasons answer is certainly the best, but something I've done before is performed a hash comparison on objects that have been serialised to WDDX.
This method is only useful for relatively small arrays, but it's another option if you want to keep it purely CFML. It also has the benefit that you can apply the method t... |
Jasons answer is certainly the best, but something I've done before is performed a hash comparison on objects that have been serialised to WDDX.
This method is only useful for relatively small arrays, but it's another option if you want to keep it purely CFML. It also has the benefit that you can apply the method t... |
I don't know the answer off the top of my head, but you could try finding out by retrieving the fill mode before and after the call. If it's not different, it's either not been changed, or was changed then changed back. |
Sorry to say this, and I'm not trying to be smart, but... **don't put office on the server!!!**
That's if I've understood correctly! :) |
Sorry to say this, and I'm not trying to be smart, but... **don't put office on the server!!!**
That's if I've understood correctly! :)
**EDIT:** Even though I've been marked down for this, I will never *ever* advocate running Office on the server - it has proven **way too** much of a pain in the ass for me in th... |
Code crash in MS Visual Studio 2005 in RELEASE configuration |
|compiler| |
I have a workspace for running an H.263 Video Encoder in a loop for 31 times i.e. the main is executed 31 times to generate 31 different encoded bit streams.This MS Visual Studio 2005 Workspace has all C source files. When i create a "DEBUG" configuration for the workspace and build and execute it, it runs fine, i.e. i... |
I have a workspace for running an H.263 Video Encoder in a loop for 31 times i.e. the main is executed 31 times to generate 31 different encoded bit streams. This MS Visual Studio 2005 Workspace has all C source files. When i create a "DEBUG" configuration for the workspace and build and execute it, it runs fine, i.e. ... |
I think doing something like this is against Microsoft recommended practices. What are you trying to do that requires emptying the Recycle Bin from a Windows service? |
You may want to try using the inttypes.h library that gives you types such as
int32_t int64_t uint64_t etc.
You can then use its macros such as:
uint64_t x;
uint32_t y;
printf("x: %"PRId64", y: %"PRId32"\n", x, y);
This is "guaranteed" to not give you the same trouble as long, unsigned long long etc, since ... |
Advancing through relative dates with strtotime() |
|php| |
I'm trying to use strtotime() to respond to a button click to advance -1 and +1 days (two buttons) relative to the day advanced to on the previous click.
Example: It's the 10th of the month, I click "-1 day" button, and now the date reads as the 9th. I click the "-1 day" button again and now the readout states th... |
|html|editor| |
Is it worth investing time in learning to use emacs? |
|editor|emacs|vim|text-editor| |
Right up front: I do _not_ want to start a religious war.
I've used _vi_ for as long as I can remember, and the few times I've tried to pick up _emacs_ I've been so lost so quickly I've given up. Lots of people find emacs very powerful, however. Its programmability is somewhat legendary. I'm primarily doing Solaris+... |
|emacs|vim|editor|text-editor| |
Recommendations for Javascript Editor on Windows? |
|javascript|editor| |
Are there any good recommendations anyone can provide for a good Javascript editor on Windows?
I currently use combinations of FireBug and TextPad but would hate to miss out on the party if there are better options out there.
Thanks. |
|javascript|editor| |
What Ruby IDE do you prefer? |
|ruby|ide|editor| |
I've been using Eclipse with RDT (not RadRails) a lot lately, and I'm quite happy with it, but I'm wondering if you guys know any decent alternatives. I know NetBeans also supports Ruby these days, but I'm not sure what it has to offer over Eclipse.
Please, list any features you think are brilliant or useful when su... |
I've been using Eclipse with RDT (not RadRails) a lot lately, and I'm quite happy with it, but I'm wondering if you guys know any decent alternatives. I know NetBeans also supports Ruby these days, but I'm not sure what it has to offer over Eclipse.
Please, list any features you think are brilliant or useful when su... |
|ruby|ide|editor| |
Elastic tabstop editors and plugins |
|editor|tabs| |
What win code editors allow the use of [elastic tabstops][1], either natively or through a plugin?
I know about a gedit plugin, but gedit that only works on *nix.
[1]: http://en.wikipedia.org/wiki/Elastic_tabstop |
Can you programmatically restart a j2ee application |
|java|jakarta-ee| |
Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how? |
Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how?
I would like to be able to do it in an app-server-agnostic way, if it is possible.
The application will be run on many different app servers-- basically whatever the client prefers.
If it isn't possible to do ... |
Can you programmatically restart a j2ee application? |
GetLeg() must return Leg to be an override. Your Dog class however, can still return DogLeg objects since they are a child class of Leg. clients can then cast and operate on them as doglegs.
public class ClientObj{
public void doStuff(){
Animal a=getAnimal();
if(a is Dog){
... |
Right, I understand that I can just cast, but that means the client has to know that Dogs have DogLegs. What I'm wondering is if there are technical reasons why this isn't possible, given that an implicit conversion exists. |
I agree with Adam, that even with the limitations that I suggested, it would still be trivial to cheat. Those were just "best effort" suggestions. |
In C#, the common mutex used is the [Monitor][1]. The type is '[System.Threading.Monitor][2]'. It may also be used implicitly via the '[lock(Object)][3]' statement. One example of its use is when constructing a Singleton class.
private static readonly Object instanceLock = new Object();
private static MySin... |
In C#, the common mutex used is the [Monitor][1]. The type is '[System.Threading.Monitor][2]'. It may also be used implicitly via the '[lock(Object)][3]' statement. One example of its use is when constructing a Singleton class.
private static readonly Object instanceLock = new Object();
private static MySin... |
You can still probably access the ToList() method, but since you are unsure of the type, won't this work?
foreach(var myObject in myObjectsList)
foreach(var obj in myObject.ToList())
//do something
Of course this will only work on C# 3.0.
Note that the use of var is merely to remove t... |
Generics are used for static time type checks **not** runtime dispatch. Use inheritance/interfaces for runtime dispatch, use generics for compile-time type guarantees.
interface IMyObjects : IEnumerable<IOtherObjects> {}
abstract class MyObjects<T> : IMyObjects where T : IOtherObjects {}
IEnumera... |
Try using:
log4j.logger.net.sf.hibernate=DEBUG
log4j.logger.org.hibernate=DEBUG
That's the finest level you'll get. If it does not show the information you want, then it's not possible. |
I use `explorer /e,c:\path`.
@[harpo]
`explorer -d c:\path` does not work for me (WinXP sp3). |
I use `explorer /e,c:\path`.
@harpo
`explorer -d c:\path` does not work for me (WinXP sp3). |
See [LAME MP3 Encoder][1]. You can checkout their source code and their [link page][2]. [Mpeg.org][3] should have documents too.
[1]: http://lame.sourceforge.net/
[2]: http://lame.sourceforge.net/links.php
[3]: http://www.mpeg.org/ |
The second requires the spring framework. The only runnable things I could find were a client in eclipse-spring-jdbc-tutorial.zip\SpringJdbc\src\test\de\laliluna\library\TestClient.java and one in eclipse-spring-jdbc-tutorial.zip\SpringJdbc\src\de\laliluna\library\sample\MyApplication.java. If you open it in eclipse (i... |
I am not sure I really understand your question?! There already *is* a managed OleDBProvider?!
using System.Data.OleDb;
I would certainly discourage writing a provider that exists and works absolutely fine! :)
But in answer to your first question, you can of course create your own. The [Data Provider Roadm... |
What are some good Python ORM solutions? |
|python|orm| |
I'm evaluating and looking at using CherryPy for a project that's basically a javascript front-end from the client-side (browser) that talks to a Python web service on the back-end. So, I really need something fast and lightweight on the back-end that I can implement using Python that then speaks to the PostgreSQL db v... |
I am new to all the anonymous features and need some help. I have gotten the following to work:
public void FakeSaveWithMessage(Transaction t) {
t.Message = "I drink goats blood";
}
public delegate void FakeSave(Transaction t);
public void SampleTestFunction() {
...
Expect.Call(delegate { _da... |
On Linux, you would call getrusage and check the returned struct rusage's
ru_isrss member (integral unshared stack size).
From the MINGW site and its sourceforge site's tracking of patches, I see that in May of 2008 there was some patching done around getrusage and it looks like it's been generally supported for qu... |
**Try trigger on logon**
Insted of trying disconnect users you should not allow them to connect.
There is and example of such trigger.
CREATE OR REPLACE TRIGGER rds_logon_trigger
AFTER LOGON ON DATABASE
BEGIN
IF SYS_CONTEXT('USERENV','IP_ADDRESS') not in ('192.168.2.121','192.168.2.123','1... |
This information is hard to really know because I believe a CAPTCHA gets broken long before anybody knows about it. There is economic incentive for those that break them to keep it quiet.
I used to work with a guy whose job revolved mostly around breaking CAPTCHA's and I can tell you the one giving them fits curren... |
> I believe that CAPTCHA is dying. If someone really wants to break it, it will be broken. I read (somewhere, don't remember where) about a site that gave you free porn in exchange for answering CAPTCHAs to they can be rendered obsolete by bots. So, why bother?
Anyone who really wants to break this padlock can use a... |
What is best way to debug Shoes applications? |
|ruby|shoes| |
Shoes has some built in dump commands (Shoes.debug), but are there other tools that can debug the code without injecting debug messages throughout? Something like gdb would be great. |
One thing that helps separate properly is avoiding the "pass local variables from controller to view" anti-pattern. Instead of this:
# app/controllers/foos_controller.rb:
class FoosController < ApplicationController
def show
@foo = Foo.find(...)
end
end
#app/views/foo... |
ContextBound object. If you create a class that extends context bound object and you create a contextattribute you can intercept the calls made to such a property and set the IsDirty. .NET will create a proxy to your class so all calls go over something like a remoting sink.
The problem with such an approach thoug... |
I agree that you should learn about M-x compile (bind that and M-x next-error to a short key sequence).
Learn about the bindings for version control (e.g. vc-diff, vc-next-action, etc.)
Look into registers. You not only can remember locations in buffers but whole window configurations (C-x r w -- window-configur... |
Just put the onclick on the a-tag:
<a href="image.jpg" onclick="Pop(...);return false;"><img ...></a>
Make sure you put the "return false" at the end -- that makes it not follow the anchor link if the js executes.
|
As it's an OS level thing, I don't believe there's an easy way of doing this.
You could try changing your include from `include('Mail.php');` to `include('./Mail.php');`, but I'm not certain if that'll work on a Windows box (not having one with PHP to test on). |
**No. Not without writing considerably more (arcane?) code than the original version** (You'd have to use reflection to check for the attribute on the property and what not.. did I mention it being 'slower').. This is the kind of duplication I can live with.
MS has the same need for [raising events when a property i... |
A true restart is not possible afaik. (Please correct me if I'm wrong!).
However, if you want to set it to 0, you can just delete and recreate it.
If you want to set it to a specific value, you can set the INCREMENT to a negative value and get the next value.
i.e if your sequence is at 500, you can set it to 1... |
Maintainability, and with it, readability, is king. Luckily, shorter very often means more readable.
Here are a few tips I enjoy using to slice and dice code:
- **Variable names**: how would you describe this variable to someone else on your team? You would _not_ say "the numberOfLinesSoFar integer". You wo... |
Until it's properly supported, you'll need to add a class to 'last' items, as suggested. You don't have to do this manually, though. If you can take a javascript hit, take a look at either:
* [the jQuery :last-child selector][1]
* [Keeping Your Elements’ Kids in Line with Offspring][2] (a list apart article by ... |
1. You need safely dispose all COM interop objects after you end your work. By "all" I mean absolutely **all**: collections property values and so on. I've created stack object and pushed objects during their setup:
Stack<object> comObjectsToRelease = new Stack<object>();
...
Log("Creating VBProject o... |
I think you just need to create a window and set the transparency. There is an MFC [CGlassDialog sample on CodeProject][1] that might help you. There is also an [article][2] on how to do this with the Win32 APIs.
[1]: http://www.codeproject.com/KB/dialog/CGlassDialog.aspx
[2]: http://www.codeproject.com/KB/wi... |
I don't know anything about Haskell, but I had this problem in a C project a few months ago.
The best way to execute an external program without any windows popping up is to use the ShellExecuteEx() API function with the "open" verb. If ShellExecuteEx() is available to you in Haskell, then you should be able to ach... |
Response.Redirect(String.Format("nextpage.aspx?{0}", Request.QueryString.ToString().Replace("foo", "mangledfoo")));
I quick hack, saves you little. But foo will not be present for the code awaiting it in nextpge.aspx :) |
Using Makefile instead of Solution/Project files under Visual Studio (2005) |
|visual-studio|makefile| |
Does anyone have experience using makefiles for Visual Studio builds (under VS 2005) as opposed to using the project/solution setup. For us, the way that the project/solutions work is not intuitive and leads to configuruation explosion when you are trying to tweak builds with specific compile time flags.
Under Unix... |
Does anyone have experience using makefiles for Visual Studio C++ builds (under VS 2005) as opposed to using the project/solution setup. For us, the way that the project/solutions work is not intuitive and leads to configuruation explosion when you are trying to tweak builds with specific compile time flags.
Under ... |
One nifty trick that I've recently found is to use PHP's [`create_function()`][1] to create an anonymous/lambda function for one-shot use. It's useful for PHP functions like `array_map()`, `preg_replace_callback()`, or `usort()` that use callbacks for custom processing. It looks pretty much like it does an `eval()` und... |
What does the const operator mean when used with a method in C++? |
|c++| |
Given a declaration like this:
class A {
public
void Foo() const;
};
What does it mean?
Google turns up this:
>Member functions should be declared with the const keyword after them if they can operate on a const (this) object. If the function is not declared const, in can not be appli... |
that will cause the method to not be able to alter any member variables of the object |
In Java or C#, an object cannot change its type once it has been instantiated.
So, if your object need to appear as a different object or behave differently depending on an object state or conditions, then use **Composition**: Refer to [State][1] and [Strategy][2] Design Patterns.
If the object need to be of the ... |
Const functions are not allowed to modify any member variables. For example:
class A
{
int x;
mutable int y;
void f() const
{
x = 1; // error
y = 1; // ok because y is mutable
}
}; |
One option is to build an array of "div-dimension" objects. (Not to be confused with the divs themselves... IE7 perf is frustrating when you read dimensions off of object.)
These objects consist of a pointer to the div, their dimensions (four points... say top, left, bottom, and right), and possibly a dirty bit. (Di... |
Inheritance is very powerful, but you can't force it (see: the [circle-ellipse problem][1]). If you really can't be completely sure of a true "is-a" subtype relationship, then it's best to go with composition.
[1]: http://en.wikipedia.org/wiki/Circle-ellipse_problem |
I'm not sure if this is what you mean, but you can bind custom events and then trigger them.
[http://docs.jquery.com/Events/bind][1]
[1]: http://docs.jquery.com/Events/bind
So add your hover event, script the functionality you need for that hover, then trigger your custom event. |
I recommend looking into the entire [java.util.concurrent][1] package, which have multiple classes for dealing with concurrency and different communication means between threads. All depends on what you want to achieve, as your question is pretty general.
[1]: http://java.sun.com/j2se/1.5.0/docs/api/java/util/co... |
[JSON][1] is a very good alternative, and there are tools for it in multiple languages. And it's really easy to use in web clients, as it is native javascript.
[1]: http://www.json.org/ |
Could you clarify a bit? Do you mean IPC in a single JVM? (Multiple threads, yes, but at an OS-level only one process.) Or do you mean multiple JVMs? (And truly OS-level inter process communications.)
If it is the first, then maybe something out of java.util.concurrent, like [ConcurrentLinkedQueue][1] would do th... |
Could you clarify a bit? Do you mean IPC in a single JVM? (Multiple threads, yes, but at an OS-level only one process.) Or do you mean multiple JVMs? (And truly OS-level inter process communications.)
If it is the first, then maybe something out of **java.util.concurrent**, like [ConcurrentLinkedQueue][1] would d... |
I think [Clearsilver][1] is a very good alternative. They even have a comparison page [here][2] and a list of [projects][3] that use it
[1]: http://www.clearsilver.net/
[2]: http://www.clearsilver.net/docs/compare_w_xmlxslt.hdf
[3]: http://www.clearsilver.net/examples.hdf |
gdb linux arm |
|linux|gdb|arm| |
I have a ARM11 based hardware board which runs a Linux kernel ver. 2.6.21.5-cfs-v19. I have my application running on this ARM-LINUX board. To do sourlce level debugging, of my application i used to use gdb from command prompt of the linux board, that was with some earlier version of the board linux version.
With t... |
What usable alternatives to XML syntax do you know? |