fundamentals

.NET String to byte Array C#

How do I convert a string to a byte array in .NET (C#)? Update: Also please explain why encoding should be taken into consideration. Can't I simply get what bytes the string has been stored in? Why this dependency on encoding?!!! ...

Compare Two .NET Array objects

I am trying to compare two .NET arrays. Here is an obvious implementation for comparing arrays of bytes: bool AreEqual(byte[] a, byte[] b){ if(a.Length != b.Length) return false; foreach(int i = 0; i < a.Length; i++) if(a[i] != b[i]) return false; return true; } A more refined approach can be s...

Does any programmer have to know C? Yes, why? No, why?

Hi, since I was at the first year of my University I always envied my fellows (mainly coming from a tech-oriented professional school) for knowing C. I came from a natural-sciences-oriented lyceum and never had programming experience or courses but some summer work with PHP learned from a teach-yourself-PHP-in-7-hours (and my programming...

What are vectors and how are they used in programming?

I'm familiar with the mathematical/physics concept of a vector as a magnitude and a direction, but I also keep coming across references to vectors in the context of programming (for example C++ seems to have a stl::vector library which comes up fairly frequently on SO). My intuition from the context has been that they're a fairly primit...

Help For The Copy & Paste Generation Of Coders

Hi all, I myself am one of these types of coders, who never learned coding in a formal setting, but am instead, self-taught by the use of copy and paste scripts, and pre-authored works available through GPL projects and premium software's(which is often the way commerical script companies show you how to change, or update code in their ...

Why are structs stored on the stack while classes get stored on the heap(.NET)?

I know that one of the differences between classes and structs is that struct instances get stored on stack and class instances(objects) are stored on the heap. Since classes and structs are very similar. Does anybody know the difference for this particular distinction? ...

How do I copy an object in Java?

Consider the below code: DummyBean dum = new DummyBean(); dum.setDummy("foo"); System.out.println(dum.getDummy()); // prints 'foo' DummyBean dumtwo = dum; System.out.println(dumtwo.getDummy()); // prints 'foo' dum.setDummy("bar"); System.out.println(dumtwo.getDummy()); // prints 'bar' but it should print 'foo' So, I want to copy the...

"Delphi Fundamentals" in Delphi 2009

Hello, Has anybody used/converted "Delphi Fundamentals" in Delphi 2009? - http://fundementals.sourceforge.net/ I'm using Dictionaries (cArrays.pas,cDictionaries.pas,cStrings.pas,cTypes.pas) in my project and now i have some troubles on upgrading code. I'll be highly obliged if anybody can convert the above mentioned units in Delphi 200...

C# Private variable list

I suspect this question illustrates my lack of understanding about what's going on behind the scenes in C#, but hey... While doing a CRM SDK project in C# that involved a number of private variables (which were CRM objects called "lists", but that doesn't really matter), I found I was repeating nearly the same lines of code. I tried sho...

what is the meaning of "$" sign in javascript

In the flowing javascript code there is one $(window). What does it mean??? $(window).bind('load', function() { $('img.protect').protectImage(); }); ...

Purpose of an 'Identity Function'?

I came across this subject when I was reading through PrototypeJS's docs: its Identity Function. I did some further searching&reading on it and I think I understand its mathematical basis (e.g. multiplication by 1 is an identity function (or did I misinterpret this?)), but not why you would write a JS(or PHP or C or whatever)-function th...

How .NET differentiates reference vs primitive and value types

.NET we have primitive datatypes like int and value types like struct. And also we have reference types. All of them seem to be derived from object class. How .NET determine primitive, value type against the reference type? Where it is done? At compiler or at JIT? Does this belongs to the capabilities of the compilers? ...

Questions every good Delphi developer should be able to answer?

Following the spirit of these questions: How to Recruit Great Developers? Questions every good .NET developer should be able to answer? ...it would be interesting to know recommendations or advice for hiring a good Delphi developer. Some time ago Steve Trefethen published a series of great articles: Delphi IDE Wisdom Delphi RTL a...

Pragmatic Programmer Techniques - who, what, where...

Few questions. But all very much related. 1) How many of the SO crowd are using 'pragmatic programmer' tools/methods/techniques including, but not limited to (some of the obvious): a) Source code control system. b) Active use of branching, tagging with SCS. c) Task/Bug tracking (integrated with SCS). d) If DB development is involved, l...

Are there any programming textbooks directly based on David Parnas' concepts?

Some great books (like Object-Oriented Analysis and Design with Applications) cite Parnas' papers, some (like Implementation Patterns) mention them in the bibliography. I know modern OO-ness was much inspired by Parnas' works, but are there books that essentially teach Parnas' concepts(*) as a method using modern notation, programming l...

what is events in c#

what events in c# and give clear real time example and program ...

Which is more fundamental: Python functions or Python object-methods?

I am trying to get a conceptual understanding of the nature of Python functions and methods. I get that functions are actually objects, with a method that is called when the function is executed. But is that function-object method actually another function? For example: def fred(): pass If I look at dir(fred), I see it has an att...

Override ToString() in asp.net c#, basics. Doesn'twork.

Hi I have the Default aspx. I want to test overriding default methods like to ToString(). Whenever I use ToString(), I thought with following code it has to add "my text";? why not? public partial class test : System.Web.UI.Page { public override string ToString() { return base.ToString() + "my text"; } prot...

Learning Algorithms and Data Structures Fundamentals

Can you recommend me a book or (better!) a site with many hard problems and exercises about data structures? I'm already answering project Euler questions, but these questions are about interesting, but uncommon algorithms. I hardly used even a simple tree. Maybe there is a site with exercises like: hey, you need to calculate this: ... ...

What should programmers practice every day?

Musicians practice scales, arpeggios, etc. every day before they begin playing "real" music. The top sports players spend time every day practicing fundamentals like dribbling before playing the "real" game. Are there fundamentals that programmers should practice every day before writing "real" code? ...