instruction
stringlengths
0
30k
###What tools are available? This [article describes][1] another developers frustrations with lack of C++ code coverage tools. It looks like their search led them to a tool called **[Bullseye Coverage][2] which [supports many platforms][3] including MSVC6 for Windows *and* native c++ compilers under linux/unix (lik...
###Which tool should I use? This [article describes][1] another developers frustrations searching for C++ code coverage tools. The author's final solution was [Bullseye Coverage][2]. **[Bullseye Coverage][2] features:** * [Cross Platform Support][3] (win32, unix, and embedded), (supports linux gcc compiler...
> But how does this handle language specific sorting rules? Does it take locale into account? No, `list.sort()` is a generic sorting function. If you want to sort according to the Unicode rules, you'll have to define a custom sort key function. You can try using the [pyuca](http://jtauber.com/blog/2006/01/27/python_...
"23||45||45||56||67".replace(/^([0-9]+\|\|){n}([0-9]+)\|\|,"$1$2&&")); where n is the one less than the nth pipe, (of course you don't need that first subexpression if n = 0)
"23||45||45||56||67".replace(/^([0-9]+\|\|){n}([0-9]+)\|\|/,"$1$2&&") where n is the one less than the nth pipe, (of course you don't need that first subexpression if n = 0)
here's something that works: "23||45||45||56||67".replace(/^((?:[0-9]+\|\|){n})([0-9]+)\|\|/,"$1$2&&") where n is the one less than the nth pipe, (of course you don't need that first subexpression if n = 0)
here's something that works: "23||45||45||56||67".replace(/^((?:[0-9]+\|\|){n})([0-9]+)\|\|/,"$1$2&&") where n is the one less than the nth pipe, (of course you don't need that first subexpression if n = 0) And if you'd like a function to do this: function pipe_replace(str,n) { var RE = new ...
Here's how I do it in C++ using GCC libraries: #include <execinfo.h> // Backtrace #include <cxxabi.h> // Demangling vector<Str> backtrace(size_t numskip) { vector<Str> result; std::vector<void*> bt(100); bt.resize(backtrace(&(*bt.begin()), bt.size())); char **btsym...
Best .NET obfuscation tools/strategy
|.net|security|obfuscation|
My product is both ASP.NET, Windows forms app and Windows service. 95% of code is .NET (VB if you must know). For IP reasons, I need to obfuscate the code. I am using an old dotfuscator (over 5 years old) and thinking it is time to move to a new gen. Anyone can recommend from his personal experience (don't just gi...
Distributed File System (DFS) is good for content, especially if each server (or a number of servers) host a replica synced up with File Replication Service (FRS). So if you've got two servers, each has a complete replica, so one going down doesn't mean the site goes down. If all servers in your 'cluster' will host ...
Classes design decision
|oop|asp.net-membership|inheritance|
ASP.NET Membership - Class design decision
|oop|asp.net|inheritance|asp.net-providers|
Class design decision
|inheritance|oop|asp.net-membership|
I have a little dilemma that maybe you can help me sort out. I've been working today in modifying ASP.NET's Membership to add a level of indirection. Basically, ASP.NET's Membership supports Users and Roles, leaving all authorization rules to be based on whether a user belongs to a Role or not. What I need to d...
Register Multiple Assemblies to the GAC in Vista
|.net|gac|gacutil|
I've got a whole directory of dll's I need to register to the GAC. I'd like to avoid registering each file explicitly- but it appears that gacutil has no "register directory" option. Anyone have a fast/simple solution?
It should work on any POSIX system. However: `os.kill` may also fail if you don't have permission to signal the process. You would need to do something like: import sys import os import errno try: os.kill(int(sys.argv[1]), 0) except OSError, err: if err.errno == errno.E...
It should work on any POSIX system (although looking at the `/proc` filesystem, as others have suggested, is easier if you know it's going to be there). However: `os.kill` may also fail if you don't have permission to signal the process. You would need to do something like: import sys import os impo...
The reason that the expression is cast to double-precision is because the literals specified are double-precision values by default. If you specify the literals used in the equation as floats, the expression will return a float. Consider the following code (Mac OS X using gcc 4.01). #include <stdio.h> in...
IronRuby performance?
|.net|ruby|performance|ironruby|
While I know IronRuby isn't quite ready for the world to use it, I was wondering if anyone here tried it and tested how well it faired against the other Rubies out there in terms of raw performance? If so, what are the results, and how did you go about measuring the performance (which benchmarks etc)?
Is it signed? Also are you trying to use the debug visualizer in the same host process as the application you are trying to debug? Try compiling the visualizer and then just reference it by it's library and file location not the project.
What are Class methods in Python for?
|python|
Map Routing, a la Google Maps?
|mapping|gis|
I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level writeups talking about it. Does anybody have any pointers, hints, etc?
|gis|mapping|
I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level writeups talking about it. Does anybody have any pointers, hints, etc? update: I'm primarily looking for pointer as to how a map system is implemented, data structures, algorithms, etc.
I would use an auto incrementing number usually an int. You want to keep the size of the key as small as possible. This keeps your index small and benefits any foreign keys as well. Additonally you are not tightly coupling the data design to external user data (this holds true for the aspnet GUID as well). Ge...
Whats the best way to shift an array of bytes by 12-bits?
|c|gcc|
With gcc, I want to shift contents of an array of bytes by 12-bit to the left. For example, starting with this array: <pre><code>uint8_t shift[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0x0A, 0xBC};</code></pre> I'd like to shift it to the left by 12-bits resulting in: <pre><code>0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0...
With gcc, I want to shift the contents of an array of bytes by 12-bit to the left. For example, starting with this array: <pre><code>uint8_t shift[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0x0A, 0xBC};</code></pre> I'd like to shift it to the left by 12-bits resulting in: <pre><code>0x00, 0x00, 0x00, 0x00, 0x00, 0x00,...
Ignoring ORM (not because I'm either for or against it) I would keep them in the same class. They are both facets of a single responsibility and separating them just makes you look in two places where I can't really think of a good reason you would want to do that.
Why stateless session beans are single threaded ?
|java|ejb|
As per my understanding stateless session beans are used to code the business logic. They can not store data in their instance variables because their instance is shared by multiple requests. So they seem to be more like Singleton classes. However the difference is contain creates (or reuses from pool) the separate ins...
Well. The rule for refactoring is. Do unit tests. So maybe first you should place some unittests at least for the core/major things. The ORM should be designed for decreasing boilerplate code. The time/trouble vs. ROI to be enterprisy is up to you to estimate :)
I haven't looked up the whole thing, but the problem lies somewhere in the style sheets. If you copy out only the table part of it, it is displaying the map correctly. If you remove the final `</span>` tag from this part, it is also working (however the page gets mixed): <div class="inner"><span class="cor...
I heard that TypeMock is often being used to refactor legacy code.
Phil's answer really solved it, but I'll elaborate a little more. Since the epoch is in UTC, if I want to compare other times to the epoch, I need to interpret them as UTC as well. >>> calendar.timegm((2009, 1, 31, 0, 0, 0, 5, 31, -1)) 1233360000 >>> 1233360000 / (60*60*24) 14275 By converting ...
You can use the `<probing>` element in a manifest file to tell the Runtime to look in different directories for its assembly files. <http://msdn.microsoft.com/en-us/library/823z9h8w.aspx> e.g.: <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <prob...
I think OpenID is far too confusing and clunky to force on any user, and I'm not even convinced it's solving an authentic problem. Having to register on each site I use has never struck me as a major issue. Particularly as it doesn't especially solve that problem; when I linked my OpenID to StackOverflow I had to fill...
I think you need to use 'display: block' on your images.
I think you need to use 'display: block' on your images. When images are inline there's a little extra space for the line spacing.
I know this might sound bad, but you need to ensure there is no whitespace between then end of you `<img>` tag and the start of the end `</td>` tag. i.e. The following will present the problem: <td> <img src="image.jpg"/> </td> And this will not: <td><img src="image.jpg"/></td> Hope th...
I know this might sound bad, but you need to ensure there is no whitespace between then end of you `<img>` tag and the start of the end `</td>` tag. i.e. The following will present the problem: <td> <img src="image.jpg"/> </td> And this will not: <td><img src="image.jpg"/></td> Hope th...
BerkeleyDB Concurrency
|c++|berkeleydb|
This isn't a question, just more seeking expert advice. What's the optimal level of concurrency that the C++ implementation of BerkeleyDB can reasonably support? How many threads can I have hammering away at the DB before throughput starts to suffer because of resource contention? I've read the manual and know how...
|c++|berkeley-db|
Thanx to Daniel, but i needed it to be done inline ... here's the solution: = System.Text.RegularExpressions.Regex.Replace(StringWithHTMLtoStrip, "<[^>]+>","") here are the links: http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx http://msdn.microsoft.com/en-us/library/ms157328.aspx
For C, C++, C#, Java and other .NET languages boolean expressions are optimized so that as soon as enough is known nothing else is evaluated. An old trick for doing obfuscated code was to use this to create if statements, such as: a || b(); if "a" is true, "b()" would never be evaluated, so we can rewrite ...
For C, C++, C#, Java and other .NET languages boolean expressions are optimised so that as soon as enough is known nothing else is evaluated. An old trick for doing obfuscated code was to use this to create if statements, such as: a || b(); if "a" is true, "b()" would never be evaluated, so we can rewrite ...
The philosophy that we follow at work is to keep the trunk in a state where you can push at any time without drastic harm to the site. This is not to say that the trunk will always be in a perfect state. There will of course be bugs in it. But the point is to never, ever leave it broken drastically. If you have a fe...
My product is both ASP.NET, Windows forms app and Windows service. 95% of code is .NET (VB if you must know). For IP reasons, I need to obfuscate the code. I am using an old dotfuscator (over 5 years old) and thinking it is time to move to a new gen. Anyone can recommend from their personal experience (please don'...
Something which is less Mozilla specific and should work reasonably well with most of the browsers: - Create a hidden form with the fields set up the way you need them - Make sure that the "target" attribute of the form is set to "_BLANK" - Submit the form programatically
There's a couple of different expression types in .ASPX files. There's: <%= TextFromMethod %> which simply reserves a literal control, and outputs the text at render time. and then there's: <%# TextFromMethod %> which is a databinding expression, evaluated when the control is DataBound(). There's...
What are some alternative bitset data structures?
|data-structures|information-retrieval|
I have an information retrieval application that tracks bit sets with sizes on the order of 10s of millions. The number of "set" bits in the set varies widely, from none to all. Currently, I'm simply setting bits in an array (`java.util.BitSet`), so each bit set takes several megabytes. My plan is to look at the car...
Tail recursion is well-described in previous answers, but I think an example in action would help to illustrate the concept. Consider a simple function that adds the first N integers. (e.g. `sum(5)=1+2+3+4+5=15`). Here is a simple Python implementation that uses recursion: def recsum(x): if x==1: ...
> Should you ever use protected member variables? Depends on how picky you are about hiding state. - If you don't want any leaking of internal state, then declaring all your member variables private is the way to go. - If you don't really care that subclasses can access internal state, then protected is g...
For detailed info on .Net access modifiers [go here][1] There are no real advantages or disadvantages to protected member variables, it's a question of what you need in your specific situation. In general it is accepted practice to declare member variables as private and enable outside access through properties. Als...
The general feeling nowadays is that they cause undue coupling between derived classes and their bases. They have no particular advantage over protected methods/properties (once upon a time they might have a slight performance advantage), and they were also used more in an era when very deep inheritance was in fashi...
Java: notify() vs. notifyAll() all over again
|java|multithreading|
If one google for "difference between notify() and notifyAll()" then a lot of explanations will pop up (leaving apart the javadoc paragraphs). It all boils down to the number of waiting threads being waken up: one in notify() and all in notifyAll(). However (if I do understand the difference between these methods ri...
I'm teaching myself Python and my most recent lesson was that [Python is not Java][1], and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with `static` methods in Java, but now I'm not sure when I would use them. All...
I'm not aware of a simple client. I remember looking for one a long time ago when I researched different queue systems and trying JMS I couldn't find one then, and I couldn't find one now. One thing though - there are a ton of tutorials that get you started and you could do a simple form to achieve that. Sorry to be...
You should probably also check that the process is actually running, so that if your script dies without cleaning itself up, it will run the next time rather than simply checking that /var/run/foo.pid exists and exiting.
I think your best bet is to get the result via SQL query and apply a regular expression programatically that will allow you to retrieve a group of words before and after the searched word. I can't test it now, but the regular expression should be something like: .*(\w+)\s*WORD\s*(\w+).* where you replace `...
You should mock an object when you have a dependancy in a unit of code you are trying to test that needs to be "just so". For example, when you are trying to test some logic in your unit of code but you need to get something from another class and what is returned from this dependancy might break what you are tryi...
You should mock an object when you have a dependancy in a unit of code you are trying to test that needs to be "just so". For example, when you are trying to test some logic in your unit of code but you need to get something from another object and what is returned from this dependancy might affect what you are tr...
You should mock an object when you have a dependancy in a unit of code you are trying to test that needs to be "just so". For example, when you are trying to test some logic in your unit of code but you need to get something from another object and what is returned from this dependancy might affect what you are tr...
Does the data need to be in a DataTable? Using a SortedList and binding that to a combo box would be a simpler way. If you need to use a DataTable you can use the Select method to retrieve a DataView and pass in a sort parameter. DataView dv = myDataTable.Select("filter expression", "sort");
The escape character is ', so you would need to replace the quote with two quotes. For example, `SELECT * FROM PEOPLE WHERE SURNAME='O'Keefe'` becomes `SELECT * FROM PEOPLE WHERE SURNAME='O''Keefe'` That said, it's probably incorrect to do this yourself. Your language may have a function to escape stri...
The escape character is ', so you would need to replace the quote with two quotes. For example, `SELECT * FROM PEOPLE WHERE SURNAME='O'Keefe'` becomes `SELECT * FROM PEOPLE WHERE SURNAME='O''Keefe'` That said, it's probably incorrect to do this yourself. Your language may have a function to escape stri...
You can actually sort the [default view][1] on a DataTable: myDataTable.DefaultView.Sort = "Field1, Field2 DESC"; That'll sort any rows you retrieve directly from the DataTable. [1]: http://msdn.microsoft.com/en-us/library/system.data.datatable.defaultview.aspx
The SLSBs are single threaded because a TX Context, Principal is associated with a bean instance when it is called. These beans are pooled and unless the max pool size is reached are processed in separate threads ( Vendor dependent). If SLSBs were designed thread safe every call would have looked like a servlet doGe...
What are some alternatives to a bit array?
I have an information retrieval application that creates bit arrays on the order of 10s of million bits. The number of "set" bits in the array varies widely, from all clear to all set. Currently, I'm using a straight-forward bit array (`java.util.BitSet`), so each of my bit arrays takes several megabytes. My plan is...
One way to judge what python is used for is to look at what products use python at the moment. This [wikipedia page](http://en.wikipedia.org/wiki/Python_software) has a long list including various web frameworks, content management systems, version control systems, desktop apps and IDEs. As it says [here](http://en...
BlaM's testing included all the DB calls made by WordPress. When you're making fewer DB calls, you'll see the performance gain of opcode caches be even more dramatic.
By 2038, time libraries should all be using 64-bit integers, so this won't actually be that big of a deal (on software that isn't completely unmaintained). COBOL programs might be fun though.
Operative word being "should". If you need to ensure futureproofing then you can construct your own date/time class and use that but I'd only do that if you think that what you write will be used on legacy OS'
Is num1 the variable you're having trouble with? This line: cin >> num1; is setting num1 to the value input by the user. So the value calculated for it in the previous run through the loop is being overwritten each time by the new input.
For Subversion, I agree with Ryan Duffield's comment. The chapter he refers to provides a good analyses on which system to use. The reason I asked is that Perforce provides a completely different way to create branches from SVN or CVS. Plus, there are all the DVCSs that give it's own philosophy on branching. Your...
File database suggestion with support for multiple concurent users.
|database|ms-access|concurrency|berkeley-db|
I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software. I'm considering MS Access or Berkeley DB. Can you share your experience with file databases? <br> Which one did you use, did you have any problems with it?
If you're simply looking to expose a collection on your instance, then using a getter/setter to a private member variable seems like the most sensible solution to me (your first proposed option).