« first day (584 days earlier)      last day (4371 days later) » 

11:00 PM
I'll be back.
Meeting time.
 
No. I guess I'll try that when I create my next class
 
@heinst Well, I don't recommend calling event handlers manually, for one thing.
 
@TonyHarmon Did you try turning it off and turning it back on? haha
 
@heinst But you will need something like the InvokeRequired/Invoke pattern.
 
@KendallFrey what do you mean manually?
 
11:00 PM
Well I just ask that because occasionally intellisense does crash.
 
@SpencerRuport I was quoting a BBC TV show
 
@heinst dateModified_Click shouldn't be called from your code. I wasn't sure if you were doing that or not.
 
no im not.
 
Good.
 
@SpencerRuport that dataverification method i had shown u earlier. im assuming that shouldnt be static then since it has a cancellationtoken passed in
 
11:02 PM
I m just trying to call the GetDisplayNameFromPath in the label function
 
public void VerifyDataTypes(int[] columnDataTypes, string sourceFilePath, string errorLogFilePath, int numberOfColumns, object obj)
 
@KendallFrey What string should be in the () does it matter?
 
@heinst No. Just the value you want to pass.
 
@HansRudel - If your method has only a couple of parameters and doesn't end up needing to access any external variables in unusual ways then there's nothing wrong with marking it static
 
Is something wrong with this? It builds but like I said the intellisense isn't picking up the Product stuff
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EssentialLanguageFeatures
{
class Program
{
static void Main(string[] args)
{
// ceate a new product object
Product myProduct = new Product();

// set the property values
myProduct.ProductID = 100;
myProduct.Name = "Kayak";
myProduct.Description = "A boat for one person";
myProduct.Price = 275M;
myProduct.Category = "Watersports";

// process the product

}

public class Product
{
public int ProductID { get; set; }
 
11:04 PM
At worst it does nothing.
 
@TonyHarmon did a reboot of VS solve it?
 
@KendallFrey Ah that helped me! thanks
 
yup
 
@SpencerRuport does nothing in the sense that the method does nothin as it needs to be an instance version?
 
@TonyHarmon It works on my machine, your problem is somewhere else.
 
11:09 PM
@Greg It's working now. I guess I shouldn't leave VS open for a week without closing it :)
 
right, this is a microsoft product we're talking about.
 
I don't even do that to my computer.
 
lol I haven't rebooted this machine in... well shit I don't even remember the last time I reboot
guess a holdover from unix/linux days
 
Not good. :/
 
well its good to see you can do that with win7
i suppose i go ages just using hibernate
 
11:11 PM
I have a linux box at home that probably hasn't been reboot in a year...
 
that is so not good....i always shut down my computers after Im done
 
win 7 64 bit has been pretty damn stable for me. This is actually my game machine so it doesn't really have much on it. Though I do have virtualbox running sql server 2008 r2 on this box, but it's for playing around
 
Yea, i think MS did right with win7 64
 
I always need at least one computer on at night. For charging my phone... :(
 
get a usb wall plugin
 
11:13 PM
USB ---> AC
 
I did. :(
 
I have an extra....ill ship it to you
 
This is an ancient phone.
 
What phone
 
BB 8703e
 
11:15 PM
You shouldn't use legacy phones.
:P j/k
 
:P It was free.
 
@KendallFrey If I have a return like so: string PathResult;
if (DisplayName == "<Default>")
{
PathResult = basePath + "\\Data";
}
else
{
PathResult = basePath + "\\Data." + DisplayName;
}
return PathResult;
 
@KendallFrey could u give me an example of a method signature that shouldnt be static + how about the following?
 
how do I get that PathResult to read into the function
 
protected virtual void OnUpdateGlobalProgressBar(object sender, GlobalProgressEventArgs  e)
        {
            EventHandler<GlobalProgressEventArgs> TempHandler = UpdateGlobalProgress;

            //Avoid possible race condition.
            if (TempHandler != null)
            {
                TempHandler(this, e);
            }
        }
 
11:16 PM
One at a time, please. @heinst asked first, so he gets priority.
 
like that PathResult to be the one that goes into my parens after the GetPathFromFileName
 
yeah dont worry i will happily wait
 
@HansRudel Beat ya! :P
 
@heinst Do you want the calling code to see the modified value of PathResult?
 
if (DisplayName == "<Default>") return basePath + "\\Data";
else return basePath + "\\Data." + DisplayName;
for the love of god, plz.
 
11:18 PM
@heinst lol
 
yes the modified value
so the value that it is returning is the value i want to read in
 
@Greg hehe (just going to edit my code) ah damn was too late
 
Ok, I'm confused. Why do you want to pass in PathResult? You don't use the value.
 
GetDisplayNameFromPath() You said I could read in any string into the ()....right? so what if I want to read in a return value from another function?
 
Then you call the function like so: GetDisplayNameFromPath(FunctionToReturnString())
 
11:23 PM
ok thanks
 
@Hans No, that shouldn't be static, as it depends on a specific instance of the containing class.
BTW, I think you mean OnUpdateGlobalProgressBar(GlobalProgressEventArgs e), as the sender is set by the function.
Also, the temp variable is unnecessary.
 
@KendallFrey yeah ok cool. Ive had a quick look through a few sites and its making more sense now thanks.
i thought (object sender, xxyy e) was the recommended signature even if i didnt require sender
 
@HansRudel That is recommended for event handlers, but I think for OnEvent methods, you should use just the EventArgs.
 
ahh ok
GlobalProgressEventArgs is the containing class right
?
 
No, the class that defines the event.
 
11:30 PM
im not very familar with the terminology with events
sorry
so if i change the method to
 
Well, the term containing class isn't event-specific. It just means the class that something is in.
 
protected virtual void OnUpdateGlobalProgressBar( GlobalProgressEventArgs e)
 
This is a bit long, but what am I doing wrong?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EssentialLanguageFeatures
{
class Program
{
static void Main(string[] args)
{
// ceate a new product object
Product myProduct = new Product();

// set the property values
myProduct.ProductID = 100;
myProduct.Name = "Kayak";
myProduct.Description = "A boat for one person";
myProduct.Price = 275M;
myProduct.Category = "Watersports";

// process the product

}

public class Product
{
public int ProductID { get; set; }
 
@HansRudel Yup, perfect.
@TonyHarmon You're not telling us what's wrong.
 
@KendallFrey then im assuming its still not valid as static since as u said earlier its a specific instance of my helper class which im passing into it
 
11:32 PM
@KendallFrey so for the FunctionToReturnString.....what did you mean by that?
 
@TonyHarmon format that please (edit it, highlight all the code, ctrl+k)
 
@heinst A function that returns a string.
 
Sorry will do. If I put the extention class in the program class it says it has to be non generic if I put it outside the program class it says ShoppingCart is unreachable
 
@HansRudel The only relevant type in the static vs instance decision the the containing type.
 
public string GetDisplayNameFromPath(string basePath)
{
string result;
int subIndex = basePath.LastIndexOf("\\Data.") + 6;
if (subIndex > 6)
{
result = basePath.Substring(subIndex);
}
else
{
result = "<Default>";
}

return result;
}
 
11:36 PM
@heinst No need for the result variable. Just return the value when you have it.
 
@TonyHarmon put your extension in its own class, not an inner class (its own file is best)
 
So how do I get the result returns statement as the read in in my datemodified.Text = GetDisplayNameFromPath() + " was last modified on " + lastdate.ToString();......im still a little confused....sorry
 
So create a new class under the references tag? This is console app I'm trying
 
@heinst That code is right. A function call can be treated like an ordinary expression.
 
@TonyHarmon You have 3 inner classes in your program class
split them out into their own files
 
11:38 PM
@KendallFrey ok lets see if i understand this. static method cant call any instance method, cant access any non static variables in its class. Can be passed instance variables from a different class.
 
a general rule of thumb: inner classes are evil.
 
yeah for the GetDisplayNameFromPath() portion...im trying to get the display return result statement into the GetDisplayFromPath()....so hypothetically it would read GetDisplayNameFromPath(result)
 
@HansRudel Yes. They can also be passed an instance of their own class, and that instance (or any other instance) can have all members accessed by the static method.
 
@KendallFrey "The only relevant type in the static vs instance decision is the containing type." i dont get this. You said the containing type is the class in which the event is declared right?
 
@HansRudel Remember this: Underneath the hood, an instance method is identical to a static method which takes an instance as its first parameter.
@HansRudel Yes.
 
11:43 PM
@KendallFrey "remember this..." i hadnt seen it explained like that before. cheers
 
@HansRudel MSIL teaches one a lot.
 
still got a while before i start digging into it i believe
:(
 
@HansRudel Yup, it's not for the fainthearted. Very similar to assembly, actually.
 
is anyone familar with Visual Studio 2010 Test Framework?
 
@HansRudel isn't "UpdateGlobalProgress" an event? Which means it's a member of the class that contains the OnUpdateGlobalProgressBar method. Which means that if the OnUpdateGlobalProgressBar method needs to access that event in order to raise it, the method can't be static the way you've implemented it.
Maybe I'm beating a dead horse if you've got it already
 
11:46 PM
@KyleGagnet yeah but what i was just about to ask was if its possible to have all of them static
 
All that assumes that your event isn't declared static.
It depends on your class and how it's used. In my experience static events aren't very commonplace.
 
so if the event and the method protected static virtual void OnUpdateGlobalProgressBar( GlobalProgressEventArgs e) are both static then its ok
 
I put the inners into their own files but now I get inconsitend accessibility
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EssentialLanguageFeatures
{
    class Program
    {
        static void Main(string[] args)
        {
            // ceate a new product object
            Product myProduct = new Product();
            // set the property values
            myProduct.ProductID = 100;
            myProduct.Name = "Kayak";
            myProduct.Description = "A boat for one person";
            myProduct.Price = 275M;
 
@KyleGagnet yeah i had to google to see if they actually existed
 
@HansRudel Me too ;)
 
11:49 PM
glad i wasnt the only one
 
@HansRudel If by "ok" you mean will it compile? Yes. If by "ok" you mean a good design? I can't say without seeing the code, but my gut says no.
 
Can anyone give me guidance please?
 
@Hans I have to fight a strong urge to tell you to make everything instance.
 
@KendallFrey is that because im a bit slow?
 
In fact, you might be well off doing that, and if you find something doesn't make sense that way, change it to static.
 
11:55 PM
@KendallFrey ill take that as a yes lol

@KyleGagnet @KendallFrey i think, assuming u guys dont see anything wrong with it, am going to leave my methods as non-static where i have events involved. Otherwise i will change my other methods to static since they usually just involve passin in strings etc and passing a value back.
 
@heinst your code is a little spread out and you've received some advice already. Can you put any updated snippets you're asking about in a pastebin?
 
@TonyHarmon that code compiles for me.
what is the exact error
?
 
Error 1 Inconsistent accessibility: parameter type 'EssentialLanguageFeatures.ShoppingCart' is less accessible than method 'EssentialLanguageFeatures.MyExtensionMethods.TotalPrices(EssentialLanguageFeatu‌​res.ShoppingCart)' c:\ASPMVCPRO\EssentialLanguageFeatures\EssentialLanguageFeatur‌​es\ShoppingCart.cs 15 31 EssentialLanguageFeatures
 
Im just trying to call a return statement from another method
 
@TonyHarmon is your shoppingcart class still marked public?
 
11:58 PM
@heinst Uh, no can do. Can you give an example?
 
@KyleTrauberman /sheepish grin ahhh now :)
 

« first day (584 days earlier)      last day (4371 days later) »