instruction stringlengths 0 30k ⌀ |
|---|
1. [Microsoft ODBC](http://msdn.microsoft.com/en-us/library/ms710252.aspx).
2. The MFC ODBC classes such as [CDatabase](http://msdn.microsoft.com/en-us/library/2dhc1abk.aspx).
3. [OleDB](http://msdn.microsoft.com/en-us/library/ms722784.aspx) (via COM).
4. And you can always go through the per-RDBMS native librar... |
As I understand it, Hashtable is similar to the HashMap and has a similar interface. It is recommended that you use HashMap unless yoou require support for legacy applications or you need synchronisation - as the Hashtables methods are synchronised. So in your case as you are not multi-threading, HashMaps are your best... |
Java is always pass-by-value. The difficult thing can be to understand that Java passes objects as references passed by value.
It goes like this:
public void foo(Dog d) {
d.name == "Max"; // true
d = new Dog("Fifi");
d.name == "Fifi"; // true
}
Dog aDog = new Dog("Max");
... |
Call Functions within Function - Flash Actionscript 2.0 |
|flash|actionscript|actionscript-2| |
I'm trying to call a function after I load some XML into Actionscript, and I'm just wondering how I call that function. Example:
//Function Declarations
function parentFunction()
{
function callMe()
{
textField.text = "lawl";
}
}
Now, **how do I call the "cal... |
There are some super-fast implementations that (from memory) represent cells of 8 or more adjacent squares as bit patterns and use that as an index into a large array of precalculated values to determine in a single machine instruction if a cell is live or dead.
Check out here:
http://dotat.at/prog/life/life.html... |
I am going to quote my answer from the other question, because the chapters I mention have some very interesting and fine-tuned solutions. Some of the implementation details are in c and/or assembly, yes, but for the most part the algorithms can work in any language:
> Chapters [17][1] and [18][2] of
> Michael Abr... |
Asp.Net MVC: How to determine if you're currently on a specific view |
|c#|asp.net-mvc| |
I need to determine if I'm on a particular view. My use case is that I'd like to decorate navigation elements with an "on" class for the current view. Is there a built in way of doing this? |
I dont' think calling a Generic Method on a webservice is possible.
If you look at the service description of two identical methods, one generic, one not:
[WebMethod]
public string[] GetSearchList(string prefixText, int count)
{
}
[WebMethod]
public string[] GetSearchList2<T>(st... |
So I found the answer in my specific case -- there was a div much further up in the DOM that had specific left/right margins set which compressed it and everything in it.
But the heart of the question is really how can you easily debug this sort of issue? What would be perfect in this case for example would be ... |
This is not a reason why, but the C# specification section 8.7.2 states the following:
> The governing type of a switch statement is established by the switch expression. If the type of the switch expression is sbyte, byte, short, ushort, int, uint, long, ulong, char, string, or an enum-type, then that is the govern... |
Not really, no.
You may be able to achieve the same effect by using reflection to get Method objects you can then invoke, and the other way is to create an interface with a single 'invoke' or 'execute' method, and then instantiate them to call the method your interested in (i.e. using an anonymous inner class).
Y... |
I suppose there is no fundamental reason why the compiler couldn't automatically translate your switch statement into:
if (t == typeof(int))
{
...
}
elseif (t == typeof(string))
{
...
}
...
But there isn't much gained by that.
A case statement on integral types allow... |
I'm used to doing all my coding in one C file. However, I'm working on a project large enough that it becomes impractical to do so. I've been #including them together but I've run into cases where I'm #including some files multiple times, etc. I've heard of .h files, but I'm not sure what their function is (or why havi... |
It's called [Script Combining][1]. There is a video example from asp.net explaining it [here][2].
[1]: http://msdn.microsoft.com/en-us/library/cc837190.aspx
[2]: http://www.asp.net/Learn/3.5-SP1/video-296.aspx |
Hey Chris, I just figured it out. Silly mistake.
It was just a permission issue, running everything from `/tmp/` worked fine --well after enabling `GODI_BASEPKG_PCRE` in `godi.conf`. I had been running it from my home directory, you forget simple things like that at 3:00am. |
Hey Chris, I just figured it out. Silly mistake.
It was just a permission issue, running everything from `/tmp/` worked fine --well after enabling `GODI_BASEPKG_PCRE` in `godi.conf`. I had been running it from my home directory, you forget simple things like that at 3:00am.
--
Actually I'm having another probl... |
Hey Chris, I just figured it out. Silly mistake.
It was just a permission issue, running everything from `/tmp/` worked fine --well after enabling `GODI_BASEPKG_PCRE` in `godi.conf`. I had been running it from my home directory, you forget simple things like that at 3:00am.
--
Actually I'm having another probl... |
[erickson][1] is almost right: since you want to match on counts of duplicates, you want a [Bag][2]. In Java, this looks something like:
(new HashBag(collection1)).equals(new HashBag(collection2))
I'm sure C# has a built-in Set implementation. I would use that first; if performance is a problem, you could a... |
Here is how the confirm window works on simpleModal:
$(document).ready(function () {
$('#confirmDialog input:eq(0)').click(function (e) {
e.preventDefault();
// example of calling the confirm function
// you must use a callback function to perform the "yes" action
confirm(... |
It is common to use a “file exists” function to check a path before writing to it. In this use case the type of file is irrelevant, if there is a directory called “/home/foo” you won't be able to create a file called “/home/foo”
Also PHP, one of the languages you mentioned, provides several functions depending on wh... |
There is an inter-op angle as well. If you upgrade your Asmx services to WCF services you can still honor your asmx clients and then start moving forward with newer WCF clients. WCF is starting to get some ReST attention, RSS is there, Silverlight has a place with WCF. Performance is better, depending on the binding... |
It seems that something like this could be negotiable. We have never though of "fees" as a hard nonnegotiable item. If they value your business I would bet they could discount the transfer fee. It certainly seems that some kind of fee is reasonable for administrative changes that are required. To me that should be ... |
Are you making good use of SuspendLayout() and ResumeLayout()?
[http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80).aspx][1]
[1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80).aspx |
According to [the switch statement documentation][1] if there is an unambiguous way to implicitly convert the the object to an integral type, then it will be allowed. I think you are expecting a behavior where for each case statement it would be replaced with `if (t == typeof(int))`, but that would open a whole can of... |
Apache uses the standard format of inode-filesize-mtime. The only caveat to this is that the mtime must be epoch time and padded with zeros so it is 16 digits. Here is how to do it in PHP:
$fs = stat($file);
header("Etag: ".sprintf('"%x-%x-%s"', $fs['ino'], $fs['size'],base_convert(str_pad($fs['mtime'],16... |
How to find the current name of the test being executing? |
|visual-studio|unit-testing| |
I know I can figure out the name of the method as its being executed, just wondering if there is a way from the setup method. I guess an attribute method would work but from the setup method it would be the best. |
I know I can figure out the name of the method as its being executed, just wondering if there is a way from the setup method. I guess an attribute method would work but from the setup method it would be the best.
EDIT NUnit |
Explicit vs implicit SQL joins |
|sql|join| |
Is there any efficiency difference in an explicit vs implicit inner join?
For example:
select * from
table a inner join table b
on a.id = b.id;
vs.
select a.*, b.*
from table a, table b
where a.id = b.id;
|
Is there any efficiency difference in an explicit vs implicit inner join?
For example:
select * from
table a inner join table b
on a.id = b.id;
vs.
select a.*, b.*
from table a, table b
where a.id = b.id;
|
@Darren: Thanks for the answer. I had tried to create pageLoad with event argument [ApplicationLoadEventArgs][1] as parameter (see below). However according to [this][2]:
*The load event is raised for all postbacks to the server, which includes asynchronous postbacks.*
As you have indicated, the isPartialLoad pr... |
A simple and fairly efficient solution is to sort both collections and then compare them for equality:
bool equal = collection1.OrderBy(i => i).SequenceEqual(
collection2.OrderBy(i => i);
This algorithm is O(N*logN), while your solution above is O(N^2).
If the collections have certain... |
There is also a formal reason why a directory is a file:
> Files (or links to files) can be
> located in directories. However, more
> generally, a directory can contain
> either a list of files or a list of
> links to files. Within this
> definition, it is of paramount
> importance that the term "file"
> incl... |
No Idea what I do, but now its working.
this is all I have done:
1. reinstall Vmware server several times ( more than 4 )
2. Fix network adapter
3. prey ( mora than 1000 times) |
No Idea what I do, but now its working.
this is all I have done:
1. reinstall Vmware server several times ( more than 4 )
2. Fix network adapter
3. prey ( more than 1000 times) |
No Idea what I do, but now its working.
this is all I have done:
1. reinstall Vmware server several times ( more than 4 )
2. Fix network adapter
3. prey ( more than 1000 times)
UPDATE: One of the three VM does not work the other works perfect. |
UNION does not support BLOB (or CLOB) column types, UNION ALL does. |
I designed a database similarly (only INSERTs — no UPDATEs, no DELETEs).
Almost all of my SELECT queries were against views of only the current rows for each table (highest revision number).
The views looked like this…
SELECT
dbo.tblBook.BookId,
dbo.tblBook.RevisionId,
... |
I designed a database similarly (only INSERTs — no UPDATEs, no DELETEs).
Almost all of my SELECT queries were against views of only the current rows for each table (highest revision number).
The views looked like this…
SELECT
dbo.tblBook.BookId,
dbo.tblBook.RevisionId,
... |
In terms of what it offers, I think the answer is compatibility. The ASMX services were pretty Microsofty. Not to say that they didn't try to be compatible with other consumers; but the model wasn't made to fit much besides ASP.NET web pages and some other custom Microsoft consumers. Whereas WCF, because of its archite... |
The only disadvantage is complexity but really how hard is it to add some domain objects and bind to a list of them as opposed to using a dataset. You don't even have to create three seperate projects, you can just create 3 seperate folders within the web app and give each one a namespace like, YourCompany.YourApp.Dom... |
I'm using GCC.
You can turn on nested functions by using the flag:
-fnested-functions
when you compile. |
My current solution is with extension methods:
public static class UrlHelperExtensions
{
/// <summary>
/// Determines if the current view equals the specified action
/// </summary>
/// <typeparam name="TController">The type of the controller.</typeparam>
/// <par... |
Replace a database connection for report and all subreports |
Personally, I wouldn't worry about it until you see a problem. Messing with the default python install on a *Nix system can cause more trouble than it's worth. I can say from personal experience that you never truly understand what python has done for the nix world until you have a problem with it.
You can also ad... |
Why not use FormsAuth, but against ActiveDirectory instead as per the info in [this thread][1]. It's just as (in)secure as Basic Auth, but logging out is simply a matter of blanking a cookie (or rather, calling [FormsAuthentication.SignOut][2])
[1]: http://stackoverflow.com/questions/30861/authenticationg-domain-u... |
<pre>
<code>
import threading
class Foo ( threading.Thread ):
def __init__(self,x):
self.__x = x
def run (self,x):
print str(self.__x)
for x in xrange(20):
Foo(x).start()
<code>
</pre>
Here is a basic threading sample, this will spawn 20 threads, each thread will output it'... |
<pre>
<code>
import threading
class Foo (threading.Thread):
def __init__(self,x):
self.__x = x
threading.Thread.__init__()
def run (self,x):
print str(self.__x)
for x in xrange(20):
Foo(x).start()
</code>
</pre>
Here is a basic threading sample, this will spawn 20 ... |
<pre>
<code>
import threading
class Foo (threading.Thread):
def __init__(self,x):
self.__x = x
threading.Thread.__init__()
def run (self,x):
print str(self.__x)
for x in xrange(20):
Foo(x).start()
</code>
</pre>
Here is a basic threading sample, this will spawn 20 ... |
<pre>
<code>
import threading
class Foo (threading.Thread):
def __init__(self,x):
self.__x = x
threading.Thread.__init__(self)
def run (self):
print str(self.__x)
for x in xrange(20):
Foo(x).start()
</code>
</pre>
Here is a basic threading sample, this will spawn 2... |
UDP packets can also be delivered out of order, so if you are devising a protocol on top of UDP you have to take that into account as well. |
Compiler
------------
You can see an example of a C 'module' at [this topic][1] - Note that there are two files - the header tea.h, and the code tea.c. You declare all the public defines, variables, and function prototypes that you want other programs to access in the header. In your main project you'll #include ... |
Your question makes it clear that you haven't really done much serious development. The usual case is that your code will generally be far too large to fit into one file. A good rule is that you should split the functionality into logical units (.c files) and each file should contain no more than what you can easily ho... |
You should regard .h files as **interface files** of your .c file. Every .c file represents a module with a certain amount of functionality. If functions in a .c file are used by other modules (i.e. other .c files) put the function prototype in the .h interface file. By including the interface file in your original mod... |
|crystal-reports| |
Is there is any way to change the datasource location for a report and all of it's subreports without having to open each of them manually? |
In addition to what izb said, `HashMap` allows null values, whereas the `Hashtable` does not.
Also note that `Hashtable` extends the `Dictionary` class, which as the [Javadocs][1] state, is obsolete and has been replaced by the `Map` interface.
[1]: http://java.sun.com/j2se/1.4.2/docs/api/java/util/Dictionary... |
It's not good. More platforms leads to more testing, leads to more time fixing bugs, leads to less time having fun implementing new features, leads to anger, hate, suffering, etc. |
How to tell which disk Windows Used to Boot |
|windows|mbr| |
I'm need to find a method to programmatically determine which disk drive Windows is using to boot. In other words, I need a way from Windows to determine which drive the BIOS is using to boot the whole system.
Does Windows expose an interface to discover this? With how big the Windows API is, I'm hoping there is so... |
I'm need to find a method to programmatically determine which disk drive Windows is using to boot. In other words, I need a way from Windows to determine which drive the BIOS is using to boot the whole system.
Does Windows expose an interface to discover this? With how big the Windows API is, I'm hoping there is so... |
I'm need to find a method to programmatically determine which disk drive Windows is using to boot. In other words, I need a way from Windows to determine which drive the BIOS is using to boot the whole system.
Does Windows expose an interface to discover this? With how big the Windows API is, I'm hoping there is so... |
As others have stated, the command pattern is a very powerful method of implementing Undo/Redo. But there is important advantage I would like to mention to the command pattern.
When implementing undo/redo using the command pattern, you can avoid large amounts of duplicated code by abstracting (to a degree) the oper... |
you might want to look into using compiled queries
have a look at [http://www.3devs.com/?p=3][1]
[1]: http://www.3devs.com/?p=3 |
Your code looks functional. As for a better way, that is going to get subjective. You might want to check out this [page][1] as it deals with time spans in SQL.
[1]: http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx |
Wait.... did you ever use .NET Remoting, cause thats the real thing its replacing. .NET Remoting is pretty complicated itself. I find WCF easier and better laid out. |
Apparently marker was introduced as a value in CSS 2 but did not make it to CSS 2.1 because of lacking browser support.
I suppose that didn’t help its popularity …
Source: http://de.selfhtml.org/css/eigenschaften/positionierung.htm#display (German) |
Have you tried Adobe's version cue? This is not open source / free but it may be easier to use for the end-user.
http://www.adobe.com/products/creativesuite/versioncue/
|
Have you tried [Tortoise SVN][1]? I can't imagine source control getting much easier to use.
[1]: http://tortoisesvn.tigris.org/ |
Dave Miller and their fellow henchmen all inhabit in the lkml or [Linux Kernel Mailing List][1]. If you can provide a reasonably decent bug report they'll get you a reasonable answer.
[1]: http://lkml.org |
Dave Miller (person in charge of networking in the linux kernel) and their fellow henchmen all inhabit the lkml or [Linux Kernel Mailing List][1]. If you can provide a reasonably decent bug report they'll get you a reasonable answer.
On the other hand if you tell them it's a very old kernel, they'll tell you to try... |
@Darren: Thanks for the answer. I had tried to create pageLoad with event argument [ApplicationLoadEventArgs][1] as parameter (see below). However according to [this][2]:
*The load event is raised for all postbacks to the server, which includes asynchronous postbacks.*
As you have indicated, the isPartialLoad pr... |
Cast List<int> to List<string> |
|c#|generics|casting| |
Does anyone know if you can cast a `List<int>` to `List<string>` somehow? I know I could loop through and .ToString() the thing but a cast would be awesome.
I'm in c# 2.0 (so no linq) |
Learning CIL |
|.net|cil| |
Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good. |
|.net|cil| |
> Although, I'm not sure how these approaches could apply when resizing a window.
Handle the ResizeBegin and ResizeEnd events to call SuspendLayout() and ResumeLayout(). These events are only on the System.Windows.Form class (although I wish they were also on Control). |
You have to build a new list. The underlying bit representations of `List<int>` and `List<string>` are completely incompatible -- on a 64-bit platform, for instance, the individual members aren't even the same size.
It is theoretically possible to treat a `List<string>` as a `List<object>` -- this gets you into the... |
While on the topic, according to Jeff Atwood, [the switch statement is a programming atrocity][1]. Use them sparingly. You can often accomplish the same task using a table (e.g. a `Dictionary<Type, Func>` in your case.)
[1]: http://twitter.com/codinghorror/statuses/909900250 |
While on the topic, according to Jeff Atwood, [the switch statement is a programming atrocity][1]. Use them sparingly.
You can often accomplish the same task using a table. For example:
var table = new Dictionary<Type, string>()
{
{ typeof(int), "it's an int!" }
{ typeof(string), "it's a... |
Designs change so much during development and afterwards that most of my carefully crafted documents rot away in source control and become almost more of a hindrance than a help, once code is in production. I see design documents as necessary to good communication and to clarify your thinking while you develop somethi... |
MSBuild is incredibly simple to use, you can use VS to manage the projects and solution files and just pass the SLN to MSBuild.
|
A couple of simple rules to start:
1. Put those declarations that you want to make "public" into the header file for the C implementation file you are creating.
2. Only #include header files in the C file that are needed to implement the C file.
3. #include header files in a header file only if required for the... |
A couple of simple rules to start:
1. Put those declarations that you want to make "public" into the header file for the C implementation file you are creating.
2. Only #include header files in the C file that are needed to implement the C file.
3. #include header files in a header file only if required for the... |
It sounds like you are a single developer working on your own site. If this is the case, it's not necessary at all, but it is still a good idea for you to learn as a part of your professional experience.
Automated building of projects becomes more necessary as the number of developers working on a project increase. ... |
From the [Python Enterprise Application Kit community][1]:
> *"Eggs are to Pythons as Jars are to Java..."*
>
> Python eggs are a way of bundling
> additional information with a Python
> project, that allows the project's
> dependencies to be checked and
> satisfied at runtime, as well as
> allowing projects... |
Since you are limited to .Net 2.0 WCF is perhaps not an option. You could use .Net remoting with shared memory as the underlying communication mechanism between app domains on the same machine. Using this approach you can easily put your processes on different machines and replace the shared memory protocol with a ne... |
I always figured you'd use a db trigger on update and delete to push those rows out into a TableName_Audit table.
That'd work with ORMs, give you your history and wouldn't decimate select performance on that table. Is that a good idea or am I missing something? |
Tell them it'll let you do your job easier which translates into less time and less money. |