Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Meysam Mahfouzi

@Meysam Mahfouzi
About
Posts
391
Topics
149
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • To the French speakers out there
    M Meysam Mahfouzi

    Most French H's are mute[^]- that is, they are not pronounced and the word acts as if it begins with a vowel.

    The Lounge collaboration question

  • Donations
    M Meysam Mahfouzi

    Marcus Kramer wrote:

    The whole point to Code Project is the Free exchange of knowledge

    Really? I don't think so. Make sure you read the CodeProject.TV's welcome message by Chris Maunder:

    You are the experts in your field – why not take your articles to the next level and make video tutorials? You set your prices and we'll take care of transcoding, hosting, streaming, tracking and billing for you.

    So, as Chris is suggesting, why not take our articles to the next level and put some donation button below them. I am NOT talking about setting prices. The articles will be still free. I am only talking about accepting donations.

    Site Bugs / Suggestions question

  • Donations
    M Meysam Mahfouzi

    Is it possible for someone to accept donations by putting a donation button at the bottom of their article? Or is it against the rules and principles of this site?

    Site Bugs / Suggestions question

  • getRandomNumber()
    M Meysam Mahfouzi

    here [^]

    The Lounge com

  • Never Forget Us!
    M Meysam Mahfouzi

    Brady Kelly wrote:

    It's because they're Arabs

    Iranian people are not Arab

    The Lounge

  • Never Forget Us!
    M Meysam Mahfouzi

    http://neverforget.us[^]

    The Lounge

  • how to call function timer on button click
    M Meysam Mahfouzi

    I suppose you are trying to do something like this:

        private void button1\_Click(object sender, EventArgs e)
        {
            myTimer.Tick += new EventHandler(myTimer\_Tick);
            myTimer.Interval = 2000; // once every two seconds
            myTimer.Enabled = true;
        }
    
        void myTimer\_Tick(object sender, EventArgs e)
        {
            MessageBox.Show("tick");
        }
    
    C# tutorial help question

  • How to monitor http downloads and uploads?
    M Meysam Mahfouzi

    Is there any easy way to monitor the amount of bytes sent and received on http port 80? I don't want to monitor the content of packets, just number and size of packets is important to me. Is TcpListener class suitable for this purpose? Any help would be greatly appreciated

    C# help tutorial question

  • hidden T before Z
    M Meysam Mahfouzi

    Very nice point! :) I guess Schizophrenic has an Italian root as well since it's pronounced SKITZO

    The Lounge question

  • Slow query when using @variable in Where clause [modified]
    M Meysam Mahfouzi

    Dear Mika You have not been on codeproject for a long time. Hope you are fine. I have asked a question here[^]. Could you please take a look at it?

    Database database css help announcement

  • Same Execution Plans / Different Actual Number of Rows [modified]
    M Meysam Mahfouzi

    I looked at it. The fragmentation is 0%

    Database database com sysadmin question announcement

  • hidden T before Z
    M Meysam Mahfouzi

    Please somebody tell me what's wrong with my question. I have asked a question in Lounge and I have not broken any rule. So your votes are not fair! That was a serious question

    The Lounge question

  • hidden T before Z
    M Meysam Mahfouzi

    There are some words like Pizza, Lazio, Schizophrenic,... in which there is a T before Z to pronounce. These kind of words have probably Italian roots. Do you know any similar words? :)

    The Lounge question

  • Same Execution Plans / Different Actual Number of Rows [modified]
    M Meysam Mahfouzi

    I have got two queries both of which generate the same execution plan: query 1:

    SELECT TOP 10 *
    FROM news
    CROSS APPLY (SELECT TOP 1 NetworkID FROM ItemNetwork WHERE ItemID = news.ID) itemNet

    query 2:

    SELECT TOP 10 *
    FROM news
    CROSS APPLY (SELECT TOP 1 NetworkID FROM ItemNetwork WHERE ItemID = news.ID AND ItemType = 0) itemNet

    ItemNetwork table has 4 columns:

    [ID] [bigint] IDENTITY(1,1) NOT NULL,
    [ItemID] [bigint] NOT NULL,
    [ItemType] [tinyint] NOT NULL,
    [NetworkID] [int] NOT NULL

    I have also created a non-clustered index on ItemNetwork table:

    CREATE NONCLUSTERED INDEX [IX_ItemNetwork_ItemID_ItemType__NetworkID] ON ItemNetwork
    (
    [ItemID] ASC,
    [ItemType] ASC
    )
    INCLUDE ( [NetworkID])

    The first query takes one second to execute, while it takes 2 minutes for the second one to execute. The execution plan for both queries is the same. You can see the execution plan for the first query here[^] and for the second query here[^]. The only difference that can be seen between the two execution plans is the amount of data that comes out of news table. For the second query, we see a very big arrow coming out of news table. That is because the actual number of rows coming out of this table is 1534672 rows while for the first query, this number is 877 rows. For both queries, the estimated number of rows is 10 (because of top 10 clause). Look at the actual number of rows for both queries here[^] and here[^]. The only difference between the two queries is this condition:

    ItemType = 0

    I also updated the statistics for all the tables involved, but it didn't make any difference. Could somebody please tell me how I can make the second query execute as fast as the first one? p.s. the total number of rows in News table is 1576612 rows, in Network table 1820 rows and in ItemNetwork table 42164 rows

    modified on Thursday, June 25, 2009 3:19 AM

    Database database com sysadmin question announcement

  • How can I make a method abstract in a child class?
    M Meysam Mahfouzi

    Thank you very much for your response Alan! It's working :) I didn't know that a method with override modifier can have no body. But with help of override abstract, it can. great to know. The original code I posted was translated from a java code from Head First Design Patterns book (chapter 3, Decorator Pattern). Do you know java? It seems that the original code I posted will return 2 written in Java.

    C# question

  • How can I make a method abstract in a child class?
    M Meysam Mahfouzi

    Do you know why the following code is returning 1 while I have completely replaced the base class method with new operator as you suggested?

    Base b = new Child();
    Console.Out.WriteLine(b.GetInt());// prints 1

    C# question

  • How can I make a method abstract in a child class?
    M Meysam Mahfouzi

    Hi Adding new keyword does not solve the problem. It still returns 1

    C# question

  • How can I make a method abstract in a child class?
    M Meysam Mahfouzi
    public abstract class Base
    {
        public int GetInt()
        {
            return 1;
        }
    }
    
    public abstract class AbstractChild : Base
    {
        public abstract int GetInt();
    }
    
    public class Child : AbstractChild
    {
        public override int GetInt()
        {
            return 2;
        }
    }
    

    I want all implementers of AbstractChild to implement GetInt method. So, I decide to make the method abstract even though it's not originally abstract in the Base class. Then I implement it in the Child class. But when I execute the following code, it surprisingly returns 1:

    Base b = new Child();
    Console.Out.WriteLine(b.GetInt());// prints 1

    Since b is of type Child, I would normally expect the overridden method in Child class to be called. Why is the method in base class being called? Am I misunderstanding something?

    C# question

  • stored procedure is fast, but slow from code
    M Meysam Mahfouzi

    Thanks for your advice, All the indexes are being used (index seek) and no table scan is happening. That's why the query gets executed very fast in Sql Server. That's why I wonder what the difference is when I execute it from code with the same parameters.

    Database database sql-server csharp sysadmin question

  • stored procedure is fast, but slow from code
    M Meysam Mahfouzi

    I have got a stored procedure which executes very fast in Sql Server Management Studio, but when I call it with the same parameters from C#, it executes slower and sometimes even throws timeout exception. Does anybody know the reason? hint: I have noticed that when I comment out one of the conditions in where clause, the query executes very fast both on SSMS and C#. Another point is that when I remove the comment and put the condition back in the query (which causes the stored procedure to compile again) the query execution becomes a little faster in C#, but after a while it becomes slow again (all with the same parameters)

    Database database sql-server csharp sysadmin question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups