Jeff H's Profile User Rating: -----

Reputation: 112 Stalwart
Active Members
Active Posts:
308 (0.24 per day)
30-January 11
Profile Views:
Last Active:
User is offline Jul 17 2014 10:36 PM

Previous Fields

Dream Kudos:
Icon   Jeff H has not set their status

Posts I've Made

  1. In Topic: need to count vowels in a string

    Posted 18 Sep 2013

    Not meant to be a correct a solution but no matter the problem always good to think of different approaches to see if better, validate another approach, look at problem differently, etc....

        class Program
            static bool[] chars = new bool[126];
            static char[] vowels = new char[] { 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U' };
            static Program()
                foreach (var v in vowels)
                    chars[(int)v] = true;
            static void Main(string[] args)
                Console.WriteLine("Enter a string");
                string test = Console.ReadLine();
            private static void PrintValue(string test)
                int count = 0;
                foreach (var c in test)
                    if (chars[(int)c])
                        Console.Write(" ");
                Console.WriteLine("Total = {0}", count);

    Not sure how but what counting 'Y'?
  2. In Topic: What the Duck - ForEach, IEnumerable, IEnumerator DuckTyping

    Posted 18 Jun 2013


    Probably need to add that to Kindle collection, I just noticed in some MSIL that it did not call the methods through the interface.
  3. In Topic: Random not so random?

    Posted 13 Jun 2013

    View Post_HAWK_, on 13 June 2013 - 10:19 AM, said:

    The purpose I had for this to create what I thought would be a better Binding name for some dynamically loaded DataColumns into a Silverlight DataGrid for importing a csv where the number of columns could be any value. One could have just used a CharArray from which the iteration variable could be used to get the char in that array, but this has limits and not totally dynamic and able to complete it's job no matter what was handed to it. This way I can have the function assign the binding name(also the column name) which is a valid binding name as well. Many thanks for the info.

    Sorry if I am way off here and not understanding the problem as I have never messed with Silverlight, but if I am understanding correctly you are just needing unique names. The first thing that comes to mind is to keep static counters and increment them each time a name is needed.

    Can they be named

    If so,

    Sorry I use C# but here is a little example of the idea and just slapped it together and I spent the 95% of time trying to assign the Char with 'A' instead of "A".

    No logic for testing when character reaches Z
    Module Module1
        Sub Main()
            For i As Integer = 1 To 10
            For i As Integer = 1 To 100
            For i As Integer = 1 To 1000000
        End Sub
    End Module
    Public Class UniqueName
        Private Shared character As Char = "A"
        Private Shared counter As Integer = -1
        Public Shared Function GetName() As String
            If Not counter < Integer.MaxValue Then
                character = Chr(Asc(character) + 1)
                counter = -1
            End If
            counter = counter + 1
            Return character + counter.ToString()
        End Function
    End Class

    If you went from A to Z it would give you 2147483621 unique names, and if that is not enough you could add logic to add characters when it reaches Z

    Sorry if I misunderstood and not familiar with VB and if shared variables have any "gotchas", etc....
  4. In Topic: Adding a "+" between integers

    Posted 5 Jun 2013

    Have a look at the String.Join method which does exactly what you want. If you look at its implementation it uses StringBuilder so not waste resources creating a new string for each concatenation. In your example the small amount would not make a difference, but with a larger set would help in performance.
    Also if you know the start and ending number there is Enumerable.Range

    Putting aside parsing the start and ending number and appending " = total" to the end you can build the string with 2 methods above easily.

    Module Module1
        Sub Main()
            Dim nums As IEnumerable(Of Integer) = Enumerable.Range(1, 10)
            Dim addtionString As String = String.Join("+", nums.Select(Function(i) i.ToString))
        End Sub
    End Module
  5. In Topic: Filtering events

    Posted 5 Jun 2013

    Just skimmed through quickly but might be a candidate for RX Extensions

My Information

Member Title:
D.I.C Regular
Age Unknown
Birthday Unknown

Contact Information




Page 1 of 1
  1. Photo

    Jeff H Icon

    14 Jul 2011 - 04:21
    To show it twice
  2. Photo

    Jeff H Icon

    14 Jul 2011 - 04:21
    To show it twice
  3. Photo

    Jeff H Icon

    13 Jul 2011 - 17:41
    Everything I do in my profile it does it twice.
  4. Photo

    Jeff H Icon

    13 Jul 2011 - 17:41
    Everything I do in my profile it does it twice.
  5. Photo

    raziel_ Icon

    13 Jul 2011 - 16:16
    lol i just saw your having fixo added twice in your friend list :D
  6. Photo

    Jeff H Icon

    09 Jul 2011 - 08:52
    Thanks smohd,
    and nice work yourself
  7. Photo

    smohd Icon

    03 Jul 2011 - 16:21
    Hi, nice work in VB.NET forum. keep it going :)
Page 1 of 1