instruction
stringlengths
0
30k
Most payment processors provide either a testing number (PayPal does this) or the ability to go into testing mode (in which no transactions actually get processed). Consult the documentation.
Virtualizing treelistview?
|.net|winforms|wpf|
Does anyone know of a good way to display hierarchical data with columns? It has to be virtualizing, as it must be able to handle several million records. It should also be multi-select, most treeview controls are not. Winforms preferred, but will ElementHost WPF if necessary.
It looks like you can use [GetFileInformationByHandleEx()](http://msdn.microsoft.com/en-us/library/aa364953.aspx) to get this information. You'll likely want to do something like: GetFileInformationByHandleEx( fileHandle, FILE_NAME_INFO, lpFileInformation, sizeof(FILE_NAME_INFO)); Double check the MSDN pag...
*edit* Thanks for the comments about this being Vista or Server 2008 only. I missed that in the page. Guess I should have read the *whole* article ;) It looks like you can use [GetFileInformationByHandleEx()](http://msdn.microsoft.com/en-us/library/aa364953.aspx) to get this information. You'll likely want to do ...
Just off the top of my head... int mask = 1 << 31; (a & mask) ^ (b & mask) < 0;
What are the C# documentation tags?
|c#|xml|documentation|
In C# documentation tags allow you to produce output similar to MSDN. What are a list of allowable tags for use inside the /// (triple slash) comment area above classes, methods, and properties?
If they're all working on the same product, probably Perforce. If there are lots of smaller projects (2 to 50), I'd run several Subversion (SVN) boxes.
- unit test are more code to write, thus a higher upfront cost of development - it is more code to maintain - additional learning required
System.Diagnostics.Process.GetCurrentProcess.Modules gives you all the modules loaded in the current process. This also includes the unmanaged win32 dlls. You can search through the collection and check the FileVersionInfo property for the loaded version.
shuffle($arr); :) edit: I should clarify... my definition of best involves not just algorithm efficiency but code readability and maintainability as well. Using standard library functions means maintaining less code and reading much less too. Beyond that, you can get into year-long debates with PhD professors about ...
I have checked the code over in the files you have sent me (thanks again for sending them through). **Note: I have not tested this since I have not installed the database etc..** However, I am pretty sure this is the issue. You need to set the _MembershipProvider_ Property for your ASP.NET controls. Making the...
I have checked the code over in the files you have sent me (thanks again for sending them through). **Note: I have not tested this since I have not installed the database etc..** However, I am pretty sure this is the issue. You need to set the _MembershipProvider_ Property for your ASP.NET controls. Making the...
This is another way to do it, though the sibling selector answer is pretty cool: var next = $('#active').next('.a'); var prev = $('#active').prev('.a'); **Edit:** I re-read your requirements and this isn't quite what you want. You could use nextAll and prevAll, but those, too, would not stop at the IMGs ...
I've answered this in another post : [About eager loading][1]. In your case it would probably be something like : DataLoadOptions options = new DataLoadOptions(); options.LoadWith<Post>(p => p.PostTag); options.LoadWith<PostTag>(pt => pt.Tag); Though be careful - the DataLoadOptions must be set...
Check the multi-byte string functions [here][1] [1]: http://be.php.net/manual/en/ref.mbstring.php
If the text that you are parsing is made up of repeated strings and tokens, break the file into chunks and for each chunk you could have one thread pre-parse it into tokens consisting of keywords, "punctuation", ID strings, and values. String compares and lookups can be quite expensive and passing this off to several ...
You want split, from the shlex module. >>> import shlex >>> shlex.split('this is "a test"') ['this', 'is', 'a test'] It has some idiosyncrasies, but it should do what you want.
Have a look at the `shlex` module, particularly `shlex.split`. > `>>> import shlex` > `>>> shlex.split('This is "a test"')` > `['This', 'is', 'a test']`
Install [uptimed][1]. It does exactly what you want. [1]: http://podgorny.cz/moin/Uptimed
Install [uptimed][1]. It does exactly what you want. Edit: You can apparantly include it in a PHP page as easily as this: <? system("/usr/local/bin/uprecords -a -B"); ?> [Examples][2] [1]: http://podgorny.cz/moin/Uptimed [2]: http://www.robertjohnkaper.com/software/uptimed/example.html
Architect Database to Allow App To Use Windows Integrated Auth or FBA
|asp.net|authentication|
I'm writing a web app that will be distributed and I want to allow the installer to choose between using Integrated Authentication, or FBA. Switching between those with web.config is obviously very easy. I'm trying to decide how best to architect the database and code to accept either a windows-sid or a UserID from t...
This will make all the Java purists cringe (which is fun, heh heh) but i would use the C preprocessor, put #ifdefs in my source. A makefile, rakefile, or whatever controls your build, would have to run cpp to make a temporary files to feed the compiler. I have no idea if ant could be made to do this. While stac...
I think this would do it: SELECT choice, count(*) FROM votes v WHERE ( SELECT count(*) FROM votes v2 WHERE v.email = v2.email AND v.ip = v2.ip AND v2.timestamp BETWEEN dateadd(hour, -1, v.timestamp) AND v.timestamp ) < 2 FYI,...
Yes, it could have to do with abstract classes and inheritance. It sometimes can mess with serialization. Also, it could be visibility of the classes and class hierarchy as well if everything is not public.
Trac and Subversion have a pretty nice integration that lets you link Trac tickets to SVN change sets and vice-versa (SVN change sets can actually move a Trac ticket to a new state).
Rendering suggested values from an ext Combobox to an element in the DOM
|javascript|ext|
I have an ext combobox which uses a store to suggest values to a user as they type. An example of which can be found here: [combobox example][1] Is there a way of making it so the **suggested text list** is rendered to an element in the DOM. Please note I do not mean the "applyTo" config option, as this would re...
First, to solve your problem,, I believe using backticks around set and parsing it yourself will work. On my Windows system, this script worked just fine. my %env = map {/(.*?)=(.*)/;} `set`; print join(' ', sort keys %env); In the camel book, the advice in Chapter 25: Portable Perl, the System Interacti...
if (a*b < 0) sign is different, else sign is the same (or a or b is zero)
Depending on your payment gateway, there are two ways to test a transaction. For example, with authorize.net, if you send "X_TEST_TRANSACTION=true" (or something like that, its been a long time), with your POST, it will run it in test mode. They also provide a test VISA and test Mastercard number that will always...
I have used [SWIG](http://www.swig.org/) to make an interface from C++ to Java or Python and then used the typical web interface support for those languages. Since Java and Python have reflection the web services frameworks that exist for them have a much easier time passing data around. Threading wise if your C+...
How to increment in vim under windows (where CTRL-A does not work...)
|vim|
While CTRL-X works fine in vim under windows, CTRL-A selects all (duh). Is there a way to increment a number with a keystroke under windows?
In my experience, yes. The [DOM spec][1] isn't any clearer. If your paranoid, try something like current = node.firstChild; while(null != current) { ... current = current.nextSibling } [1]: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1451460987
In my experience, yes. The [DOM spec][1] isn't any clearer. If your paranoid, try something like current = node.firstChild; while(null != current) { ... current = current.nextSibling; } [1]: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1451460987
In my experience, yes. The [DOM spec][1] isn't any clearer. If you're paranoid, try something like current = node.firstChild; while(null != current) { ... current = current.nextSibling; } [1]: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1451460987
What are some Search Servers out there?
|search|full-text-search|solr|search-server|
I'm looking to find alternatives to [Solr][1] from the Apache Software Foundation. For those that don't know, Solr is an enterprise search server. A client application uses a web-services like interface to submit documents for indexing and also to perform search queries. Solr has other features built in like cachin...
It looks like you've got a bunch of form items you'd like to show in a list, right? Hmm... if only those HTML spec guys had thought to include markup to handle a list of items... I'd recommend you set it up like this: <form> <ul> <li><label>Thingy 1:</label><input class="a" type="text" name="o...
Perforce is a decent system, and scales well. I'm working at an organization of about 5000 employees, and perforce is a fast and efficient system. It scales well, has good branch support, has atomic commits. Each change has a change number that can be used for "software archaeology" and a host of other great fea...
Similarity between line strings
|algorithm|gis|
I have a number of tracks recorded by a GPS, which more formally can be described as a number of line strings. Now, some of the recorded tracks might be recordings of the same route, but because of inaccurasies in the GPS system, the fact that the recordings were made on separate occasions and that they might have b...
I have a number of tracks recorded by a GPS, which more formally can be described as a number of line strings. Now, some of the recorded tracks might be recordings of the same route, but because of inaccurasies in the GPS system, the fact that the recordings were made on separate occasions and that they might have b...
MSDN article from 2002 detailing all the tags and when to use them: [http://msdn.microsoft.com/en-us/magazine/cc302121.aspx][1] [1]: http://msdn.microsoft.com/en-us/magazine/cc302121.aspx
Adding one or both of the following #defines will exclude often unnecessary header files and may substantially improve compile times especially if the code that is not using Windows API functions. #define WIN32_LEAN_AND_MEAN #define VC_EXTRALEAN See http://support.microsoft.com/kb/166474
The stack is a portion of memory that can be manipulated via several key assembly language instructions, such as 'pop' (remove and return a value from the stack) and 'push' (push a value to the stack), but also call (call a subroutine - this pushes the address to return to the stack) and return (return from a subroutin...
What parallel programming model do you recommend today to take advantage of the manycore processors of tomorrow?
|multicore|future|parallel|manycore|
If you were writing a new application from scratch today, and wanted it to scale to all the cores you could throw at it tomorrow, what parallel programming model/system/language/library would you choose? Why? I am particularly interested in answers along these axes: <ol> <li>Programmer productivity / ease of us...
Similar behavior exists when module attribute names begin with a single underscore (e.g. _foo). Module attributes named as such will not be copied into an importing module when using the `from*` method, e.g.: from bar import * However, this is a convention and not a language constraint. These are not priva...
It will depend upon your DBMS. I believe that most systems will not take advantage of the full-text index unless you use the full-text functions. (e.g. [MATCH/AGAINST][1] in mySQL or FREETEXT/CONTAINS in MS SQL) Here is a good article on when, why, and how to use full-text indexing in SQL Server: [Understanding SQ...
.NET is a framework. It can be used from many languages (VB.NET, C#, IronPython, boo, etc) .NET always executes as interpreted, and no you cannot include the 'VM' inside the .exe. Any user wishing to run your .NET app must have the framework installed.
@Konrad Rudolph: I get those two (row major/column major) mixed up myself, but I do know this: It's well-defined. int x[3][5], for example, is an array of size 3, whose elements are int arrays of size 5. (§6.5.2.1) Adding all the rules from the standard about arrays, addressing, etc. you get that the second subsc...
You'll want to use the SmtpClient class as outlined **[here][1]**. There are no gotchas - sending email is about as easy as it gets. [1]: http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx
It's primarily used to describe .NET because that's the term Microsoft chose to differentiate .NET from C/C++ and other older languages. Microsoft chose it because it wasn't a term that was usually associated with Java because they didn't want to emphasize the similarities between C#/.NET and Java (as opposed to calli...
.NET is a framework. The Common language Runtime (CLR) executes the Microsoft Intermediate Language (MSIL) code that is generated when a solution is compiled (i.e., it does not compile to machine code). You cannot contain the API within the exe, nor would you want to as it is quite large. The major benefit here is m...
I can answer the framework question. .NET is a framework, C#, VB.NET, etc are languages. Basically .NET provides a common platform of libraries to call (All the System.... dlls) that any language using .NET can call. All the .NET languages are compiled into MSIL (Microsoft Intermediate Language, better known as just...
Managed means that the code is not compiled to native code, and thus runs under the auspices of a virtual machine. Java compiles to an intermediate format called bytecode, which the Java VM knows how to interpret and execute. All the .NET languages do a similar thing, compiling to IL (intermediate language) which the...
First, to solve your problem, I believe using backticks around set and parsing it yourself will work. On my Windows system, this script worked just fine. my %env = map {/(.*?)=(.*)/;} `set`; print join(' ', sort keys %env); In the camel book, the advice in Chapter 25: Portable Perl, the System Interactio...
How to get an Batch file .bat continue onto the next statement if there is an error.
|batch-file|
I'm trying to script the shutdown of my VM Servers in a .bat. if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out. c: cd "c:\Program Files\VMWare\VmWare Server" vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx suspe...
There is no pre-compiler in Java. Thus, no way to do a #ifdef like in C. Build scripts would be the best way.
what is the difference between invalidateList and invalidateDisplayList?
|apache-flex|datagrid|
I have a DataGrid, populated with objects in an ArrayCollection. After updating one of the objects' fields, I want the screen to update. The data source is not bindable, because I'm constructing it at runtime (and I don't understand how to make it bindable on the fly yet -- that's another question). In this situ...
Try using Google Social Graph. In one of the talks at dConstruct08 last week there was a social graph showing the friend connections of Robert Scoble. http://code.google.com/apis/socialgraph/ http://dconstruct.org/2008
Object-Oriented Software Construction by Bertrand Meyer
Your application's utilization of the database is the most critical ones. Mainly what queries are used most often (SELECT, INSERT or UPDATE)? Say if you use SQLite, it is gears for smaller application but for "web" application you might a bigger one like MySQL or SQL Server. The way you write scripts and your web...
Mostly its referring to the fact that all of your memory allocations are "managed" for you. If you are using managed code you don't have to worry about freeing your objects when you are done with them. Simply allowing them to go out of scope will mean that the VM will eventually recognize that there are no longer any r...
When you compile C# code to a .exe, it is compiled to Common Intermediate Language(CIL) bytecode. Whenever you run a CIL executable it is executed on Microsofts Common Language Runtime(CLR) virtual machine. So no, it is not possible to include the VM withing your .NET executable file. You must have the .NET runtime ins...
Help Understanding .Net Configuration Options
|c#|.net|configuration|
I'm really confused by the various configuration options for .Net configuration of dll's, ASP.net websites etc in .Net v2 - especially when considering the impact of a config file at the UI / end-user end of the chain. So, for example, some of the applications I work with use settings which we access with: st...
M-x shell opens a shell where you can browse directories
I found the writeup of HTTP Digest Auth (<a href="http://www.faqs.org/rfcs/rfc2617.html">RFC 2617</a>) very helpful in understanding the use and need for IVs / nonces.
There are 2 ways to user PHP and apache. 1. Install PHP as an Apache module: this way the php execution is a thread inside the apache process. so if php execution fails, the apache process fails. there is no fallback strategy. 2. Install PHP as a CGI script handler: this way apache will start a new PHP process for ea...
Check out [http://thoughtpad.net/alan-dean/cs-xml-documentation.html][1]. Great documentation on the various C# XML documentation tags. (Go to the bottom to see the tags) [1]: http://thoughtpad.net/alan-dean/cs-xml-documentation.html
Or, just make the key a tuple with time.now() as the first field in the tuple. Then you can retrieve the keys with dictname.keys(), sort, and voila! Gerry
Put this in your .emacs file: ;; Toggle window dedication (defun toggle-window-dedicated () "Toggle whether the current active window is dedicated or not" (interactive) (message (if (let (window (get-buffer-window (current-buffer))) (set-window-dedicated-p window (not (window-dedicat...
<p>Interfaces and base classes represent two different forms of relationships.</p> <p>*Inheritance* (base classes) represent an <b>is-a</b> relationship. E.g. a dog or a cat <b>is-a</b> pet. This relationship always represents the (single) *purpose* of the class (in conjunction with the "single responsibility principl...
<p>Interfaces and base classes represent two different forms of relationships.</p> <p><b>Inheritance</b> (base classes) represent an "is-a" relationship. E.g. a dog or a cat "is-a" pet. This relationship always represents the (single) <b>purpose</b> of the class (in conjunction with the "single responsibility principl...
Use strpos and substr: $truncated = substr($longString,0,strpos($longString,' ',200)-1); This will give you a string truncated at the first space after 200 characters.
Essentially you're only going to store the Date part of your DateTime object. This means regardless of how you wish to handle querying the data the Date returned will always be set to 00:00:00. Time related functions are useless in this scenario (even though your original DateTime object uses them) as your database ...
Before you do any requires (especially before requiring rubygems) you can do: ENV['GEM_HOME'] = '/foo' This will change the environment variable inside this process.
If you're looking for a way to control a browser for the purpose of functional testing, Selenium has Perl bindings: http://selenium.openqa.org/
I would think you could return the number of rows (using RETURN) or use an out parameter to get the value.
I've had good luck with Cobertura. It's a code coverage tool which can be executed via your ant script as part of your normal build and can be integrated into Hudson.
You need to know in what character set your input string is encoded, or this will go nowhere fast. If you want to do it correctly, this article may be helpful: [The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)][1] [1]: http://www.joe...
Here you go: function neat_trim($str, $n, $delim='…') { $len = strlen($str); if ($len > $n) { preg_match('/(.{' . $n . '}.*?)\b/', $str, $matches); return rtrim($matches[1]) . $delim; } else { return $str; } }