instruction stringlengths 0 30k ⌀ |
|---|
|c#|winapi|hardware|keyboard|hook| |
I have a system where I have multiple keyboards and really need to know which keyboard the key stroke is coming from. To explain the set up:
1. I have a normal PC and USB keyboard
2. I have an external VGA screen with some hard-keys
3. The hard keys are mapped as a standard USB keyboard, sending a limited number ... |
I personally mark most methods and properties virtual. I use proxies and lazy loading alot, so I don't want to have to worry about changing things at a later date. |
I've had success using **[DoxyGen][1]** to generate documentation from the XML comments in my projects - a byproduct of this is a nice, hyperlinked list of classes.
[1]: http://www.stack.nl/~dimitri/doxygen/ |
XStream is a serialization library I used for serialization to XML. It should be possible and rather easy to extend it so that it writes Java code. |
You should set the icon ID to something other than 0:
'icon_resources': [(42, 'my_icon.ico')]
Windows resource IDs must be between 1 and 32767. |
Im am not sure if this is what you want
public abstarct class Player
{
int position;
DecisionMaker decisionDependency;
...
public void TakeTurn()
{
position += RollDice();
GameOption option GetOptions(position);
MakeDescion(option);
}
protected int RollDice... |
Well, there actually is a length method, it is just hidden:
>>> a_list = [1, 2, 3]
>>> a_list.__len__()
3
The len() built-in function appears to be simply a wrapper for a call to the hidden __len__() method of the object.
Not sure why they made the decision to implement things this way though. |
If the job names are known ahead of time, you could include the job name when you do the getLogger() call. You then can bind different appenders to different loggers, with separate file names (or other destinations).
If you cannot know the job name ahead of time, you could configure the logger at runtime instead of... |
Best way to handle it would be to make a nice CSS document that will specify all the areas that you would like to offer customization, such as header background image, background and text colors, etc. Then build application code to allow specification of which theme to load, and bring up that CSS file. |
Can you pass a Java system property for each job? If so, you can parameterize like this:
java -Dmy_var=somevalue my.job.Classname
And then in your log4j.properties:
log4j.appender.A.File=${my_var}/A.log
You could populate the Java system property with a value from the host's environment (for exampl... |
Posting a string:
curl -d "String to post" "http://www.example.com/target"
Posting the contents of a file:
curl -d @soap.xml "http://www.example.com/target" |
This question may be related to [what-are-some-good-java-rdf-libraries][1]
[1]: http://stackoverflow.com/questions/73445/what-are-some-good-java-rdf-libraries |
You can make the Ctrl-A increment in windows by opening up the 'mswin.vim' file in your vim directory and finding the section that looks like:
" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
... |
My biggest issue with the background worker class is that there really is no way to know when the worker has finished due to cancellation. The BackgroundWorker does not expose the thread it uses so you can't use the standard techniques for synchronizing thread termination (join, etc.). You also can't just wait in a loo... |
What is the most effective tool you've used to track changes in a CVS repository? |
|cvs|version-control| |
I'm in Quality Assurance and use Fisheye to track checkins to CVS. What other options do people use? |
I'm in Quality Assurance and use Fisheye to track checkins to CVS. What other options do people use?
We have tens of thousands of files and have plans for migrating to Team Foundation Server's code management tool 'at some point' When we do that, there will be lots of information that will be available. |
I think you can create outlets on each one and cross-bind them so that they each have the same data all the time. If there's one model object they need to share, that's pretty tidy. I don't actually know how to do this; I think I saw it in an iPhone tutorial one time! |
Unpivot xml doc based on attributes using XSLT |
|xslt|unpivot| |
I have a simple xml document that looks like the following snippet. I need to write a XSLT transform that basically 'unpivots' this document based on some of the attributes.
<?xml version="1.0" encoding="utf-8" ?>
<root xmlns:z="foo">
<z:row A="1" X="2" Y="n1" Z="500"/>
<z:row A="2" X="5" ... |
Hrm.
Taking a WAG (Wild Ass Guess), it looks to me like LINQ - SQL is trying to find an object with an id that doesn't exist, based somehow on the creation of the JobMaster class. Are there foreign keys related to that table such that LINQ to SQL would attempt to fetch an instance of a class, which may not exist? Yo... |
I highly recommend that you take a look at [MVC for ASP.NET][1] if you want to make unit testing a high priority in your development process. It sounds like it is perfect for what you are trying to do.
[1]: http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx |
I highly recommend that you take a look at [MVC for ASP.NET][1] if you want to make unit testing a high priority in your development process. It sounds like it is perfect for what you are trying to do.
I would also recommend [CruiseControl.NET][2] for continuous integration (this is important even as a single devel... |
What are the relative strengths and weaknesses of Git, Mercurial, and Bazaar? |
|configurationmanagement|versioncontrol|subversion|git|mercurial| |
What do folks here see as the relative strengths and weaknesses of Git, Mercurial, and Bazaar?
In considering each of them with one another and against version control systems like SVN and Perforce, what issues should be considered?
In planning a migration from SVN to one of these distributed version control syst... |
|subversion|git|mercurial|source-control|version-control| |
|subversion|git|mercurial|version-control|bazaar| |
|svn|version-control|git|mercurial|bazaar| |
in this second example, if you would define your struct as a
struct foo { unsigned x:12} f;
and then write a value like 1 into f.x - it uses 2 Bytes because of the alignment. If you do an assignment like
f.x = 1;
and this returns the assigned value. This is quite similar to
int a, b, c;
... |
If you can create an *inner* class of MyClass (call it MyInnerClass) that derives from FrameworkElement while retaining the capability to access an enclosing MyClass object, your problem will be solved. You can then implement a 'getListener' method within MyClass that returns the embedded MyInnerClass that you will use... |
How do I export the Bazaar history of a subfolder |
|bazaar| |
I'm coding a framework along with a project which uses this framework. The project is a Bazaar repository, with the framework in a subfolder below the project.
I want to give the framework a Bazaar repository of its own. How do I do it? |
|bazaar| |
What I would do is this:
1. The constraint is CASCADE
2. The application checks if preferences exist.
3. If they do, show the warning.
4. If no preferences exist, or the warning is accepted, delete the client.
Changing database relationships on the fly is not going to be a good idea!!
Cheers,
RB. |
How do DVCSs (DRCSs) work? |
|dvcs|bazaar| |
I have been hearing a lot of good things about DVCS systems, in particular about bazaar. Apart from the concept of distributed repository, I see two main advantages being touted: the merge is better automated, and the rename is handled right.
Could someone please point me at some text explaining how exactly the impr... |
I believe the issue at hand is that is the statement was skipped, and you tried to use the var elsewhere, it wouldn't be declared. |
You can declare variables within a switch statement *if* you start a new block:
switch (thing)
{
case A:
{
int i = 0; // Completely legal
}
break;
}
The reason is to do with allocating (and reclaiming) space on teh stack for storage of the local variable(s). |
You can't do this, because `case` labels are actually just entry points into the containing block.
This is most clearly illustrated by [Duff's device][1]. Here's some code from Wikipedia:
strcpy(char *to, char *from, int count) {
int n = (count + 7) / 8;
switch (count % 8) {
case 0:... |
newVal exists in the entire scope of the switch but is only initialised if the VAL limb is hit. If you create a block around the code in VAL it should be OK. |
@BKimmel - It won't work since this is in silverlight and apparently that part of the grid column has not yet been worked on. In the XAML of the page it doesn't show up with the attribute for sortmode on the columns, and in the backend code, it doesn't recognize it as it isn't a web control, it's a silverlight control... |
The entire section of the switch is a single declaration context. You can't declare a variable in a case statement like that. Try this instead:
switch (val)
{
case VAL:
{
// This will work
int newVal = 42;
break;
}
case ANOTHER_VAL:
...
break;
... |
We had a similar issue with our CC implementation.
Our solution... We had already crafted a 3:00 AM nightly build that executed longer running integration tests in addition to the base unit tests. We simply decided to make that 3:00 AM build a fully clean build on a fresh tree. As it was the middle of the night, i... |
Case statements are only 'labels'. This means the compiler will interpret this as a jump directly to the label.The problem here is one of scope. Your curly brackets define the scope as everything inside the 'switch' statement. This means that you are left with a scope where a jump will be performed further into the cod... |
Deepzoom for WPF |
|wpf|silverlight|deepzoom| |
Are there any ports to WPF of Silverlight's MultiScaleImage (aka DeepZoom)? Have Microsoft road-mapped this at all for WPF?
I want to move from WinForms to WPF and require something like DeepZoom, using Silverlight isn't an option. |
It's a bug reported in [bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=201307)
Apparently a work-around (with mixed reports of success..) is to [disable smooth-scrolling](http://ubuntuforums.org/showpost.php?s=6a1b84b5381937fac2f478508203098e&p=3675924&postcount=6)
> Just disable smooth scrolling in Edit ... |
How to import module from file name |
|python|configuration| |
How can I load a python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
|
The most straightforward answer is that TFS doesn't scale DOWN well enough for it to be worthwhile. TFS is very much aimed at development teams of medium, large, and huge sizes, it's not designed well for very small teams.
Also, on the small scale there are already pretty high quality free, or inexpensive, source co... |
It depends on what the method relies on, but assuming it is a static method or that it does not rely on the Page Lifecycle to work, you could expose a webservice endpoint and hit that with whichever Javascript calling mechanism you would like to use. |
it eats CPU because the browser has to repaint the entire viewport every scroll change rather than just the newly visible area |
Using jQuery, it's as simple as:
$("a").each(function() {
var link = $(this);
var top = link.offset().top;
var left = link.offset().left;
var width = link.offset.width();
var height = link.offset.height();
});
|
We are using an action filter for this.
...
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var controller = (Controller) filterContext.Controller;
Breadcrumb[] breadcrumbs = _breadcrumbManager.PushBreadcrumb(_breadcrumbLinkText);
controller.ViewData.Add(breadcrumb... |
I'd personally go for a CSS-based solution.
You could define the elements' IDs and CSS classes for each page in the web application, so that customers can provide their own set of CSS files.
This approach is platform-agnostic, so that the developer who creates the custom themes is not forced to fit into the ASP.N... |
You could programmatically configure log4j, just for the filename. |
You could programmatically configure log4j when you initialize the job.
You can also set the log4j.properties file at runtime via a system property. From the [manual][1]:
> Set the resource string variable to the value of the _log4j.configuration_ system property. The preferred way to specify the default initiali... |
I'd start with the [official community forum][1] for SlickEdit macros.
[1]: http://community.slickedit.com/index.php?board=4.0 |
Perhaps the GET variables are arrays themselves? i.e. http://site.com?var[]=1&var[]=2 |
In most browsers the full url is used.
In some browsers, if you have a query in the url, the document will never be cached. |
Use the compiler flag -fno-strict-aliasing.
With strict aliasing enabled, as it is by default for at least -O3, in the line:
size_t t = *((size_t*)&f);
the compiler assumes that the size_t* does NOT point to the same memory area as the float*. As far as I know, this is standards-compliant behaviour. If I r... |
Use the compiler flag -fno-strict-aliasing.
With strict aliasing enabled, as it is by default for at least -O3, in the line:
size_t t = *((size_t*)&f);
the compiler assumes that the size_t\* does NOT point to the same memory area as the float*. As far as I know, this is standards-compliant behaviour (adher... |
div's and css positioning allow a more flexible design, leading to easier modification and templating of your web pages.
That said, if you aren't interested in the flexibility then using a table rather than some divs that are morphed into a table by css is definitly a lot easier and quicker to knock up. I tend to us... |
If you open the "Class View" dialogue (View -> Class View or Ctrl+W, C) you can get a list of all of the classes in your project which you can then select and copy to the clipboard. The copy will send the fully qualified (i.e. with complete namespace) names of all classes that you have selected. |
You might try the following papers to get started with the concept of fingerprinting:
* [Winnowing: Local Algorithms for Document Fingerprinting](http://theory.stanford.edu/~aiken/publications/papers/sigmod03.pdf)
* [Scalable Document Fingerprinting](http://www.cs.cmu.edu/afs/cs/user/nch/www/koala/main.html) |
It seems that `mysql_real_escape_string` is binary-safe - the documentation states:
> If binary data is to be inserted, this function must be used.
I think it's probably safer to always use `mysql_real_escape_string` than addslashes. |
If you're on framework 3.5, it looks like there's a method on the DataGridView to process the delete key.
<http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.processdeletekey.aspx>
Otherwise, I would suggest capturing the form keypress event and working backwards to get the active/selected ... |
i need to write code in python for comparing text of two documents uning fingerprint techniques |
|pthon| |
I need to write code in python language for comparing the text of document uning fingerprint techniques. I do not know to take fingerprint of a document or to generate fingerprint of a document. Please if anyone know the method or have a source code for generating fingerprints of documents which is stored in bits form.... |
|python|diff| |
|python|diff| |
Maybe you can write an XSL/XSLT to display only the class names from the XML generated by the XML documentation, if you have any. |
While not answering your question, I will say that I have been in a similar position.
I realised that code samples in C# were awkward when I was really starting out in .NET, but a few weeks into my first project (after I grown more familiar with the .NET framework and VB.NET itself), I found that it was interesting ... |
<blockquote><p><code>string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] )</code><br />
<code>mysql_real_escape_string()</code> calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.</p></blo... |
JIRA - Updating summary from post function |
|java|jira| |
How to update summary field's value from post function in JIRA? |
How do you update a summary field's value from post function in JIRA? |
If you just need to know that it changed, rather than specifically that this is a later version or how many changes there have been, consider using a `rowversion` column. |
Perhaps it is attaching to "the wrong kind" of code.
In the "Attach to Process" dialog, there is a setting that allows you to select the kind of code you want to debug. Try clicking "Select" button next to "Attach to" text box and checking only "Managed code".
Most of the time, leaving "automatically determine th... |
Perhaps it is attaching to "the wrong kind" of code.
In the "Attach to Process" dialog, there is a setting that allows you to select the kind of code you want to debug. Try clicking "Select" button next to "Attach to" text box and checking only <s>"Managed code"</s> the relevant code type.
<img src="http://img204... |
Perhaps it is attaching to "the wrong kind" of code.
In the "Attach to Process" dialog, there is a setting that allows you to select the kind of code you want to debug. Try clicking "Select" button next to "Attach to" text box and checking only <s>"Managed code"</s> the relevant code type.
<img width="600" src="h... |
Perhaps it is attaching to "the wrong kind" of code.
In the "Attach to Process" dialog, there is a setting that allows you to select the kind of code you want to debug. Try clicking "Select" button next to "Attach to" text box and checking only <s>"Managed code"</s> the relevant code type.
<img src="http://img204... |
I highly recommend that you take a look at [MVC for ASP.NET][1] if you want to make unit testing a high priority in your development process. It sounds like it is perfect for what you are trying to do.
I would also recommend [CruiseControl.NET][2] for continuous integration (this is important if your team is going ... |
I don't have my Mac in front of me currently since I'm at work, but would it be possible to bind an instance of one delegate to a member of the other delegate? This would be similar to binding an NSArrayController to a member of another controller class, for example.
However, depending on what the delegate classes a... |
Open each page in the browser and save them as .htm files. Compare the two using windiff. |
var x = {"hdrs": ["Make","Model","Year"],
"data" : [
{"Make":"Honda","Model":"Accord","Year":"2008"}
{"Make":"Toyota","Model":"Corolla","Year":"2008"}
{"Make":"Honda","Model":"Pilot","Year":"2008"}]
};
x.data[0].Make == "Honda"
x['data'][0]['Make'] == "Honda"
You... |
There's a handy set of [comparison charts][1] on microsoft.com.
It depends on the particular express edition, of course (since there are several and they have different features).
Here's a list of features that are in Visual Studio 2008 Standard Edition but are in none of the express editions:
- Add-Ins
... |
ORA-03113: end-of-file on communication channel after long inactivity in ASP.Net app |
|oracle-database|odp.net|oracleexception| |
I've got a load-balanced (not using Session state) ASP.Net 2.0 app on IIS5 running back to a single Oracle 10g server, using version 10.1.0.301 of the ODAC/ODP.Net drivers. After a long period of inactivity (a few hours), the application, seemingly randomly, will throw an Oracle exception:
Exception: ORA-03113:... |