I migrated from Java to C# and so I am wondering how to unit tests in C#. I remember using JUnit to test my Java applications and importing the package, etc. How can I unit test in C#? What are some good resources for unit testing in C#?
I want to calculate time elapsed during a function call in C, to the precision of 1 nanosecond.
Is there a timer function available in C to do it?
If yes please provide a sample code-snippet.
Pseudo code
Timer.Start()
foo();
Timer.Stop()
Display time elapsed in execution of foo()
Environment details: - using gcc 3.4 compiler on a RHEL…
DISCLAIMER:
THIS QUESTION WAS NOT MENT TO BE ARGUMENTATIVE!!!!!!!
What is fastest and less memory draining way of searching a key-value pair? I will be storing items in a key-value like relation and I need to access them quickly. Should I use a SQLite database? A Map? A Hashtable? A HashMap? Please give some advantages/disadvantages of…
Hello,
I have a small query. I need to create a Caching Service of my own that will write and read .NET Objects to and from the Database. Now, I have achieved that with the help of Binary Serialization. But the Problem is I need to deliberately marked my objects as [Serializable], which makes me think that what if someone will try to add…
How could I possibly implement a unit converter in Java??? I was thinking of having a abstract base class:
public abstract class Unit
{
...
public void ConvertTo(Unit unit);
}
Then having each class like Meter Kilometer Inch Centimeter Millimeter ... derive from that base Unit class. All the units of length would be in a…
I wanted to create an application which can be a web service client on Android cell. Any recommendations how to do that. I can send SOAP requests to the server
Thanks cell
I am using Open Source toolchain to compile my iPhone apps. So I have no Interface Builder or XCode. How would I setup the layout of widgets like UIButton, UITextView, etc. Also, how would I add an event handler to those UI widgets? Please remember that I don't have Interface Builder or XCode.
I need to get the fillcolor from a legendItem, howerver doing
lItem.getStyle("fill")
returns a different color than the actual legendItem marker color. Any pointers on what am I doing wrong here?
Say I have 2 activities (ActivityOne and ActivityTwo). How would I call ActivityTwo from ActivityOne? Then how would I return to ActivityOne from ActivityTwo? For example, I have a listview with all the contacts on the host phone. When I tap on a contact, another activity shows information and allows editing of that contact. Then I…
Say I have multiple EditTexts in an application. When I click a Button, I want to test what EditTexts are empty and what EditTexts have content. How would I do that? Could someone write the code for the Button click handler.
Here is my code:
public class TasksList extends ListActivity {
...
private static final int COLUMNS_DIALOG = 7;
private static final int ORDER_DIALOG = 8;
...
/**
* @see android.app.Activity#onCreateDialog(int)
*/
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog;
…
Many of today's programming languages are based on C; like C++, C#, Java, Objective-C. So could I call a C method from C++ code? Or call C from Java or C#? Or is this goal out of reach and unreasonable? Please include a quick code sample for my and everyone else's understanding.
I have a main ListView that is based on an adapter from my database. Each database id is "assigned" to an Activity via the ListView. And in my AndroidManifest, each activity has an intent filter with a custom action. Now with this, I have had to create this class:
public final class ActivityLauncher {
private…
I have been exploring the possibilities of Microsoft Silverlight and how it runs in web browsers. I just wonder if Silverlight requires the .NET framework? Meaning that Mac or Linux users cannot run Silverlight. I will be making the application using the .NET framework 3.5. Will this application run in any web…
I am kind of new to C (I have prior Java, C#, and some C++ experience). In C, is it necessary to declare a function prototype or can the code compile without it? Is it good programming practice to do so? Or does it just depend on the compiler? (I am running Ubuntu 9.10 and using the GNU C Compiler, or gcc,…
I have a static library project in Eclipse that was compiled into a .a file. So now how would I use the functions and constants in that library? Would I just put in into my includes:
#include "mylib.a"
Earlier this week we had contest ran over the blog where we are giving away USD 198 worth books of Joes 2 Pros.
We had over 500+ responses during the five days of the contest. After removing duplicate and incorrect responses we had a total of 416 valid responses combined total 5 days. We got maximum…
Yesterday in my interview I was asked this question. (At that time I was highly pressurized by so many abrupt questions).
int *p;
*p=23;
printf('%d',*p);
Is there any problem with this code?
I explained him that you are trying to assign value to a pointer to whom memory is not allocated.
But…
Yesterday in my interview I was asked this question. (At that time I was highly pressurized by so many abrupt questions).
int *p;
*p=23;
printf('%d',*p);
Is there any problem with this code?
I explained him that you are trying to assign value to a pointer to whom memory is not allocated.
But…