Blog Home  Home Feed your aggregator (RSS 2.0)  
kevin Mocha - Thursday, April 05, 2007
Bookmarks collected from web.
 
 Thursday, April 05, 2007

http://en.csharp-online.net/BCL_Generics%E2%80%94S...
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

namespace SortedListTest
{
    public class Customer
    {
        private int id;
        private string name;
        private string category;
        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                if (id == value)
                    return;
                id = value;
            }
        }
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                if (name == value)
                    return;
                name = value;
            }
        }
        public string Category
        {
            get
            {
                return category;
            }
            set
            {
                if (category == value)
                    return;
                category = value;
            }
        }

        /// <summary>
        /// Creates a new instance of customer
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="category"></param>
        public Customer(int id, string name, string category)
        {
            this.id = id;
            this.name = name;
            this.category = category;
        }

        public override string ToString()
        {
            return string.Format("{0}-{1}-{2}", id, name, category);
        }
    }


    class Program
    {
        static void Main(string[] args)
        {
            List<Customer> collCustList =
                new List<Customer>();
            collCustList.Add(new Customer(99,
               "Happy Gillmore", "Platinum"));
            collCustList.Add(new Customer(77,
               "Billy Madison", "Gold"));
            collCustList.Add(new Customer(55,
               "Bobby Boucher", "Gold"));
            collCustList.Add(new Customer(88,
               "Barry Egan", "Platinum"));
            collCustList.Add(new Customer(11,
               "Longfellow Deeds", "Other"));

            Console.Out.WriteLine("Before:");
            foreach (Customer cust in collCustList)
                Console.Out.WriteLine(cust);

            collCustList.Sort
               (delegate(Customer cust1,
               Customer cust2)
            {
                return Comparer<int>.Default.Compare
                   (cust1.Id, cust2.Id);
            });

            Console.Out.WriteLine("After:");
            foreach (Customer cust in collCustList)
                Console.Out.WriteLine(cust);

            collCustList.Reverse();

            Console.Out.WriteLine("Reversed:");
            foreach (Customer cust in collCustList)
                Console.Out.WriteLine(cust);

            Console.In.ReadLine();
        }

   
    }
}
Thursday, April 05, 2007 9:47:57 PM UTC  #    Comments [0]    |  Trackback
 Wednesday, April 04, 2007
 Monday, April 02, 2007
 Friday, March 30, 2007
Friday, March 30, 2007 9:41:16 PM UTC  #    Comments [0]    |  Trackback
 Thursday, March 29, 2007
Thursday, March 29, 2007 10:03:19 PM UTC  #    Comments [0]    |  Trackback
 Wednesday, March 28, 2007

In the configuration file the connection string of MySQL should use ip address as the server address.

In installation package, the error "cannot find specified types" is said to be related with the framework version. But I have no luck of it. The alternation is to divide the installation package to two part. One part install the crystal report merge module, the copy the reportengine service files to the server and use command "installutil" to install the service manually.  When running the service, "Can not find keycodeV2.dll" pops out, the main reason to cause is to assign the invalid code to one of the merge modules. Anyway, here are some useful links I found when diagnosing the problems I got today:

Application Deployment (CR report for VS.Net) http://support.businessobjects.com/

"Cannot find KeycodeV2.dll or invalid keycode" http://technicalsupport.businessobjects.com/

"unable to get installer types"  (no answers can solve my problem)

Wednesday, March 28, 2007 8:35:45 PM UTC  #    Comments [0]    |  Trackback
 Tuesday, March 27, 2007

Normally you cannot get the size of an object in the managed heap. This is because that size doesn't make sense in the managed world due to different reasons. One of them could be that the size of the same object is not guaranteed to be the same between two starts of the application. The JIT compiler is free to layout the objects as it sees fit. The layouting can be different due to different configuration of the machine, different version of the CLR, etc. Furthermore, your type may reference other reference types. Even two objects can cross-reference the same object. How can you possibly tell what is the size of the object Using Marshal.SizeOf returns the size of the marshaled (unmanaged)
equivalent of the provided type. I said "normally" back then because there is an operator that returns the managed size for a type (only for valuetypes). In C# it is represented by the *sizeof* operator. However *sizeof* operator has some limitations in addition to its syntax I don't think that is what you need.

About sizeof operator you can read at MSDN
ms-help://MS.MSDNQTR.2003FEB.1033/csref/html/vclrfSizeofPG.htm
To demonstrate the difference between Marshal.SizeOf and *sizeof* operator run the following simple code

class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
unsafe static void Main(string[] args)
{
Console.WriteLine("Managed size: {0}", sizeof(char));
Console.WriteLine("Unmanaged size: {0}", Marshal.SizeOf(typeof(char)));
Console.ReadLine();
}
}


The result is:
Managed size: 2
Unmanaged size: 1

Unmanaged size is 1 because System.Char struct is set to be marshaled as ANSI char by default.

Tuesday, March 27, 2007 9:57:14 PM UTC  #    Comments [0]    |  Trackback
 Thursday, March 15, 2007

Working with google map. Following functions should be provided:

  • Navigation and Location.
  • User Login and management
  • Create their own page (Pictures and Text)
  • Menu Management (Normal and Special)
  • Announcement Management.
  • UserForum (and search) (Optional)
  • Service Fee (Golden and Silver)

A similar website: http://www.toeat.com/

Thursday, March 15, 2007 9:26:48 PM UTC  #    Comments [0]    |  Trackback
Copyright © 2009 Kevin Mocha. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: