instruction
stringlengths
0
30k
|c#|unit-testing|tdd|mocking|
I guess you want what VSS calls Next/PreviousDocumentWindow. By default, it's on Ctrl(-Shift)-F6 on my VSS 8. On Ctrl(-Shift)-Tab they have Next/PreviousDocumentWindowNav. You can change key assignment via Tools/Options/Keyboard.
I guess you want what VSS calls Next(Previous)DocumentWindow. By default, it's on Ctrl(-Shift)-F6 on my VSS 8. On Ctrl(-Shift)-Tab they have Next(Previous)DocumentWindowNav. You can change key assignments via Tools/Options/Keyboard.
Best use pattern for a DataContext
|linq-to-sql|.net-3.5|
What's the best lifetime model for a DataContext? Should I just create a new one whenever I need it (aka, function level), should I keep one available in each class that would use it (class level), or should I create a static class with a static DataContext (app-domain level)? Are there any considered best practices on...
Creating batch jobs in PowerShell
|powershell|batch-file|
Imagine a DOS style .cmd file which is used to launch interdependent windowed applications in the right order. Example: 1) Launch a server application by calling an exe with parameters. 2) Wait for the server to become initialized (or a fixed amount of time). 3) Launch client application by calling an exe with ...
Use an installer with a worked out script. Any installer like Wise, InstallShield, InnoSetup, etc will probably do.
Use the cut command. e.g. echo "system-source-yyyymmdd.dat" | cut -f1 -d'-' will extract the first bit. Change the value of the -f parameter to get the appropriate parts. Here's a guide on the [Cut](http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch03s04.html) command.
Just using <bodycontent>JSP</bodycontent> is not enough. You should do soimething like JspFragment body = getJspBody(); StringWriter stringWriter = new StringWriter(); StringBuffer buff = stringWriter.getBuffer(); buff.append("<h1>"); body.invoke(stringWriter); buff.appe...
Thanks for all the input, it looks like the short answer is 'No you can't (well not nicely anyway)', so I'll have to do it the hard way and add the conditional code.
One way I have done is to use ::CryptExportKey() to get the PRIVATEKEYBLOB or PUBLICKEYBLOB. From there you can use the PUBLICKEYSTRUC and RSAPUBKEY to extract the various key components and write a key data xml file that looks like this (base64 data removed): <RSAKeyValue> <Modulus></Modulus> <...
Ok, forget the last answer I can't read :) You are working with 3Des keys not RSA keys. I worked on a bunch of code to share keys between .NET, CryptoAPI and openssl. Found a lot of good example code here for doing the key conversions: http://www.jensign.com/JavaScience/cryptoutils/index.html There is some 3d...
Are there any automatic methods for trimming a path string in .NET? For example: C:\Documents and Settings\nick\My Documents\Tests\demo data\demo data.emx becomes C:\Documents...\demo data.emx It would be particularly cool if this were built into the Label class, and I seem to recall it is--can't...
|c#|.net|winforms|path|
|c#|.net|winforms|path|
What Mature PL/SQL Libraries For Auto-Generating JSON Do You Recommend?
|json|plsql|javascript|
Are there any good PL/SQL libraries for JSON that you've worked with and found useful? In [PL/SQL][1], I'm having to tediously hand code the return of [JSON][2] values to JavaScript functions. I found [one PL/SQL library][3] for auto-generating JSON, but it doesn't do exactly everything I need it too. For example, I...
What PL/SQL Libraries For Auto-Generating JSON Do You Recommend?
|javascript|json|plsql|
Are there any good PL/SQL libraries for JSON that you've worked with and found useful? In [PL/SQL][1], I'm having to tediously hand code the return of [JSON][2] values to JavaScript functions. I found [one PL/SQL library][3] for auto-generating JSON, but it doesn't do exactly everything I need it too. For example, I...
|javascript|json|plsql|
ASP.NET absolute path back to web-relative path
|asp.net|path|mappath|
If I have managed to locate and verify the existence of a file using Server.MapPath and I now want to send the user directly to that file, what is the **fastest** way to convert that absolute path back into a relative web path?
|asp.net|path|mappath|
Asp.net path compaction
|c#|asp.net|asp|path|
Have you seen the [LINQKit][1]? The AsExpandable sounds like what you're after (though you may want to read the post [Calling functions in LINQ queries][2] at TomasP.NET for more depth). [1]: http://www.albahari.com/nutshell/linqkit.html [2]: http://tomasp.net/blog/linq-expand.aspx
You should get familiar with the [Mono project][1] and [MonoDevelop][2]; the express purpose of those projects is to allow building and running .NET code on a variety of platforms, including Windows, Linux, and Mac OSX. Since the Mono is a re-implementation of .NET, it always lags a little behind Microsoft.NET, but ...
Pre-process: Build a trie with each leaf as a known word. At search time: Consider the input string as a multiset. Find the first sub-word by traversing the index trie as in a depth-first search. At each branch you can ask, is letter x in the remainder of my input? If you have a good multiset representation...
Pre-process: Build a trie with each leaf as a known word, keyed in alphabetical order. At search time: Consider the input string as a multiset. Find the first sub-word by traversing the index trie as in a depth-first search. At each branch you can ask, is letter x in the remainder of my input? If you have a...
[Mono][1] is the only option currently. It runs on [these platforms][2]. And there will be problems, not necessarily huge, but still. [1]: http://www.mono-project.com [2]: http://www.mono-project.com/Supported_Platforms
Use the ConnectionStringsSection class. The documentation even provides an example on how to create a new ConnectionString and have the framework save it to the config file without having to implement the whole XML shebang. See [here][1] and browse down for an example. [1]: http://msdn.microsoft.com/en-us/lib...
This should give you a list of all columns in the table "Person" that has only NULL-values. You will get the results as multiple result-sets, which are either empty or contains the name of a single column. You need to replace "Person" in two places to use it with another table. DECLARE crs CURSOR LOCAL FAST_FORW...
I haven't seen anything in boost that helps with the structure that you tend to end up with when using IO Completion Ports, but then I haven't looked that recently... However, slightly off-topic, you might like to take a look at the IOCP based thread pool that is part of my free IOCP server framework. It might give you...
When writing a package called "foo", I will put unit tests into a separate package "foo\_test". Modules and subpackages will then have the same name as the SUT package module. E.g. tests for a module foo.x.y are found in foo\_test.x.y. The \_\_init\_\_.py files of each testing package then contain an AllTests suite tha...
WPF Data Binding and Validation Rules Best Practices
|wpf|validation|data-binding|
I have a very simple WPF application in which I am using data binding to allow editing of some custom CLR objects. I am now wanting to put some input validation in when the user clicks save. However, all the WPF books I have read don't really devote any space to this issue. I see that you can create custom ValidationRu...
I can recommend to use [Enterprise Library][1] for that purpose. Policy Application Block delivers the infrastructure to do "something" (something = you can code that on your own) whenever you enter/exit a method for example. You can control the behavior with attributes. Take that as a hint an go into detail with the d...
|.net-3.5|linq-to-sql|
|.net-3.5|linq-to-sql|
Is there a pattern using Linq to dynamically create a filter?
|linq|linq-to-sql|.net-3.5|
Is there a pattern using Linq to dynamically create a filter? I have the need to create custom filtering on a list, in the past I would just dynamically create the SQL...it doesn't seem like this is possible with Linq.
|linq|.net-3.5|linq-to-sql|
|linq|.net-3.5|linq-to-sql|
Can you use LINQ tools such as SQLMetal with an access database?
|linq-to-sql|microsoftaccess|c#|
I'm creating a small database application to teach myself the following concepts 1. C# programming 2. .Net 3.5 framework 3. WPF 4. LINQ ORM I want to use Microsoft Access as the database but I can't seem to find any mention of whether its possible to use the SQLMetal to generate the ORM code from a Micro...
|linq-to-sql|microsoft-access|c#|
I'm creating a small database application to teach myself the following concepts 1. C# programming 2. .Net 3.5 framework 3. WPF 4. LINQ ORM I want to use Microsoft Access as the database but I can't seem to find any mention of whether its possible to use SQLMetal to generate the ORM code from a Microsoft...
|c#|linq-to-sql|microsoft-access|
|c#|linq-to-sql|ms-access|
|c#|linq-to-sql|ms-access|
Get last item in a table - SQL
|sql|
I have a History Table in SQL Server that basically tracks an item through a process. The item has some fixed fields that don't change throughout the process, but has a few other fields including status and Id which increment as the steps of the process increase. Basically I want to retrieve the last step for each i...
GSM Modems, PCs, SMS and Telephone Calls
|asp.net|
What all would be the requirements for the following scenario: > A GSM modem connected to a PC running > a web based (ASP.NET) application. In > the application the user selects a > phone number from a list of phone nos. > When he clicks on a button named the > PC should call the selected phone > number. When ...
I like the fact that you can just create classes, and xpo creates the tables and relationships for you - so you can start from a blank database. One issue I don't like is when I want to delete a whole bunch of stuff, it will go through my collection and do a delete on each one. This takes ages, so for this kind of ...
I'm not sure where you want to link to when you click the Div, but given something like this perhaps would work: <select id="mySelect"> <option value="1">Option 1</option> <option value="2">Option 2</options> </select> <div id="myDiv"/> and the following JQuery creates a list of `<div>...
VS2005 and VS2008 use different STL implementations. When the VS2005 code returns a vector, the object has memory layout different from what VS2008 expects. That should be the reason for the broken values you see in the returned date. As a rule of thumb, you should always compile all C++ modules of a project with th...
It depends on the nature of how your data will be used, but if the old price data will not be used nearly as regularly as the current price data, there may be an argument here for a price history table. This way, non-current data may be archived off to the price history table (probably by triggers) as the new prices co...
How do you manage your app when the database goes offline?
|.net|sql-server|error-handling|
Take a .Net Winforms App.. mix in a flakey wireless network connection, stir with a few users who like to simply pull the blue plug out occasionally and for good measure, add a Systems Admin that decides to reboot the SQL server box without warning now and again just to keep everyone on their toes. What are the sugg...
I think the easiest way is to split as shown before, and then loop through the values and try to convert to int. class Program { static void Main(string[] args) { string queryString = "1234,4321,6789"; int[] ids = ConvertCommaSeparatedStringToIntArray(queryStrin...
Funny you should ask this question. I asked Microsoft how to do this about a year ago. At the time, using .NET 3.0, it was not possible. Not sure if that changed in the 3.5 world. But, no, there was no physical way of adding security to the request and leaving the response empty. At my previous employer we used a mo...
If you are using PHP 4, you can take advantage of [this][1] bug. Off course that is a messy solution... Or you could just rename your mail.php file to something else... [1]: http://bugs.php.net/bug.php?id=43821
If you commit with a message you can add "[artf1000]" (where artf1000 is your artifact number) to the beginning or end of your commit message. Then it will associate to that artifact you can also do this with documents using doc1000, to get the id of the item you can use the URL it is what is after the http://sfeeserve...
If you commit with a message you can add "[artf1000]" (where artf1000 is your artifact number) to the beginning or end of your commit message. Then it will associate to that artifact you can also do this with documents using doc1000, to get the id of the item you can use the URL it is what is after the http://sfeeserve...
Run jps -lv which shows PIDs and command lines of all running Java processes. Determine PID of the task you want to kill. Then use command: taskkill /PID &lt;pid&gt; to kill the misbehaving process.
Just specifying UTF-8 in the header is not enough. I'd bet you haven't saved your file as UTF-8. Any reasonably advanced text editor will have this option. Try that and I'm sure it'll work!
You can't do this with the base dict class -- it's ordered by hash. You could build your own dictionary that is really a list of key,value pairs or somesuch, which would be ordered.
You should also note that the inline keyword is only a request. The compiler may choose not to inline it, likewise the compiler may choose to make a function inline that you did not define as inline if it thinks the speed/size tradeoff is worth it. This decision is generaly made based on a number of things, such as ...
Using unsafe pointers is the fastest way to do direct memory manipulation in C# (definitely faster than using the Marshal wrapper functions). Just out of curiosity, what sort of 2d drawing operations are you trying to perform? I ask because locking a DirectX surface to do pixel level manipulations will defeat m...
After reading your answers here's what I'm thinking: **No. In general, it's not necessary or useful to explicitly specify the variables scope. It just adds clutter to an already verbose language.** Granted, there is one minor exception, as [Soldarnal][1] pointed out, where qualifying a variables-scoped variable i...
After reading your answers here's what I'm thinking: **Yes, it's safe. In general, it's not necessary or useful to explicitly specify the variables scope. It just adds clutter to an already verbose language.** Granted, there is one minor exception, as [Soldarnal][1] pointed out, where qualifying a variables-scope...
Don't repeat yourself vs Internationalisation
I don't have time to try and think of a regex that probably won't work, but I wanted to comment that you should most definitely break up your regex, at least if it gets to [this level of ugliness][1]: (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t] )+|\Z|(?=[\["()<>@,;:\\".\[\...
I don't have time to try and think of a regex that probably won't work, but I wanted to comment that you should most definitely break up your regex, at least if it gets to [this level of ugliness][1]: (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t] )+|\Z|(?=[\["()<>@,;:\\".\[\...
Our current project makes heavy use of drag+drop, using [GWT][1] and [gwt-dnd][2] you can do some very cool stuff. Standards based, and works in IE6, Safari, Firefox, Opera, etc.. [1]: http://code.google.com/webtoolkit/ [2]: http://code.google.com/p/gwt-dnd/ The issue of how to transmit a file is a seperate ...
Here are the salient points: 1. You can't make UI control calls from a different thread than the one they were created on (the form's thread). 2. Delegate invocations (ie, event hooks) are triggered on the same thread as the object that is firing the event. So, if you have a separate "engine" thread doing...
What is a binding?
|binding|language-agnostic|
My good friend, Wikipedia, didn't give me a very good response to that question. So: - What are bindings? - How do they work?
What is a language binding?
My good friend, Wikipedia, [didn't give me a very good response][1] to that question. So: - What are language bindings? - How do they work? [1]: http://en.wikipedia.org/wiki/Language_binding
|binding|language-agnostic|glossary|
|language-binding|language-agnostic|glossary|
|language-agnostic|language|glossary|language-binding|
My good friend, Wikipedia, [didn't give me a very good response][1] to that question. So: - What are language bindings? - How do they work? Specifically accessing functions from code written in language X of a library written in language Y. [1]: http://en.wikipedia.org/wiki/Language_binding
|language-agnostic|language|glossary|language-binding|
|language-agnostic|language|glossary|language-binding|