instruction stringlengths 0 30k ⌀ |
|---|
I think the reason you need the static instance of a dependency property is really just because that's how they were designed. The static bit holds all the property metadata - its default value, its owner type (handy if it's an attached property) etc, its callback methods for when it changes - that sort of thing. Makes... |
The problem with most of the above is that they will run out of precision at about 25! (12! with 32 bit ints) or just overflow. Here's a c# implementation to break through these limits!
class Number
{
public Number ()
{
m_number = "0";
}
public Number (string value)
... |
How to make a WCF service STA (single-threaded) |
|.net|web-services|user-interface|wcf|multithreading| |
I have a WCF service which includes UI components, which forces me to be in STA mode.
How do I set the service behaviour to STA-mode? |
I think what John is saying is you can use document.createEvent() to simulate a mousemove at the location you want. If you capture that event, by adding a eventlistener to the body, you can look at the event.target and see what element was at that position. I'm unsure as to what degree IE supports this method, maybe so... |
I think what John is saying is you can use document.createEvent() to simulate a mousemove at the location you want. If you capture that event, by adding a eventlistener to the body, you can look at the event.target and see what element was at that position. I'm unsure as to what degree IE supports this method, maybe so... |
I think what John is saying is that you can use document.createEvent() to simulate a mousemove at the location you want. If you capture that event, by adding an eventlistener to the body, you can look at the event.target and see what element was at that position. I'm unsure as to what degree IE supports this method, ma... |
We have this in our Main() method which traps all unhandled exceptions...
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(UnhandledExceptionCatcher);
Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(Application_UnhandledException);
and then Applicatio... |
We have this in our Main() method which traps all unhandled exceptions...
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(UnhandledExceptionCatcher);
Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(Application_UnhandledException);
and then Applicatio... |
Backing up /etc with source code control can be a big help when you want to revert a change that hosed your system, experiment with changes, or carry changes from one server to another. But subversion's multitude of .svn directories can get in the way for that, not just when searching but in some cases, like *.d folde... |
I've done this off and on for years -- managing (or trying to manage) schema versions. The best approaches depend on the tools you have. If you can get the Quest Software tool "Schema Manager" you'll be in good shape. Oracle has its own, inferior tool that is also called "Schema Manager" (confusing much?) that I don... |
Final code snippet that takes what I hope is the best from all the suggestions:
Function GetIDs(ByVal IDList As String) As List(Of Integer)
Dim SplitIDs() As String = IDList.Split(new Char() {","c}, StringSplitOptions.RemoveEmptyEntries)
GetIDs = new List(Of Integer)(SplitIDs.Length)
D... |
Calling function when program exits in java |
|java|events| |
I would like to save the programs settings everytime the user exits the program. So I need a way to call a function when the user quit the program. How do I do that?
I am using java 1.5. |
There may be a small number of cases where you can use the Rails standard single-table-inheritance model. Perhaps all of the classes in one particular functional grouping have the same fields (or nearly all the same). In that case, take advantage of the DRYness STI offers. When it doesn't make sense, though, use cla... |
It's your lucky day - no need for an add-on!
## How to configure Firefox for automatic NTLM authentication
1. In Firefox, type about:config into the address bar and hit enter. You should see a huge list of configuration properties.
2. Find the setting named network.negotiate-auth.delegation-uris (the easiest way... |
Waveform Visualization in Ruby |
|ruby|audio|mp3|visualization|waveform| |
I'm about to start a project that will record and edit audio files, and I'm looking for a good library (preferably Ruby, but will consider anything other than Java or .NET) for on-the-fly visualization of waveforms.
Does anybody know where I should start my search? |
[Powershell][1]
[1]: http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx |
The application that I maintain and develop for work is an [HTML Application][1] or [HTA][2], linked with a SQL Server 2005 backend. This allows various security restrictions to be "avoided". All the client-side components in the application are done with javascript, including writing files to locally mapped network dr... |
<a href="http://visualstudiomagazine.com/">Visual Studio Magazine</a> has some gems every once in awhile |
Definitely [Your Sinclair][1]. Hands down.
[1]: http://en.wikipedia.org/wiki/Your_Sinclair |
Request.Url.AbsoluteUri
This property does everything you need, all in one susinct call. |
display:inline
float:left
is your problem
Floating makes the parents width not be stretched by the child, try placing the image without the float. If you take the float off, it should give you the desired effect.
Another approach would be to make sure you are clearing your floats at the end of the... |
I use [Console2][1].
I like the tabbed interface and that copy works properly if text breaks at the end of a line.
[1]: http://sourceforge.net/projects/console/ |
Assuming the Item Ids are incrementally numbered:
--Declare a temp table to hold the last step for each item id
DECLARE @LastStepForEach TABLE (
Id int,
Status int,
BatchRef char(10),
ItemCount int)
--Loop counter
DECLARE @count INT;
SET @count = 0;
--Loop through... |
I have not used any of these libraries, but I may be able to give some hints.
1. MPI is a communication protocol while Spread and ØMQ are actual implementation.
2. MPI comes from "parallel" programming while Spread comes from "distributed" programming.
So, it really depends on whether you are trying to build a p... |
Kyle's answer is pretty good. I think the only additional clarification is that the closure is basically a snapshot of the stack at the point that the lambda function is created. Then when the function is re-executed the stack is restored to that state before executing the function. Thus as Kyle mentions, that hidden v... |
Perhaps it would be helpful to know why you want to do this and then try to help solve the original problem... |
I don't see the harm if you know that it's always going to be a simple struct and that you're never going to want to attach behaviour to it. |
From the [documentation][1] (emphasis added):
> The following error types **cannot** be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
Calling undefined functions... |
I have not touched WinForms and .NET for years now, so I can not give you any technical details, but there is the lager picture answer:
**First and foremost - do not bind your form data directly to a database.**
Create a separate data/model layer that you bind your form widgets to.
From there on, you have se... |
This may be a little *too* much support for the offline scenario, but have you considered the "[Microsoft Sync Framework][1]"? Included in the framework is the "Sync Services for ADO.NET 2.0", which allows your application to hit a local SQL Server CE instance. This can easily be synchronized with a central SQL Server ... |
The simple solution is to use
$("#mySelect").change(function() {
document.location = this.value;
});
This creates an onchange event on the select box that redirects you to the url stored in the value field of the selected option. |
This should make sure that you won't get duplicates from multiple records with identical ThingIDs and PriceDateTimes:
SELECT * FROM Thing WHERE Thing.ID IN
(
SELECT MAX(Thing.ID)
FROM Thing
INNER JOIN
(SELECT ThingID, MAX(PriceDateTime) LatestPriceDateTime FROM Thing
WHERE PriceDateTime >= CAST... |
I'm converting the uniqueidentifier to a binary so that I can get a MAX of it.
This should make sure that you won't get duplicates from multiple records with identical ThingIDs and PriceDateTimes:
SELECT * FROM Thing WHERE CONVERT(BINARY(16),Thing.ID) IN
(
SELECT MAX(CONVERT(BINARY(16),Thing.ID))
FROM Thi... |
How to recover a deleted branch in TFS? |
How do you reliably get an IP address via DHCP? |
|linux|dhcp| |
I work with embedded Linux systems that sometimes want to get their IP address from a DHCP server. The DHCP Client client we use ([dhcpcd][1]) has limited retry logic. If our device starts up without any DHCP server available and times out, dhcpcd will exit and the device will never get an IP address until it's reboo... |
Lisp is a large and complex language with a large and complex runtime to support it. For that reason, Lisp is best suited to large and complicated problems.
Now, a *complex* problem isn't the same as a *complicated* one. A *complex* problem is one with a lot of small details, but which isn't hard. Writing an airl... |
Or did you want to just see if a column only has NULL values (and, thus, is probably unused)?
Something like this could work if you had a particular column in mind...
DECLARE @TotalRowCount NUMERIC(15,0)
DECLARE @NullRowCount NUMERIC(15,0)
SELECT @TotalRowCount=count(*) FROM YourTable
SELECT @N... |
|c++|c|midi| |
I want to write C/C++ programs that take input from a MIDI device.
The MIDI device connects to my PC using a USB connector.
I'm looking for a (C/C++ implemented) library that I can use to read the MIDI signals from the MIDI device through the USB port.
I'm happy manipulating the MIDI data once I get it, I ju... |
|c++|c|midi| |
|c++|c|midi|signal-processing| |
|c++|c|midi|signal-processing| |
Regex Library |
|regex| |
Does anyone use have a good regex library that they like to use? Most of the regexes that you find online either contain bugs or are so focused on the edge cases that it turns into a competition to validate whatever spec 100%. Of course you can write your own, but when you are billing by the hour its handy to have a li... |
|regex|needs-editing| |
Pre-built regular expression patterns or Regex Libraries? |
|regex| |
|regex| |
Accessing .NET components from Powershell |
|powershell|components| |
I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to help me fast track this? |
|powershell|components| |
|powershell|components| |
Charting library for Java and .Net |
|.net|java|charts| |
Can anyone recommend a library for chart generation (bar charts, pie charts etc.) which runs on both Java and .Net? |
|.net|java|charts| |
Mixing C/C++ Libraries |
|c++|visual-studio|gcc|linker| |
Is it possible for gcc to link against a library that was created with Visual C++? If so, are there any conflicts/problems that might arise from doing so? |
|c++|visual-studio|gcc|linker| |
What is the best EXIF library for .Net? |
|version-control|tfs| |
I deleted a branch in TFS and just found out that I need the changes that were on it.
How do I recover the branch or the changes done on it? |
Assuming you have the necessary privileges to run svnadmin, you need to use the [dump][1] and [load][2] commands.
[1]: http://svnbook.red-bean.com/en/1.4/svn.ref.svnadmin.c.dump.html
[2]: http://svnbook.red-bean.com/en/1.4/svn.ref.svnadmin.c.load.html |
Answer depends on type of your application. There are applications that can work offline - Microsoft Outlook for example. Such applications doesn't treat connectivity exceptions as critical, they can save your work locally and synchronize it later. Another applications such as online games will treat communication prob... |
VB.Net FormatNumber equivalent in C#? |
|c#|.net|vb.net| |
Is there a C# equivelent for the VB.Net FormatNumber function?
i.e.:
JSArrayString += "^" + (String)FormatNumber(inv.RRP * oCountry.ExchangeRate, 2);
|
Note that, in Antti's example you'd probably want to add a catch for any absolute links you may have to your own domain, which you probably **don't** want to flag as 'external', e.g.:
a[href^="http://your.domain.com"]
{
background: none;
padding: 0;
}
And you'd want this **after** ... |
[tcptraceroute](http://michael.toren.net/code/tcptraceroute/) |
You might find some help on migrating svn repositories here: [Migrating a repository](http://svnbook.red-bean.com/en/1.0/ch05s03.html#svn-ch-5-sect-3.5)
This approach requires access to svnadmin. |
`set_error_handler` is designed to handle errors with codes of: `E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE`. This is because `set_error_handler` is meant to be a method of reporting errors thrown by the *user* error function `trigger_error`.
However, I did find this comment in the manual that may help you:
>"... |
If you're using Linux, try [Virtual Distributed Ethermet][1] (VDE).
VDE gives you virtualised switches/hubs and Ethernet cables. You can tune network characteristics such as latency, delay, MTU, errored bits per MB, bandwidth, duplicates, etc on individual cables - all in real time!
[1]: http://vde.sourceforge.... |
I would say you should have as many as required, or any that make the code cleaner (such as [guard clauses](http://www.refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html)).
I have personally never heard/seen any "best practices" say that you should have only one return statement.
For the most p... |
One good reason I can think of is for code maintenance: you have a single point of exit. If you want to change the format of the result,..., it's just much simpler to implement. Also, for debugging, you can just stick a breakpoint there :)
Having said that, I once had to work in a library where the coding standards ... |
I often have several statements at the start of a method to return for "easy" situations. For example, this:
public void DoStuff(Foo foo)
{
if (foo != null)
{
...
}
}
... can be made more readable (IMHO) like this:
public void DoStuff(Foo foo)
{
... |
The [Gardens Point Parser Generator](http://plas.fit.qut.edu.au/gppg/) looks good, however I've not had a chance to try it myself. |
[Tutorials in G][1], also check out the [webring][2].
-Adam
[1]: http://www.cipce.rpi.edu/programs/remote_experiment/labview/
[2]: http://c.webring.com/hub?ring=labview |
I imagine you'd want something like a tree with a list of children, as described [here][1].
[1]: http://csus.cs.mcgill.ca/wiki/COMP-302_(Panangaden%2C_Pientka%2C_Winter_06)_Lectures#Trees_with_a_list_of_children |
One way to do it, is to create a new empty masterpage/aspx-file and then copy-paste the code you allready have into that page. That will take care of all the wire-up and creating of code-files. |
@Brian Leahy
Obviously if you are only operating on it as a Leg there is no need or reason to cast. But if there is some DogLeg or Dog specific behavior, there are sometimes reasons that the cast is neccessary. |
The concept that is causing you problems is described at <http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)> |
You said multiple instances of one application, so we're talking about two program.exe's running, right? The lock statement won't lock across multiple programs, just within the program. If you want a true Mutex, look at the <a href="http://msdn.microsoft.com/en-us/library/system.threading.mutex.aspx">System.Threading.M... |
Your only hopes are a strong school honor code and human proctoring of the room where the test is being given.
As many other posters have said, you can't control the student's computer, and you certainly can't keep them from using a second computer or an iPhone along side the one being used for the test -- note th... |
Regarding UPnP: be aware that not all routers support UPnP. And if they do it could be switched off (for security reasons). So your solution might not always work.
You should also have a look at NatPMP.
A simple library for UPnP can be found at [http://miniupnp.free.fr/][1], though it's in C...
[1]: http:... |
I'd argue the only difference is syntax: MySingleton.Current.Whatever() vs MySingleton.Whatever(). The state, as David mentioned, is ultimately "static" in either case. |
I'd argue the only difference is syntax: MySingleton.Current.Whatever() vs MySingleton.Whatever(). The state, as David mentioned, is ultimately "static" in either case.
----------
EDIT: The bury brigade came over from digg ... anyhow, I thought of a case that would require a singleton. Static classes cannot inhe... |
@proudgeekdad:
Is this an ASP.NET app or a windows forms app running on multiple machines? |
@proudgeekdad:
Is this an ASP.NET app or a windows forms app running on multiple machines?
If it's an ASP.NET app then just encrypt the connection strings section of your web.config.
If it's a client app running on multiple machines, instead of storing the connection string locally, consider using a web servi... |
@proudgeekdad:
Is this an ASP.NET app or a windows forms app running on multiple machines?
If it's an ASP.NET app then just encrypt the connection strings section of your web.config.
If it's a client app running on multiple machines, instead of storing the connection string locally, consider using a web servi... |