Friday, September 28, 2012

Why science TV programs suck

We, all saw a lot of popular science programs on TV. BBC, Discovery and others show them all the time. And somehow all the programs about nature are interesting and amazing and all the science programs suck. They try to explain very interesting things but immediately fail because of stupid effects or science guys who look ridiculous trying to explain the universe looking at the spider web or playing a piano and saying: "OK, this has nothing to do with this web/piano, but I will still proceed." I understand that networks just need ratings and it causes weird decisions. But are there a lot of guys who would love to watch something solid and serious, who would love not to be treated like all they want is entertainment. I would totally pay extra for that.

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();