instruction stringlengths 0 30k ⌀ |
|---|
I am displaying some dynamically generated objects in a PropertyGrid. These objects have numeric, text, and enumeration properties. Currently I am having issues setting the default value for the enumerations so that they don't always appear bold in the list. The enumerations themselves are also dynamically generated an... |
|c#|reflection|attributes|enumeration| |
Note: I am using .Net 1.1, although I am not completely against answer that use higher versions.
I am displaying some dynamically generated objects in a PropertyGrid. These objects have numeric, text, and enumeration properties. Currently I am having issues setting the default value for the enumerations so that they... |
I think the best bet for this is to have a different gridview for each of your "tabs". Use the MultiView control with a View control for each tab, and a gridview in each View. In the click event of your menu change to the correct view. Only bind each gridview once, and then your checkboxes will persist. |
There's a tool called [JarAnalyzer][1] that will give you the dependencies between the jars in a directory. It'll also give you a list of dependencies that don't exist in the directory.
[1]: http://www.kirkk.com/main/Main/JarAnalyzer |
We access Informix from .NET and use multiple connections. Unless we're starting a transaction on each connection, it often is handled in the connection pool. I know that's very brand-specific, but most(?) database systems' cilent access will pool connections to the best of its ability.
As an aside, we did have a ... |
Database connections are a limited resource. Some DBs have a very low connection limit, and wasting connections is a major problem. By consuming many connections, you may be blocking others for using the database.
Additionally, throwing a ton of extra connections at the DB doesn't help anything unless there are re... |
Answering the purely subject question "recommend me a better C IDE and compiler" I find [Ming32w and Code::blocks (now with combined installer)][1] very useful on windows but YMMV as you are obviously used to the MS IDE and are just struggling with C.
May I suggest you concentrate on console applications to get a fe... |
Bloodshed Dev-C++ is the best windows C/C++ IDE IMO: http://www.bloodshed.net/
It uses the GNU compiler set and is free as in beer.
EDIT: the download page for the IDE is here: http://www.bloodshed.net/dev/devcpp.html |
Another item I wrestle with is *where should I use dependency injection?* Where do you take your dependency on StructureMap? Only in the startup application? Does that mean all the implementations have to be handed all the way down from the top-most layer to the bottom-most layer? |
> 2^64 is not the maximum value of a double. 2^64 is the number of unique values that a double (or any other 64-bit type) can hold. Double.MaxValue is equal to 1.79769313486232e308.
Not even; the IEEE encodings use multiple encodings for the same values. Specifically, NaN is represented by an exponent of all-bits-1... |
This is set when you compile your assembly. There are two types of optimizations:
* IL optimization
* JIT Native Code quality.
The default setting is this
/optimize- /debug-
This means unoptimized IL, and optimized native code.
/optimize /debug(+/full/pdbonly)
This means unoptimized IL, an... |
When debuggin I find the "Display" view really useful. It lets you type code (using auto complete) and lets you run/display they outcome of whatever you write.
Give it a try! |
There is only one "really bad" thing with them that I'm aware of.
If your 3rd party does some JavaScript, that attempts to modify their DOM a bit too early... IE6 and IE7 will throw the oh so unhelpful "**[Operation Aborted][1]**" error, then **blank out not only the iframe, but the entire surrounding page**. (e.g. ... |
DllRegisterServer entry point was not found |
|.net|iis| |
I'm having problems refreshing .Net 2.0 with IIS 6.
I have been able to successfully execute "aspnet\_regiss.exe -i", but when I try to register the aspnet\_isapi.dll:
regsvr32 “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
I get the error
C:\Windows\..\aspnet_isapi.dll was loaded,... |
I'm having problems refreshing .Net 2.0 with IIS 6.
I have been able to successfully execute "aspnet\_regiss.exe -i", but when I try to register the aspnet\_isapi.dll:
regsvr32 “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
I get the error
>C:\Windows\..\aspnet_isapi.dll was loaded, bu... |
I'm having problems refreshing .Net 2.0 with IIS 6.
I have been able to successfully execute "aspnet\_regiis.exe -i", but when I try to register the aspnet\_isapi.dll:
regsvr32 “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
I get the error
>C:\Windows\..\aspnet_isapi.dll was loaded, bu... |
The suggestions by others in other answers are probably fine if you intend to stay small scale, but if your intent is grow, and particularly if you might want to have someone else invest money in the business, then it makes sense to invest in a lawyer, one who has experience in software. It doesn’t have to cost a lot ... |
What language/IDE are you using?
In .Net you can view the threads of an application: Debug->Windows->Threads or Ctrl+Alt+H |
This [post][1] should get you started on the various options..Check the posts tagged with Debugging..
Another useful article on [debugging deadlocks][2]..
[1]: http://blogs.msdn.com/carloc/archive/2007/10/08/ok-now-how-do-i-capture-my-dump.aspx
[2]: http://www.debuginfo.com/articles/easywindbg.html#debugde... |
Debugging deadlocks can be tricky. I usually do some kind of logging and see where the log stops. I either log to a file or to the debug console using OutputDebugString(). |
We just ran into this today. I wanted **pseudo-random** (so it would look like compressed audio data in terms of size). I TODO'd that I also wanted **deterministic**. rand() was different on OSX than on Linux. And unless I re-seeded, it could change at any time. So we changed it to be deterministic but still psued... |
I'll be honest - I find Interface Builder just as fast as using Omnigraffle with (the aforementioned) stencils for prototyping desktop application UIs.
Plus the bonus is you get *all* of the available controls to look at. |
Another solution is to use [Rpy][1], which puts all of the power of R (including lots of tools for distributions), easily into Python.
[1]: http://rpy.sourceforge.net/ |
Encapsulate your DataContext so that developers don't use Table in their queries. I have an 'All' property on my repositories that does a similar filtering to what you need. So then queries are like:
from item in All
where ...
select item
and all might be:
public IQueryable<T> All
{
... |
[Entity Framework - Vote of no confidence][1]
[1]: http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/
That's all I have to say... |
If you've ever used C++ templates, then .Net generics are nearly the same thing. They even use a similar <T> syntax.
Even if you don't know any C++ you're probably making this harder than you need to, especially with regard to the collections. They're just like any other collection, but when you create them you... |
public event EventHandler Jump;
public void OnJump()
{
EventHandler handler = Jump;
if (null != handler) handler(this, EventArgs.Empty);
}
then
Frog frog = new Frog();
frog.Jump += new EventHandler(yourMethod);
private void yourMethod(object s, EventArgs e)
... |
How does the Java for each loop work? |
|java| |
<pre><code>List<String> someList = new ArrayList<String>()
// add "monkey", "donkey", "skeleton key" to someList
</code></pre>
<pre><code>for(String item : someList ){
System.out.println(item);
}
</code></pre>
What would the equivalent for loop look like without using the for each syntax? |
instead of using sysobjects which is not recommended anymore use sys.procedures
select name,create_date,modify_date
from sys.procedures
order by modify_date desc
you can do the where clause yourself but this will list it in order of modification date descending
|
You really don't need perl for this.
sed '/^\/\/#.*$/d' inputfile > outputfile
I <3 sed. |
You really don't need perl for this.
sed '/^\/\/#/d' inputfile > outputfile
I <3 sed. |
Arguments in RMI calls a serialised. Deserialisation on the server creates a copy of the lists. If the lists remained on the client side, then the number of network calls would be quite high. You can pass remote objects, but beware of the performance implications. |
To an extent it is probably an 'Arms Race' against the .NET CLR.
But I think there are also genuine reasons for introducing new languages to the JVM, particularly when they will be run 'in parallel', you can use the right language for the right job, a scripting language like Groovy may be exactly what you need for... |
Best way to version control T-SQL? |
|sql|version-control| |
What's the best way to version control my tables, views, sprocs, etc? Preferably automated or at least semi-automated :)
Thanks |
From [Microsoft support][1] via the Microsoft forums:
> Further investigation reveals that this is expected behavior for Visio 2007. When Visio opens a connection using the Visio SQL Server Driver it checks the server version and since SQL Server 2008 shipped after Visio 2007 it doesn't recognise SQL Server 2008 as ... |
Django + FCGID on Fedora Core 9 -- what am I missing? |
|python|django|apache2|fastcgi|fcgid| |
Fedora Core 9 seems to have [FCGID][1] instead of [FastCGI][2] as a pre-built, YUM-managed module. [*I'd rather not have to maintain a module outside of YUM; so no manual builds for me or my sysadmins.*]
I'm trying to launch Django through the runfastcgi interface (per the [FastCGI deployment][3] docs).
What I... |
Fedora Core 9 seems to have [FCGID][1] instead of [FastCGI][2] as a pre-built, YUM-managed module. [*I'd rather not have to maintain a module outside of YUM; so no manual builds for me or my sysadmins.*]
I'm trying to launch Django through the runfastcgi interface (per the [FastCGI deployment][3] docs).
What I... |
I'm having problems refreshing .Net 2.0 with IIS 6.
I have been able to successfully execute "aspnet\_regiis.exe -i", but when I try to register the aspnet\_isapi.dll:
regsvr32 “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
I get the error
>C:\Windows\..\aspnet_isapi.dll was loaded, bu... |
This is one of those areas in which C and C++ differ.
In C, file-scoped variables are `extern` by default. If you're using C, `VAL` is `static` and `ANOTHER_VAL` is `extern`.
In C++, file-scoped variables are `static` by default if they are `const`, and `extern` by default if they are not. If you're using C++, b... |
The `static` and `extern` tags on file-scoped variables determine whether they are accessible in other translation units (i.e. other `.c` or `.cpp` files).
- `static` gives the variable internal linkage, hiding it from other translation units. However, variables with internal linkage can be defined in multiple tr... |
I believe you have to type:
:cino=(0
This is when using cindent of course. |
I believe you have to type:
:set cino=(0
This is when using cindent of course.
edit: I missed "set" |
.NET NumericTextBox |
|.net|textbox|numerical| |
Does anyone know why Microsoft does not ship a numeric text box with its .NET framework e.g. a text box which would ensure that the characters entered are always a valid number? It's something which is commonly used across applications of different flavours and indeed something which most GUI libraries (well, those tha... |
Does anyone know why Microsoft does not ship a numeric text box with its .NET framework e.g. a text box which would ensure that the characters entered are always a valid number? It's something which is commonly used across applications of different flavours and indeed something which most GUI libraries (well, those tha... |
Does anyone know why Microsoft does not ship a numeric text box with its .NET framework e.g. a text box which would ensure that the characters entered are always a valid number? It's something which is commonly used across applications of different flavours and indeed something which most GUI libraries (well, those tha... |
If you are writing your own lock-free data structures for a multi-core cpu, do not forget about memory barriers! Also, consider looking into [Software Transaction Memory][1] techniques.
[1]: http://en.wikipedia.org/wiki/Software_transactional_memory |
It is, as other posters have pointed out, down to endianness.
The Java [DataInputStream][1] expects the data to be [big-endian][2] (network byte order). Judging from the Mono documentation (for equivalents like [BinaryWriter][3]), C# tends toward being little-endian (the default for Win32/x86).
So, when you use t... |
It is, as other posters have pointed out, down to endianness.
The Java [DataInputStream][1] expects the data to be [big-endian][2] (network byte order). Judging from the Mono documentation (for equivalents like [BinaryWriter][3]), C# tends toward being little-endian (the default for Win32/x86).
So, when you use t... |
Giving different names to different assembly versions is the easiest way and surely works.
If your assembly (commonutils.dll) is strong-named (i.e. signed), you can think about installing it in the GAC (Global Assembly Cache - you can install different versions of the same assembly side-by-side in the GAC), therefor... |
A fixed point combinator (or fixed-point operator) is a higher-order function that computes a fixed point of other functions. This operation is relevant in programming language theory because it allows the implementation of recursion in the form of a rewrite rule, without explicit support from the language's runtime en... |
What is the best way to obtain a list of site resources when writing a Maven2 site plugin? |
|java|plugins|maven-2|maven2|mvn| |
When creating a plugin that executes in the default life-cycle, it's easy to obtain a reference to the project and its resources, but I'm getting a null instead of a MavenProject object when creating plugins that execute in the site life-cycle.
Any hints, tips or suggestions? |
SSRS Report designinng |
|reporting| |
It is possible to use stored procedure for designing Reports in Report builder. |
If your entities do not have behavior, then you are not writing object-oriented code. If everything is done with getters and setters and no other behavior, you're writing procedural code.
A lot of shops <a href="http://moffdub.wordpress.com/2008/09/03/soa-is-not-an-excuse-to-write-procedural-java/">say they're pract... |
Use the \ at the end of the line. I've seen a lot of C macos where they use a do...while(0)
#define foo() do \
{
//code goes here \
\
\
}while(0);
Also, remember to use parenthases in many instances.
Example:
#define foo(x) a+b
//should be
#define foo(x) ... |
Maybe do a soft delete? (i.e., set a "deleted" flag on the node) You can clean up the list later if you need to, |
Maybe do a soft delete? (i.e., set a "deleted" flag on the node) You can clean up the list later if you need to. |
Best way to catch a WCF exception in Silverlight? |
|silverlight|wcf|exception| |
I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these calls, an exception is generated as you would expect. ... |
Autocomplete Textbox on Gridview editing |
|asp.net|ajax|gridview|autocomplete| |
How do you implement autocomplete on ASP.Net Gridview? Can anyone point me where to go to achieve this? I'm willing to use non-.Net ajax controls if that what it takes. |
Compiler directives aren't as flexible, but they are appropriate in some circumstances.
For instance, by default when you compile in DEBUG mode in VS.NET, there is a 'DEBUG' symbol defined...so you can do
void SomeMethod()
{
#if DEBUG
//do something here
#else
//do s... |
This kind of testing is called a [Monkey test][1]. When done right, it can smoke out bugs from the really dark corners.
To address your concerns about reproducibility: the right way to approach this, is to record the failed test entries, generate a unit test, which probes for the *entire family* of the specific bug;... |
The argument to `HELO` should be a hostname or an IP address. foo_bar.example.com is neither an IP address nor a hostname (underscores are illegal in hostnames), so the error message is correct and there is nothing to fix. |
Note that outside of a class, `inline` does something more useful in the code: by forcing (well, sort of) the C++ compiler to generate the code inline at each call to the function, it prevents multiple definitions of the same symbol (the function signature) in different translation units.
So if you inline a non-me... |
Debugging a true deadlock is actually kind of easy, if you have access to the source and a memory dump (or live debugging session).
All you do is look at the threads, and find the ones that are waiting on some kind of shared resource (for example hung waiting in `WaitForSingleObject`). Generally speaking from there ... |
The real downfall of Singletons is that they break inheritance. You can't derive a new class to give you extended functionality unless you have access to the code where the Singleton is referenced. So, beyond the fact the the Singleton will make your code tightly coupled (fixable by a Strategy Pattern ... aka Dependenc... |
I am all for AOP together with log4*. This really helped us.
Google gave me [this article][1] for instance. You can try to search more on that subject.
[1]: http://www.ibm.com/developerworks/rational/library/2782.html |
(not a sales pitch)
<a href="http://www.acsysinteractive.com">my company</a> offers <a href="http://www.acsysinteractive.com/product/default.aspx">mail manager</a>, but it's a hosted service. It has a full API though. |
(IMHO) how 'logging' happens isn't part of your solution design, it's more part of whatever environment you happen to be running in - like System and Calendar in Java.
Your 'good' solution is one that is as loosely coupled to any particular logging implementation as possible so think interfaces. I'd check out the tr... |
That article significantly exaggerates the problem by misunderstanding the source. It assumes that data loss events are independent, ie that if I take a thousand disks, and get five hundred errors, that's likely to be one each on five hundred of the disks. But actually, as anyone who has had disk trouble knows, it's pr... |
use a static class, it has the least overhead and is accessible from all project types within a simple assembly reference
note that a Singleton is equivalent, but involves unnecessary allocation
if you are using multiple app domains, beware that you may need a proxy object to access the static class from domains ... |
How best to alleviate scenarios that trigger non-incremental linking (MSVS) |
You need to edit the build working directory of your Build Agent so that the begging path is a little smaller. To edit the build agent, right click on the "Builds" node and select "Manage Build Agents..."
I personally use something like c:\bw\$(BuildDefinitionId). $(BuildDefinitionId) translates into the id of the... |
not sure if this would work or not, haven't tested it with overflow:
<br/>
overflow:hidden !important
maybe?
|
If the div has an inline style declaration, the only way to modify it without changing the source is with JavaScript. Inline style attributes 'win' every time in CSS. |
The C and JNI code can allocate memory as well (malloc/free/new/etc), which is outside of the VM's 256m. The xMX only restricts what the VM will allocate itself. Depending on what you're allocating in the C code, and what other things are loaded in memory you may or may not be able to get up to 2GB. |
I remember PL/1 had no boolean class. You could create a bit and assign it the result of a boolean expression. Then, to use it, you had to remember that 1 was false and 0 was true. |
WPF Validation for the whole form |
|wpf| |
I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"?
For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 lines of code in WPF!!
I can do this using my ... |
use this option so the byte alignment is the same as C/C++ and then you don't need to add padding bytes in structs.
{$MINENUMSIZE 4}
|
i don't know if it's mentioned in the About.com article but i think it's worth mentioning that the hyperlink in TRichEdit only works if the TRichEdit itself is directly placed on the form (not in a panel).
[http://www.scalabium.com/faq/dct0146.htm][1]
[1]: http://www.scalabium.com/faq/dct0146.htm |
I have found the MVC framework RIAWave [link][1] to be absolutely incredible. It is super lightweight and easy to use. I found Cairngorm and PureMVC to have a pretty steep learning curve and they both feel a bit too bulky for me. RIAWave stays out of the way and just gives you the MVC basics to work with.
AMFPHP ... |