« first day (1080 days earlier)      last day (3884 days later) » 

9:05 PM
Hello
Question: Other than public MyClass(int wat) : base(wat), is there another way to call the base constructor of my class? In particular, at the end of my constructor's code?
 
@Hamster No - the base class has to initialize itself first
the base class constructor always runs prior to yours
 
@ReedCopsey Hmm, then I suppose I need a factory method for what I'm trying to do
 
maybe explain what you're trying to do?
 
@drch Well, I want a value to be passed to the base constructor that also gets stored in my class as a property
public MyClass(int wat) : base( MyProperty = wat ) seems weird.
 
@ton.yeung that's the equivalent way of saying the same thing, the compiler barfs if that isn't the first line of a subclass constructor
 
9:14 PM
why can't base initialise wat?
or MyProperty
 
@Hamster why do you want to do that, and in what respect is the base constructor behaviour not suitable?
 
or make the base class's wat field protected
 
Well, here's what I end up with, and it's invalid: public ActionSimulationHeap( bool min_heap ) : base( HeapCompare = new HeapCompare<ActionSimulation>(min_heap) {}
I'm just gonna use a factory method I guess.
 
er does base have a constructor that takes an int?
 
Do you have control of the base class?
 
9:17 PM
maybe it should, even if it's protected
er sorry bool
 
Gui
hi guys whats up
 
hello graphical user interface
 
Hang on, might be a stupid typo
 
@ton sure, but it could provide a protected constructor to allow the initialisation param to come from a subclass
 
Nope, "Invalid token = in constructor etc."
 
9:20 PM
so far I'm surprised base doesn't already have one
@hamster yeah your syntax is definitely invalid. you can only pass values to a constructor that way, not set properties
but if HeapCompare is a property if the base class, can't the base class provide a constructor to initialise it ?
 
@drch I don't have access to the base class.
@ton.yeung You're right, hence typo I mentioned. :P
 
in that case, it's not a bad practice to both pass the value to the base as well as initialise your own property with the same value
 
@ton.yeung Naw, I've already moved on.
 
factory seems unnecessary from here
 
hello everyone
what is the best book to learning oop in deep manner and with real world practice?
 
9:26 PM
the book of google
and stchatckoverflow
 
To answer your question, the property IS in both the base class and my inherited class separately, but I can't access it from the base one, apparently.
Anyway, problem solved I guess.
Thanks for the help.
 
bonne chance
 
@dirt google is a search engine and it is good to find a specific problem. are you professional programmer? if yes, are you be professional with google? did you safisticated yourself?
 
I safisticate myself on a nightly basis
and yes I am a professional googler
 
C#
C/C++
Basic
VB
Assembly
 
9:33 PM
engage visual studio
 
@ton ha yeah i dont know how to say good luck in german
 
@ton.yeung ok, but oop is not a built-in concept in it's language, for Example C# give us a specific tools for implementing oop but eventually that's is us to implement oop pronciple and standard with that's tool
 
@drch isnt it...
 
i like the second choice in that translate... Toi Toi Toi!
 
@dirt What if someone's gravatar was randomly generated as that
 
9:39 PM
I wouldnt be surprised if there were checks to prevent that
 
@ton.yeung yes, but i want to learn oop Design tool in language and then learn design pattern.
 
go4 is the classic, but its all c++
there was a good oreilly book iirc
 
for example: i'm looking for book to learn me about deffierence between interface and abstract class, about modifiers, about namespaces and so on...
 
@drch GoF is all pseudo-code - there's no C++ in there
 
@programmer1 that would come from any c# book
 
9:42 PM
@drch orly? I'd say it is pretty agnostic
 
ah im remembering wrong then
 
thank's i couldn't give you my intention
 
dunno how many patterns in it that are considered antipatterns today though
 
@programmer1 that interface/abstract class/modifiers/namespaces etc will be covered in any intro c# or oop book
and thats less about design patterns and more about OOP in general
 
@drch in your openion if i learn a design pattern, i learn oop too?
 
9:44 PM
not exactly
design patterns are building blocks
the others are more raw materials
 
well... stringly typed programmed can also be considered Message based programming
one is a terrible antipattern, one is a great pattern
 
@programmer1 A Design Pattern isn't a building block to learn Object Oriented Programming; they help solve particular problems within the paradigm though. You'll want to learn the fundamentals, before implementing patterns. Without the proper knowledge of when and why to implement; you may not leverage the right solution to your problem.
 
i think that might be the one i remember
but its up to you - i learn better with working code. you might be better with UML and pseudo code
 
@ton.yeung do you learn this book yourself?
 
9:47 PM
@drch I would almost recommend C# 5.0 In A Nutshell. That is a great book; it encompasses alot of information in it.
 
hmm... is the garbage collector smart enough to collect a large object that is never used again later in the class? Or should I create a context for it so that it is marked as GCable?
I have a PDF of C# 4 in a nutshell if anybody wants it
 
@ton.yeung no!, search is easy but reading and report expirence is hard and valuable!
 
this book is quite good, despite having 'web 2.0' in the byline
they are also design patterns, but higher level
 
@drch I should read this one, hope it is short
 
If you aren't a strong programmer; I would recommend this:
 
9:49 PM
@JohanLarsson its relatively short, but its also something where you can just look at the ToC and jump to what you want to learn
code is python tho.
 
do you speak python?
oh
 
He focuses on C#, not so much on WPF, Web Forms, MVC, or Windows Forms. He basically forces the usage of the compiler; he even uses common pitfalls students have as examples in explination to help learn.
 
@JohanLarsson yep, altho the best things about python are the tools/libs
 
You only use the console, but he really forces you to understand why and how C# works.
@ton.yeung haha, well... You can go that route to.
 
i build solutions to jira tickets
and if a task takes less than its estimate, it takes as long as its estimate
 
9:56 PM
one of my problem is that when i want to writing a program, familar with new concept, for example when i'm coding and write "///" after search in google familar with new concept with name "Xml Documentation" and sudden with some book in that scope, or unit testing, tdd, design pattern, uml, agile and ... this problem is reason to can't end the program? what is your solution? execusme to wrong in talking, the english is my 2st language
 
@programmer1 read it twice, just don't understand what you mean.
 
urgh... I really dislike all these void methods
 
@Pheonixblade9 I seem to have misplaced my copy, if I may use the pdf?
 
@CCInc email?
k
 
@ton.yeung thanks yes this is mean
 
10:00 PM
done
 
thanks, Pheonix
 
@ton.yeung ok, that is a valid point. Learning to learn is part of the steepness in the initial learning curve imo. Not just for programming.
 
@programmer1 start with something that works and incrementally make it better
 
^ solid advice
 
10:02 PM
its not a mountain, its a bunch of molehills
 
this is how i build my program
a wall consists of a group of bricks
 
Also consider version control from the get go. Gives you a powerful undo.
 
@programmer1 patterns solve problems. you should ask 'how do i solve this problem' not 'which patterns best suit my application'
 
@Johan
 
@JohanLarsson I was asked to manage/architect a project recently... I insisted upon CI/GIT from the very start.
 
10:03 PM
@drch ok, but you suppose your program in step 1 has 10000 line of code, and you want to implement some pattern and unit testing and other, can you do?
 
@JohanLarsson verson control is very helpful
 
@ton.yeung I am using CircleCI and Github private
 
@programmer1 you don't go from 1 to 10,000. usually theres a 2, a 10, and a 100 a long the way
 
@Pheonixblade9 makes sense, I was thinking for programmer1. Be able to undo can probably be helpful if starting with a sample and modifying it.
 
costs me $27/mo for both... pretty cheap, considering I don't have to worry about managing my own build server.
 
10:05 PM
@programmer1 start small, but don't be afraid to refactor as you go
a 100-line solution to a problem looks a lot different than a 10000 line solution
if your problem can be solved in 100 lines, nobody really cares about the patterns
 
@ton.yeung why would it be that much?
Yeah, you don't need a new server for each solution
unless they're in different repos
ah, then it would be more expensive
still way cheaper than paying someone to maintain a build server though
 
whats circleci?
 
yeah, we use TeamCity. I didn't want to maintain a build server though
 
teamcity aint no thang
 
@drch it's continuous integration
yeah. I am working with some guys in Malaysia, so I would have to pay for hosting. I can't host stuff off my home internet, it's against contract.
 
10:08 PM
@drch i have expirence to my talk, when i read first basic c# book, i write a program with 10000 line of code and 5 mounth later i would to change program from ado.net and convert it to 3-layers architecture, but it's very hard and confusing
 
@Pheonixblade9 do you get access to the actual tools at CircleCI? or is it some proprietary build server / deployment?
 
@drch actual tools? What do you mean
 
ie teamcity + octodeploy admin
 
oh, not that I know of
 
appharbor is great for small apps
CI/CD from the get-go. instant rollbacks. lots of hosted addons (redis, mongo, sql, etc)
but its awesome for free
 
10:10 PM
cool :)
 
@JohanLarsson johan please give me keyword to search this problem in google?
 
@programmer1 what is the problem?
 
"Operator '==' cannot be applied to operands of type 'E' and 'E'"
Bummer
 
@JohanLarsson learning to learn
@ton.yeung iran
 
@programmer1 oh, I probably invented that, I don't speak/write much English either. I use guessing and google.translate. By learning to learn I mean learning where good help resources are and how to use them effectively.
 
10:16 PM
thank's friends, bye
 
I don't, everyone was supernice the way I read it.
yeah, US-propaganda seems to be extremely loud
We don't really have any of that in Sweden.
that is a general truth I think
Commercials comes to mind
And it works, if not no one would pay for it
bai
 
hey @JohanLarsson, do you have that link handy to that WPF guy who swears?
 
lemme find it
 
i watched the first one and it was good. want to watch another and go to sleep
 
10:27 PM
ty
 
I always download the stuff from channel 9
are you in wpf mode now?
 
we'll see. i want to build out this memorization tool for myself first. but i think it better suits a desktop app
just depends on how long it would take me to do the UI in web vs wpf
altho i was thinking of doing everything in javascript :S
 
ping me if you want ~help~ I can't get started with anything of my own stuff as of lately. Meaning lots of time to waste.
 
will do
 
@JohanLarsson can you help me make SQL work?
silly SQLCompare...
 
10:32 PM
no one wants my SQL ~help~ :D
 
@Pheonixblade9 is it < 5kb of sql?
 
@drch it's 2 million rows.
 
ive seen your sprocs and they give me the heebie jeebies
 
it's working, just taking forever
@drch hahahaha our sprocs are noneuclidean in nature.
you think they're complicated, we actually have a custom language that modifies that sprocs at runtime
it's pretty crazy...
 
@Pheonixblade9 you mean they are nuclear?
 
10:40 PM
noneuclidean
sisyphaean may be a better description though
 
dropping a 10 Megaton sproc on this mf
 
pretty much
3k LOC sprocs are not out of the ordinary here
 
nty
 
SO HAY GUYZ U WANNA JERB
 
10:43 PM
that's actually mostly just on my team
 
I came across a kind of crazy generics request and came up with this: stackoverflow.com/a/19105195/1026459 Can it be improved? Does it suck?
 
is PrivateDict supposed to be private?
 
@Reed - His whole example was private, but I made it all public so it was testable. It can be used as private in the state it is in with some minor edits.
 
(that's also doing a lot of setting - PrivateDict doesn't need to existfor no apparent reason)
Your method:
 public static String ToString(F argument)
  {
     IPublicDictionary t = (T)Activator.CreateInstance(typeof(T));
     PrivateDict = t.Get();
     return PrivateDict.First(d => !Comparer<T>.Equals((F)d.Value, argument)).Key;
  }
there's no reason to set to a static - just call t.Get().First(d => ...
 
okay
 
10:51 PM
Your idea of using an interface has merit, if the class hierarchy can be changed, though
 
Does that mean I should remove the reference to a private dictionary as well? It was really hard to tell why he was trying to buck convention like this
 
yeah - and the class-specific dictionary could actually be static
 
eurgh recursive heavy duty method makes me sad
 
(though the Get() method, which I'd make a property, can't be)
 
just the dictionary, not the class?
Isn't the Get() already a method?
 
10:55 PM
god I don't want to work on this project any more >.>
 
@Reed - I added static to the class specific dictionary and removed the reference to a dictionary in the base class. I also removed the setting.
@Reed - I wanted to have the get method be a property but couldn't quite figure it out. It would be really nice to infer the int type as well instead of using F, but that also seemed hard to accomplish in this narrow scope.
 
for property:
public interface IPublicDictionary<T>
{
    Dictionary<string, T> NamingDictionary { get; }
}
THen I'd do the specific as:
  IPublicDictionary<T>.Dictionary<string, T> NamingDictionary
  {
     get { return PublicDict; }
  }
then no casts required in the value types
public static class BaseClass<T,F> where T : IPublicDictionary<F>
that eliminates the GetType/casts
@TravisJ Does that make sense?
 
I wish I knew things
 
@Reed - Make sense? Well it seems to work better, but I was having time finding the right way to do that :) I made the changes from your examples. But I am not sure if this was unavoidable, or if I implemented it incorrectly, because the second type is still required in this call
var s = BaseClass<GenderClass,int>.FromString("F");
 
11:13 PM
Does anyone here know enough C++ to help me? DeadMG is a douche and keeps removing my question.
 
goddamnit, this worked and now it doesn't
@MatthewH what is the question?
 
I'm simply trying to add the C++ application as a start up. I'm using this code.
http://pastebin.com/2JQpANpN

When I have the code in it. It does add it; but the program doesn't actually run.
When I don't, the program runs like it's supposed to.
 
@Reed - Having *a hard time. Sorry for the typo. I still cannot seem to figure out how to properly infer the type in that scenario (or if it is possible). I made your suggested changes (they were elegant) and placed them in an edit.
 
@MatthewH Does the process have sufficient privleges to modfiy the registry?
 
@CCInc hello :) and yes. It does. It actually adds it to the registry and pops up on start up. It's just after the program starts it closes...shit...I think I know...
maybe
Hm...
I have an idea,
 
11:21 PM
What do you think's the issue?
 
I have the adding to the start up first...then the program second. Maybe I should switch those? Hm...unless I can add...shit. I can just do this in C#. I'm a dumbass.
maybe...
FUCKKKK
I'll compile. Add as resource in C# program. Then add the program as a startup item.
Brb dinner time xD
 
11:44 PM
@TravisJ If that's a base class, you can do: IPublicDictionary<F> t = this;
no need to create an instance
and ` return t.PublicDictionary.First(d => Comparer<F>.Equals(d.Value, argument)).Key;`
 
@Reed - When I tried that, I got this error: Keyword 'this' is not valid in a static property, static method, or static field initializer
 
oh, yeah
 
Oh did I do not equals?
Oops!
 
sorry - forgot that's being used in a static context
BaseClass<T,F> where T : IPublicDictionary<F>, new()
so you can do IPublicDictionary<F> t = new T();
@TravisJ shouldn't Comparer<T>.Equals((F)d.Value, argument)) be Comparer<F>.Equals(d.Value, argument))?
 
Wow, that is pretty sweet. I have never got the hang of new in generics down properly. Are there other use cases for it as well? How is it that using new there allows for the instance to be instantiated?
 
11:48 PM
@TravisJ It requires there to be a default constructor, so you can use new T() - it's really just doing what you did, but puts the constraint into the compiler so you won't get a runtime error if there's no constructor
 
The funny thing is that the comparer worked both ways. I think the example was kind of thin from the OP and I didn't write a full test case.
You are correct though, it should be F.
 
so I'm going on a sailboat race with my CEO. That'll be interesting
 
Sounds awesome. Watch the jib!
 
well he'll probably be sure to remember my name now..
 
@TravisJ I actually prefer changing it to not use a generic type, and use generic methods instead, btw:
public class BaseClass
{
 public static string ToString<T,F>(F argument) where T : IPublicDictionary<F>, new()
 {
  IPublicDictionary<F> t = new T();
  return t.PublicDictionary.First(d => Comparer<F>.Equals(d.Value, argument)).Key;
 }

 public static F FromString<T,F>(string argument) where T : IPublicDictionary<F>, new()
  {
   IPublicDictionary<F> t = new T();
   return t.PublicDictionary[argument];
  }
}
var s = BaseClass.FromString<GenderClass, int>("F");
Console.WriteLine(s);
var t = BaseClass.ToString<GenderClass,int>(2);
Console.WriteLine(t);
I think it's more obvious what its doing on the calling side
and maybe switch so you write
var t = BaseClass.ToString<int, GenderClass>(2);
 

« first day (1080 days earlier)      last day (3884 days later) »