instruction stringlengths 0 30k ⌀ |
|---|
|c#|.net|winforms| |
When you use a Windows Forms TextBox, the default number of tab stops (spaces) is 8. How do you modify this? |
First add the following namespace
using System.Runtime.InteropServices;
Then add the following after the class declaration:
private const int EM_SETTABSTOPS = 0x00CB;
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr h,
int msg,
int... |
How do I get a value from an XML web service in C#? |
|c#|xml| |
In C#, if I need to open an HTTP connection, download XML and get one value from the result, how would I do that?
For consistency, imagine the webservice is at www.webservice.com and that if you pass it the POST argument fXML=1 it gives you back
<xml><somekey>somevalue</somekey></xml>
I'd like it to spit ... |
It can be used to hide your code from casual observers, but as you say: it's easily circumvented.
It really can't be any other way, since the server needs to decrypt the code to execute it. It's DRM, basically, and fails for the same reason as all the other DRM does - you can't simultaneously hide the data, and allo... |
If your leaning is to Python, you may be interested in checking out the Python Wrapper for Filemaker. It provides two way access to the Filemaker data via Filemaker's built-in XML services. You can find some quite thorough information on this at:
[http://code.google.com/p/pyfilemaker/][1]
[1]: http://code... |
[Pdftotext][1] An open source program (part of Xpdf) which you could call from python (not what you asked for but might be useful). I've used it with no problems. I think google use it in google desktop.
[1]: http://en.wikipedia.org/wiki/Pdftotext |
If I have to expose APIs, I prefer doing it as JSON. Python has excellent support for JSON objects (JSON Objects are infact python dictionaries) |
Doesn't ODBC use the old "?" syntax for parameters? Try this:
select col1, col2 from table1 where col3 = ?
The order of your parameters become important then, but it's less vulnerable to SQL injection than simple appending the parameter value. |
Doesn't ODBC use the old "?" syntax for parameters? Try this:
select col1, col2 from table1 where col3 = ?
The order of your parameters become important then, but it's less vulnerable to SQL injection than simply appending the parameter value. |
Doesn't ODBC use the old "?" syntax for parameters? Try this:
select col1, col2 from table1 where col3 = ?
The order of your parameters becomes important then, but it's less vulnerable to SQL injection than simply appending the parameter value. |
Yep, use table and index partitioning with filegroups.
You don't even have to change the select statements, only if you want to get the last bit of speed out of the result.
Another option can be the workload balancing with two servers and two way replication between them. |
Sending e-mail from a Custom SQL Server Reporting Services Delivery Extension |
|c#|reporting-services| |
I've developed my own delivery extension for Reporting Services 2005, to integrate this with our SaaS marketing solution.
It takes the subscription, and takes a snapshot of the report with a custom set of parameters. It then renders the report, sends an e-mail with a link and the report attached as XLS.
E... |
> And you can change your code "on the fly" without restarting the server
You can accomplish this with ASP.net if you make a Web Site project (as opposed to a Web Application Project). Using a Web Site project, you can post changes to code-behinds without having to refresh anything on the server, and the server does... |
Capturing Cmd-C keyboard event from modular Flex application in browser or AIR. |
|apache-flex|air| |
It seems that it is impossible to capture the keyboard event normally used for copy when running a Flex application in the browser or as an AIR app, presumably because the browser or OS is intercepting it first.
Is there a way to tell the browser or OS to let the event through?
For example, on a AdvancedDataGrid ... |
Inherited must be explicitly called in descendant objects as well as in visual form inheritance. If you use class completion then it adds inherited automatically if you flagged the definition as override (but not for reintroduce). If you are using visual form inheritance then when you add a new event hander through t... |
Does anyone know where to find free database design templates? |
|database|templates| |
I'm obviously not talking about a full solution, but just a good starting point for common applications for software architects. It could be for a CMS, e-commerce storefront, address book, etc. A UML diagram is not essential, but a table schema with data types in the least. Thanks! |
You might take a look at [Free Pascal][1] as it includes a 64 bit version and is mostly Delphi compatible syntax.
[1]: http://www.freepascal.org/ |
FTS *can* help in this scenario, the question is whether it is worth it or not.
To begin with, let's look at why `LIKE` may not be the most effective search. When you use `LIKE`, especially when you are searching with a % at the beginning of your comparison, SQL Server needs to perform both a table scan of every sin... |
Update schema and rows in one transaction, SQL Server 2005 |
|database|transactions|ado| |
I'm currently updating a legacy system which allows users to dictate part of the schema of one of its tables. Users can create and remove columns from the table through this interface. This legacy system is using ADO 2.8, and is using SQL Server 2005 as its database (you don't even WANT to know what database it was u... |
I'm currently updating a legacy system which allows users to dictate part of the schema of one of its tables. Users can create and remove columns from the table through this interface. This legacy system is using ADO 2.8, and is using SQL Server 2005 as its database (you don't even WANT to know what database it was u... |
Simple:
if(!MyNamespace) MyNamespace = {};
MyNamespace.foo = function() {
this.length = 0;
};
MyNamespace.foo.prototype.getLength = function() {
return this.length;
}; |
@Thomas WISA is:
W=Windows<br>
I=IIS<br>
S=SQL (Microsoft SQL Server)<br>
A=ASP (or ASP .NET)
As for choosing between them, I would think that the available resources and talent would be the deciding factor. If you can get great ASP .NET and MS SQL devs, go that route. If you've got a bunch of PHP/MySQL gurus ... |
Lucene doesn't allow you to start WildcardQueries with an asterisk by default, because those are incredibly expensive queries and will be very, very, very slow on large indexes.
If you're using the Lucene QueryParser, call setAllowLeadingWildcard(true) on it to enable it.
If you want all of the documents with a c... |
> What do you do if you are given a pile of crap and seem like you are stuck in a perpetual state of cleanup that you know with the addition of any new feature or code can break the current set because the current software is like a house of cards?
> How can we do unit testing then?
You start small. The project I... |
Cost is our biggest thing pushing us towards the LAMP environment, no question about it. Trying to go through Corporate procurement for Windows and SQL server licenses is horrific. |
How to write a spec that is productive? |
|specs| |
I've seen different program managers write specs in different format. Almost every one has had his/her own style of writing a spec.
On one hand are those wordy documents which given to a programmer are likely to cause him/her missing a few things. I personally dread the word documents spec...I think its because of m... |
The [WMD editor][1] is completely free (in the speech and beer senses of the word). It's available under an MIT-style license.
[1]: http://wmd-editor.com/ |
C2 wiki discussion: http://c2.com/cgi/wiki?BuyDontBuild |
[Sandcastle][1] works pretty well for generating documentation and it supports a couple different formats for the generation. As far as I know, there isn't any Visual Studio integration for it, but there is a [GUI][2] for it that is available.
[1]: http://www.codeplex.com/Sandcastle
[2]: http://www.inchl.nl/S... |
[Sandcastle][1] works pretty well for generating documentation and it supports a couple different formats for the generation. As far as I know, there isn't any Visual Studio integration for it, but there is a [SandcastleGUI][2] for it that is available.
[1]: http://www.codeplex.com/Sandcastle
[2]: http://www.... |
It turns out that readFully() adds more performance overhead than I was willing to put up with.
In the end I compromised: I call skipBytes() once, and if that returns fewer than the right number of bytes, I call readFully() for the remaining bytes.
|
It sounds like the simplest thing to do here may be to create an abstract base class with all of the common GIS members and then to inherit the other X classes that will have nothing more than the necessary NHibernate mappings. I would then use the Factory pattern to create the object of the specific type using your me... |
It's the [WMD](http://wmd-editor.com/) Markdown editor which is free and seems to be pretty easy to use. Just include the javascript for it and (in the easiest case), it just attaches to the first textarea it finds.
Here's some info about the [Perl implementation of Markdown](http://daringfireball.net/projects/mark... |
It's the [WMD](http://wmd-editor.com/) Markdown editor which is free and seems to be pretty easy to use. Just include the javascript for it and (in the easiest case), it just attaches to the first textarea it finds.
Here's some info about the [Perl implementation of Markdown](http://daringfireball.net/projects/mark... |
With PowerShell:
Get-Process | Sort-Object CPU -desc | Select-Object -first 3 | Format-Table | CPU,ProcessName -hidetableheader
|
With PowerShell:
Get-Process | Sort-Object CPU -desc | Select-Object -first 3 | Format-Table | CPU,ProcessName -hidetableheader
returns somewhat like:
16.8041632 System
12.568072 csrss
11.9872368 powershell
|
As alternative, log4net, though potentially dangerous, has given me better results than System.Diagnostics. Basically in log4net, you have a method for the various log levels, each with an Exception parameter. So, when you pass the second exception, it will print the stack trace to whichever appender you have config... |
I think it will be useful to read this first:
[Creating and Consuming a Web Service][1] (in .NET)
This is a series of tutorials of how web services are used in .NET, including how XML input is used (deserialization).
[1]: https://web.archive.org/web/20211020134836/https://aspnet.4guysfromrolla.com/articles... |
Tested only in octave... (no matlab license). Variations of arrayfun() exist, check the documentation.
#!/usr/bin/octave -qf
function result = dostuff(my_ten, my_one)
result = my_ten + my_one
endfunction
tens = [ 10 20 30 ];
ones = [ 1 2 3];
x = arrayfun(@dostuff, tens, ... |
How to insert a row into a dataset via SSIS |
|sql-server|ssis| |
I'm trying to create an SSIS package that takes data from an XML data source and for each row inserts another row with some preset values. Any ideas? I'm thinking I could use a DataReader source to generate the preset values by doing the following:
SELECT 'foo' as 'attribute1', 'bar' as 'attribute2'
The que... |
Java Desktop application framework |
|java|eclipse|desktop|platform|netbeans| |
I am working on designing and building a desktop application. I am thinking about using eclipse or netbeans for the base of this application. However, I have never built on either of these platforms. I am personally leaning to using netbeans because it seams like that platform is an easer learning curve. But, I wan... |
|java|eclipse|desktop|netbeans|platform| |
You can use something like that:
var client = new WebClient();
var response = client.UploadValues("www.webservice.com", "POST", new NameValueCollection {{"fXML", "1"}});
using (var reader = new StringReader(Encoding.UTF8.GetString(response)))
{
var xml = XElement.Load(reader);
va... |
Avoid [modes][1].
[1]: http://www.osnews.com/story/18904/Common_Usability_Terms_pt_V_Modes |
Avoid [modes][1]. It's frustrating to a user when input works sometimes but not others, or does different things at different times.
[1]: http://www.osnews.com/story/18904/Common_Usability_Terms_pt_V_Modes |
Win32 ToolTip disappears never to re-appear with Commctl 6 |
|windows|winapi| |
|project-management|productivity|specs| |
The best way to deal with it is to probably put a no-cache directive in your ASP.NET pages (or a master page if you're using one). I don't think there's a way to deal with this directly in your ASP.NET code (since the cache decision is happening on the client).
As for MVC, don't know how you would accomplish that (a... |
One of the Microsoft Press books has excellent examples of various documents, including an SRS (which I think is what you are talking about). It might be one of the requirements books by Weigert (I think that's his name, I'm blanking on it right now). I've seen US government organizations use that as a template, and fr... |
Best method to parse various custom XML documents in Java |
|java|xml| |
What is the best method to parse multiple, discrete, custom XML documents with Java? |
[Joel on Software][1] is particularly good at these and has some good articles about the subject...
[a specific case][2]
[1]: http://www.joelonsoftware.com/articles/fog0000000036.html
[2]: http://www.joelonsoftware.com/articles/AardvarkSpec.html |
As far as I know (or at least have read) is its best to try not to work in response to user events, but rather think "in the page"..
Architect your application so it doesn't care if the back button is pushed.. It will just deal with it.. This may mean a little extra work from a development point of view, but overall... |
WISA can be cheap, if your application doesn't need anything beyond shared hosting, there is little cost.
It can also be expensive, then again so can LAMP once you get to the same size.
Personally, I like the WISA stack, but its more out of familiarity than anything.
Two things that stand out:
* SqlServer -... |
My decision was based on two things. First and foremost I hated programming in ASP. I did it for an old job, and when given a choice I would choose PHP. I also tend to enjoy Linux over Windows.
When it came to actually picking though, the corporate heads chose LAMP due to cost. Because let's be honest as developers... |
Capturing Cmd-C (or Ctrl-C) keyboard event from modular Flex application in browser or AIR. |
It seems that it is impossible to capture the keyboard event normally used for copy when running a Flex application in the browser or as an AIR app, presumably because the browser or OS is intercepting it first.
Is there a way to tell the browser or OS to let the event through?
For example, on an AdvancedDataGrid... |
var today = new Date();
var yesterday = new Date().setDate(today.getDate() -1); |
var d = new Date();
d.setDate(d.getDate()-1);
|
The technical answer is that the ***Grammar*** of the PHP language only allows subscript notation on the end of **variable expressions** and not **expressions** in general, which is the case in most other languages. I've always viewed it as a deficiency in the language, because it is possible to have a grammar that res... |
*getDate()-1* should do the trick
Quick example:
var day = new Date( "January 1 2008" );
day.setDate(day.getDate() -1);
alert(day);
|
If I understand this correctly...
We had a object that could use different hardware options. To facilitate this we used a abstract interface of Device. Device had a bunch of functions that would be fired on certain events. The use would be the same but the various implementations of the Device would either have a fu... |
You'll probably have to use a tool, such as [ILMerge][1], to merge the two assemblies.
[1]: http://research.microsoft.com/~mbarnett/ILMerge.aspx |
I recommend that you use the [Simple Logging Facade for Java][1] (SLF4J). It supports different providers that include Log4J and can be used as a replacement for Apache Commons Logging.
[1]: http://slf4j.org |
I tend to prefer using the new Linq syntax:
myListView.DataSource = (
from rec in GetAllRecords().Values
where rec.Name == "foo"
select rec ).ToList();
myListView.DataBind();
Why are you getting a dictionary when you don't use the key? You're paying for that overhead. |
Thanks @Eric it works! Just a few code corrections for future reference:
- the first select statements misses a coma after wp_term_relationship tr2
- In the same select statemt the following must be change:
<pre><code>wp_terms t2, wp_term_taxonomy tt2, wp_term_relationship
tr2</code></pre>
should be... |
What you are looking for is called DOSKEY
You can use the doskey command to create macros in the command interpreter. For example:
doskey mcd=mkdir "$*"$Tpushd "$*"
creates a new command "mcd" that creates a new directory and then changes to that directory (I prefer "pushd" to "cd" in this case because i... |
Yes, [A-Za-z] will be much faster than setting the `RegexOptions.IgnoreCase`, largely because of Unicode strings. But it's also much more limiting -- [A-Za-z] does *not* match accented international characters, it's literally the A-Za-z ASCII set and nothing more.
I don't know if you saw Tim Bray's answer to my mess... |
Both `FREETEXTTABLE` and `CONTAINSTABLE` will return the `[RANK]` column, but make sure you are using either the correct variation or union both of them to get all appropriate results. |
Using [P/Invoke Interop Assistant][1]:
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct SidIdentifierAuthority {
/// BYTE[6]
[System.Runtime.InteropServices.MarshalAsAttribute(
... |
You mean like this?
<edmx:ConceptualModels>
<Schema xmlns="http://schemas.microsoft.com/ado/2006/04/edm" Namespace="Model1" Alias="Self">
<EntityContainer Name="Model1Container" >
<EntitySet Name="ColorSet" EntityType="Model1.Color" />
<EntitySet Name="DoctorSet" EntityType=... |
I'm creating a [ToolTip](http://msdn.microsoft.com/en-us/library/bb760250(VS.85).aspx) window and adding tools to it using the flags
TTF_IDISHWND | TTF_SUBCLASS. (c++, win32)
I have a manifest file such that my program uses the new WindowsXP themes
(comctrl32 version 6).
When I hover over a registered t... |
Will random data appended to a JPG make it unusable? |
|hacks|jpeg|file-format|steganography| |
So, to simplify my life I want to be able to append from 1 to 7 additional characters on the end of some jpg images my program is processing*.
Having tried this out with a few programs, it appears they are fine with the additional characters, which occur after the [FF D9 that specifies the end of the image][1] - so ... |
The JAutodoc plugin for eclipse does exactly what you need, but with a package granularity :
right click on a package, select "Add javadoc for members..." and the skeleton will be added.
There are numerous interesting options : templates for javadoc, adding a TODO in the header of every file saying : "template j... |
The Server Explorer should support any database system that provides an ODBC driver. In the case of Oracle there is a built in driver with Visual Studio.
In the Add Connection Dialog click the change button on the data source you should then get a list of the providers you have drivers for. |
Here is instructions on how to connect to your MySQL database from Visual Studio:
> To make the connection in server
> explorer you need to do the following:
>
> * first of all you need to install the MyODBC connector 3.51 (or latest) on
> the development machine (NB. you can
> find this at
> http://www.mysql... |
Starting a new job focused on brownfield application refactoring & Agile |
|.net|vb.net|refactoring|brownfield| |
I am starting a new job on Monday. The company has a home grown enterprise case management application written in ASP.NET/VB.NET. They are attempting to implement an Agile development process. They have gone so far as to get two people Scrum Master certified and hire an Agile coach. They are currently focused on 6-9 mo... |