difference

What are core concept differences between C++ and C#?

Let assume one knows C++, what are the main concepts that can confuse them/that work differently when using C#? I do not mean the syntax differences but for example how references works, what "replaces" pointers, etc. or how the idea of managed code affects developer experience? EDIT: Thanks to Chris for pointing out this great blog po...

What is the difference between "JPG" / "JPEG" / "PNG" / "BMP" / "GIF" / "TIFF" Image?

I have seen many types of image (extension) but have never understood the real difference between them. Are there any links out there that clearly explains the difference between them. Is there a standard to use a particular type of image in your application? What do we use for web applications? ...

What's the difference between an object and a class in Perl?

I'm having a little trouble getting my head around the conceptual difference between an object and a class. I don't really understand the distinction between the two in any programming language, but currently I'm working with Perl, and Moose, so I'd prefer an explanation using those things. Cheers ...

Bash string difference

Hi there, I'm trying to find a way to determine the difference between two strings in my script. I could easily do this with diff or comm, but I'm not dealing with files and I'd prefer not to output them to files, do the compare and read it back. I see that comm, diff, cmp all allow to pass either two files OR a file and standard input...

OS Multi threading differences

I'm asking this question because i was investigating the Haiku OS (a BeOS descendant). The goal of the BeOS operating system was to create a desktop environment that handles multimedia well and is very responsive. They manage this by creating a kernel that has "pervasive multi threading". Other operating systems (linux, windows etc.) d...

Difference between -Wconversion between gcc and g++

Consider the following test program: static void func(int a) { } int main() { unsigned int b = 42; func(b); return 0; } Compiling it with gcc: lol@mac:~/projects$ gcc -Wconversion testit.c testit.c: In function âmainâ: testit.c:11: warning: passing argument 1 of âfuncâ as signed due to prototype lol@mac:~/projects$ ...

Algorithm for finding the difference between two arrays

Given two arrays, is there a fast algorithm for finding all elements in the two that are different? For example, consider two arrays of Keys (as in keyboard keys) structs. One represents the currently depressed keys, and the other represents the keys depressed in the last timestep. Keys[] oldKeys = LastKeyboardState.GetPressedKeys(); Ke...

Calculate elapsed time in Java / Groovy

I have... Date start = new Date() ... ... ... Date stop = new Date() I'd like to get the years, months, days, hours, minutes and seconds ellapsed between these two dates. -- I'll refine the question. I just want to get the elapsed time, as an absolute measure, that is without taking into account leap years, the days of each mont...

How to calculate the difference between two Java java.sql.Timestamps?

Please include the nanos, otherwise it would be trivial: long diff = Math.abs(t1.getTime () - t2.getTime ()); [EDIT] I want the most precise result, so no doubles; only integer/long arithmetic. Also, the result must be positive. Pseudo code: Timestamp result = abs (t1 - t2); Examples: t1 = (time=1001, nanos=1000000), t2 = (time=99...

What are the main differences between Cocoa and CocoaTouch?

I am currently learning objective-c and cocoa. Next, I want to stick up to iPhone programming. I'll get a book for that, of course. But I would like to know already now, which main differences are there between cocoa and cocoaTouch. ...

calculate time difference in cocoa

I have got two timevalues in the format: %H%M%S (E.G.161500) These values are text-based integers. Is there a simple function in Cocoa that calculates the difference between these two integers using a 60 seconds and minutes scale? So if time 1 = 161500 time 2 = 171500 timedifference = 003000 ...

XML Versioning Algorithm

I'm looking for an efficient way to compare and get differences between two XML-based parse trees. What would you suggest to be the best way to store those differences? I would have done this: XML A: <w:p> <w:pPr> <w:spacing w:after="1"/> </w:pPr> <w:r> <w:t>World</w:t> </w:r> </w:p> XML B: <w:p> <w:pPr> <w:s...

Binary diff tool?

I need a utility to diff two binary files. The files are large (6-50GB) Beyond Compare is my favorite diff tool, and I own it, but it cannot handle binary files over what can fit in the process's address space. HexDiff 3.0 seemed interesting, except the trial version doesn't do diff's. *rolls eyes* The tool should be free, since I'm ...

Does the string <!-FTCACHE-1-> in a PDF file mean anything?

My program downloads a PDF file from a source location every day. When I see the binary text of the PDF file in Notepad, I find that sometimes the PDF file has the string <!-FTCACHE-1-> at the end. Sometimes this word is missing from the PDF file. My program downloads this PDF daily and compares it with the previous day's PDF file using...

Fastest way/algorithm to find one different keyword between two set of text files

I've got 4 text files, 2 of them contains a keyword which other 2 text files don't. What's the fastest way/algorithm to find this "keyword" shared in the first 2 text files but don't exist in the other 2 files? I can think of really slow ways such as go word by word and then search with IndexOf etc. But sounds like it's going to be r...

Live Range vs Reaching Definitions

In compiler data flow analysis, what is the difference between a live range of a variable and it's reaching definition? Both seem to refer to the same thing... ...

Compare many text files that contain duplicate "stubs" from the previous and next file and remove duplicate text automatically

I have a large number of text files (1000+) each containing an article from an academic journal. Unfortunately each article's file also contains a "stub" from the end of the previous article (at the beginning) and from the beginning of the next article (at the end). I need to remove these stubs in preparation for running a frequency an...

Differences between CTP, Alpha, Beta, Gamma, RTM and Preview for Software Release?

It is quite intuitive that at least Gamma comes after Beta and Alpha. But how about CTP, RTM and Preview releases? Which one comes first and last? MEF (Managed Extensibility Framework) is currently on Preview 5 release, but I am not sure if it is a release before Alpha or after Beta, CTP or RTM. Is it OK to use preview releases in pro...

C# SHA-1 vs. PHP SHA-1...Different Results?

Hey, I am trying to calculate a SHA-1 Hash from a string, but when I calculate the string using php's sha1 function I get something different than when I try it in C#. I need C# to calculate the same string as PHP (since the string from php is calculated by a 3rd party that I cannot modify). How can I get C# to generate the same hash as ...

What is the difference between jQuery's functions val() and text()?

I think the question says it all. Where would you use one over the other? Thanks! ...