User Profile

Collapse

Profile Sidebar

Collapse
balabaster
balabaster
Last Activity: Jul 17 '14, 03:37 AM
Joined: Mar 27 '07
Location: Canada
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • balabaster
    replied to How to to fix Lambda expression?
    in .NET
    Just a hunch as I have no way to test this. I dunno what Isolate.WhenCal led is doing as I haven't seen the signature, but as a lambda, could you be treating the method as a delegate? i.e. remove the brackets:

    Code:
    Isolate.WhenCalled(() => myFakeObject.Method1).WillReturn("Method1");
    Usually in cases where you're referencing a delegate, you are pointing to the method, not calling the method. Similar to:
    ...
    See more | Go to post

    Leave a comment:


  • I have a number of strategies for debugging this kind of situation. You mention it's just frozen a channel so I'm assuming your server app isn't hanging or crashing entirely. I'm not entirely sure how your server code is written, if it's a windows app, console app, windows service etc. What is the nature of the use of your ClientCollectio n? Are you doing frequent lookups? Would this perhaps be better served as a dictionary which would increase performance...
    See more | Go to post
    Last edited by balabaster; Mar 2 '11, 04:40 PM.

    Leave a comment:


  • I don't know where to start with all the things that are wrong with this code. I realize you're probably learning so don't take anything I say harshly. There's a lot to learn and it's an exciting path, you will get there, stick at it. Take everything I've got to say objectively, nothing I say is a personal attack on you.

    Firstly and most importantly, *NEVER* post credential information on any website. It might seem like this information...
    See more | Go to post
    Last edited by balabaster; Oct 8 '10, 11:54 AM.

    Leave a comment:


  • balabaster
    replied to Cache Absolute Expiry problem
    in .NET
    When the item is removed from the cache, it doesn't destroy the object. The cache should just hold a reference to the object.

    Check this simplified example:

    Code:
    Hashtable cache = new Hashtable();
    MyClass stuff = new MyClass 
    { 
        Property1 = "Hello", 
        Property2 = "World"
    }
    cache.Add("stuff", stuff);
    When you added the item to the...
    See more | Go to post

    Leave a comment:


  • If I recall correctly, you need to use Windows Server products if you wish to install the Standard or Enterprise editions of SQL Server. If you wish to install on XP, you will need to install the Developer edition.
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to Using an "and" in LINQ
    in .NET
    You know what, you may be right about the lambda expressions, they may not have been available until 3.5. To be honest, I'm not entirely sure. However, the lambda expressions will still work with the non-LINQ code in 3.5 for sure, it's possible that they won't work in 2.0.
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to Using an "and" in LINQ
    in .NET
    Code:
    var londonCustomers = from c in Customers
                          where (c.City.Equals("London") && c.CreditCardType.Equals("Visa"))
                          select c;
    If you only needed certain parts, then you'd use the select to filter the relevant fields. For example:

    Code:
    from c in Customers
    where customer.City.Equals("London")
    select new { Name = c.Name, PostCode
    ...
    See more | Go to post
    Last edited by balabaster; Sep 3 '10, 01:04 PM.

    Leave a comment:


  • I'd combine the two approaches. In C# there's a ManualResetEven t, have your consumer WaitAny. When the producer adds items to the queue, have your consumer loop through the queue until there's no more items left in the queue. When it's finished processing the queue, have it reset the ManualResetEven t. When the producer adds the next item(s), it trips the ManualResetEven t, telling the producer there's items in the queue to process.
    ...
    See more | Go to post

    Leave a comment:


  • The term "member" is a collective generic catch all name for anything that is part of a class or interface. For instance: Method, Field, Property, Constructor, Desctructor. The literal definition (according to csharp-online.net) is:

    "Class element that defines a behavior or property—constr uctors, events, member variables, methods, properties, etc. Also known as type members."

    A method is a function...
    See more | Go to post
    Last edited by balabaster; Aug 12 '10, 06:42 PM.

    Leave a comment:


  • balabaster
    replied to How to use Generic Class as Service
    in .NET
    No problem, any time
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to How to use Generic Class as Service
    in .NET
    I'd update a mini-table with the last-updated timestamp and each time a table is updated, update the timestamp. This way you've got an ultra-lightweight table that will allow you to determine if a table's been updated without having to query all the rows in the table checking for new timestamps to figure that out.

    If your table has a couple of million rows in it, it could get expensive to figure out if it's got any new rows since...
    See more | Go to post
    Last edited by balabaster; Aug 10 '10, 05:37 PM.

    Leave a comment:


  • balabaster
    replied to How to use Generic Class as Service
    in .NET
    What you're talking about is caching. This can be done a number of ways, the simplest of which is to have the caching built directly in to the DAL.

    In the simplest cases, I would probably use some architecture similar to this:

    BLL would call the Data Layer, which is no longer actually the data access layer, but a caching mechanism that holds the current view of the data in memory - though, this could potentially be a large...
    See more | Go to post
    Last edited by balabaster; Aug 10 '10, 03:47 PM.

    Leave a comment:


  • balabaster
    replied to Add "compile" option into an application
    in .NET
    @jbm1313

    I'm not sure he's suggesting distributing the csharp compiler. He implied the control panel that generates the executable for each of the clients is something that only he uses, only the resulting executable and configuration file would be distributed. Unless I misinterpreted.
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to Add "compile" option into an application
    in .NET
    Okay, I have two thoughts about this:

    1). If features of your application are going to be enabled/disabled via the app.config then you should look at encryption routines for the app.config. I've not used them, but there's plenty of documentation regarding this. You can encrypt sections of your app.config and your executable can still read the section without anyone else being able to.

    2). You could only write the features...
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to Add "compile" option into an application
    in .NET
    I think I need some clarification on exactly what the logical relationship between your control panel and your application is.

    Does the control panel write the configuration used by the executable? Or does the control panel generate the executable based on some kind of configuration?

    In the case of the latter, I would imagine that the control panel would be in the first sense modifying some cs or cpp files (depending...
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to Sending an Email from C#
    in .NET
    No worries. If you get stuck, give us a another shout....
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to Sending an Email from C#
    in .NET
    Disclaimer: I haven't coded this in Visual Studio, nor have I tried to compile it, I'm working purely off the exception you've provided, so this may not work, but should point you in the right direction.

    MyMail.To is expecting a MailAddressColl ection, not a single MailAddress and you are providing a MailAddress instead of a MailAddressColl ection. What you need to do is create the collection and add the mail address to that collection...
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to VB.net component process1 provide password
    in .NET
    What version of .NET are you running? It probably has to do with the version you're using not supporting lambda expressions. Let me code it a different way to avoid that:

    Code:
    Private Shared Function CreateSecureString(ByVal str As String) As SecureString
        Dim s = New SecureString
        For Each c As Char In str
            s.AppendChar(c)
        Next
        Return s
    End Function
    ...
    See more | Go to post

    Leave a comment:


  • balabaster
    replied to VB.net component process1 provide password
    in .NET
    I don't mean to sound condescending here, but read and understand the error. "1234" is a string, and Me.Process1.Sta rtInfo.Password is a SecureString.

    I'm going to go out on a limb here and suggest looking in to System.Security .SecureString. I'll wager a significant amount that you need to be instantiating a secure string instead of a straight string

    Beware this code example assumes that you have already...
    See more | Go to post

    Leave a comment:


  • Eek, the worst kind of bug, one that just goes away without explanation. Glad it works again, have my fingers crossed that it doesn't resurface :D...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...