instruction
stringlengths
0
30k
I suggest you take a look at the [SHChangeNotify][1] API call, which can notify you of all kinds of shell events. To monitor file creation and deletion activity, you may want to pay special attention to the SHCNE_CREATE and SHCNE_DELETE arguments. [1]: http://msdn.microsoft.com/en-us/library/bb762118(VS.85).asp...
AspectJ doesn't work well with classes in the Spring Web MVC framework. [Read the bottom of the "Open for extension..." box on the right side of the page][1] Instead, take a look at the [HandlerInterceptor][2] interface. The new Spring MVC Annotations may work as well since then the Controller classes are all P...
AspectJ doesn't work well with classes in the Spring Web MVC framework. [Read the bottom of the "Open for extension..." box on the right side of the page][1] Instead, take a look at the [HandlerInterceptor][2] interface. The new Spring MVC Annotations may work as well since then the Controller classes are all P...
AspectJ doesn't work well with classes in the Spring Web MVC framework. [Read the bottom of the "Open for extension..." box on the right side of the page][1] Instead, take a look at the [HandlerInterceptor][2] interface. The new Spring MVC Annotations may work as well since then the Controller classes are all P...
Basically there are some registry settings you have to set as well as some interfaces to implement. Check out this: http://msdn.microsoft.com/en-us/library/ms685141.aspx You are interested in the SCM (Service Control Manager).
can you use the getpid() function found in unistd.h ? [osx reference][1] [1]: http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/getpid.2.html
PHP Include function outputting unknown char
|php|include|
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, b...
[Google first hit](http://www.prescod.net/rest/rest_vs_soap_overview/) seems pretty comprehensive. I think the problem here is there are too many advocates of one or the other, may be better of googling and getting more of a handle of the pro's/con's yourself and making your own decision. I know that sounds kinda...
[XSS][1] (Cross Site Scripting) Attacks [1]: http://en.wikipedia.org/wiki/Cross-site_scripting
SQL Server (starting with 2000) will install performance counters (viewable from Performance Monitor or Perfmon). One of the counter categories (from a SQL Server 2005 install is:) - SQLServer:Databases With one instance for each database. The counters available however do not provide a CPU % Utilization count...
Assuming finalizers are similar to their .NET namesake then you only really need to call these when you have resources such as file handles that can leak. Most of the time your objects don't have these references so they don't need to be called. It's bad to try to collect the garbage because it's not really your gar...
Obviously test every field for vulnerabilities: * SQL - escape strings (e.g. `mysql_real_escape_string`) * XSS * HTML being printed from input fields (a good sign of XSS usually) * Anything else thatis not the specific purpose that field was created for Search for infinite loops (the only indirect thing (if a ...
The GC does a lot of optimization on when to properly finalize things. So unless you're familiar with how the GC actually works and how it tags generations, manually calling finalize or start GC'ing will probably hurt performance than help. Here's some reasons from an [MSDN article][1]: >* Finalizable objects ...
Have you taken a look at this? http://www.codeplex.com/MvcValidatorToolkit Quoted from the page > The Validator Toolkit provides a set > of validators for the new ASP.NET MVC > framework to validate HTML forms on > the client and server-side using > validation sets. I'm afraid that someone more MVC-savvy ...
@Nathan >Actually, it may be better to check if the first char in the string is '\0': I almost mentioned that, but ended up leaving it out, since calling `strcmp()` with the empty string and directly checking the first character in the string are both O(1). You basically just pay for an extra function call, which ...
Can I copy files to a Network Place from a script or the command line?
|sharepoint|command-line|scripting|powershell|moss|wss|
Is it possible, in Windows XP, to copy files to a Network Place from the command line, a batch file or, even better, a PowerShell script? What sent me down this road of research was trying to publish files to a WSS 3.0 document library from a user's machine. I can't map a drive to the library in question because the...
Yes you can. I suggest using a tool like robocopy.
you could use the 'net' commands to authenticate and then copy the files. copy src \\dest-machine\shared-library-name\dest I'm not *really* sure exactly how to handle authentication if it's needed.
Maybe there is a design problem in your tests. Usually each test must not depend on any other tests, so they can run in any order. Each test needs to instantiate and destroy everything it needs to run, that would be the perfect approach, you should never share objects and states between tests. Can you be more ...
Convert Hex to Decimal efficiently in C
|c|dec|
In C what is the most efficient way to convert a hex value to it's decimal value. For example if I have FFFFFFFE the result would be 4294967294.
Yeah, my question was not very well put. Here's a solution but rather than a single pass with a regex, I use a split and perform iteration. It works as well but isn't as elegant: string xpath = "//foo/bar/baz[1]/ns:foo2/@attr/text()"; string[] nodetests = xpath.Split( new char[] { '/' } ); for (int i = 0; i <...
|.net|bestpractices|
I was writing some ASP.NET control when I came to the scenario where I needed to remove items from a list, only when they matched a certain condition. The RemoveAll method of the generic List class does a good job, but removes _all_ items that match the condition, specified by the predicate. What if I want to only r...
|.net|bestpractices|
|.net|
OOP isn't about creating re-usable classes, its about creating Usable classes.
Is a "Confirm Email" input good practice when user changes email address?
|html|bestpractices|email|forms|confirm|
My organization has a form to allow users to update their email address with us. It's suggested that we have two input boxes for email: the second as an email confirmation. I always copy/paste my email address when faced with the confirmation. I'm assuming most of our users are not so savvy. Regardless, is this...
|html|email|forms|confirm|
Should I provide accessor methods / Getter Setters for public/protected components on a form?
|.net|windowsforms|
If I have .Net Form with a component/object such as a textbox that I need to access from a parent or other form I obviously need to "upgrade" the modifier to this component to an Internal or Public level variable. Now, if I were providing a public variable of an int or string type etc. in my form class I wouldn't th...
|.net|windowsforms|bestpractices|
|.net|bestpractices|winforms|
|.net|winforms|
I've found that using [contracts][1] is a great approach. Metaprogramming contracts are generally lower-level than the types of integration tests you describe, but the two are certainly not mutually exclusive. I find contracts help keep documentation, implementation, and testing all in sync -- this is a major problem...
|java|configuration|data|freeware|plot|real-time|
On a recent JAVA project, we needed a free JAVA based real-time data plotting utility. After much searching, we found this tool called the [Scientific Graphics Toolkit or SGT][1] from NOAA. It seemed pretty robust, but we found out that it wasn't terribly configurable. Or at least not configurable enough to meet our...
I've also had success using [JFreeChart][1] on multiple projects. Also, I agree that it is very configurable. JFreeChart is open source, but they charge for the [developer guide][2]. If you're doing something simple, the sample code is probably good enough. Otherwise, $50 for the developer guide is a pretty good bargai...
I've also had success using [JFreeChart](http://www.jfree.org/jfreechart/) on multiple projects. It is *very* configurable. JFreeChart is open source, but they charge for the [developer guide](http://www.jfree.org/jfreechart/devguide.html). If you're doing something simple, the sample code is probably good enough. Othe...
I've had success using [JFreeChart](http://www.jfree.org/jfreechart/) on multiple projects. It is *very* configurable. JFreeChart is open source, but they charge for the [developer guide](http://www.jfree.org/jfreechart/devguide.html). If you're doing something simple, the sample code is probably good enough. Otherwise...
The throw in your first example has the overhead of the creation of a new CustomException object. The re-throw in your second example will throw an exception of type Exception. The re-throw in your third example will throw an exception of the same type that was thrown by your "some code". So the second and thi...
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, b...
|php|encoding|byte-order-mark|
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, b...
@jelovirt So if I understand this correctly, we concatenate the default answer and the value of the node, and then take the correct subset of the resulting string by testing for the existence of the node to set the offset to either zero or the position right after my default string. That is the most perverse twistin...
Can Mac OS X's SpotLight be configured to ignore certain file types?
|macos|
I've got bunches of auxiliary files that are generated by code and LaTeX documents that I dearly wish *would not* be suggested by SpotLight as potential search candidates. I'm not looking for `example.log`, I'm looking for `example.tex`! So can SpotLight be configured to ignore, say, all `.log` files? (I know, I ...
Can Mac OS X's Spotlight be configured to ignore certain file types?
The GC does a lot of optimization on when to properly finalize things. So unless you're familiar with how the GC actually works and how it tags generations, manually calling finalize or start GC'ing will probably hurt performance than help.
The Decimal data type although precise might not be the optimum choice depending on what you want to do. Generally Direct3D and GPUs use 32-bit floats, and vectors of 3 (total 96 bits) to represent a position in x,y,z. This will usually give more than enough precision unless you need to mix both huge scale (planets...
Process of .Net 1.1 uses the Performance Counters to get the information. Either they are disabled or the user does not have administrative rights. Making sure the Performance Counters are enabled and the user is an administrator should make your code work. Process of .Net 2.0 is not depended on the Performance Coun...
Process of .Net 1.1 uses the Performance Counters to get the information. Either they are disabled or the user does not have administrative rights. Making sure the Performance Counters are enabled and the user is an administrator should make your code work. Actually the "Performance Counter Users Group" should enoug...
I've actually done a small test like this in python on a website I maintain and found that they are almost equivalent in speed, with the procedural approach winning by something like ten-thousandths of a second, but that the OO code was so significantly cleaner I didn't continue the exercise any longer than one iterati...
Anyone using CouchDB?
|database|server|technologies|
I've followed the [CouchDB](http://incubator.apache.org/couchdb/index.html) project with interest over the last couple of years, and see it is now an Apache Incubator project. Prior to that, the CouchDB web site was full of *do not use for production code* type disclaimers, so I'd done no more than keep an eye on it. I...
|database|couchdb|
The default wiki included with Sharepoint doesn't support common wiki features well at all. There is no way to edit a single section of a page, and no way to link directly to a particular section on another page. The backend is in HTML so you lose the ability to edit in plaintext using simple syntax. The diff featur...
Static resources shouldn't be resent unless changed. IIS will send a response code which tells the browser to use the cached version.
Is it possible to be ambikeyboardrous?
|keyboard|dvorak|qwerty|
I switched to the dvorak keyboard layout about a year ago. I now use dvorak full-time at work and at home. Recently, I went on vacation to Peru and found myself in quite a conundrum. Internet cafes were qwerty-only (and Spanish qwerty, at that). I was stuck with a hunt-and-peck routine that grew old fairly quickly. ...
Variable Bindings in WPF
|c#|wpf|data-binding|
I’m creating a UserControl for a rich TreeView (one that has context menus for renaming nodes, adding child nodes, etc.). I want to be able to use this control to manage or navigate any hierarchical data structures I will create. I currently have it working for any data structure that implements the following interface...
I've got bunches of auxiliary files that are generated by code and LaTeX documents that I dearly wish *would not* be suggested by SpotLight as potential search candidates. I'm not looking for `example.log`, I'm looking for `example.tex`! So can Spotlight be configured to ignore, say, all `.log` files? (I know, I ...
I've got bunches of auxiliary files that are generated by code and LaTeX documents that I dearly wish *would not* be suggested by SpotLight as potential search candidates. I'm not looking for `example.log`, I'm looking for `example.tex`! So can Spotlight be configured to ignore, say, all `.log` files? (I know, I ...
There are many tools and libraries available that can automate WinForms testing, ranging from open source solutions like White to the expensive commercial solutions such as HP QuickTest Pro. There is also the UIAutomation namespace in .NET if you want to roll your own automation framework. But the real cost of automati...
1. Take a bunch of data 2. Perform some kind of transformation that converts every datum to another kind of datum 3. Transform those new data into yet simpler data Step 2 is Map. Step 3 is Reduce. For example, 1. Get time between two impulses on a pressure meter on the road 2. Map those times into speeds ba...
Some advantages of LINQ over sprocs: 1. **Type safety**: I think we all understand this. 2. **Abstraction**: This is especially true with [LINQ-to-Entities][1]. This abstraction also allows the framework to add additional improvements that you can easily take advantage of. [PLINQ][2] is an example of adding multi...
Here is the great thing about MVC. It works closer to the base of the framework than normal ASP.NET Web Forms. So by using MVC and understanding it, you will have a better understanding of how WebForms work. The problem with WebForms is there is alot of magic and about 6 years of trying to make the Web work like Win...
Perhaps this is overkill for your case, but I would be tempted to create a "Job" class that takes the tuple as its constructor argument and has respective properties on it. I'd then pass instances of this class around instead.
To impliment a user control you do the following call: <% Html.RenderPartial("~/Views/Shared/MyControl.ascx", {data model object}) %> You may also see the older syntax which as of PR5 is not valid anymore <%= Html.RenderUserControl("~/Views/Shared/MyControl.ascx", {data model object}) %> You will al...
I would use a dictionary. You can convert the tuple to a dictionary this way: values = <querycode> keys = ["jobid", "label", "username"] job = dict([[keys[i], values [i]] for i in xrange(len(values ))]) This will first create an array [["jobid", val1], ["label", val2], ["username", val3]] and then c...
What is a DSL and where should I use it?
|theory|dsl|
I'm hearing more and more about domain specific languages being thrown about and how they change the way you treat business logic, and I've seen Ayende's blog posts and things, but I've never really gotten exactly why I would take my business logic away from the methods and situations I'm using in my provider. If yo...
ASP.Net Webforms is a completely different abstraction over the base framework than ASP.NET MVC. With MVC you've got more control over what happens under the covers than with ASP.NET Webforms. In my opinion learning different ways to do things will usually make you a better programmer but in this case there might be...
I'm not sure if this is an option for you, but if you exclude your temporary folder from VSS (delete the folder inside VSS using the VSS UI), the files that go into it should not get "picked up" again.
I've been using Flex since version 2 and Flex3/BlazeDS since it came out of beta. I also have some experience with Lazzlo and the difference is day and night (Flex rocks!). I have not regretted once using Flex. Regarding FlexBuilder, it is worth every penny. While it is completely possible and reasonable to write F...
I started learning by looking at jQuery extensions to see how other developers work with the jQuery language. It not only helped me to learn jQuery syntax but also taught me how to develop my own extensions.
I'm not entirely sure how your code works, but it seems like you have a small error in your code. On the line you posted in your question you have $link->parent_node(), but in the answer with the entire code snippet you have $link**s**->parent_node(). I don't think the s should be there. Also, I think you should use $l...
How to find out which tags cover which directories?
|cvs|
There is a legacy CVS repository, which contains a large number of directories and sub-directories. There is also a large number of branches and tags that do not necessarilly cover all directories - usually a subset. How can I find out, which branch / tag covers, which directories and, optionally, files? CVS log alr...
There is a legacy CVS repository, which contains a large number of directories, sub-directories, and paths. There is also a large number of branches and tags that do not necessarilly cover all paths & files - usually a subset. How can I find out, which branch / tag covers, which files and paths? CVS log already prov...
How to find out which CVS tags cover which files and paths?
Parsing XML using unix terminal
|xml|unix|shell|parse|csv|
Sometimes I need to quickly extract some arbitrary data from XML files to put into a CSV format. What's your best practices for doing this in the Unix terminal? I would love some code examples, so for instance how can I get the following problem solved? Example XML input: <root> <myel name="Foo" /> ...
|xml|unix|shell|parsing|csv|