instruction stringlengths 0 30k ⌀ |
|---|
insert into Test2.dbo.MyTable (MyValue) select MyValue from Test1.dbo.MyTable
This is assuming a great deal. First that the destination database is empty. Second that the other columns are nullable. You may need an update instead. To do that you will need to have a common key. |
Here is a simple one that baffles me when I see developers that don't understand it:
- Order of Operations |
Are you setting the credentials for the E-Mail?
smtp.Credentials = New Net.NetworkCredential("xyz@gmail.com", "password")
I had this error, however I believe it threw an exception. |
I see you've accepted the `noscript` answer, but how will you use this to fight spam? `noscript` will allow you to add special content for users without JS, but unless you're generating the rest of your site in JS, it will still be available to user agents without JS.
A captcha of some sort is still likely the best ... |
<http://www.hanselman.com/smallestdotnet/>
that will tell you based on the headers you are sending. only works on ie or if you have the firefox extension installed. more info in [hanselman's blog post](http://www.hanselman.com/blog/SmallestDotNetOnTheSizeOfTheNETFramework.aspx)
|
The System.Net.Mail library uses the config files to store the settings so you may just need to add a section like this
<system.net>
<mailSettings>
<smtp from="test@foo.com">
<network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" /... |
There is a simple way very much like this as long as both databases are on the same server. The fully qualified name is dbname.owner.table - normally the owner is dbo and there is a shortcut for ".dbo." which is "..", so...
INSERT INTO Datbase1..MyTable
(ColumnList)
SELECT FieldsIWant
FROM ... |
There isn't a method call, if that's what you're asking for. With a little research, I suppose you could write your own. A particular instance has a fixed sized derived from the number of references and primitive values plus instance bookkeeping data. You would simply walk the object graph. The less varied the row type... |
I'm developing in a Parallels VM running Windows Server 2008, and overall it is terrific. I'd highly recommend the server OS over Vista or XP if you are doing web development.
Other than the keyboard issue, the one pitfall with the MacBook Pro is that the fan is extremely loud and annoying, and running a VM has in m... |
Proxy with Android Emulator |
|proxy|android| |
Has anybody managed to get the Android Emulator working behind a proxy which requires authentication?
I've tried setting the -http-proxy argument to
http://DOMAIN/USERNAME:PASSWORD@IP:PORT
but am having no success.
I've tried following the docs to no avail. I've also tried the -verbose-proxy setti... |
According to [this guy][1], IIf can take up to 6x as long as If/Then. YMMV.
[1]: http://www.vb-helper.com/howto_compare_iif_ifthen_speeds.html |
I don't think it does since this clause is not met:
>Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
Since equal(o1, o2) depends on o1's implementation of equals, two objects that are logically equal (as determined by equals) still have... |
in ksh, in vi mode, if you hit 'v' while in command mode it will spawn a full vi session on the contents of your current command line. You can then edit using the full range of vi commands (global search and replace in your case). When :wq from vi, the edited command is executed. I'm sure something similar exists fo... |
[PC-Lint](http://www.gimpel.com/) claims to do static exception analysis of C++ code.
[Coverity](http://www.coverity.com/) is another static C++ code analysis tool that apparently informs you of unhandled exceptions.
[AQtime](http://www.automatedqa.com/products/aqtime/index.asp) claims to have exception tracing a... |
...as to why it can take as long as 6x, quoth the wiki:
> Because IIf is a library function, it
> will always require the overhead of a
> function call, whereas a conditional
> operator will more likely produce
> inline code.
Essentially IIf is the equivalent of a ternary operator in C++/C#, so it gives you s... |
I'm not really sure about the System.identityHashCode(Object). That's pretty much what the == is used for. You might rather want to use the Object.hashCode() - it's more in parallel with Object.equals(Object). |
A good question but a very controversial topic.
[This blog post from Frans Bouma][1] from a few years back citing the pros of dynamic SQL (implying ORMs) over stored procedures sparked quite the fiery flame war.
[1]: http://weblogs.asp.net/fbouma/archive/2003/11/18/38178.aspx |
Creating custom types can be done in PowerShell.
Kirk Munro actually has two great posts that detail the process thoroughly.
[Naming Custom Objects][1]
[Defining Default Properties for Custom Objects][2]
The book [Windows PowerShell In Action by Manning][3] also has a code sample for creating a domain specifi... |
Creating custom types can be done in PowerShell.
Kirk Munro actually has two great posts that detail the process thoroughly.
- [Naming Custom Objects][1]
- [Defining Default Properties for Custom Objects][2]
The book [Windows PowerShell In Action by Manning][3] also has a code sample for creating a domain... |
You can create an abstract base class the implements IMessageHeader and also inherits MarshalByRefObject |
No, because the serializer needs a concrete class that it can instantiate.
Given the following code:
XmlSerializer ser = new XmlSerializer(typeof(IMessageHeader));
IMessageHeader header = (IMessageHeader)ser.Deserialize(data);
What class does the serializer create to return from Deserialize()?
... |
Try adding IXmlSerializable to your IMessageHeader declaration, although I don't think that will work.
From what I recall, the .net xml serializer only works for concrete classes that have a default constructor. |
You can also use "hotcopy".
svn hotcopy OLD_REPOS_PATH NEW_REPOS_PATH
It takes full backup from repository, including all hooks, configuration files, etc..
[more at svn book][1]
[1]: http://svnbook.red-bean.com/en/1.0/re33.html |
If you're looking for a licensing solution, you can check out [truelicense api][1]. It's based on use of asymmetrical keys. However, it doesn't mean your application cannot be cracked. Every application can be cracked with enough effort. What really important is, as Stu answered, figuring out how strong protection you ... |
It really does not matter if the API/Code is thread safe. CBC encryption in itself is not thread safe.
Some terminology -
E(X) = Enctrypt message X
D(X) = Dectrypt X. (Note that D(E(X)) = X)
IV = Initialization vector. A random sequence to bootstrap the CBC algorithm
CBC = Cipher block chaining.... |
As described in the [TFS FAQ][1]:
**Are Deletes physical or logical? Can accidental deletes be recovered?**
Deletes are fully recoverable with the “undelete” operation. You wouldn’t want to do a SQL restore because that would roll back every change to the TFS in the time since the file was deleted.
[1]: ht... |
Excerpt from my [Blog-Note-to-myself][1]
Now you can import a dump file e.g. if you are migrating between machines / subversion versions. e.g. if I had created a dump file from the source repository and load it into the new repository as shown below.
CmdShell> svnadmin dump D:\CoderZone2\svn-repos > ReposD... |
Languages are easy to learn (especially one like C)... the hard part is learning the libraries and/or coding style of the language. For instance, I know C++ fairly well, but most C/C++ code I see confuses me because the naming conventions are so different from what I work with on a daily basis.
Anyway, I guess what... |
You should have a look at the [URL Rewriting Guide][1] from the apache documentation.
The following is untested, but it should to the trick:
RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.domain\.com$
RewriteRule ^/(.*)$ http://blah.domain.com/%1/$1 [L,R]
This only works if the subdomain contain ... |
**from sun's java tutorial:**
Why Use Nested Classes?
There are several compelling reasons for using nested classes, among them:
* It is a way of logically grouping classes that are only used in one place.
* It increases encapsulation.
* Nested classes can lead to more readable and maintainable code... |
[From Sun's Java Tutorial:][1]
Why Use Nested Classes?
There are several compelling reasons for using nested classes, among them:
* It is a way of logically grouping classes that are only used in one place.
* It increases encapsulation.
* Nested classes can lead to more readable and maintainable code.... |
Follow-up on this question:
Thanks DannySmurf, flushing the registry key was ultimately what needed to be done. However, there were a few steps that I was missing before reaching that stage. So, here's what came to light:
- I was using a RAM-based registry, where by design the registry does not persist after ... |
In .net, you can use <code>Request.Browser.JavaScript</code> to detect if the browser supports JavaScript. However, the user may still have Javascript disabled. An ugly way to check to see if Javascript is enabled, is to use <code>window.location</code> to redirect to page.aspx?jscript=true, and then check <code>Requ... |
I can't remember where I've seen this method but spam bots like to fill out forms. Have you considered putting a form field that is hidden with javascript (and says don't fill this field if the user doesn't have JavaScript). This way if something fills in this field you can ignore it as spam. |
You could check - have JavaScript that populates a hidden form field with a specific value *after* the page loads. Then, when the page posts back to the server, check that hidden form field the expected value. If it is not there, that means the JavaScript didn't execute.
As to whether you should assume it is spam is... |
[XmlSchemaValidator][1]
Warning: It's not pretty to use.
[1]: http://msdn.microsoft.com/en-us/library/system.xml.schema.xmlschemavalidator.aspx |
Doh, just remembered it's done automatically and errors appear as warnings in the "Error List" and underlined with the blue squiggle. |
Okay just remembered it's done automatically and errors appear as warnings in the "Error List" and underlined with the blue squiggle. Not sure if there is another way. |
Okay just remembered it's done automatically, errors appear as warnings in the "Error List" and are additionally underlined with the blue squiggle in the source file.
Not sure if there is another way to validate the file, but this will do for now. |
Updating Legacy Code from System.Web.Mail to System.Net.Mail in Visual Studio 2005: Problems sending E-Mail |
|.net|email|visual-studio-2005| |
Using the obsolete System.Web.Mail sending email works fine, here's the code snippet:
Public Shared Sub send(ByVal recipent As String, ByVal from As String, ByVal subject As String, ByVal body As String)
Try
Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.Ma... |
Controlling which Network Card TCP/IP message are sent on |
|c#|.net|networking| |
The system I'm currently working on consists of a controller PC running XP with .Net 2 connected to a set of embedded systems. All these components communicate with each other over an ethernet network. I'm currently using TcpClient.Connect on the XP computer to open a connection to the embedded systems to send TCP/IP m... |
I am studying towards the (admittedly soon-to-be-obsoleted) MCAD, and part of the WinForms element was Visual Inheritence.
I personally have had no major problems with it, however, there **are considerations to take in to account**.
For me, **the main problem has always initialization**.. You need to remember tha... |
If I'm not mistaken the zip function you use in python [creates a pair of the items found in list1 and list2][1]. Basically it still is a for loop with the addition that it will retrieve the data from the two seperate lists for you, instead that you have to do it yourself.
So maybe your best option is to use a *stan... |
Basically, once the TcpClient.Connect method has been successful, it will have created a mapping between the physical MAC address of the embedded system and the route it should take to that address (i.e. which network card to use).
I don't believe that all messages then sent over the TcpClient connection will be sen... |
XMLSerialization in C# |
|c#| |
I have a simple type that explicitly implemets an Interface.
<pre>
public interface IMessageHeader
{
string FromAddress { get; set; }
string ToAddress { get; set; }
}
[Serializable]
public class MessageHeader:IMessageHeader
{
private string from;
private string to;
[XmlAttribute("Fro... |
|c#|.net|serialization|interface| |
@Torlack: Recursion is a bad idea here, because there are "overlapping subproblems." I.e., If you choose `a` as `1` and `b` as `2`, then you have 3 variables left that should add up to 497; you arrive at the same subproblem by choosing `a` as `2` and `b` as `1`. (The number of such coincidences explodes as the numbers ... |
@Torlack: Recursion is a bad idea here, because there are "overlapping subproblems." I.e., If you choose `a` as `1` and `b` as `2`, then you have 3 variables left that should add up to 497; you arrive at the same subproblem by choosing `a` as `2` and `b` as `1`. (The number of such coincidences explodes as the numbers ... |
@Torlack, @Jason Cohen: Recursion is a bad idea here, because there are "overlapping subproblems." I.e., If you choose `a` as `1` and `b` as `2`, then you have 3 variables left that should add up to 497; you arrive at the same subproblem by choosing `a` as `2` and `b` as `1`. (The number of such coincidences explodes a... |
AD does that sort of caching for you so don't worry about it unless performance becomes a problem. I have software doing this sort of thing all day long running on a corporate intranet that takes thousands of hits per hour and have never had to tune performance in this area. |
[Structured programming][1] says you should only ever have one return statement per function. This is to limit the complexity. Many people such as Martin Fowler agrue that it is simpler to write functions with multiple return statements. He presents this argument in the classic [refactoring][2] book he wrote. This work... |
I've seen it in coding standards for C++ that were a hang-over from C, as if you don't have RAII or other automatic memory management then you have to clean up for each return, which either means cut-and-paste of the clean-up or a goto (logically the same as 'finally' in managed languages), both of which are considered... |
As Kent Beck notes when discussing guard clauses in [Implementation Patterns][1] making a routine have a single entry and exit point ...
> "was to prevent the confusion possible
> when jumping into and out of many
> locations in the same routine. It made
> good sense when applied to FORTRAN or
> assembly languag... |
Straight forward lossless compression is the way to go. To make it searchable you will have to compress relatively small blocks and create an index into an array of the blocks. This index can contain the bit offset of the starting bit in each block. |
How can I access a website configured with host headers in IIS on the local machine? |
|iis|hostheaders| |
When using host headers to host multiple websites on the same IP address in IIS, is there any way of accessing that website from a browser running on the local machine?
This is normally required when a given web component only allows configuration from the local machine. It's also useful when things like ASP.Net's b... |
Recording the database calls, the gross timing and the number of records (bytes) returned in the application is useful, but it's not going to give you all the information you need.
It might show you usage patterns you were not expecting. It might show where your using "row-by-row" access instead of "set based" opera... |
What does the <assemblies> part of your web.config file look like?
Here's what it looks like for a brand new ASP.NET 3.5 project made with Visual Studio 2008:
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.... |
Have you looked in the MFC source code, which you'll find in something like
C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc
|
I've got something similar set up: I have a main Ant build.xml which calls a separate build.xml that takes care of building my tests. This is how I do it:
<target name="build-tests">
<subant target="build">
<fileset dir="${test.home}" includes="build.xml"/>
</subant>
</target>
The trick is ... |
I found the answer :) I needed to add the following to my web.config:
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
... |
Cannot add WebViewer of ActiveReports to an ASP.NET page |
|activereports| |
I installed ActiveReports from their site. The version was labeled as ".NET 2.0 build 5.2.1013.2 (for Visual Studio 2005 and 2008)". I have an ASP.NET project in VS 2008 which has 2.0 as target framework. I added all the tools in the DataDynamics namespace to the toolbox, created a new project, added a new report.
... |
|.net20|email|visual-studio-2005| |
|.net|vb.net|email|.net-2.0|visual-studio-2005| |
How to validate an XML file against a schema using Visual Studio 2005 |
|visual-studio|xml|xslt|visual-studio-2005| |
Is it possible to validate an xml file against it's associated schema using Visual Studio 2005?
I could only see options to create a schema based on the current file, or show the XSLT output
![alt text][1]
[1]: http://farm4.static.flickr.com/3043/2843566028_28b36c943e_o.png
|
Is it possible to validate an xml file against it's associated schema using Visual Studio 2005 IDE?
I could only see options to create a schema based on the current file, or show the XSLT output
![alt text][1]
[1]: http://farm4.static.flickr.com/3043/2843566028_28b36c943e_o.png
|
In C# switch statements you can fall through cases only if there is no statement for the case you want to fall through
switch(myVar)
{
case 1:
case 2: // Case 1 or 2 get here
break;
}
However if you want to fall through with a statement you must use the dreaded GOTO
... |
Using ConfigurationManager to load config from an arbitrary location |
|asp.net|configuration|classicasp| |
I'm developing a data access component that will be used in a website that contains a mix of classic ASP and ASP.NET pages, and need a good way to manage its configuration settings. I'd like to use a custom ConfigurationSection, and for the ASP.NET pages this works great. But when the component is called via COM inte... |
|asp.net|configuration|asp-classic| |
Three points to make here:
- Firstly, there is little or NO performance penalty in actually having try-catch blocks in your code. This should not be a consideration when trying to avoid having them in your application. The performance hit only comes into play when an exception is thrown.
- When an exception i... |
No, there is no inbuilt capability in the .NET Base Class Library. |
Find all available JREs on Mac OS X from Java application installer |
|java|macos|installation| |
If Java application requires certain JRE version - how can I check its availability on Mac OS X during installation? |
|java|macos|installation| |
This is to do with something called 'K & R C' and 'ANSI C'.
In good old K & R C, if something is not declared, it is assumed to be int.
So any thing that looks like a function call, but not declared as function
will automatically take return value of 'int' and argument types depending
on the actuall call.
Howev... |
Eclipse Ganymede hacks, hints, tips, tricks, and best practices |
|c|eclipse|ganymede|eclipse-cdt| |
I've recently started using Eclipse Ganymede CDT for C development and I couldn't like it more. I'm aware the learning curve could be sort of pronounced, therefore and with your help, my goal is to flatten it as much as possible. I'm looking for the best hacks, hints, tips, tricks, and best practices to really unleash ... |
You could implement your own wrapper around the ZipInputStream and hand that off to the third-party library.
thirdPartyLib.handleZipData(new CloseIgnoringInputStream(zipStream));
class CloseIgnoringInputStream extends InputStream
{
private ZipInputStream stream;
public Cl... |
You could implement your own wrapper around the ZipInputStream that ignores close() and hand that off to the third-party library.
thirdPartyLib.handleZipData(new CloseIgnoringInputStream(zipStream));
class CloseIgnoringInputStream extends InputStream
{
private ZipInputStream stream;
... |
Reading Other Process' Memory in Mac OS / BSD |
|memory|ptrace|macos|bsd| |
I've been attempting to understand how to read the memory of other processes on Mac OS, but I'm not having much luck. I've seen many examples online using `ptrace` with `PEEKDATA` and such, however it doesn't have that option on BSD ([man page](http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/ptr... |
Realizing, as Joel Coehoom pointed out, that my icon was actually a background image, I created a transparent.gif image with title and alt attributes over top of the background, and voila - tooltips! |