instruction stringlengths 0 30k ⌀ |
|---|
The .Net framework 1.1 is always targeting 32 bits CPUs while .Net framework 2.0 and above can target 32 bits or 64 bits according to the processorArchitecture property of the program manifest changed by the 'Platform Target' option of the Visual Studio IDE.
With the default option 'Any CPU', the IL code is compiled a... |
Just to show the contrast, compare the following c++ and java snippets:
In C++: **Note: Bad code - memory leaks!** But it demonstrates the point.
void cppMethod(int val, int &ref, Dog obj, Dog &objRef, Dog *objPtr, Dog *&objPtrRef)
{
val = 7; // Modifies the copy
ref = 7; // Modifies t... |
The following will work for SQL Server, other databases use different functions for date calculation and getting the current time.
Select Case When (Stop <> '31 Dec 9999') Then
DateDiff(mi, Start, Stop)
Else
DateDiff(mi, Start, GetDate())
End
... |
Note that the names generated by the RTTI feature of C++ is **not** portable.
For example, the class
MyNamespace::CMyContainer<int, test_MyNamespace::CMyObject>
will have the following names:
// MSVC 2003:
class MyNamespace::CMyContainer[int,class test_MyNamespace::CMyObject]
// G++ 4.2:
... |
Not the traditional desktop app, but the ATI Catalyst Control Center is .NET based. |
How to get IKVM to build in Visual Studio 2008? |
|ikvm|c#|visual-studio-2008| |
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens a... |
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens a... |
|c#|visual-studio-2008|ikvm|solved| |
According to Stroustrup in the <a href="http://www.amazon.com/C-Programming-Language-Special-3rd/dp/0201700735/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1221747306&sr=8-1">C++ Programming Language</a>:
> Which style you use depends on circumstances and taste. I usually prefer to use <code>struct</code> for classes that ha... |
The only other difference is the default inheritance of classes and structs, which, unsurprisingly, is private and public respectively.
Skizz |
We use a similar technique with WPF's new datagrid:
Private Sub SelectAllText(ByVal cell As DataGridCell)
If cell IsNot Nothing Then
Dim txtBox As TextBox= GetVisualChild(Of TextBox)(cell)
If txtBox IsNot Nothing Then
txtBox.Focus()
txtBox.Sele... |
Depending on your Active Directory topology, you might have to wait for the Universal Group membership to replicate around to all the Domain Controllers. Active Directory recommends the following though:
1. Create a Global group for each domain, e.g., "Domain A Authorized Users", "Domain B Authorized Users"
2. Put... |
If user_tb has auth info, I would very much keep it separate from people_tb. I would however keep a relationship between the two, and most of users' info would be stored in people_tb except all of the info needed for auth (which i guess will not be used for much else) Its a nice tradeoff between design and efficiency i... |
["The && and || operators are not overloadable, mainly because they provide "short circuit" evaluation that cannot be reproduced with pure method calls."][1]
-- Jim Weirich
[1]: http://ola-bini.blogspot.com/2007/10/operator-overloading-in-ruby.html?showComment=1191704640000#c7207705878073349200 |
What it the quickest way to find the shortest distance between two polygons |
|oop|design-patterns|singleton|language-agnostic|duplicate| |
|oop|design-patterns|singleton|language-agnostic| |
<strike>Please feel free to bitch on [Singleton][1].</strike>
Inappropriate usage of [Singleton][1] may cause lot of paint. What kind of problem do you experienced with singleton? What is common misuse of this pattern.
*Note: This post is motivated by answers on [What design pattern do you use the most?][2] quest... |
<strike>Please feel free to bitch on [Singleton][1].</strike>
Inappropriate usage of [Singleton][2] may cause lot of paint. What kind of problem do you experienced with singleton? What is common misuse of this pattern?
----
After some digging into [Corey's answer](#86678) I discovered some greate articles on t... |
|language-agnostic|design-patterns|oop|singleton| |
<strike>Please feel free to bitch on [Singleton][1].</strike>
Inappropriate usage of [Singleton][1] may cause lot of paint. What kind of problem do you experienced with singleton? What is common misuse of this pattern?
----
After some digging into [Corey's answer](#86678) I discovered some greate articles on t... |
What do you mean by "does not seem to be compatible"? Can you post the error message?
If the latest version does not work, you can select an older version in the "other releases" drop down and download that. |
What do you mean by "does not seem to be compatible"? Can you post the error message?
If the latest version does not work, you can select an older version in the "other releases" drop down and download that.
Edit: to those reading this, the author updated the question, so my answer seems a bit out of left field... |
Profiling? I don't know what IDE you are using, but [Eclipse has a decent proflier][1] and there is also a list of some open-source profilers at [java-source][2].
[1]: http://www.eclipse.org/tptp/home/documents/tutorials/profilingtool/profilingexample_32.html "Eclipse profiling tutorial"
[2]: http://java-sour... |
Something seems a bit odd about this table; I would actually think about refactoring it. What do ID and OWNER_ID refer to, and what is the relationship between them?
Would it make sense to have
CREATE TABLE `CLIENTS` (
`ID` int(11) NOT NULL auto_increment,
`CLIENT_NAME` varchar(500) NOT NULL,
... |
One pass.
a = [1,1,'a','b','c','c']
new_list = []
prev = None
while 1:
try:
i = a.pop(0)
if i != prev:
new_list.append(i)
prev = i
except IndexError:
break
|
1) It is your fault :)
2) If you're using eclipse or netbeans, try using the profiling features -- it should pretty quickly tell you where your code is spending a lot of time.
3) failing that, add console output where you think the inner loop is -- you should be able to find it quickly. |
Sure, Visual Studio can compile "managed" C++. I'm not sure I understand your "web browser client" reference though; do you mean you want to compile your C++ to something that will run with Silverlight? |
Yes, there are such tools: you have to profile the code. You can either try [TPTP][1] in eclipse or perhaps try [JProfiler][2]. That will let you see what is being called and how often.
[1]: http://www.eclipse.org/tptp/
[2]: http://www.ej-technologies.com/products/jprofiler/overview.html |
Use a profiler. There are many. Here is a list: [http://java-source.net/open-source/profilers][1].
For example you can use [JIP][2], a java coded profiler.
[1]: http://java-source.net/open-source/profilers
[2]: http://java-source.net/open-source/profilers |
MySQL cannot enforce uniqueness on keys that are longer than 765 bytes (and apparently 500 UTF8 characters can surpass this limit).
1) Does CLIENT_NAME really need to be 500 characters long? Seems a bit excessive?
2) Add a new (shorter) column that is hash(CLIENT_NAME). Get MySQL to enforce uniqueness on that hash ... |
MySQL cannot enforce uniqueness on keys that are longer than 765 bytes (and apparently 500 UTF8 characters can surpass this limit).
1. Does CLIENT_NAME really need to be 500 characters long? Seems a bit excessive.
2. Add a new (shorter) column that is hash(CLIENT_NAME). Get MySQL to enforce uniqueness on that hash ... |
Find item in Winforms/WPF ComboBox |
|.net|winforms|wpf|user-controls| |
I know in ASP.NET I can get an item from a DropDownList by using
DropDownList1.Items.FindByText
Is there a similar method I can use in WinForms/WPF for a ComboBox? |
Find item in WPF ComboBox |
|.net|wpf|user-controls| |
I know in ASP.NET I can get an item from a DropDownList by using
DropDownList1.Items.FindByText
Is there a similar method I can use in WPF for a ComboBox? |
|.net|wpf|search|user-controls| |
Generating JavaScript stubs from WSDL |
|javascript|soap|wsdl| |
I'm looking for a tool to generate a JavaScript stub from a WSDL.
Although I usually prefer to use REST services with JSON or XML, there are some tools I am currently integrating that works only using SOAP.
I already created a first version of the client in JavaScript but I'm parsing the SOAP envelope by hand and... |
I'm looking for a tool to generate a JavaScript stub from a WSDL.
Although I usually prefer to use REST services with JSON or XML, there are some tools I am currently integrating that works only using SOAP.
I already created a first version of the client in JavaScript but I'm parsing the SOAP envelope by hand and... |
It's much easier for a compiler writer to generate JVM or CLR byte-codes. They are a much cleaner and higher level abstraction than any machine language. Because of this, it is much more feasible to experiment with creating new languages than ever before, because all you have to do is target one of these VM architectur... |
Hey Juan, I'd recommend that you use the Vector3 class as suggested by several others since it's easy to use and above all - supports all operations you need (like addition, multiplication, matrix multiply etc...) without the need to implement it yourself.
If you have any doubt about how to proceed - inherit it and at... |
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens a... |
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens a... |
|c#|gis|distance|algorithm|polygon| |
I have **1 red polygon** say and **50 randomly placed blue polygons** - they are situated in geographical space. What is the quickest/speediest algorithim to find the the shortest distance between 2 polygons? This is harder than it sounds! |
What it the quickest way to find the shortest cartesian distance between two polygons |
I have **1 red polygon** say and **50 randomly placed blue polygons** - they are situated in geographical **2D space**. What is the quickest/speediest algorithim to find the the shortest distance between a red polygon and its nearest blue polygon?
Bear in mind that it is not a simple case of taking the points that ... |
|c#|algorithm|gis|distance|polygon| |
I have **1 red polygon** say and **50 randomly placed blue polygons** - they are situated in geographical **2D space**. What is the quickest/speediest algorithim to find the the shortest distance between a red polygon and its nearest blue polygon?
Bear in mind that it is not a simple case of taking the points that ... |
Flash editor. |
|flash| |
What application should I use for creating Flash animations for a website? |
How can I avoid duplicate copies of an object in a cache? |
|caching| |
I'm using memcache to design a cache for the model layer of a web application, one of my biggest problems is data consistency.
It came to my mind caching data like this:
(key=query, value=list of object ids result of the query)
for each id of the list:
(key=object.id, value=object)
So, every time a query is don... |
time.sleep -- sleeps thread or process? |
|python|multithreading|time|sleep| |
In Python for the *nix, does time.sleep() block the thread or the process? |
The original question described Tcl to a "T".
Tcl was designed from the beginning to be an embedded scripting language. It has evolved to be a first class dynamic language in its own right but still is used all over the world as an embeded language. It is available under the BSD license so it is just about as free... |
Use a profiler (e.g [yourkit ][1])
[1]: http://www.yourkit.com |
To remove the body edit the type, expand "Submission form settings" and put in blank for body field label. For title you can rename it to another text field. If you really have no need for any text fields you can create a custom module, say called foo, and create function foo\_form\_alter() which replaces $form['titl... |
This question has been asked in several forms over the last few days, so I'm going to say this very clearly.
<h1>Q: How do I parse HTML with Regular Expressions?</h1>
<h1>A: Please Don't.</h1>
Use <a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a>, or <a href="http://codespeak.net/lxml/lxm... |
This question has been asked in several forms over the last few days, so I'm going to say this very clearly.
<h1>Q: How do I parse HTML with Regular Expressions?</h1>
<h1>A: Please Don't.</h1>
Use <a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a>, <a href="http://code.google.com/p/html5li... |
Why would a region of memory be marked non-cached? |
|memory|embedded|caching| |
In an embedded application, we have a table describing the various address ranges that are valid on out target board. This table is used to setup the MMU.
The RAM address range is marked as cacheable, but other regions are marked at not cacheable. Why is that? |
Older question with longer discussion: [How to create symbolic links in Windows?](http://stackoverflow.com/questions/46885/how-to-create-symbolic-links-in-windows) |
Platform SDK - IDiscMaster::EnumDiscRecorders (XP / 2003)
DirectX and DirectShow has extensive interfaces to work with DVD
Else enumerate disk drives and try firing a DeviceIonControlCode that supports extarcting the type info.
Good luck |
Word documents are binary, so, no. Are the editors knowledgeable enough that they can be taught how to use a plain-text format like reStructuredText or LaTeX? |
No: since Word uses a binary file format, svn cannot merge the files at all.
However, Word itself has a merge feature. You might try that if you have to resolve a merge conflict. |
Perhaps it's used for memory-mapped I/O? |
It is very helpful to have only have one class per file, but if you do your building via bulkbuild files which include all the individual C++ files, it makes for faster compilations since startup time is relatively large for many compilers. |
Any memory region used for DMA or other hardware interactions should not be cached. |
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens a... |
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens a... |
Using the same test suite on various implementations of a repository interface. |
|c#|interface|testing|unittest|duplication| |
I have been making a little toy web application in C# along the lines of Rob Connery's Asp.net MVC storefront.
I find that I have a repository interface, call it IFooRepository, with methods, say
IQueryable<Foo> GetFoo();
void PersistFoo(Foo foo);
And I have three implementations of this: ISqlFooRepos... |
I have been making a little toy web application in C# along the lines of Rob Connery's Asp.net MVC storefront.
I find that I have a repository interface, call it IFooRepository, with methods, say
IQueryable<Foo> GetFoo();
void PersistFoo(Foo foo);
And I have three implementations of this: ISqlFooRepos... |
|c#|unit-testing|interface|duplication| |
I have been making a little toy web application in C# along the lines of Rob Connery's Asp.net MVC storefront.
I find that I have a repository interface, call it IFooRepository, with methods, say
IQueryable<Foo> GetFoo();
void PersistFoo(Foo foo);
And I have three implementations of this: ISqlFooRepos... |
You need to add testing attributes for your favorite testing framework. TestDriven picks up these attributes by reflection in order to know what tests to run.
For example, using NUnit.Framework - each test class needs [TextFixture] and each test method needs [Test]
Here's an [example][1]
[1]: http://www.n... |
If it is decided that our system needs an overhaul, what is the best way to go about it? |
|vbscript|python|asp-classic| |
|python|vbscript|asp-classic| |
We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manor. We have pretty much embraced the current webMVC pattern that is ... |
We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is... |
Can you access the data via a built in package? If so then perhaps you could write a function that returned a string representation of the data (eg some sort of hash on the data), then you could do
select key, to_hash_str_val(glob_value) from source_table
minus
select key, to_hash_str_val(glob_value) f... |
When should I use a struct instead of a class? |
|c#|.net|oop|design| |
MSDN says that you should use structs when you need lightweight objects. Are there any other scenarios when a struct is preferable over a class? |
MSDN says that you should use structs when you need lightweight objects. Are there any other scenarios when a struct is preferable over a class?
**Edit:**
Some people have forgotten that:
1. *structs* can have methods!
2. *structs* have no inheritance capabilites.
**Another Edit:**
I understand the te... |
|.net|oop|design| |
|.net|design|oop| |