I would like to develop an application with two languages. Actually, the goal is to generate two differents application, one with a language (Java), the other on in another language (C#). I would like to use makefiles to help me generate one application or the other one, thanks to targets definition. I don’t know where to begin. Have you ever
Tag: c++
C# DateTime.Ticks equivalent in Java
What is the Java equivalent of DateTime.Ticks in C#? What will be the equivalent of above mentioned code in Java? Answer Well, java.util.Date/Calendar only have precision down to the millisecond: That’s the nearest effective equivalent. If you need to convert between a .NET ticks value and a Date/Calendar you basically need to perform scaling (ticks to millis) and offsetting (1st
Java’s enum… Where are they created?
Since enum in C# are on the stack, I was wondering where enum, in Java, where created. On the stack? On the heap? In some mysterious other place? Enumeration in C# are more primitive than those in Java, this might explain why they are created on the stack… Where are they? I can’t find them! Thanks Answer Enums in Java
in which namespace / package to put exceptions?
What is the common or best practice to structure the location of your exception classes? Let’s say you have the packages/namespaces myproject.person (models and DAOs for persons) and myproject.order (models and DAOs for orders) and the exceptions PersonException and OrderException. Should I put the exceptions in their corresponding packages or in a separate package for exceptions (e.g. myproject.exceptions)? The first
How to obtain all subsequence combinations of a String (in Java, or C++ etc)
Let’s say I’ve a string “12345” I should obtain all subsequence combinations of this string such as: –> 1 2 3 4 5 –> 12 13 14 15 23 24 25 34 35 45 –> 123 124 125 234 235 345 –> 1234 1235 1245 1345 2345 –> 12345 Please note that I grouped them in different number of chars
C# Java HashMap equivalent
Coming from a Java world into a C# one is there a HashMap equivalent? If not what would you recommend? Answer Dictionary is probably the closest. System.Collections.Generic.Dictionary implements the System.Collections.Generic.IDictionary interface (which is similar to Java’s Map interface). Some notable differences that you should be aware of: Adding/Getting items Java’s HashMap has the put and get methods for setting/getting items
Can I pass parameters by reference in Java?
I’d like semantics similar to C#’s ref keyword. Answer Java is confusing because everything is passed by value. However for a parameter of reference type (i.e. not a parameter of primitive type) it is the reference itself which is passed by value, hence it appears to be pass-by-reference (and people often claim that it is). This is not the case,
Regex for tree structures?
Are there regular expression equivalents for searching and modifying tree structures? Concise mini-languages (like perl regex) are what I am looking for. Here is an example that might clarify what I am looking for. An operation that would be possible on the above tree is “move subtree at node 2.1 into the subtree at node 1.” The result of the
What is the Java equivalent of C’s printf %g format specifier?
I tried using Formatter.format, but that seems to leave the mantissa on numbers with 0 mantissa, whereas the C version does not. Is there an equivalent of C’s %g format specifier in Java, and if not, is there a way to fake it? My intention is to preserve the mantissa exactly like C’s for compatibility reasons. foo.c Main.java Console: Similarly,
What are real world examples of when Linked Lists should be used?
Another programmer was mentioning that they haven’t found a use case for using a linked list data structure in any professional software in his career. I couldn’t think of any good examples off the top of my head. He is mostly a C# and Java developer Can anyone give some examples where this was the correct data structure to solve