Posts Tagged Dotnet

Books for Sale

I’m having a hard time keeping up with reading my NEW books. So instead of just letting them gather dust in my shelf, I’m thinking of selling some of them (those which I do not need for my current projects).

0321193687 UML Distilled (for 1k Php)

1590595165 SCJD Exam with J2SE 5, Second Edition (for 1.2k Php)

0321349601 Java Concurrency in Practice (for 1.2k Php)

1590594681 Beginning ASP .NET 2.0 E-Commerce in C# 2005 (for 1.2k Php)

1590598733 Accelerated C# 2008 (for 1k Php)

The tag prices attached are based on Amazon’s base price (converted to pesos). I already paid for shipping (to Philippines) and customs taxes so in effect you are really getting a HUGE discount.

You can drop me a line here or email me at dayg77 AT gmail DOT com if you’re interested.

Thanks.

Update 4/22: Proceeds will go to the same fund raising event as described here.

Comments (4)

Hero Hack Pack

Order your own Hero Hack Pack and get started with Open Source and Microsoft technology.

Each Hero Hack Pack contains free evaluation editions of Windows Server 2008 and Visual Studio 2008, plus resources for getting started with Open Source development.

Looking for more? We’ve randomly hidden vouchers for free passes to the 2008 Open Source Convention (OSCON) this summer, held in Portland, OR. Each Pack gives you a chance to win a free pass to one of the world’s largest gatherings of the Open Source community.

Taken from: http://www.microsoft.com/opensource/heroes/default.mspx

Update: 2:30PM, I already received an email confirmation from Microsoft. Excited to get my Hack Pack copy!

Thank you for placing your order for the Hero Hack Pack with Microsoft.

You’ll receive your Hero Hack Pack in 4-6 weeks.

Leave a Comment

Pro C# 2008 for $10

At 12:01 AM PST, a different Apress or friends of ED eBook will be priced at $10 US for a 24-hour period

You can view/purchase the discounted eBooks from this URL: http://www.apress.com/info/dailydeal.

I already have four books from that promo, including Pro C# 2008 which I purchased also for $10 last January 24.

1590598849 Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition

Luckily, they are featuring that book again for $10.

So hurry, buy now before time runs out…

UPDATE 4/1: Deal’s off, price is back up to $41.99.

Buying directly from Amazon might be the better option. Better luck next time.

Leave a Comment

Java vs C# – switch statements

This is my first installment of a new blog series I’m planning to call Java vs C#.

Today, I’ll be discussing the behavior of “switch” statements in both Java and C#.

Consider this snippet for Java which prints out the values “1”, “2” and “Default” when value = 1.

Since I did not add “break” statements after each case, it should execute the code in the next cases up to the point where it reaches a break statement (or exits the switch).

switch (value) {
   case 1:
      System.out.println("1");
   case 2:
      System.out.println("2");
   default:
      System.out.println("Default");
      break;
}

You would think that the snippet for C# below (which is patterned after the code above) would behave in exactly the same way.

switch (value)
{
   case 1: System.Console.WriteLine("1");
   case 2: System.Console.WriteLine("2");
   default: System.Console.WriteLine("Default");
      break;
}

But this is where it gets interesting, the code above will actually NOT compile.

Error 1 Control cannot fall through from one case label (‘case 1:’) to another
Error 2 Control cannot fall through from one case label (‘case 2:’) to another

They said that this is actually a safety mechanism for C# which help prevent debugging nightmares for developers in the event that these switch statements get bigger and more complex.

Seems like a valid point.

But it might be important to note that C# still allow fall through for switch statements, provided you do not add any logic to the case statements.

switch (value)
{
   case 1:
   case 2:
   default: System.Console.WriteLine("Default");
      break;
}

You can however work around the said fall through problem by using goto which I do not really recommend (so I’m not going to add any more details about that).

As a side note, in addition to int and enum types, C# switch statements also allow string types as argument.

So there you have it folks, switch statements in Java and C#.

Hope you enjoyed and learned something from my first installment.

References:

Comments (1)

Fibonacci

If you were given a task to compute the nth Fibonacci number, how would you do it?

You would go straight away and write a recursive function right?

public static int getNumberRecurse(int n) {
    if (n == 0 | n == 1) {
       return 1;
    } else {
       return getNumberRecurse(n - 1) + getNumberRecurse(n - 2);
    }
 }

elapsed for n=30: 31 ms

elapsed for n=40: 3016 ms

Well think again. Because there might be a better way of doing it.

public static int getNumberLoop(int n) {
if (n == 0 | n == 1) {
return 1;
} else {
int[] fib = new int[n + 1];
fib[0] = 1;
fib[1] = 1;
for (int i = 2; i <= n; i++) { fib[i] = fib[i - 1] + fib[i - 2]; } return fib[n]; } } [/sourcecode] elapsed for n=100000: 31 ms If we compare the elapsed time (in ms) between the two functions, we can clearly see which one is better. Anyway, I've found an invaluable book called Algorithms from where I got the example above.

I know a lot of programmers (myself included) who are easily satisfied with a workable solution rather than an efficient one.

I hope someday (with enough time and practice) I can be an expert on this topic too.

Leave a Comment

Books from Microsoft Press

Taken from: Microsoft.com.

Requires registration.

Leave a Comment

IT HERO3S Solutions Challenge

The IT HERO3S CHALLENGE is a Solutions Development Challenge for Developers and IT Professionals in the Philippines. The aim of the contest is to provide a solution for an actual NEED by any of the participating NGOs. Unfortunately, the deadline for submission of entries was two days ago (January 15, 2008).

Too bad I didn’t have enough MS knowledge to provide a sound plan in such a short timespan. I hope this event pops up again next year, when I think I should be more armed and ready.

Leave a Comment