instruction stringlengths 0 30k ⌀ |
|---|
|.net|.net-2.0| |
I am considering converting a project that I've inherited from .net 1.1 to .net 2.0. The main warning I'm concerned about is that it wants me to switch from System.Web.Mail to using System.Net.Mail.
I'm not ready to re-write all the components using the obsolete System.Web.Mail, so I'm curious to hear if any commun... |
The Today() function should behave properly on Vista. I believe behind the scenes it is simply evaluating the DateTime.Today property, so it shouldn't throw any exceptions. If you're porting VB to VB.NET you should probably go ahead and use the DateTime.Today property rather than the VB6 compatability code. |
What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion? |
|.net|assembly|attributes| |
There are three assembly version attributes. What are differences? Is it ok if I use AssemblyVersion and ignore the rest?
----------
MSDN says:
- [AssemblyVersion][1]:
> Specifies the version of the assembly being attributed.
- [AssemblyFileVersion][2]:
> Instructs a compiler to use a specific vers... |
function not_empty_string($s) {
return $s !== "";
}
array_filter(explode('/', '1/2//3/'), 'not_empty_string'); |
Try [preg_split][1].
`$exploded = preg_split('@/@', '1/2//3/', NULL, PREG_SPLIT_NO_EMPTY);`
[1]: http://php.net/preg_split |
You can do a serialization-based deep clone using org.apache.commons.lang.SerializationUtils.clone(..) in Commons Lang, but be careful--the performance is abysmal.
In general, it is best practice to write your own clone methods for each class of an object in the object graph needing cloning. |
DataContext x = new DataContext;
//Something like this perhaps?
var a = x.Where().with()...etc
let's you have a much finer control over the sql. |
Presumably someone else wrote most or all of the system that you're now maintaining. Look for the usual bad habits (repeated code, variables that are too widely scoped, nested if statements, etc.), and refactor as you would any other language. Keep an eye out for recurring things in the same file or different files and... |
Tags give a way of explicitly labelling something with what it is about instead of relying on computers to extract this information.
For example, you might be interested in on questions about stackoverflow. If you search for "stackoverflow" you will get all kinds of questions that are not about stackoverflow at all ... |
Ah! I see now :}
You want hacky? I present unto you the following:
...
lv.OwnerDraw = true;
lv.DrawItem += new DrawListViewItemEventHandler( lv_DrawItem );
...
void lv_DrawItem( object sender, DrawListViewItemEventArgs e )
{
Rectangle foo = e.Bounds;
... |
Another possibility is to use the WinHttp COM object [Using the WinHttpRequest COM Object][1].
WinHttp was designed to be used from server code.
[1]: http://msdn.microsoft.com/en-us/library/aa384079(VS.85).aspx |
Scripting dictionary is the best option IMHO. |
Check out [RC-WinTrans][1]. Its a commercial tool that my company uses. It basically imports our .RC files (or .resx files) into a database which we send to a different office for translation. The tool can then export a translated .RC file (or .resx file) for each language from the database. It even has a basic dia... |
Inheritance shouldn't be an issue as long as the ctor is private.
However, if you don't disallow the copy constructor, users may [un]intentionally copy the singleton instance. Privately inheriting from [boost::noncopyable][1] is the easiest way to prevent this.
[1]: http://www.boost.org/doc/libs/1_36_0/libs/... |
Careful! If you use an answer (like the one by Brian Bondy currently voted up) where you move items back from the second stack to the first, the solution does not have amortized constant time, and can be made faster. For example, if the queue contains 100 elements, and then repeatedly a new item is pushed then popped,... |
This blog post provides a example on how to do what you want on via command line svn.
http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/
These change will be reflected in TortoiseSVN.
I believe there is a way to do it via tortoise however i don't have a windows vm accessibl... |
Use AOP to intercept calls to the socket and measure the response time. |
Your loop looks valid - what does the following code (just on it's own) return?
zipStream.read(tempBuffer)
if it's returning -1, then the zipStream is closed before you get it, and all bets are off. It's time to use your debugger and make sure what's being passed to you is actually valid.
When you call ge... |
[The HTML specs][1] state that both selected & disabled are available options for the `<option>` element, but doesn't specify what should happen in case of a conflict. In the [section on disabled controls][2] it says
> When set, the disabled attribute has
> the following effects on an element:
>
> - Disabled co... |
According to the HTML 4.01 Specification, [**disabled *is* a standard attribute for the option element**][1], but behavior is probably indeterminate based on the standard (read over the information on the select element and the options elements. Here is a portion I think may shed light on Opera's reasons for their impl... |
See the answers to [this similar question][1]: a few auto-update frameworks were recommended there which are designed for (or work with) .net apps:
* [Application Updater Block][3] (which you mention)
* [ClickOnce][2],
* [ClickThrough][4]
[1]: http://stackoverflow.com/questions/37030/how-to-best-impleme... |
I've used it once and was quite happy with it. Often, there is no need for "big" multithreading, but only for 2 Threads (UI and Worker), and it works really well without having to worry too much about the underlying Threading Logic. |
There's nothing in VB6 that will do that. If you update to Visual Studio Tools for Office with .Net you can use generics:
Function MyRoutine(Of O)(R As Delegate, newvalue As Object) As O
Dim i As O = CType(r.Method.Invoke(Nothing, Nothing), O)
'you'd need another parameter to tell it which p... |
I think they **can** belong together but don't necessarily **have** to belong together. In your scenario, it seems like it makes sense that the limits are documented in such a way that they appear in the generated API documentation and intellisense (if the language/IDE support it).
I think it does depend on the lang... |
I think they do, and have always placed comments in the header files (c++) arcordingly.
In addition to valid input/output/return comments, I also note which exceptions are likly to be thrown by the function (since I often want to use the return value for...well returning a value, I prefer exceptions over error codes... |
I think they do, and have always placed comments in the header files (c++) arcordingly.
In addition to valid input/output/return comments, I also note which exceptions are likly to be thrown by the function (since I often want to use the return value for...well returning a value, I prefer exceptions over error codes... |
What tools exist to convert a Delphi 7 application to C# and the .Net framework? |
|delphi|c#| |
I maintain an old PC-only application written in Delphi 7. Although Delphi has served me very well in the past I now only use it for this one application and find my skills with the language diminishing. It's syntax is too different from my 'day job' languages of Java/Ruby so it takes me longer to get into the groove o... |
Load a form without showing it |
|c#|winforms| |
Short version: I want to trigger the Form_Load() event without making the form visible. This doesn't work because Show() ignores the current value of the Visible property:
tasksForm.Visible = false;
tasksForm.Show();
Long version: I have a WinForms application with two forms: main and tasks. The main for... |
**Short version:** I want to trigger the Form_Load() event without making the form visible. This doesn't work because Show() ignores the current value of the Visible property:
tasksForm.Visible = false;
tasksForm.Show();
**Long version:** I have a WinForms application with two forms: main and tasks. The ... |
Short version: I want to trigger the Form_Load() event without making the form visible. This doesn't work because Show() ignores the current value of the Visible property:
tasksForm.Visible = false;
tasksForm.Show();
Long version: I have a WinForms application with two forms: main and tasks. The main for... |
What are some good rigid body mechanics references? |
|physics|math| |
I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I took only took through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real pro... |
|math|physics| |
I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I only took Maths through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real pr... |
What are some good rigid body dynamics references? |
I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I only took Maths through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real pr... |
It helps you understand the focus of the page or site that you're looking at. What topics being discussed the most? What kinds of information will I find here?
If you search for something related to Java and land on two sites, one with a tag cloud showing 'Java' is prominent, and one where Java is almost invisible b... |
> Why would I need a "cloud" of tags upon which to click? I can just type that tag(s) into a search box. What am I missing?
How do you know what tags are available to type without a lot of trial and error? Even if you know what tags are available, how do you know which are most popular without a bunch more trial an... |
Try version [2.0 RC2][1] - it's pretty stable.
[1]: http://pgfoundry.org/frs/?group_id=1000140&release_id=1217 |
Can distutils create empty __init__.py files |
|python|distutils| |
If all my `__init__.py` files are empty, do I have to store them into version control, or is there a way to make distutils create empty `__init__.py` files during installation? |
This is probably a combination of impersonation and a mismatch of different authentication methods occurring.
There are many pieces; I'll try to go over them one by one.
**Impersonation** is a technique to "temporarily" switch the user account under which a thread is running. Essentially, the thread briefly gains... |
|c#|delphi|migration| |
I maintain an old PC-only application written in Delphi 7. Although Delphi has served me very well in the past I now only use it for this one application and find my skills with the language diminishing. Its syntax is too different from my 'day job' languages of Java/Ruby so it takes me longer to get into the groove of... |
This actually got me interested:[Check out this mailing on the pylons list][1]. So AuthKit is being developed, and I will follow the book and get back on the results.
[1]: http://groups.google.com/group/pylons-discuss/browse_thread/thread/644deb53612af362?hl=en |
Here is a sample tokenizer class that might do what you want
//Header file
class Tokenizer
{
public:
static const std::string DELIMITERS;
Tokenizer(const std::string& str);
Tokenizer(const std::string& str, const std::string& delimiters);
b... |
Here is a sample tokenizer class that might do what you want
//Header file
class Tokenizer
{
public:
static const std::string DELIMITERS;
Tokenizer(const std::string& str);
Tokenizer(const std::string& str, const std::string& delimiters);
b... |
What simple method can I use to debug an embedded processor without serial port or video? |
|debugging|hardware|embedded| |
We have a small embedded system without any video or serial ports (i.e. we can't output text via printf).
We would like to track the progress of our code through the initialization sequence.
Is there some simple things we can do to help with this.
It is not running any OS, and the hardware platform is somewhat... |
There are a few strategies you can employ to help with debugging:
If you have Output Pins available, you can hook them up to LEDs (or an oscilloscope) and toggle the output pins high/low to indicate that certain points have been reached in the code.
For example, 1 blink might be program loaded, 2 blink is foozbar... |
How do I keep Resharper Files out of SVN? |
|visual-studio|svn|tortoisesvn|resharper| |
I am using VS2008 and Resharper. Resharper creates a directory _Resharper.ProjectName. These files provide no value for source control that I am aware of and cause issues when committing changes. How can I get SVN to ignore them? I am using TortoiseSVN as my interface for SVN. |
I am using VS2008 and Resharper. Resharper creates a directory _Resharper.ProjectName. These files provide no value for source control that I am aware of and cause issues when committing changes. How can I get SVN to ignore them? I am using TortoiseSVN as my interface for SVN.
EDIT: You guys are fast. |
My favorite command is "ls -thor"
It summons the [power of the gods][1] to list the most recently modified files in a conveniently readable format.
[1]:http://en.wikipedia.org/wiki/Thor |
ActiveScaffold is by far and away the most configurable/easiest to integrate/most automagic scaffolding around at the moment.
It has built in ajax support, near seamless db introspection and it even plays nicely with legacy Oracle databases (which can be a real pain in Rails).
Try it: http://activescaffold.com/ |
I have found that using an index into an array, rather than a pointer, can speed things up a tick. It all depends on how your compiler chooses to optimize. The key is that the processor has instructions to do complex things like [i*2+1] in a single instruction. |
Try this:
<div onselectstart="return false">some stuff</div>
Simple, but effective... works in current versions of all major browsers. |
The best advice regarding descriptors I give to any new Symbian developer in my company is to try and avoid using the descriptors when not necessary. The Symbian SDK has the libc API which includes stdio, stdlib, string and more. I usually use char* types and when necessary I convert it to a descriptor (when I need to ... |
There's nothing in VB6 that will do that. If you update to Visual Studio Tools for Office with .Net you can use generics:
Function MyRoutine(Of O)(R As Delegate, newvalue As Object) As O
Dim i As O = CType(r.Method.Invoke(Nothing, Nothing), O)
'you need another parameter to tell it which pro... |
also, I would recommend not to let the users upload into a folder that's accessible from the web. Even the best MIME type detection may fail and you absolutely don't want users to upload, say, an executable disguised as a jpeg in a case where your MIME sniffing fails, but the one in IIS works correctly.
In the PHP w... |
Java -> Python? |
|java|python| |
Besides the dynamic nature of Python (and the syntax), what are some of the major features of the Python language that Java doesn't have, and vice versa?
|
I think this pair of articles by Philip J. Eby does a great job discussing the differences between the two languages (mostly about philosophy/mentality rather than specific language features).
* [Python is Not Java][1]
* [Java is Not Python, either][2]
[1]: http://dirtsimple.org/2004/12/python-is-not-java... |
Multithreaded programming is hard to grasp in the beginning (and veterans still fail sometimes) and BackgroundWorker makes it a bit easier to use. I like the fact that BackgroundWorker has functionality which is easy to implement but even easier to wrongly implement in a subtle way, like cancellation.
I use it if I ha... |
Re-Running Database Development Scripts |
|sql-server|database|version-control|sdlc| |
In our current database development evironment we have automated build procceses check all the sql code out of svn create database scripts and apply them to the various development/qa databases. This is all well and good, and is a tremdous improvement over what we did in the past, but we have a problem with rerunning ... |
I personally would advise against trying to do this integration. I know what you're going for ... the ease of defining GUI/HUD elements in WPF greatly outweighs trying to do the same in just plain old XNA. However, think realistically of the time you'll spend trying to enable this scenario vs. how much you'd save if ... |
These are Microsoft's [10 reasons to upgrade](http://download.microsoft.com/download/3/B/D/3BDDC5D5-E8CF-4031-A12A-B072ECA27C42/VS2008PETopTenFSEMEA.doc) (.DOC):
1. LINQ support
2. Same designer elements as Microsoft Expression (Web and Blend)
3. AJAX and WCF/REST
4. Better WPF support
5. Improved MSTEST (also i... |
A lot of the magic you see in Rubyland has to do with metaprogramming, which is simply writing code that writes code for you. Ruby's `attr_accessor`, `attr_reader`, and `attr_writer` are all simple metaprogramming, in that they create two methods in one line, following a standard pattern. Rails does a whole lot of meta... |
Caching is the way to go. And if your into design patterns, take a look at the singleton.
Overall however I'm not sure I'd be worried about it until you notice performance degradation. |
What is the best way of preventing memory leaks in a yacc-based parser? |
|c++|yacc| |
Yacc does not permit objects to be passed around. Because the %union can only contain POD types, complex objects must be new'd and passed around by pointer. If a syntax error occurs, the yacc parser just stops running, and references to all of those created objects are lost.
The only solution I've come up with is th... |
Here is a sample tokenizer class that might do what you want
//Header file
class Tokenizer
{
public:
static const std::string DELIMITERS;
Tokenizer(const std::string& str);
Tokenizer(const std::string& str, const std::string& delimiters);
b... |
Should you use international identifiers in Java/C#? |
|c#|java|coding-style| |
C# and Java allow almost any character in class names, method names, local variables, etc.. Is it bad practice to use non-ASCII characters, testing the boundaries of poor editors and analysis tools and making it difficult for some people to read, or is American arrogance the only argument against? |
I'd say it entirely depends on who's working on the codebase.
If you have a small group of developers who all share a common language and you don't ever plan needing anyone who doesn't speak the language to work on the code then go ahead and use whatever characters you want.
If you need to have people of varying ... |
Both are very similar but Subversive is the "eclipse svn provider". I primarily use subversive because of a few convenient features.
Grouping of history.
When i'm browsing the history of a branch instead of just seeing a bunch of rows for every commit it can group commits by today, week, etc.
Mapping of trunk, b... |
Any of the distributed solutions. Git, mercurial etc. My preference would be git. |
[git][1]
I have fallen in love with it.
[1]: http://git.or.cz/ |
A JTAG debugger is also an option, though cumbersome to set up. |
Gonna post an answer to my own question here as I RTFM after I typed this up. In TortoiseSVN, goto settings. Add ReSharper* to the "Global ignore pattern". Adding items to the global ignore pattern means that these files will be ignored for any project you work on for the client with TortoiseSVN installed, so it mig... |
Gonna post an answer to my own question here as I RTFM after I typed this up. In TortoiseSVN, goto settings. Add
*ReSharper*
to the "Global ignore pattern". Adding items to the global ignore pattern means that these files will be ignored for any project you work on for the client with TortoiseSVN ... |
Have you looked into distributed version control, such as Git? Each "checkout" is essentially a branch... it's a fairly different way of thinking about source control.
Git is free, created by Linus Torvalds, and used for Linux (among many other projects of course). |
The simplest most scalable solution are state LEDs. Toggle LEDs based on actions, either in binary form or when certain actions occur if you can narrow your focus.
The most powerful will be a hardware JTAG device. You don't even need to set breakpoints - simply being able to stop the application and inspect the stat... |
<script type="text/javascript">
/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***************... |