Friday, September 28, 2012

Windows Command Prompt Tips

1. Copy/Past to the Command Prompt
Not very convenient but still easy. You can Right-click on top of the command prompt window (top window bar) and choose Edit menu. There you can copy text from the command prompt and past into it.

2. Open Command Prompt in Current Directory
Discovered this feature only recently. It made my life much easier. Right-click somewhere in directory (not on the file or menu) with the Shift button down. You will see a new option "Open command windows here" that will open Command Prompt in the current directory. This feature does not work inside Libraries (Documents, Pictures, etc.) in Windows 7. Don't really know why. May be path to the directory is ambiguous because you can add a lot of directories to your library. Although, paths in sub directories are well defined but this feature still does not work.

DELTA Statistics

I really want to write about my new Android applications that collects statistics for my DELTA research project at the USF. It is my first serious experience with Android (before I worked more with JNI and native code) and especially with Beta testing. What I want to do is to cover some Android features that I used and also to talk about my application's design.

So, that what comes to mind:
  1. Alarms in Android (how to schedule alarms and do something when you receive them).
  2. Background services and WakeLocks.
  3. Alerts in Android.
  4. Text file handling (saving, etc.).
  5. Sending data with HTTP post request.
  6. Custom notifications.
  7. How to catch when device goes asleep (doesn't look very big but I am really exited about this because I did not find any information on in).
I think I will just divide everything in 8 posts (don't know how I will write all this...): these seven above and one about general design ideas I had in mind when I wrote the application.

Tuesday, September 4, 2012

Get Cause of Exception

Got a weird InvocationTargetException in Android. Why nobody told me to call getCause() method first and not to google it for half an hour? Happened to be a security violation (did not have a required permission) and a simple fix.

Saturday, July 28, 2012

Pass NULL to the Contains Method in C#

I wanted to use FirstOrDefault method inside of the Contains method for List<T>. FirstOrDefault(...) method returns the first appearance of the element (defined by the expression in the brackets) or the default element. Default element is the result of default(SomeClass) and is NULL for all user-defined classes. Thus, my concerns was what would happen if I will pass NULL to the Contains method. It happens that Contains just returns FALSE wherever it has NULL as an input parameter. It does not depend on whether are any elements in the collection.

Sunday, July 22, 2012

Wrath of the Titans

Why can't they make a good movie based on the Greek mythology? As I recall Troy with Brad Pitt was the only one worth noting. The only thing Wrath of the Titans has is effects. They are really good. No credit for good characters in the plot ad they are all were created long long ago. They tried to merge several myths and obviously failed. Worst of all, the movie is totally meaningless. I don't get why they fight, for what and who are they. Why not just follow the myth then? They have a lot of sense.

Wednesday, June 27, 2012

GUID in C#

I always forget useful stuff about GUID.

1. How to create GUID from string?

Guid newGuid = new Guid(Guid_As_String);

2. How to compare to GUID values?

Guid a;
Guid b;
if (a == b)
{
      // Do something
}

You can compare them with == operator because it is overloaded for Guid type (see here).

3. How to get new Guid?

Guid a = Guid.NewGuid();

Saturday, May 26, 2012

My New Project

Two weeks have passed since my arrival to Samara and I am finally all into my new project (well, no mine actually). I will write a formulas descriptor for a bank software. It will allow one to create new formulas for various coefficients in IronPython. The scripts will be connected to .NET C# code using Microsoft DLR. 

So far I spent a week digging into the source code and realized that it is extremely difficult without any comments and documentation (my case). I actually do not understand how my project manager (who wrote all 100,000 lines of code) remembers all the design principles and how he plans to do it in 3 years... I assume he is  just much smarter than me. So, one thing I understand very clearly now is that comments and documentation matter and are very important. The clearest and the best-written code in the world is practically unsupportable and very hard to understand without them.