instruction stringlengths 0 30k ⌀ |
|---|
I've only done a small bit of coding in Erlang but I found the most useful method was just to write the code in a text editor and have a terminal open ready to build my code as I need to (this was in Linux, but a similar idea would work in Windows, I'm sure).
Your question didn't mention it, but if you're looking fo... |
Thanks for all the responses. I never expected to get an answer this quick. For my test application I think SQL Server Compact Edition would be the way to go. I'm basically creating a money managment app similar to Microsoft Money and although it is an exercise to learn skills, I would eventually want to use it to mana... |
If you want to know how much the GC uses try:
GC.GetTotalMemory(true)
If you want to know what your process uses from Windows (VM Size column in TaskManager) try:
Process.GetCurrentProcess().PrivateMemorySize64
If you want to know what your process has in RAM (as opposed to in the pagefile) (Mem Usa... |
You have found the biggest pain point of ASP.NET. As far as sealed, private classes that hinder unit testing.
This is the main reason that TDD people will use a MVC framework (ASP.NET MVC, Castle MonoRail) as it provides a clear seperation from your view templates and your controller logic. The controllers are fully... |
1. Navigate to Tools -> Options
2. Select "Projects and Solutions" in the tree view on the left
3. Select "Track Active Item in Solution Explorer" |
Tools>Options...>Projects and Solutions>General
Make sure "Track active item in Solution Explorer" is checked. That should do it. |
`char(13)` is `CR`. For DOS-/Windows-style `CRLF` linebreaks, you want `char(13)+char(10)`, like:
'This is line 1.' + CHAR(13)+CHAR(10) + 'This is line 2.' |
Also not related to Python, but [Ubiquity][1] (a firefox extension) is a graphical command-line-like tool for the web, with a similar spirit to Quicksilver/Launchy/GnomeDo.
[1]: http://labs.mozilla.com/2008/08/introducing-ubiquity/ |
[GateKiller][1], how about adding a `break` to that `if` in the `foreach` loop? That would speed up things **a lot** because if like 6 is divisible by 2 you don't need to check with 3 and 5. (I'd vote your solution up anyway if I had enough reputation :-) ...)
ArrayList primeNumbers = new ArrayList();
for... |
Tools->Options->Project and Solutions->General
Check the box "Track Active Item in Solution Explorer"
|
This is always cool, because when you get exported lists from, say Oracle, then you get records spanning several lines, which in turn can be interresting for, say, cvs files, so beware.
Anyow, Rob's answer is good, but I would advice to use something else than @, try a few more, like §§@@§§ or something, so it will ... |
I don't think there is an official naming convention, but i've seen that Microsoft use m_ in the Microsoft.VisualBasic dll (via reflector). |
Check out [asio][1]. It is a cross compatable c++ library for asyncronous IO. I am not sure if this would be useful for the server ( I have never tried to link a standard c++ DLL to a c# project) but for the client it would be useful.
We use it with our application, and it solved most of our IO concurrency problems.... |
The reorganize and rebuild are different things.
Reorganize: it's a defrag for indexes. Takes the existing index(es) and defragments the existing pages. However if the pages are not in a contiguous manner, they stays like before. Only the content of the pages are changing.
Rebuild: actually it drops the index and... |
The reorganize and rebuild are different things.
Reorganize: it's a defrag for indexes. Takes the existing index(es) and defragments the existing pages. However if the pages are not in a contiguous manner, they stays like before. Only the content of the pages are changing.
Rebuild: actually it drops the index and... |
Querying like Linq when you don't have Linq. |
|database|linq|orm| |
I have a project that I'm currently working on but it currently only supports the .net framework 2.0. I love linq, but because of the framework version I can't use it. What I want isn't so much the ORM side of things, but the "queryability" (is that even a word?) of Linq.
So far the closest is [llblgen][1] but if t... |
There's a way to reference LINQ in the .NET 2.0 Framework, but I have to warn you that it *might* be against the terms of use/EULA of the framework:
[http://stackoverflow.com/questions/2138/linq-on-the-net-20-runtime#2146][1]
[1]: http://stackoverflow.com/questions/2138/linq-on-the-net-20-runtime#2146 |
I would agree with the slow refactoring approach; for example, take that copy-and-pasted code and extract it into whatever the appropriate Java paradigm is (a class, perhaps? or better yet, use an existing library?). When your code is really clean and terse, yet still lacking in overall architectural strategy, *then* y... |
Style counts for a lot, and it seems to me that if there is a constructor with 20+ arguments, then the design should be altered. Provide reasonable defaults. You are the programmer; you control your class. |
I think it all depends on the situation. For something like your example, a customer class, I wouldn't risk the chance of having that data being undefined when needed. On the flip side, passing a struct would clear up the argument list, but you would still have a lot of things to define in the struct. |
I would think the easiest way would be to find an acceptable default for each value. In this case, each field looks like it would be required to construct, so possibly overload the function call so that if something is not defined in the call, to set it to a default.
Then, make getter and setter functions for each p... |
If your database is small enough to download to a laptop and work with it offline, you probably don't need to worry too much about the performance differences between ints and Guids. But do not underestimate how useful ints are when developing and troubleshooting a system! You will probably need to come up with some ... |
Well, OK.
So what are we going to pick as the basic building block for this. Windows has two building blocks that look promising, I think; I/O Completion Ports (IOCPs) and Asynchronous Procedure Calls (APCs). Both of these give us FIFO queuing without having to perform explicit locking, and with a certain amount o... |
Steve Mcconnell writes in Code Complete that people have trouble keeping more 7 things in their head at a time, so that'd be the number I try to stay under. |
Outside of SQL:
Record.find(:all).group_by(&:date).count
ActiveSupport's [Enumerable#group_by](http://api.rubyonrails.com/classes/Enumerable.html#M001795) is indispensable. |
One more thing, there is a [Deep Fried Bytes Podcast][1] that is entirely about .NET development on Mac - you may find some nuggets in there too.
[1]: http://deepfriedbytes.com/podcast/episode-5-developing-net-software-on-mac/ |
Another solution is [wget][1].
[1]: http://www.devarticles.com/c/a/Web-Services/Website-Mirroring-With-wget/1/ |
@Jonathan is correct, but you also have to change the return type to
IList<T>
also. Unless that is just a markdown bug. |
@Jon and @Jonathan is correct, but you also have to change the return type to
IList<T>
also. Unless that is just a markdown bug.
@[Jonathan][1], figured that was the case.
[1]: http://stackoverflow.com/questions/43126/ilistcasttypeoft-returns-error-syntax-looks-ok#43137 |
@Jon and @Jonathan is correct, but you also have to change the return type to
IList<T>
also. Unless that is just a markdown bug.
@[Jonathan][1], figured that was the case.
I am not sure what version of nHibernate you are using. I haven't tried the gold release of 2.0 yet, but you could clean the metho... |
@Jon and @Jonathan is correct, but you also have to change the return type to
IList<T>
also. Unless that is just a markdown bug.
@[Jonathan][1], figured that was the case.
I am not sure what version of nHibernate you are using. I haven't tried the gold release of 2.0 yet, but you could clean the metho... |
I develop in ASP.Net on my mac almost daily, and I have to question why you aren't interested in Boot Camp. Yeah, VMWare is nice, but for my money nothing beats the performance of running Windows by itself on the Mac. |
@bpapa
Nightly backups of work folders to servers will prevent losing more than a days work.
@tonyo
Let's see the requirement documents were completed the day after we finished coding. Does that tell you about our project management?
We are a small shop so while you would think change is easy there are... |
In C++, what alternatives do I have for exposing a collection, from the point of view of performance and data integrity. |
Clearing Class::DBI's internal cache. |
|perl| |
I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI. This is a mod_perl implementation, so an instance of a class can be quite old between times that it is accessed.
From the man pages I found two optio... |
Linux: What is the best way to estimate the code & static data size of program? |
|c++|c|linux| |
I want to be able to get an estimate of how much code & static data is used by my C++ program?
Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime?
Will objdump & readelf help? |
Fluid rounded corners with jquery |
|jquery| |
What is the best way to create fluid width/height rounded corners with jquery? |
How to divide two 64-bit numbers in Linux Kernel? |
|linux|c|64-bit| |
Some code (albeit a little contrived but close to the real thing) to demonstrate the problem (C-syntax):
#define SINT64 long long int
#define SINT32 long int
SINT64 divRound(SINT64 dividend, SINT64 divisor)
{
SINT32 modResult = dividend % divisor;
SINT32 multResult = modResult ... |
Working set isn't a good property to use. From what I gather, it includes everything the process can touch, even libraries shared by several processes, so you're seeing double-counted bytes in that counter. Private memory is a much better counter to look at. |
Check out Share on [Acrobat.com][1], there you can upload PDFs and make them embedable Flash files (sort of like YouTube for documents). Should be possible to load those into Flex. Not an ideal solution, but unfortunately you need to convert the PDF to an SWF somehow to be able to load it into a Flex application. I don... |
That it can close Firefox faster then I can with the mouse and that little [x] thing in the corner... :-P |
If your objects are represented as points in 2D space you can use line intersection to determine if two objects have collided. You can use similar logic to check if an object is inside another object (and thus they have collided even any of their lines are not currently intersecting). The <a href="http://local.wasp.uwa... |
If you plan on searching anything of remotely decent size, your best bet is going to be to use a dictionary or a set. Otherwise, you basically have to iterate through every element of the iterator until you get to the one you want.
If this isn't necessarily performance sensitive code, then the list comprehension wa... |
I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives wo... |
I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives wo... |
I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives wo... |
First of all. Getting linq itself to work on 2.0 is out of the question. Its possible, but really not something to do outside a testing environment.
<br /><br />
The closest you can get in terms of the ORM/Dynamic Querying part of it, is imho SubSonic, which I'll recommend for anyone stuck in C# 2.0 |
`
my %unique = ();
for each my $item (@my_array)
{
$unique{$item} ++;
}
my @my_unique_array = keys %unique;
`
If you use a hash and add the items to the hash. You also have the bonus of knowing how many times each item appears in the list |
My usual was of doing this is:
my %unique = ();
for each my $item (@myarray)
{
$unique{$item} ++;
}
my @myuniquearray = keys %unique;
If you use a hash and add the items to the hash. You also have the bonus of knowing how many times each item appears in the list |
1. No. A table should be named after the entity it represents.
Person, not persons is how you would refer to whoever one of the records represents.
* Again, same thing. The column FirstName really should not be called FirstNames. It all depends on what you want to represent with the column.
* NO.
* Yes. Case it for... |
According to the standards, pwd -P should return the path with symlinks resolved.
C function char *getcwd(char *buf, size_t size) from unistd.h should have the same behaviour. |
According to the standards, pwd -P should return the path with symlinks resolved.
C function char *getcwd(char *buf, size_t size) from unistd.h should have the same behaviour.
[getcwd][1]
[pwd][2]
[1]: http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html
[2]: http://www.opengroup.org/onl... |
Someone took the javascript code from Google Maps and ported it to python: [gmerc.py][1]
I've used this and it works great.
[1]:http://code.google.com/p/gheat/source/browse/trunk/__/lib/python/gmerc.py |
You can use a similar technique on Windows, you just need to use different words for the same concepts. :) This article: http://msdn.microsoft.com/en-us/library/ms682499.aspx uses a win32 pipe to handle I/O from another process, you just have to do the same thing with threads within the same process. Of course, in your... |
For bit operations, you need to use bitwise operators.
This should do the trick:
if(testItem & FlagTest.Flag1)
{
// Do something,
// however This is never true.
} |
For bit operations, you need to use bitwise operators.
This should do the trick:
if ((testItem & FlagTest.Flag1) == FlagTest.Flag1)
{
// Do something,
// however This is never true.
}
**Edit:** Fixed my if check - I slipped back into my C/C++ ways (thanks to Ryan Farley for poi... |
Palm or Pocket PC for developers |
|mobile|device| |
I need to develop some programs for mobile devices but haven't decided the platform to build upon. I'm looking for Palm or Pocket PC devices that have Touch screen and Wi-Fi connection and are cheep because I'll need to buy several of them.
I don't really need mp3 players, video players, pdf readers or anything els... |
I need to develop some programs for mobile devices but haven't decided the platform to build upon. I'm looking for Palm or Pocket PC devices that have Touch screen and Wi-Fi connection and are cheep because I'll need to buy several of them.
I don't really need mp3 players, video players, pdf readers or anything els... |
I need to develop some programs for mobile devices but haven't decided the platform to build upon. I'm looking for Palm or Pocket PC devices that have Touch screen and Wi-Fi connection and are cheep because I'll need to buy several of them.
I don't really need mp3 players, video players, pdf readers or anything els... |
Mobile devices for developers |
I need to develop some programs for mobile devices but haven't decided the platform to build upon. I'm looking for Palm or Pocket PC devices that have Touch screen and Wi-Fi connection and are cheep because I'll need to buy several of them.
I don't really need mp3 players, video players, pdf readers or anything els... |
|c++| |
My problem is that I want to return an internal list of data to the caller, but I don't want to generate a copy. Thant leaves me with either returning a reference to the list, or a pointer to the list. However, I'm not crazy about letting the caller change the data, I just want to let it read the data.
- Do I have t... |
Something to consider ... not everyone is capable of programming:
Some people just cannot get past things like:
A = 1
B = 2
A = B
(these people will still think A = 1)
[Jeff has talked about this too.][1] In fact, my example is in the link (and explained, to boot).
[1]: http://www.codinghorr... |
Oded, it depends on what type of .NET development one is trying to do, and for what platform. If you're targeting Windows and building something other than console apps, you're best off not using Mono, as Mono projects are not necessarily drop-in-to-Windows-and-go solutions. |
Regex in VB6? |
|regex|vb6| |
I need to write a program that can sift through specially-formatted text files (essentially CSV files with a fixed set of column types that have different delimiters for some columns ... comma in most places, colons in others) to search for formatting errors. I figure regular expressions will be the way to go.
The ... |
I need to write a program that can sift through specially-formatted text files (essentially CSV files with a fixed set of column types that have different delimiters for some columns ... comma in most places, colons in others) to search for formatting errors. I figure regular expressions will be the way to go.
The ... |
One good way is to fix each bug in the stable branch and merge the stable branch into the development branch. This is the [Parallel Maintenance/Development Lines][1] pattern, and the key is to merge early and often. Merging infrequently and late means that the development branch is unrecognisable compared to the stable... |
The page linked to in another answer is a good source, but a lot to read. Here is a short list of some the major differences:
- internationalization: they used new terminology, rather than using language tied to US legal concepts
- patents: they specifically address patents (including the Microsoft/Novell issue ... |
Personally, I love the work of [Paul Bourke](http://local.wasp.uwa.edu.au/~pbourke/geometry/).
Also, Paul Nettle used to write on the topic. He has a full 3D collision detection library, but you may be more interested in the ideas behind such libraries. For that, see [General Collision Detection for Games Using Elli... |
Personally, I love the work of [Paul Bourke](http://local.wasp.uwa.edu.au/~pbourke/geometry/).
Also, Paul Nettle used to write on the topic. He has a full 3D collision detection library, but you may be more interested in the ideas behind such libraries (which are very applicable to 2D). For that, see [General Collis... |
I took all of the podcasts from the answers scoring 5 or better (and those in the original question) and added them to an aggregated page on Cullect.com:
[http://www.cullect.com/StackOverflow-Recommended-Podcasts][1]
It provides a handy way to get a glimpse of these podcasts as well as a way to preview them if yo... |
I think what you are looking for is called a toolStripSplitButton. It is only available in a toolStrip. But you can add a toolStripContainer anywhere on your form and then put the toolStrip and toolStripSplitButton inside your container.
You won't want to show the grips so you'll want to set your gripMargin = 0. Yo... |
For what it's worth, caching is DIRT SIMPLE in PHP even without an extension/helper package like memcached.
All you need to do is create an output buffer using ob_start().
Create a global cache function. Call ob_start, pass the function as a callback. In the function, look for a cached version of the page. If e... |
Check out: http://www.swftools.org/ for tools to convert your PDF to SWF, speifically pdf2swf- http://www.swftools.org/pdf2swf.html |
Since I found the control in Windows itself, I was hoping to find it built-in somewhere already so I didn't have to add anything to my code-base to use it. But the split button at this link (found via the msdn suggestion) looks pretty promising.
[http://blogs.msdn.com/jfoscoding/articles/491523.aspx][1]
I'll try... |
I think the best answer to each of those questions would be given by you and your team. It's far more important to have a naming convention then how exactly the naming convention is.
As there's no right answer to that, you should take some time (but not too much) and choose your own conventions and - *here's* the i... |
You can do something like this:
sub uniq {
return keys %{{ map { $_ => 1 } @_ }};
}
@my_array = ("one","two","three","two","three");
print join(" ", @my_array), "\n";
print join(" ", uniq(@my_array)), "\n";
That destroys the original order of the items in the array, though. |
You can do something like this:
sub uniq {
return keys %{{ map { $_ => 1 } @_ }};
}
@my_array = ("one","two","three","two","three");
print join(" ", @my_array), "\n";
print join(" ", uniq(@my_array)), "\n";
That destroys the original order of the items in the array, though.
U... |
You can do something like this:
sub uniq {
return keys %{{ map { $_ => 1 } @_ }};
}
@my_array = ("one","two","three","two","three");
print join(" ", @my_array), "\n";
print join(" ", uniq(@my_array)), "\n";
That destroys the original order of the items in the array, though.
U... |
Common shell scripts often have to find their "home" directory even if they are invoked as a symlink. The script thus have to find their "real" position from just $0.
cat `mvn`
on my system prints a script containing the following, which should be a good hint at what you need.
if [ -z "$M2_HOME" ] ; th... |
I need to develop some programs for mobile devices but haven't decided the platform to build upon. I'm looking for Palm or Pocket PC devices that have Touch screen and Wi-Fi connection and are cheep because I'll need to buy several of them.
I don't really need camera, mp3 players, video players, pdf readers or anyt... |
Regarding the edit. You can't make it true. I suggest you wrap what you want into another class (or extension method) to get closer to the syntax you need.
i.e.
public class FlagTestCompare
{
public static bool Compare(this FlagTest myFlag, FlagTest condition)
{
return ((myFlag & condition)... |
Regarding the edit. You can't make it true. I suggest you wrap what you want into another class (or extension method) to get closer to the syntax you need.
i.e.
public class FlagTestCompare
{
public static bool Compare(this FlagTest myFlag, FlagTest condition)
{
return (... |
Does C# have built-in support for parsing page-number strings? |
|c#|parsing| |