Blog of a Filipino Developer about C#, VB.NET, ASP.NET, Java, PHP, SQL Server, MySql and Oracle RSS 2.0
 Tuesday, December 04, 2007

...and it has pure Ruby goodness tied into it! I think I'm going to wash my .NET hands today with Neatbens SOAp enhancements. Congratulations to the great folks from NetBeans! You definetely nailed it this time.

From their official press release:

The focus of NetBeans IDE 6.0 is superior developer productivity with a smarter, faster editor, and the integration of all NetBeans products into one IDE. NetBeans IDE 6.0 features Ruby/JRuby/Ruby on Rails support, enhancements for improved Swing development, a new Visual Game Designer, updated Data Binding support, integrated Profiling, and more. The new installer lets you customize your download preferences--use it to choose the features and runtimes you need.
Highlights of NetBeans IDE 6.0 are:

Java
* Swing GUI Builder
* Intelligent Editor
* Profiler
* Debugger
* Updated Platform APIs

C/C++
* C/C++ Projects and Templates
* Source Code Editor
* Multiple Configurations
* Class Hierarchy Browser
* File Navigation
Ruby
* Ruby on Rails Support
* JRuby Runtime
* Code Completion
* Debugger
* Refactoring
Mobility
* Game Builder
* Device Fragmentation
* SVG Graphics
* Web Services
* Handheld Device / Set Top Box
Web & Java EE
* Visual JSF Design
* Enhanced JavaScript
* AJAX Enabled Components
* CSS Editor
* Web Services & SOA
SOA
* XML Schema Editor, XSLT Designer
* WSDL Designer
* BPEL Designer
* Service Assembly Editor
* Deploy to JBI compliant runtime

Awesome! Really awesome! I've been using Netbeans on the side(due to my obedience with .NET) and it has been a great experience for me. I have used Java IDEs in the past(Visual Cafe 4 anyone?) and i must say that Netbeans has come along way since the days of old when Eclipse elitist call Netbeans a "a tool for non-serious java developers". I think this release has proven that NetBeans is valid alternative against the big boys(Eclipse & IntelliJ among others).

Now,  onwards to a cup of Java. ;)

Tuesday, December 04, 2007 11:37:22 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Java | Tech News and Issues

I was working on a report today when I opened my Excel 2007 and this is all i got:

To my surprise there was no toolbar. No menu. No spreadsheet tab. Nothing. All i got was a window with the manification option showing on top of the form. I right-clicked on the bar and this is what i got:

What in the world happened? This was working fine a few days ago! Arrrgh! :( Good thing there is Google Spreadsheet handy!

Tuesday, December 04, 2007 5:56:45 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
All about Keith | Tech News and Issues
 Wednesday, November 28, 2007

I'm still a big fan of VB.NET even if I haven't touched a single VB.NET code in a year and one the biggest VB.NET fanboy I know has just started a website all about the good things you can do with VB.NET. Chris Williams (VB.NET MVP) has just started a website called ILoveVB.NET. The idea is to build a community that would champion the cause of VB.NET(which is to make the world known that VB.NET is a first class programming language and not a code kiddies toy anymore).

Here's the official message from Chris Williams:

This is the place where we show off all the amazingly cool stuff you can do with VB.NET.

If you're passionate about VB.NET, or you have an interesting project or maybe you're providing community support to a technology that doesn't currently have language parity, then you've come to the right place. We will gladly host your project and blog(s).

If you're looking for answers, you may find them here as well. If you're tired of looking everywhere for code samples and only finding C#, keep checking back here. We're making contact with the product teams and working towards getting the samples and SDKs you want.

Once again, thank you for stopping by. If you need anything, feel free to ask.

Chris Williams

Man, I bet you Paul, Carl, Bill and the VB.NET MVPs are going to be excited about this!

Wednesday, November 28, 2007 7:20:57 PM (GMT Standard Time, UTC+00:00)  #    Comments [2] -
.NET | Tech News and Issues

Somebody sent me an email today asking me about an article I wrote a few years ago detailing how to generate random strings and numbers in C# and VB.NET. He asked me if I could add function to the code that creates a random character set to be used as a base for the allowed characters in the random string. I went on and hammered the solution and this what I built for him. I don't have enough time to explain the whole thing but I hope the code comments I added would be good enough to understand what I did with the code.

[----------------- C# Version -----------------]

using System;
using System.Collections.Generic;
using System.Text;

namespace KeithRull.ConsoleCentral
{
   class RandomStrings
   {
      //our default string size
      private const int CONST_MaxStringLenght = 10;

      //our default character string set
      private const string CONST_AllowedCharacterLiterals 
         = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";

      //our randomizer
      Random randomNumber = new Random();

      /// <summary>
      /// Generate a random string using the default options
      /// </summary>
      /// <returns>the random string</returns>
      public string GenerateRandomString()
      {
         return GenerateRandomString(CONST_MaxStringLenght);
      }

      /// <summary>
      /// Create a random string based on a specified lenght
      /// </summary>
      /// <param name="lenght">the lenght of the desired lenght of the random string</param>
      /// <returns>the randomized string</returns>
      public string GenerateRandomString(int lenght)
      {
         return GenerateRandomString(lenght, CreateRandomStringSet());
      }

      /// <summary>
      /// Creates a random string based on a specific lenght and character set
      /// </summary>
      /// <param name="lenght">the lenght of the desired lenght of the random string</param>
      /// <param name="charsToUse">character set to use</param>
      /// <param name="randomizeSourceSet">defines whether the source set should be scrambled</param>
      /// <returns>the random string</returns>
      public string GenerateRandomString(int lenght, string charsToUse, bool randomizeSourceSet)
      {
         string randomString = String.Empty;

         if (randomizeSourceSet) {
            //scramble and jumble it
            randomString = GenerateRandomString(lenght, CreateRandomStringSet(charsToUse));
         }
         else {
            //use the default charset
            randomString = GenerateRandomString(lenght, charsToUse);
         }

         return randomString;
      }

      /// <summary>
      /// Creates a random string based on a specific lenght and character set
      /// </summary>
      /// <param name="lenght">the lenght of the desired lenght of the random string</param>
      /// <param name="charsToUse">character set to use</param>
      /// <returns>the random string</returns>
      public string GenerateRandomString(int lenght, string charsToUse)
      {
         //Create a new StringBuilder that would hold the random string.
         StringBuilder randomString = new StringBuilder();

         //Create a variable to hold the generated charater.
         char appendedChar;

         //Create a loop that would iterate from 0 to the specified value of intLenghtOfString
         for (int i = 0; i <= lenght; ++i)
         {
            int characterIndex = Convert.ToInt32(randomNumber.Next(i, charsToUse.Length - i));
            //Generate the char and assign it to appendedChar
            appendedChar = charsToUse[characterIndex];
            //Append appendedChar to randomString
            randomString.Append(appendedChar);
         }
         //Convert randomString to String and return the result.
         return randomString.ToString();
      }

      /// <summary>
      /// Returns a random set of characters based on the default literal set
      /// </summary>
      /// <returns>the random string</returns>
      private string CreateRandomStringSet()
      {
         //just use the default character set
         return CreateRandomStringSet(CONST_AllowedCharacterLiterals);
      }

      /// <summary>
      /// A function that returns a new set of characters based on an input set
      /// </summary>
      /// <param name="allowedCharacters">the source set</param>
      /// <returns>the new collection of characters</returns>
      private string CreateRandomStringSet(string allowedCharacters)
      {
         string randomizedString = String.Empty;

         //get a random string set size
         int randomSetLenght = allowedCharacters.Length * randomNumber.Next(1, CONST_MaxStringLenght);

         //while lenght of the random set is not the same as the source string lenght
         while (randomizedString.Length != randomSetLenght)
         {
            //add a new character
            randomizedString += GetRandomCharFromString(allowedCharacters);
         }

         //return our random string
         return randomizedString;
      }

      /// <summary>
      /// Gets a character from the the input string
      /// </summary>
      /// <param name="allowedCharacters">source string</param>
      /// <returns>a random character</returns>
      private char GetRandomCharFromString(string allowedCharacters)
      {
         return allowedCharacters[randomNumber.Next(allowedCharacters.Length - 1)];
      }
   }
}

[----------------- C# Usage -----------------]

using System;
using System.Collections.Generic;
using System.Text;

namespace KeithRull.ConsoleCentral
{
   class Program
   {
      static void Main(string[] args)
      {
         RandomStrings r = new RandomStrings();

         Console.WriteLine(r.GenerateRandomString());
         Console.WriteLine(r.GenerateRandomString(10));
         Console.WriteLine(r.GenerateRandomString(10, "qwerttyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM"));
         Console.WriteLine(r.GenerateRandomString(10, "[]{}<>!@#$%^&*()qwerttyuioplkjhgfdsazxcvbnm1234567890", true));
         Console.WriteLine(r.GenerateRandomString(10, "qwerttyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM", false));

         Console.ReadLine();
      }
   }
}

[----------------- VB.NET Version -----------------]

Imports System
Imports System.Collections.Generic
Imports System.Text

Namespace KeithRull.ConsoleCentral 
   Class RandomStrings 
      Private Const CONST_MaxStringLenght As Integer = 10 
      Private Const CONST_AllowedCharacterLiterals As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" 

      Private randomNumber As New Random() 

      ''' <summary> 
      ''' Generate a random string using the default options 
      ''' </summary> 
      ''' <returns>the random string</returns> 
      Public Function GenerateRandomString() As String 
         Return GenerateRandomString(CONST_MaxStringLenght) 
      End Function 

      ''' <summary> 
      ''' Create a random string based on a specified lenght 
      ''' </summary> 
      ''' <param name="lenght">the lenght of the desired lenght of the random string</param> 
      ''' <returns>a random string</returns> 
      Public Function GenerateRandomString(ByVal lenght As Integer) As String 
         Return GenerateRandomString(lenght, CreateRandomStringSet()) 
      End Function 

      ''' <summary> 
      ''' Creates a random string based on a specific lenght and character set 
      ''' </summary> 
      ''' <param name="lenght">the lenght of the desired lenght of the random string</param> 
      ''' <param name="charsToUse">character set to use</param> 
      ''' <param name="randomizeSourceSet">defines whether the source set should be scrambled</param> 
      ''' <returns></returns> 
      Public Function GenerateRandomString(ByVal lenght As Integer, ByVal charsToUse As String, ByVal randomizeSourceSet As Boolean) As String 
         Dim randomString As String = [String].Empty 

         If randomizeSourceSet Then 
            'scramble and jumble it 
            randomString = GenerateRandomString(lenght, CreateRandomStringSet(charsToUse)) 
         Else 
            'use the default charset 
            randomString = GenerateRandomString(lenght, charsToUse) 
         End If 

         Return randomString 
      End Function 

      Public Function GenerateRandomString(ByVal lenght As Integer, ByVal charsToUse As String) As String 
         'Create a new StringBuilder that would hold the random string. 
         Dim randomString As New StringBuilder() 

         'Create a variable to hold the generated charater. 
         Dim appendedChar As Char 
         For i As Integer = 0 To lenght 

            'Create a loop that would iterate from 0 to the specified value of intLenghtOfString 
            Dim characterIndex As Integer = Convert.ToInt32(randomNumber.[Next](i, charsToUse.Length - i)) 
            'Generate the char and assign it to appendedChar 
            appendedChar = charsToUse(characterIndex) 
            'Append appendedChar to randomString 
            randomString.Append(appendedChar) 
         Next 
         'Convert randomString to String and return the result. 
         Return randomString.ToString() 
      End Function 

      ''' <summary> 
      ''' Returns a random set of characters based on the default literal set 
      ''' </summary> 
      ''' <returns></returns> 
      Private Function CreateRandomStringSet() As String 
         Return CreateRandomStringSet(CONST_AllowedCharacterLiterals) 
      End Function 

      ''' <summary> 
      ''' A function that returns a new set of characters based on an input set 
      ''' </summary> 
      ''' <param name="allowedCharacters">the source set</param> 
      ''' <returns>the new collection of characters</returns> 
      Private Function CreateRandomStringSet(ByVal allowedCharacters As String) As String 
         Dim randomizedString As String = [String].Empty 

         'get a random string set size 
         Dim randomSetLenght As Integer = allowedCharacters.Length * randomNumber.[Next](1, CONST_MaxStringLenght) 

         'while lenght of the random set is not the same as the source string lenght 
         While randomizedString.Length <> randomSetLenght 
            'add a new character 
            randomizedString += GetRandomCharFromString(allowedCharacters) 
         End While 

         'return our random string 
         Return randomizedString 
      End Function 

      ''' <summary> 
      ''' Gets a character from the the input string 
      ''' </summary> 
      ''' <param name="allowedCharacters">source string</param> 
      ''' <returns>a random character</returns> 
      Private Function GetRandomCharFromString(ByVal allowedCharacters As String) As Char 
         Return allowedCharacters(randomNumber.[Next](allowedCharacters.Length - 1)) 
      End Function 
   End Class
End Namespace

[----------------- VB.NET Usage -----------------]

Imports System
Imports System.Collections.Generic
Imports System.Text

Namespace KeithRull.ConsoleCentral 
   Class Program 
      Private Shared Sub Main(ByVal args As String()) 
      Dim r As RandomStrings = New RandomStrings() 

      Console.WriteLine(r.GenerateRandomString()) 
      Console.WriteLine(r.GenerateRandomString(10)) 
      Console.WriteLine(r.GenerateRandomString(10, "qwerttyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM")) 
      Console.WriteLine(r.GenerateRandomString(10, "[]{}<>!@#$%^&*()qwerttyuioplkjhgfdsazxcvbnm1234567890", True)) 
      Console.WriteLine(r.GenerateRandomString(10, "qwerttyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM", False)) 

      Console.ReadLine() 
      End Sub 
   End Class
End Namespace

[----------------- Screenshot -----------------]

And that's how you create random strings in C# and VB.NET. Interested in the source code? You can download them here. RandomStrings.cs (4.61 KB) | RandomStrings.vb (5 KB)

Wednesday, November 28, 2007 6:08:02 PM (GMT Standard Time, UTC+00:00)  #    Comments [1] -
.NET | Fun Stuff

I've just finished downloading Microsoft Visual Studio 2008 bits last night and I think I'm about ready to install it on my VPC (yup, I don't want to install it yet on my real machine.).  I'm really excited about this new release since it looks really really promising. I've seen blogs giving it high praise and some not giving it a nod of acceptance(a few I should say) but for me it's the best Visual Studio to come out yet. I've been playing with the beta version since last year and really happy with this new release from the VS Team.

I know there are several things to consider before you install this version and I'm really glad that Jon made this list to keep as sane when installing/upgrading to Visual studio 2008. Great job Jon!

Now I'm ready to rock!

Wednesday, November 28, 2007 5:19:26 PM (GMT Standard Time, UTC+00:00)  #    Comments [2] -
.NET | Tech News and Issues
 Monday, November 26, 2007

Sounds like Woody, Lynn, Jason, Tim, Anand, Rob, Mithun and JD are going to hit the road with there Microsoft Truck this 2008.

What's a Code Trip?  Think of it like Cannonball Run. Only slower, and geekier.  We sat around on a campfire burning copies of Microsoft Bob a while back and decided we needed to hit the streets.  We want to get out to developers and hear some stories and have some fun (JD wants to blow stuff up, so we're trying to work that in).  Really, it is going to be what you tell us it is. One RV, bunch of geeks, lots o' code.  Join the trip!

This is going to be awesome.  I go to MS conferences alot and have met a couple of MS Developer Evangelist in the past (specially those who are in the SoCal area) and I think it's a great time for me to meet the other MS Developer Evangelist who cover the west coast.

Hey Woody! Can you reserve me one of those XBOX 360 :D I think that would look great in our living room :P Just kidding.

Monday, November 26, 2007 6:54:16 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Tech News and Issues
 Wednesday, November 21, 2007

"No PC should be without it! No PC should be without i!"

I saw this in YouTube today and it made me laugh really hard. I'm really surprised how far we have come along since the days of MS-DOS up to Vista and Longhorn.

Check the video here: http://www.youtube.com/watch?v=dmEvPZUdAVI

Wednesday, November 21, 2007 10:36:10 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Fun Stuff

I just saw this because Jojo Paderes had his status in GTalk pointing to this link.

According to Mercer, the Philippines is still one of the cheapest IT outsourcing destination in the world. The figures states that as of 2007 IT Managers in Manila only earn $22,280/year on an averaged ranking third compared to Switzerland, the highest paying country which has their IT managers average a whooping $140,960/year[link].

Figure 1*

IT Manager: 10 top-paying countries (various currencies)
 

 

Local USD EUR GBP
Switzerland 176,920 140,960 110,990 74,150
2 Denmark 722,310 123,080 96,890 64,750
3 Belgium 95,380 121,170 95,380 63,760
4 UK 62,180 118,190 93,090 62,180
5 Ireland 85,200 108,230 85,200 56,950
6 US 107,500 107,500 84,650 56,550
7 Germany 84,020  106,730  84,020  56,160 
8 Canada 106,000 93,860 73,870 49,370
9 Hong Kong (China) 702,720 90,340 71,120 47,530
10 Australia 115,480 88,850 69,950 46,740
Figure 2*

IT Manager: 10 lowest-paying countries (various currencies)
Local USD EUR GBP
Vietnam 15,470 15,470 12,180 8,140
2 Bulgaria 34,25o 22,240 17,510 11,700
3 Philippines 1,106,700 22,280 17,540 11,720
4 India 1,120,490 25,000 19,680 13,150
5 Indonesia 289,155,000 31,720 24,970 16,690
6 China (Shanghai) 265,810 33,770 26,580 17,770
7 Malaysia 129,930 35,260 28,040 18,740
8 Czech Republic 791,430 35,880 28,250 18,880
9 China (Beijing) 285,130 36,220 28,520 19,060
10 Argentina 133,040 43,180 33,990 22,720
 

Figure 3* Figure 4*
IT Manager: 5 highest paying positions in Asia
    Local USD
Hong Kong 1 702,723.00 90,344.03
2 Australia 2 115,483.00 88,846.75
3 Japan 3 10,347,000.00 87,638.17
4 South Korea  4 69,374,000.00 74,022.62
5 Singapore  5 104,127.00  66,615.70
IT Manager: 5 lowest paying positions in Asia
    Local USD
Vietnam 1 15,473.00 15,473.00
2 Philippines 2 1,106,700.00 22,281.05
3 India 3 1,120,486.00 24,996.90
4 Indonesia 4 289,155,000.00 31,721.24
5 China - Shanghai 5 265,814.00 33,768.74

*Note:

  • Average total cash compensation includes base pay and annual bonus.

  • Foreign exchange conversions were made as of November 2006.

  • Source: Mercer: 2007 IT Pay around the World. 

You can treat the numbers above in different ways... either Manila is not getting the big piece of the pie because we are undervalued (considering that we are the largest english speaking nation in Asia) or... That we can attract more companies to outsource to Manila because we are talented and cheap enough to do projects for other countries which means a larger economic growth for our country.

I think the numbers above would fluctuate specially knowing that the US Dollar is currently in a slow decline and Euro starting to dominate the markets. 

The Philippines has a great talent pool when it comes to IT and most of the them work hard to hone their skills even if they don't get paid that much. That's what I call responsibility and commitment to bringing ang building a world class application from a truely world class workforce.

Hayy, I hope Manila gets a bigger piece of the pie :( Till then, Mabuhay ka Filipino Developer!

Wednesday, November 21, 2007 6:12:59 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
All about Keith | Tech News and Issues | Your Career
 Tuesday, November 20, 2007

Microsoft realeased Visual Studio 2008 yesterday and it made my fingers play with the latest bits and I wanted to exercise my hands on something that I could play with and at the same time learn the cool new features of the latest VS2008. With 'Play' being the keyword I have decided that the best application I could work with(and play at the same time) is this demo program from Vertigo.

Man, they did a great job on this app. The solution is in Visual Studio .NET 2003 (.NET 1.1) but can easily be ported to .NET 2.0 or .NET 3.5(which is what i'm trying right now). Here's some bits about the application taken from Vertigo's website:

In 1997, the computer gaming company id Software released a watershed first-person shooter game called QUAKE II, which went on to sell over one million copies and earn industry accolades as Game of the Year. Later, in December 2001, id Software generously made the QUAKE II 3-D engine available to the public under the GNU General Public License ("GPL").

Now, in July 2003, Vertigo Software, Inc. is releasing Quake II .NET, a port of the C-language based engine to Visual C++ with a .NET managed heads-up display. We did this to illustrate a point: one can easily port a large amount of C code to C++, and then run the whole application as a managed .NET application using the Microsoft Common Language Runtime (CLR) without noticeable performance delays. Once running as a .NET managed application, adding new features is easy and fun.

Quake II .NET Features:

  •  Demonstrates how to port C to native and managed C++
  •  Shows how to extend Quake II using .NET
  •  Whitepaper with tips on porting to native and managed C++

I haven't program in C++ in years but it think this is going to be a great refresher for my rusty C skills. I wonder if Scott Stansfield and his minions are brewing up something like this for .NET 3.5 and XNA? Hmmm... I have to wait and see but in the mean time if you guys are interested you can download this great application from Vertigo's website(complete with source code, demo tips and a developer white paper) here.

Hey Jeff! Maybe you can give me tips on how to beat the bad guys on level 4.

Tuesday, November 20, 2007 6:57:58 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | Fun Stuff

"FEATURE!"

Hehehe! I just saw this in my documents folder. I can't remember where I got it but it definetely made my developer flesh chuckle! Dedicated to all Software QA's out there(specially to my wonderful wife :*).

Later!

Tuesday, November 20, 2007 1:09:14 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
All about Keith | Fun Stuff
 Monday, November 19, 2007

"Ayayay Caramba!" Another great app from the makers of VisualSVN.

Introducing VisualSVN Server. VisualSVN Server is a packaged that contains all you need to start(and managed) your own SVN repository. Think of it as your own mini toolbox of goodies for SVN. The package comes with SubVersion, Apache and sleak lookin' management console.

And best of all, it's 100% free.

Monday, November 19, 2007 10:02:05 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Tech News and Issues

Oh boy! Oh boy! Oh boy! Talk about geeky goodness! In case you miss the news, VS 2008 is ready for download for MSDN subscribers. Not an MSDN subscriber? Fear not! VS Express 2008 was also shipped today!

Want to learn whats on VS2008? Check out the video tutorials here or just read what ScottGu has to say.

Jeff also mentioned that Team Suite and TFS is also available and that the 90 day trial(in case you are not an MSDN subsriber) can be downloaded from the MSDN website.

Monday, November 19, 2007 8:19:50 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | Tech News and Issues
 Saturday, November 17, 2007