Jelly Bean 4.2 for Nexus 7

Posted in Uncategorized on November 14, 2012 by vlipwig

This morning I got a system update (Jelly Bean 4.2) for my Nexus 7 🙂
Here are my first impressions:
After the reboot you see that there is now some kind of Widgets for the lock
screen. You can choose between Clock, Calendar and Gmail.

After logging in I wanted to check the setting of my tablet. I pulled down the notification bar and … realized that the Settings button is gone. I remembered that I read something about the new “Quicksetting” Feature. You must wipe with two one fingers from top to Bottom in the Info bar (that’s where you see the current time and the small Battery icon).
I took a quick look through the available settings and checked out the new “Daydream” which you find in the Display Options.

The “Developer options” in the settings are not visible by default. To enable them, you need to go to “About Tablet” in the settings, scroll down to the “Build number” and tap it seven times, yes I know that sounds crazy. When you go back, you will see an entry for the “Developer options”.

Next thing I checked out was the new Android Keyboard. I am not sure about this. Wiping to write is really fast – but only if the Keyboard recognizes the words you are trying to write correctly, which it didn’t in my case. I couldn’t get it to write the same letter twice in one word, so I switched back to the SwiftKey Keyboard. I will give the Android Keyboard another try when I have a bit more time.

After the update my Amazon apps (Appstore, Amazon Kindle, Amazon MP3) couldn’t remember my Amazon credentials any more.
Another thing I realized was that my custom wallpaper doesn’t seem to fit the screen any more. When I scroll to the most left or right Home screen there is a 1 cm gap without wallpaper. Looks like they changed the resolution for the wallpaper.

Oh, and Firefox crashes a lot under Jelly Bean 4.2 😦

Visual Studio Conditional Breakpoints Pitfalls

Posted in csharp, Visual Studio with tags , on September 8, 2012 by vlipwig

Conditional Breakpoints in Visual Studio are great. They allow you to restrict when the breakpoint will hit based on the evaluation of a Boolean expression. You can choose to hit the breakpoint when the condition is true or when the result of the condition has changed.
But there are a couple of things you should be aware of:

  • that the source language determines the expression operators. This means that if you are debugging in Visual Basic, the “<>” operator means “not equal” while in C# or C++/CLI, you would use “!=”.
  • if you choose a wrong expression operator you get no warning or error. Assume you use “=” (assign) instead of “==” (equal) and you will see that suddenly the variable you are examine will always have the same value.

So do yourself a favor and double check the conditions of your breakpoints.

More infos about conditional Breakpoints:

http://msdn.microsoft.com/en-us/library/7sye83ce.aspx

http://support.microsoft.com/kb/308469

“Think Like a Programmer” by V. Anton Spraul; No Starch Press

Posted in Book Review on September 7, 2012 by vlipwig

V. Anton Spraul is an experienced computer science teacher and has taught introductory programming and computer science for more than 15 years.

The goal of this book is to teach you the creative Part of programming. It’s target audience are clearly beginners who “struggle to write programs, even though you think you understand programming languages.”
You should be familiar with at least one Programming language (it doesn’t have to be c++).

The book starts with some general problem solving techniques (e. g. always have a plan, divide and conquer) and explains them on some general puzzles.
In later chapters Problems will be solved with specific programming concepts like Arrays, pointers, dynamic memory and recursion.

You might be disappointed because Spraul doesn’t give any answers to the exercises but as Spraul states at the beginning of the book you should see them as opportunities to apply the concepts described in the chapters.

The exercises are coded in c++ but the book is not specifically about c++.  Most chapters start with a short review of the used concepts in c++.

More infos can be found here

“Team Geek” by Brian W. Fitzpatrick and Ben Collins-Sussman; O’Reilly Media;

Posted in Book Review on July 30, 2012 by vlipwig

Brian Fitzpatrick leads Google’s Data Liberation Front and Transparency Engineering teams.Ben Collins-Sussman is one of the founding developers of SVN and now manages the engeneering team for the Google Affiliate Network.
Both have a lot of experience with Open Source Projects.

The Book has a clearly defined goal – to help programmers become more effective
and efficient at creating software by improving their ability to
understand, communicate with, and collaborate with other people.

And that is the essence of this book. It explains why each relationship (not only related to Software projects) should be based on Humility, Respect and Trust (HRT).

The message of the book also applies to the relationship between team mates, team leader and team and above all to the relationship with end users.

The book gives useful tips on how to cope with complicated team mates and how managers should lead their team.

Brian and Ben explain why a team culture is so important and should be protected right from the start.

Last but not least the reader gets some tips on how to promote himself better within his company.

I really enjoyed reading this book.

Book catalog page

List<T>.BinarySearch Pitfalls

Posted in csharp on July 17, 2010 by vlipwig

The BinarySearch Method of List<T> collection can be very useful to get the zero-based index of an element.

Further more if the element you searched for is not in the List<T> you can calculate the index of the first element that is larger then the element you searched for. Just apply the ~ operator on the result of the BinarySearch:

var pos = aList.BinarySearch(aString);
if (pos < 0)
{
     aList.Insert(~pos, aString);
}

But there is one pitfall: The List<T> must already be sorted; otherwise the BinerySearch result is incorrect.
This is not a big secret. It is clearly stated in the MSDN description for the Method (under Remarks)

I saw a Bug in a Project where someone used a BinarySearch to find duplicated entries between to Lists. This works as long as the Lists are sorted. If not the result is totally nonsense.

It took a while to find this Bug.

MSDN Link:
http://msdn.microsoft.com/en-us/library/w4e7fxsh.aspx

Fun with Extension Methods

Posted in csharp on July 15, 2010 by vlipwig

In a Pair-programming session Fhad showed me some interesting ideas for extension methods.
He and his colleague used extension methods to get rid of those nasty null checking stuff:

if (object != null)
    return object.SomeProperty;
else
    return string.Empty;

They use a generic extension method together with a lambda expression:

public static TResult IfNotNull<T, TResult>(this T obj, Func<T, TResult> func, TResult value) where T : class
{
    return obj == null ? value : func(obj);
}

Here is an example on how to use this extension method:

SomeClass myClass;
string value = myClass.IfNotNull(obj => obj.SomeProperty, string.Empty);
//value contains string.Empty

myClass == new SomeClass();
myClass.SomeProperty = “something”;
value = myClass.IfNotNull(obj => obj.SomeProperty, string.Empty);
//value is now “something”

And here are some more extension methods I’m using:

public static bool HasItems<T>(this IList<T> list)
{
    return list.Count > 0;
}

public static bool IsEmpty<T>(this IList<T> list)
{
    return list.Count == 0;
}

Example on how to use them:

List<string> _stringList = new List<string>;

if (_stringList.HasItems()) ...
if (_stringList.IsEmpty())...

I think this code is much easier to read.

Finally a link to the msdn website about Extension Methods:
http://msdn.microsoft.com/en-us/library/bb383977.aspx
and about Lambda Expressions:
http://msdn.microsoft.com/en-us/library/bb397687.aspx