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

6:00 PM
its just before the switch statement
 
@HansRudel - It looks mostly okay. I'm not convinced you've handled the multithreading correctly but I don't have time to test it.
@HansRudel - Those aren't declared as static. I'm not sure what you're asking. :)
 
Should domain models and repositories be in different classes?
 
Not necessarily.
Only if you find your code getting out of hand.
They're usually pretty easy to separate down the road though.
 
@SpencerRuport i believe it does work. The final row is initially assigned via a static property. a local variable is assigned via the static property. after that everything is local. I dont believe the static properties are touched
 
@HansRudel Anyway hans, what was your initial question?
 
6:08 PM
static properties, should they be used at all?
 
@HansRudel - This is what I'm looking at
       private int CurrentRowInFile;
        public int CurrentRow
        {
            get { return CurrentRowInFile; }
            set { CurrentRowInFile = value; }
        }

        private int FinalRowInFile;
        public int FinalRow
        {
            get { return FinalRowInFile; }
            set { FinalRowInFile = value; }
        }
 
Ah, only if you have a decent reason. I think you'd be better off not using statics in this case
 
Those aren't static.
 
aye
@SpencerRuport
int initialRow = RowInformation.InitialRow;
the initial row is set via a static
 
6:11 PM
and
FinalRow = RowInformation.FinalRow;
 
Why aren't you just passing in an instance of RowInformation?
to DataVerification?
 
where RowInformation is where the static properties are declared
 
oh wow. Yes Hans thats a bit of a bad idea
 
@SpencerRuport i dont know actually
 
I would do that.
 
6:12 PM
good point
 
And here's what I'm unsure of when it comes to the multithreading
 //Create a task to verify the data.
                Task childTask = Task.Factory.StartNew(() =>
                    {
                        VerifyDataTypes(columnDataTypes, sourceFilePath, errorLogFilePath, numberOfColumns, obj);
                    });

                try
                {
                    Task.WaitAll(childTask);
                }
You create a thread to run the VerifyDataTypes
 
correct
 
but then immediately block with the WaitAll call
 
yeah
 
I could be wrong but I believe you will get the exact same behavior if you do this
            try
            {
                VerifyDataTypes(columnDataTypes, sourceFilePath, errorLogFilePath, numberOfColumns, obj);
            }
 
6:14 PM
It sounds like RowInformation should be an object
and a new instance should be instantiated for each CSV you parse
 
@SpencerRuport.... quite possible so.
@Greg, ill have a read though and see about making those changes. :)
 
@HansRudel If its code that is to hard to change, i'd just pass the variable finalRow, etc like spencer suggested.
 
@SpencerRuport the main reason for that odd construct is that i wanted then GUI thread to go back to Form1 class so it could wait to update the progress bar. I will change it to what u suggested and see if that works as that does look alot neater.
@SpencerRuport @Greg so if i make those changes, marks out of 10?
 
Right @HansRudel that's usually what I'd expect to see but the way you've coded it won't do that.
@HansRudel - Remove the prepended comments also.
 
oh i don't know, it looks good enough
Why remove the comments?
 
6:19 PM
@SpencerRuport howd u mean it wont work, which part?
@Greg, im assuming he means like so
 
Well since you're blocking with that WaitAll call the UI thread is going to wait for your worker thread to complete either way.
 
// this comment
int myinteger
and not the /// comments
@SpencerRuport no thats why i created the parentthread
that one doesnt force the GUI to wait
 
I like // comments
 
Oh okay.
 
but the childthread forces the parent thread to wait
 
6:21 PM
Then the task just isn't necessary that's all.
 
@onepseudoxy @onepseudoxy It does not appear to be a similar control. Sorry.
 
though comments like this could be removed //Local fields.
 
as i couldnt see how to get the gui thread to return and still process the aggregateexceptions
 
@HansRudel - It's hard to say a rating. I've definitely made all the same mistakes I've pointed out at one time or another. But if I wrote something that accomplishes the same goal someone like Jon Skeet could probably come along and find a dozen mistakes that I made.
So don't worry about a rating just learn from your mistakes and do better next time.
 
so would u guys accept it thats what im curious about?
 
6:23 PM
well i'd have to look at the new version
 
@HansRudel - The big blocks of comments contain your interpretation of how the function works. You don't actually know that for sure. It's just as far as you know. I think this can pollute another programmer's opinion when they're trying to figure out what your code does and may cause them to miss a bug they wouldn't have if they hadn't read your comment first.
Also I don't know about you but by this point in my life I've read far more lines of code than I have lines of English. I understand code better than words.
 
Apparently there is some compiler optimization being done for cases where an event has zero or one subscriber. But having the extra empty anonymous delegate will add some overhead.

In reading about the topic (here http://stackoverflow.com/questions/170907/is-there-a-downside-to-adding-an-anonymous-empty-delegate-on-event-declaration) I found this other wait to raise events that I may have to adopt now. It's the best use of extension methods I've seen:

public static void Raise(this EventHandler handler, object sender, EventArgs e) {
 
@KyleGagnet Ah kyle, did you try the benchmark?
 
@SpencerRuport regarding the threading, i get rid of the child task and put the method call that was within the child task inside the parent + enclose in try block and then its ok?
 
No, but your findings seemed in line with what others got
 
6:25 PM
righto then
 
@Greg I'll run it out of respect for the fact that you were benchmarking C# instead of working on your Javascript ;)
 
@SpencerRuport as i said, this is my first program ive written so unfortunately english is still alot easier for me to read
 
but the difference was really about 1 second for 100 million calls
 
@HansRudel - No worries. It's not bad. :)
I've seen a lot worse for sure.
 
@KyleGagnet thanks very letting us know!
 
6:26 PM
i did it with delgates rather than events
 
@SpencerRuport lol and alot better as well
 
im betting the J++ line doesn't even effect the time
 
You have good naming conventions, you're actively trying to improve and you're trying to handle errors properly.
All things which you should be proud of.
 
ah right, you can pull j = j+2; out and you'll get the same results
 
Oh and logging, you're logging.
 
6:28 PM
so 5/10
 
well within 10%
 
lol @HansRudel no ratings. Just take the compliment. ;)
 
oh another thing, Its my preference but usually something like this: if (TempHandler != null)
{
TempHandler(this, e);
you can ommit the brackets and make it a one liner: if (TempHandler != null) TempHandler(this, e);
 
@SpencerRuport lol that means less than 5. thanks for the compliments though
@Greg, i wasnt aware of that, cheers bro
 
@HansRudel - No it means I don't think rating systems make any sense for this kind of stuff.
:)
 
6:30 PM
same thing with this
 
fair doo's
 
if (progressBarUpdateInverval == 0)
{
progressBarUpdateInverval = 1;
}
 
Despite what highschool and college would have you believe, life doesn't give you grades.
 
ommit brackets, make it one line, makes it easier to read
i like to think of salary as my grade
 
I understand tight cohesion and loose coupling but this dependency injection stuff is confusing the crap out of me; does anyone know of an example I might be able to look at?
 
6:30 PM
haha
im not getting paid so...
 
@TonyHarmon - What in the world are you doing?
 
Tony, are you talking about dependency injection framework, or manual dependency injection etc?
 
I hardly use dependency injection.
What do you need it for?
 
@SpencerRuport do you have any idea why these threads aren't working, everything is working properly stepping through it in debug mode, the querystring is passed to the methods properly, every webservice is call and returns the right response, but none of the controls are being updated from the seperate threads
 
I use manual dependency injection often for linking GUI to backend
 
6:32 PM
It's in my book... :)
 
@SpencerRuport @Greg just want to thank u guys for ur time. Looks like i got a couple thing to sort out tonight but i really appreciate ur help!
 
@ScottSelby - Are you getting errors?
 
no errors
 
@TonyHarmon - Take smaller bites. Dependency injection is rarely necessary in a web app.
 
the page just posts back with all labels and gridview and image empty
 
6:32 PM
So rare in fact I've never used it. :P
@ScottSelby - Did you get it working in a console app first like I told you?
 
Spencer has used it, he just doesn't want to accept that it is manual dependency injection :P
 
@Greg - Fair enough. I've never used it to the point where I've had to know what it's called.
 
@SpencerRuport - yea, the multithreading is working perfect, its the controls that aren''t being updated
 
Need bigger bites! :) It just happend to be in the section I'm reading and I'm a big fan of loose coupling but was getting confused by the injection stuff
 
:P I like to think of it as an industry design pattern that exists, then eventually someone named it
 
6:34 PM
@ScottSelby - You need to get the main thread to wait for your worker threads to finish before rendering your HTML.
 
if I set a breakpoint, the code behind will say lblArtistName.Text = "phish" , but it never actually happens on the page
 
have you ever used a strategy pattern?
 
@TonyHarmon - Skip that crap.
Look at it later.
 
ahhhh
how do I do that? that wasn't necessary in console app, they all just worked
 
If you've ever coded to an interface in a class, then stuck a implementation of that interface into your object in your main code, you've done manual dependency injection
 
6:36 PM
@ScottSelby - That's because Console.WriteLine is a thread safe call.
 
i think the same is true of delegates used in the same manner
 
Actually that's not thread-safe. The "best practice" is something like this:

private void RaiseMyEvent(EventArgs args) {
EventHandler myEvent = MyEvent;
if (myEvent != null)
myEvent(this, args);
}
 
@ScottSelby - Look up "wait for thread to complete"
 
How do I only code-format part of a message?
 
I was actually working on a dependency injection framework for C# using postsharp
 
6:37 PM
@SpencerRuport I read on how to wait for the thread to complete - but what is the name of the main thread that I need to pause?
 
i didn't like how the other ones used there syntax
 
You don't need to know the name. Whatever code you use to spawn the other threads is going to be executed by the main thread.
You need to force it to block until they complete.
 
i wanted something like this:

[Inject id ="someid"]
IMyObject object;

Where in i could assign an object, class, or factory method to "someid" during runtime.
 
ok, thanks
 
@TonyHarmon - How's everything else going?
 
6:40 PM
@TonyHarmon So whats your dependency injection question?
 
Fairly well. I was able to do one of the labs last night without having to look at the book
 
Nice.
 
It's not really a question, yet. It's the dependency injection container stuff that has me confused. Like, is it a dashboard for dependencies within your project?
 
It's for portal projects but to be honest I think it's a bad approach.
It seems like people are trying to make web apps behave more like desktop apps and that's just not how things are.
 
Isn't the container what controls the mappings between Interface and object? Hold on let me check.
 
6:43 PM
For the most part Tony, dependency injection = "plug-ins"
If you don't have plugins you probably won't need to mess with it.
 
Thats for compile time weaving
They have a few like ninject where you just have to add a library
though i don't like ninject.
 
Ok. I guess being aware of it is good enough?
 
yea, just think of automated dependency injection as a feature where some library determines what objects get stuffed into your instantiated objects.
Its actually really important in Java EE, where entity managers are injected into your servlets.
 
Not so much in ASP.Net MVC.
 
6:47 PM
The framework manages the life span of the entity manager, your object just uses it then lets the framework decide when to close it.
 
ASP.Net MVC doesn't set up any of that for you so it's easier just to create a base controller and have it handle all that stuff.
 
is there a library for Asp.Net that handles that stuff that you can just draw from?
 
Not specifically no.
 
i haven't really done ASP.net, I use C# for desktop gui
 
I just follow nHibernates session management approach.
It's easy to understand and it works.
All it does is when the page is initialized it creates a session connection and tosses it into the httpcontext
from then on you just access a static property somewhere that's really just shorthand for pulling the session back out from the httpcontext
and then when the page is done rendering you just close it out.
 
6:51 PM
ah thats good. I would prefer if JAX-RS did that, but it builds the response after you return.
so i get lazy load exceptions after i return my response
 
You can expand this to make sessions persist across page rendering but then you've gotta create this whole pooling mechanism to grow and shrink depending on traffic and to be honest, most web servers are also database servers or are right next to them on an isolated 1000mps network segment. The connection time spent for each page is pretty insignificant.
Not worth the effort to mess with a more complex mechanism.
I'm not writing facebook. :P
@Greg - Yeah I hate those.
 
what i really like about ejb 3.0 is how easy it is to use. I just let my framework handle anything thats not business logic and give me an entity manager.
@PersistenceContext private EntityManager em;
 
I haven't used it.
I love love love nHibernate.
Have you used Hibernate at all?
 
now i just let it get injected, use my em, then let the framework handle everything else
Yea, i'm using hibernate in my JavaEE stack
 
<3
The learning curve was ridiculous but that was mainly due to a lack of documentation.
Which isn't really the case anymore.
 
6:57 PM
Ah, i bet it would be alot easier if you learned JPA first
 
Perhaps.
 
JPA is the spec that Hibernate was built on
i also use annotations rather than xml for config
 
Ah I love the xml
 
@Entity Class SomeDbEntity
and im done.
 
hehe
I just like it because then I feel like my xml is my entity
and the class is my business object
 
6:58 PM
@Greg I ran that test code you wrote, and I got the same results. It is definitely slower to initialize the event with an empty anonymous delegate.

That itself is enough to convince me not to do it anymore, but after discovering this wonderful use of extension methods, I think I've found my optimal solution. After adding this to my helper library, I'll never have to write a null check on an event again AND I won't get any performance hit from needlessly multicast events.
 
So I don't need to go creating another.
 
public static class MyLibraryHelperClass {
        public static void Raise(this EventHandler eventToRaise, object sender, EventArgs args) {
            if (eventToRaise != null)
                eventToRaise(sender, args);
        }

        public static void Raise<T>(this EventHandler<T> eventToRaise, object sender, T args) where T : EventArgs {
            if (eventToRaise != null)
                eventToRaise(sender, args);
        }
    }
 
ah right on kyle
@Data
@Entity
public class UserNode {
@Id @GeneratedValue
@JsonIgnore
private Long id;
@OneToOne
@JoinColumn(name = "userName_fk")
private UserLogon userName;
@OneToOne
@JoinColumn(name = "node_fk")
private Node attachedNode;
private Boolean isRead;
private Float progress;
private String notes;
}
Thats one of my entities, Its half annotation hahaha
But its Jackson, Lombok, and JPA
 
Yeah
Personal preference though. I don't think one way is better than the other.
 
does nHibernate require getters and setters, or do you just make auto-init properties?
 
7:01 PM
I just make auto-inits
Sometimes I do this:
 
thats good, one shortfall of Java is you need getters and setters. Lombok and the @Data fix that, but its a compile time plugin.
 
protected virtual int _myEnum { get; set; }
public virtual MyEnumeration myEnum { get { return (MyEnumeration)_myEnum; } { set { _myEnum = (int)value; } }
LOVE that.
Never have to think about it again.
 
lol, thats a bit verbose, why do you do that?
i haven't used nHibernate
 
If I have an enumerated type it's an integer type in the database
 
ah i see
 
7:03 PM
so nHibernate handles the _myEnum property
But then whenever I use the object
 
you cast it back
good idea
 
I just use the myEnum property
So then the casting is all behind the scenes and I don't have to fuck with it.
 
right right
so how do you guys like dynamics?
 
And yeah it's a little verbose but this is just my data classes and those rarely get over 100 lines anyway so it's still pretty easy to read.
I haven't used them haha.
 
nah, thats fine. It sounds liek nHibernate needs to add a feature to handle that for you
 
7:07 PM
Perhaps.
You use any linq 2 sql?
 
[enumtype="int"]
public virtual MyEnumeration myEnum { get; set;}
Im not sure, i think i used it in a project in 2009, but that used sqlmetal or something
 
gotcha
Alright it's lunch time
I'll bbl
 
take care
 
I'm still confused. I never figured out the difference between LINQ to SQL and EF.
 
well for starters, they have different names. :P
 
7:10 PM
Yeah, but...
 
So they are obviously different products. Ask anyone at microsoft.
 
I remember whenever I googled for problems I had with L2S, I always got articles on EF. And the EF code looked the same as my L2S code.
 
Cool. I know to stay away from L2S (past experience), so next time I make a db app I'll try EF.
 
7:29 PM
@SpencerRuport - I think I am getting into way more then I need to , I tried Thread.CurrentThread.Suspend(); then Resume(); and intellisense says that those are outdated and not allowed anymore
Is there a simple way to pause the main thread and wait untill 5 other threads are complete, then resume main thread?
 
Thread.Join?
 
@KendallFrey I don't know where to put the join , because I don't want them all to be processed one after another , I want main to wait for the next 5 running simultaneously , then the main resumes
 
In the main thread, call Thread.Join(otherThread1); Thread.Join(otherThread2); ...
After they are all started
 
I'll try that
Would it me Thread.CurrentThread.Join(nextThread) ?
 
No, Thread.Join(other). It automatically pauses the current thread.
Oh, wait nvm.
otherThread.Join();
 
7:39 PM
Here is the problem , originally I have the 5 threads in Page_load , and they were running super fast , and in debug mode they were all opperating properly but none of the controls were getting updated that the methods were supposed to update. Now I added Join() to each one and it works fin , but it isn't that fast, it seems like join is slowing them down
I want them to go as fast as they were, but each thread able to update controls independently
 
Not sure. Maybe instead of Join you want while (!complete) or something like that.
 
Does anyone here use the test driven development model? If so is the arrange, act, assert really that easy?
 
@TonyHarmon what do you mean?
 
@ScottSelby use monitors?
 
I'm reading about MVC 3 and it's testing stuff and this book suggests TDD because the test stubs are easy to create
 
7:42 PM
yeah
 
@KyleGagnet I could try monitors, I wish I could find a way to have each thread update labels and images and gridview independently , they aren't trying to update the same control , they all work with seperate ones
 
Well I thought I had a grasp on multithreading, and that passing understanding got me by for a while. But I regret not sitting down and reading this entire site/book much earlier in my career: http://www.albahari.com/threading/
Maybe it will help you out.
 
@KyleGagnet - I'm reading it now
 
Hey @yas4891, I was thinking the C# room needs some more owners. People who are active regularly in the room, since most of the owners don't come around very often.
hint hint
 
Kendall, quit trying to nominate me. I won't take it.
 
7:51 PM
Not quite what I meant. ;)
According to the stats, I am the most active person in this room. Guess I am an addict. :P
 
@KendallFrey great idea. I'll make C.Barlow and Kyle owners
 
I think we need a new room title
var future = await new CSharp5(); has become stale
 
@yas4891 Rascal :P Oh, well, nvm.
@Greg Why do you think I brought this up?
 
@OutlawLemur I'm well familiar with the feeling
 
7:56 PM
OMG, congratulations
i am so happy for you. ::sob sob::
 
@KendallFrey there you go. More karma for you :-)
 
Haha YESSS
BTW I'm looking for owners for the SQL room, so if you know anyone...
Hey thanks much. Okay...... Ideas for a new room description?
 
Java is c#'s retarded brother
 
Hmm. Might not come across so well...
Hey!
 
haha
 
7:59 PM
I am so mature
 
Did anyone used to write programs in the 90's that worked with AOL to kick other people off , and freeze their computers ?? That comment reminded me of that stuff
 
no seriously: Is there a reason for a new description?
err.. Sub7 ?
 
@yas4891 It's old.
 
or something with a similar name
that was pretty popular back then
 
its a bit stale, and not entirely descriptive. Its a neat title for a while, but its kinda a pop title
If we're going to have witty titles, might as well change them up every week or so
 
8:02 PM
"c# - cus java sucks"
 
@ScottSelby You mean "punters"? I didn't code back then, but I definitely used them... and mass mailers... good times.
 
Java is c#'s retarded brother - Nominate plz
 
@KyleGagnet yea!
 
oh right, those old spam bomb tools
those were neat
 
"It's 5.50 a.m.... Do you know where your stack pointer is?"
 
8:04 PM
hmmm, i don't think most c# people concern themselves with that
 
Not when C# is babysitting, right?
 
oh yeah- right
 
I want to put on a resume " when I was only 16 I wrote programs that annoyed the hell out of people using America Online"
 
lol
The only thing C# isn't good for is poking fun at.
 
hahahaha
 
8:09 PM
haha
 
oh aol. When they made unlimited internets it was really neat.
 
Seriously, I'm searching for C# jokes, and not finding them.
C/C++ jokes abound.
 
Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”

“Yeah,” reply the bytes. “Make us a double.”
 
Someone buzzed for me hours ago (days ago?)
 
@KendallFrey that's because C# is so awesome
 
8:14 PM
IKR?
Loled: JIT Happens!
 
C# not your father's C
 
double penetration; // ouch
 
hi
 
Anyone here familiar with System.Runtime.Caching?
 
8:19 PM
@ScottSelby, your mileage may vary, but when my company was hiring last month one of the things I was fishing for in resumes/interviews was basically "when did you start programming". So if you can find a tactful way to say that you were 'self-taught programming starting at 16' or something along those lines I think it could only help. You don't have to go into great detail unless asked. And the days of writing AOL punters are so long ago you can always chalk it up to teenage rebellion.
 
i passed AP CS test when i was 16! ::Beams::
 
I wish I would of kept coding , I went in the marine corps at 18, was electronics engineer for like 8 years, now I'm just getting back into it
 
EE makes you a bit smarter and broader
 
I would still work it in there somehow, especially if that's the field you want to get (back) into. Since we were looking at new grads, I wanted to hire someone who is addicted to computers, not someone who got their college acceptance letter and said "Hmmm... you can make money in computer science, right?"
 
yea, I have a huge advantage over recent college grads , but at the same time most positions want at least a solid 2 years professional experience as a developer, I have none,
 
8:25 PM
Do you have project management exp?
 
yea, a lot of project management
 
Might want to find a job as an assistant software project manager then. It will give you the experience you need to learn project management as done by CS
Principles in EE cross over to CS, but there is alot software dev. specific.
 
I really prefer junior c# developer role, I learn extremely fast , and want to get with a team of awesome developers and learn to make whatever I thinkj of
 
you know, about 6 months ago agilent was hiring WPF developers
your EE background would be excellent
 
I have a few ideas for some apps that I think will be really profitable, I am just far from being able to create the idea
I have no idea how to do photo recognition of pills
 
8:30 PM
oh no.... another idea guy..... get on the list
 
lol same idea as me. Neural Networks
 
Ideas aren't worth very much without a well thought out business plan and market analysis
people are weary of NDAs, and patents are a bit difficult
 
and none are worth much without the ability to create a working model of the idea
 
well if you have the above, you can get funding for the ability
Its much easier to identify someone who can do work than identify a winning idea
but then again, i often hear that VCs invest in people, not ideas
 
room topic changed to C#: [AwesomeRoom] public class CSharpRoom : ChatRoom { } [.net] [c#]
 
8:47 PM
yay
 
I assume you configured your dependency injection container.
 
I will never understand what the [stuff] above the methods/actions are
I kinda do .. but I don't
 
they are meta data.
 
@AmmarAhmed Attributes
 
Your not geting rid of the SQL room are you? Even though I never see anyone in it
 
8:48 PM
you can get the Attributes by using reflection, and do stuff with them.
 
I will look into them. I got a pluralsight account
also got diablo3.. so I am screwed
 
@TonyHarmon I don't plan to. I would like more discussion, to hopefully draw gurus into the room.
@AmmarAhmed So you won't look into them? :)
 
runtime wweeeeaavvviiinnngggg
 
huh?
 
runtime weaving. its what postsharp does.
it finds classes, methods, etc with annotations, and injects code based on them during runtime.
I think castle windsor does it too
 
8:51 PM
Yeah I used them with http post. But I don't have a deep understanding in them
 
castle windsorrrrrrrrrrrrrr
i'm so bored.
 
Knock knock. Who's there? Long pause... Java.
3
 
this project is going to kill me.
 
hahaha
 
I love that joke.
 
8:54 PM
i was writing my own dependency injection project based on postsharp, it was pretty revealing about how everything worked.
 
This room talks about dependency injection way too often.
I think people just think the name sounds cool so they want to learn more about it.
But honestly it's boring.
 
do you have something better to talk abut
 
at least we're not beating MVVM to death.
 
How we can't wait until Windows phones pass up Android so we can forget about Java again?
Who's the owner of this room anyway?
 
8:59 PM
As a person(edit: Man) who knows nothing about dependency injection.. I like the name of it
 
@SpencerRuport A whole bunch of people.
 

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