« first day (2165 days earlier)      last day (2780 days later) » 

War
12:19 PM
@AvnerShahar-Kashtan these are pre built 15 inch wheels, what if I have a horse and want a cart ... 15 inch wheels aint going to cut it ... All i'm saying is object.ToString() is a method I should have to add to my objects not something that just comes built in for me becasue the implementation is never right as any time I do actually want to use it the first hting I do is replace it
what was wrong with just giving us an interface for that
and for the other methods on object
@AvnerShahar-Kashtan but yeh ... there's that too ... contextually speaking those things are just weird "hexagonal wheels" ... so yay, I got some free wheels ... but do I really want them?
I dunno maybe it's just me ... but then I was pretty much alone in thinking that tuples gained us nothing too
 
@War The implementation isn't built in, because it's not an implementation.
It's a contract with a thin default implementation.
 
surely you don't override .ToString and .Equals on every single class you implement...?
 
War
so it is an implementation?
 
that way lies madness
 
War
@Squiggle well you have to if you want meaningful results
 
12:31 PM
@War the default implementation works just fine for me 95% of the time
 
War
for the most part though I don't really use ToString much except on perhaps simple value types when building strings
 
You want meaningful, override it.
@War Exactly.
 
War
and equals ... well I usually do something like if(obj1.Id == obj2.Id) it's the same obj
 
I don't understand what the problem is. You don't want to use the mechanism, you don't have to. You'll be opting out from a lot of framework mechanisms, but that's fine. Doesn't cost you anything.
 
War
@AvnerShahar-Kashtan so it's a meaningless implementation (my entire point)
 
12:32 PM
@War Wheel. Reinvented.
@War It's not meaningless for ints, or datetimes, or bools.
 
War
yeh I get that
 
It's not meaningless for StringBuilder.
 
War
but intA == intB makes sense
intA == DateTime.UtcNow doesn't
 
@War And it won't compile either. == is typed.
intA.Equals(DateTime.UtcNow) will compile, and it's not very pretty, I agree.
 
int value;
if (int.TryParse (text, out value) && value == 0)
	return;
would something like this work?
I'm not 100% sure
 
12:35 PM
@Dunno have You checked it? Btw yes
 
War
@AvnerShahar-Kashtan yeh that's what i'm trying to say ... it's a poor implementation that shouldn't exist at all
 
@Dunno should do, but it's easy to test, surely?
 
@Dunno Download something like LinqPad or RoslynPad, or use dotnetfiddle.net. 30 seconds to test.
 
the only issue I can see is if the compiler thinks value wouldn't have been assigned yet.
 
:32937363 object obj = GetUntypedResult();
return obj.Equals("test");
Do you think this should work?
 
12:37 PM
I tested it and it worked, just wanted to make sure it's not something compiler-dependant
 
War
@AvnerShahar-Kashtan it shouldn't but it does
 
@War Why shouldn't it? Imagine obj is a string.
 
War
String inherits object sure ... but I should not be comparing an object to a string I should be comparing 2 strings
it's poor programming imo
this promotes that
object obj = GetUntypedResult();
if(obj is String)
    return (String)obj) == "test";
surely that's a lot better ?
and actually that might not be what Equals does
 
@War Not really. The whole point of polymorphism is that your code should not explicitly check for types.
 
War
no it shouldn't
 
12:42 PM
My example was contrived, I agree, but yours isn't any better.
 
War
if you get in to either situation you probably have a bigger architectural issue
 
4 hours ago, by Roel van Uden
You hold some weird opinions, Wadry.
 
hi
i have a list with three item height,width,name
i want to get the item which has heighest value of height and which has name test
what would be the linq query for this?
 
@ShofiqulAlam What have you tried, and where does it fail?
 
@SagorAhmed did you find the answer?
 
12:50 PM
@Nerdintraining No partay yet boro
 
@JakobMillah why :<
 
I'll partay after tomorrow if I get z job
 
i havent tried
 
zen i will pardey wit u
 
i saw there is a max function
but i dont know how to integrate the max query with another select query
 
12:52 PM
@ShofiqulAlam Max() will return the max value. It won't help you get the object with the top value.
@ShofiqulAlam The thing to remember, though, is that linq queries are composable, meaning they can feed into one another,.
 
oh ok
great
 
myList.Where(item => item.Name = "test").OrderByDescending(item => item.Height).First()
This query will A) filter the list to keep only those named "test". B) order them from highest to lowest, C) pick the first one.
 
great
thanks
 
wouldnt it be: => item.Name == "test")
?
 
@Nerdintraining Yes, yes it would.
But I figure if someone can't get past that typo, they've got bigger problems. :)
 
1:03 PM
Yeahy, sensai @RoelvanUden is teaching me well!
Where is my cookie sensai? Where is it? :D
@AvnerShahar-Kashtan ^^ ♥
 
THATS A HUGE-ASS COOOKIEE ♥,♥
Thank you Sensai!
 
I know @AvnerShahar-Kashtan :D just looking that 1 up :P
 
War
@AvnerShahar-Kashtan why is that weird?
 
1:24 PM
lol
 
@RoelvanUden just noticed that the webpage you got it from is called "cookiesociety.com" thats epic!
 
That's a huge ass-ass.
 
1:56 PM
ny1 der
 
@Shilpa This is an English-only site.
 
ohh ok
Its short form for "There"
 
No, it's appalling
 
sorry
:(
my bad
can you tell me y we use anonymous methods
as we have to write inline code
which will ruin the decoupling property of delegates
 
What decoupling property?
 
2:02 PM
Decoupling Advantage
 
Is there a way to join two entity objects using linq?
 
@Shilpa What are you talking about?
@Euridice01 Yes
 
How?
 
I can't answer that question because it's too broad.
 
We write Anonymous method i.e. inline code implementation while creating delegate object
 
2:05 PM
@KendallFrey sorry, something like if I have two entities of the same type
Entity foo and Entity bar but both are of type Entity
 
new[]{foo, bar}?
 
@Euridice01 What does "join" mean, then?
 
Sorry I mean add the entities together
There is a collection of data and i want to add the data to one of the other entities
 
What does "add" mean?
 
2:06 PM
but Concept of delegate is to decouple the reference object call from actual methods Suppose in Class A implementation so that when new methods are added to Class A we need not change the delegate object call
 
@Euridice01 Ok, now we're getting somewhere. Tehre are two entities, each one having a collection of sub-entities, and you want to copy the sub-entities from one entity to the other?
 
@Shilpa The concept of a delegate is just first-class functions.
 
I have a deserialized json object
into an entity
and I have another deserialized json object into the same entity type
but I want to return the data as one entity
so I need to put the entities together
 
you you want to merge them?
That might be best done at the JSON level
 
@KendallFrey Can you elaborate on what it means as first class function?
 
2:11 PM
@Shilpa A function as a data type, that you can store in a variable, and pass to other functions
@Shilpa Don't repeat your message, edit your first one
 
y r u so rude
@kendallFrey
 
I'm not rude, I'm just pointing out how this chat works
 
I am also using it from last few years but never met someone who talks like this
 
Hey Sensai, when i have a Server-Programm that looks like this:
https://gist.github.com/anonymous/e6a31d6fb1ceb01e70b55462b75f23f7
Would the Garbage Collector "stop" my Server.
Correct me if i'm wrong, but the GC frees all unused ressources and destroys all objects, that arn't used anymore.
So at the end of the Main() Funktion the objServer- Object isn't used anymore so it will be destroyed and eaten up correct? This would result in the "Server-Tread" to stop it's work.

Or am i just totally confused and should stop thinking today?
 
@Nerdintraining Normally the GC stops all code while it is running
There is a "server" mode for the GC that doesn't do that, IIRC
 
2:16 PM
So the GC starts running, pauses all threads, finishes runing, resumes all threads?
 
pretty much, yes
 
So if the GC runs, consumes the "tServer"-Object at the end of the "Main()"-Method, the actual Thread (which is represented by tServer), doesn't really care and just resumes its work afterwards?
Oh gawd, i need to find a way to invoke the GC by hand,
BRB
 
The GC is designed to be magic and invisible (aside from in low-latency code)
@Nerdintraining GC.Collect()
But why?
 
To test if "tServer..processConnections() still runs after GC
 
Why does it matter what order stuff runs in?
 
2:21 PM
Guys, the enterprise Database class - AddOutParameter method
 
@KendallFrey yes I want to merge the entities and not before then
 
what does the Size parameter expects? The documentation says its the maximum size of the return value
 
@Euridice01 So what's your question?
 
Nah it doesn't matte in what order, but i care that it runs xD

If .processConnections() isn't being executed anymore, no1 can connect to the server.
I was just wodnering if i have to keep the reference up or not.
 
so for Nvarchar(10), it should be either 9 or 10?
 
2:22 PM
@SamyS.Rathore Then that's what it expects
@SamyS.Rathore Why would it be 9?
 
both gives index out of range exception
 
@Nerdintraining I don't understand. If an object goes out of scope, it disappears. What's the issue?
 
string.Length? idk :(
 
an event raised from a wcf service self hosted in a wpf host can be handled in this way: stackoverflow.com/questions/139809/… anyone know how the reverse would be done? wpf raises the event, wcf service listens to it?
 
https://gist.github.com/anonymous/e6a31d6fb1ceb01e70b55462b75f23f7

.processConnection() basically handles all incomming request to connect to the server.
Now, the object is out of scope (i will not interact with objServer anymore) but the funktion which is executing the actuall server is still running (.processConnections() is essentially a while(true) loop))
 
2:26 PM
i'm a total idiot, don't mind me..:|
 
@Nerdintraining processConnection has a reference to its instance. You can't GC something that has references to it
 
I figured what I was doing wrong
 
@KendallFrey thanks for your time Kendall, i get the feeling i have to read into the subject Garbage Collection in more detail to get rid of my fears :)
 
The GC will never collect something that you're using, or can still access in any way, with the exception of WeakReferences.
 
So how does mighty GC know when to collect?
Time?
Logic?
Tests?
 
2:32 PM
@Nerdintraining Whenever it thinks it's worth it
and it usually does a partial collection, for performance
A full collection doesn't happen very often
I think the actual logic is based mainly on memory usage
if there's a lot of free memory, it may not collect for a while
 
 
@KendallFrey mkay interesting..
 
3:04 PM
Thoughts on factories producing interface implementations vs abstract class implementations?
 
@Nathvi The answer is "yes"
my preference is expose interfaces. However these are implemented - via abstract classes or whatever - is entirely irrelevant
 
How is interface vs abstract class irrelevant? Interfaces allow for multi inheritance, abstract classes do not.
@Squiggle
When I say interface, I mean the interface type in c#, not the general concept of coding to interfaces with multiple implementations
 
when you're talking about factories, you're talking about creating class instances, right?
 
Yessss
SomeType x = SomeTypeFactory(Implementaitons.ImplementationXYZ);
Or something like that
 
so what does it matter whether you expose a type or an interface?
 
3:12 PM
because, of multi inheritance
 
but that's hidden inside the factory
unless you want to check the type or subtype of the instance created by the factory, in which case you can probably avoid that
 
Ok, let me try and think of an example
 
plz :)
 
If you have a class
Cat : IMammal, IPet
 
OK
 
3:15 PM
and another class,
Dog : IMammal, IPet
You can have factories for IMammal, and IPet
 
IPet Voice()
 
Indeed you could.
 
You couldn't do that, if IMammal, and IPet were abstract classes
Dog : Mammal, Pet

wouldn't work
 
well, no it wouldn't work because C# has no multiple inheritence
 
can only be one Base class
 
3:17 PM
So it seems to me, you reduce flexibility
 
but you're asking about the factory
and factories can only produce something of a single interface or type, right?
so I'm asking "why does it matter whether or not it's an interface or class?"
 
true
 
you could have PetShopFactory.GetPetForPersonOfAge(4); which would produce either Goldfish: IPet or Goldfish: Animal
so... IPet GetPetForPersonOfAge(int x) {} or Animal GetPetForPersonOfAge(int x) {}
 
True
 
you shouldn't be doing things like var animal = (Animal)pet; anyway
 
3:23 PM
@Nathvi interface is a contract, abstract class is not.
 
^ hence my preference to use interfaces, because they're more 'portable'.
 
@Nathvi Imagine I want something to explode, just tack on IExplodeable on everything that can possibly explode. They sure don't share anything, because that car and airplane might be exploding vehicles, but that chemical compound was not!
But they all explode! #explosionsforlife
 
lol,
Yes, coding to interfaces looks like the way to go
 
Similarly, IFuckable can apply to non-mammals too.
 
:(
:o
 
3:26 PM
@RoelvanUden like Cars!
 
Exactly like Cars!
 
What's especially nice is being able to write your own interface and apply it to an existing type. Oh, wait, damn, this is C#.
;P
 
Sheet sheet go away you Haskell Frey
 
you can sort of do that with extension methods... :o
 
class Car : IFuckable<Dragon>
 
3:27 PM
Kendall knows his bad memes
 
I'd look, but I'm at work
 
@Nathvi But then you can't do the reverse, which is create a new type and apply an existing interface
@Squiggle ( Í¡° ͜ʖ Í¡°)
 
fak
 
did you just google it?
 
I'm guessing it's not sfw
so no
 
3:30 PM
Golang has allows for duck-typed interfaces.
you can implicitly implement an interface just by having the right signature. You don't even need to declare it.
I'm still not sure whether that's good or bad, but at least it's compile-time safe
 
just curious... how often do you guys use factory pattern?
It seems like it would be pretty useful
 
War
@Nathvi rarely but it's good in an IoC scenario
I use a controller factory and a service factory
thinking about adding a datasource factory
 
IOC is basically the ability to inject concrete implementations into classes right?
@War, when you say service, you mean windows service?
 
War
sort of ... but yeh that's one of the things you can do with it
 
What else can you do with it?
 
War
3:36 PM
@Nathvi no I mean business service from my service layer
 
@Nathvi use as in call, or use as in write? former: lots. latter: not so much.
 
War
@Nathvi imagine you have a web stack that allows to serve up an API you might choose to structure your code like this ....
request => controller => service => data source => db
I use a factory to construct the controller and service parts
 
@KendallFrey, why don't you write them?
"not so much"
 
I don't think they're that useful
Sometimes I do
But I see them in places that don't really make sense to me
 
example?
 
3:40 PM
behold! The Enterprisey world of Java!
SimpleBeanFactoryAwareAspectInstanceFactory
 
That's so simple!
haha
 
it's a factory that produces a factory that produces modules
as much as "aspects" and "beans" are considered modules
Java </3
 
My favourite bean is the Paula bean.
 
dear god
Well, you know...
That is just obnoxious
 
3:44 PM
No, it's brillant.
 
there's a nice factory
 
@Squiggle dat url doe
 
FizzBuzz Enterprise Edition
 
Christ
 
makes you almost want to code in JavaScript
anyhow. my brain hurts and I'm going home.
cheerio! o/
 
3:45 PM
@Squiggle but I already do
Java Language Support for Visual Studio Code has landed http://developers.redhat.com/blog/2016/09/19/java-language-support-for-visual-studio-code-has-landed/ via @rhdevelopers
2
 
o no
 
4:36 PM
@KendallFrey Brillant.
 
War
@Squiggle only in java world!
 
4:51 PM
Question... So I'm implementing a factory like...
Is this an acceptable way to do this?
Any suggestions?
It's not done, just the general idea
 
@KendallFrey wow...
 
5:33 PM
@Nathvi Just call the method CreatePublisher
or just Create
 
6:06 PM
@scheien, yes, but then I have to pass parameters for every stinking implementation...
@scheien, for example, the parameters used to create a udp publisher and a IPC publisher would be different, no?
 
user1881400
@Nathvi If you're talking about having to create every permutation of the UDP / TCP / IPC combinations, then you could try the Builder pattern, I guess. Having multiple permutations as a result of similar classes is a known downfall of the Factory pattern.
 
@Nathvi this might help youtube.com/watch?v=rtXpYpZdOzM
 
I'll check out the builder pattern @JoshuaLamusga
 
user1881400
6:23 PM
I know the basics for HTML, Javascript, some jQuery, and CSS. I've got a C# program I'd like to rewrite with JS for the web. I was wondering what the best way to do that was, since nowadays there's a ton of web deployment tools and I don't know any of them (I've heard of asp.net, though). Does anybody with web experience know the best way to go about that?
 
anyone know why you can't do a "contains" search in lucene? or why some fields aren't searchable?
 
user1881400
@Bardicer I have no idea but this is what I found with Google, which may/may not be helpful at all since I've never heard of Lucene. This I think is how, not why: http://stackoverflow.com/questions/5484965/howto-perform-a-contains-search-rather-than-starts-with-using-lucene-net. This looks like it might deal with fixing unsearchable fields? http://stackoverflow.com/questions/650643/lucene-indexing-store-and-indexing-modes-explained

Probably not helpful, but oh well.
 
6:43 PM
@Bardicer You mean there are some fields that are set to be indexed but you still can't search them?
 
@KendallFrey i've not done anything with lucene in the past
i'm using luke, and i pull up a document and i see there's fields in the document
but if i do a search on that field, it returns zero results
wouldn't all the information in the index be searchable?
 
Yes, but if a field is set to not be indexed it won't be searchable
 
ah
ok so i should look at the indexing stuff to make sure the fields are set searchable
that's a different rabbit hole lol
i don't know why we're using lucene... sql server should be able to work just fine
 
Can somebody code a simple example explaining the difference between the Factory vs the Builder design pattern?
 
Guys I have a question
What is the difference between
private SomeHelper someHelper;
and
private SomeHelper = new someHelper();
I want to do it in the begining of the class
Which one should I use
 
user1881400
6:54 PM
@Nathvi Try dofactory.com/net/design-patterns and go to the builder and factory pattern pages near the top. You can explore other design patterns on this site, too. I found it helpful when I was researching design patterns myself.
 
@JoshuaLamusga, thanks
 
@Obviously well the second one is a compiler error
 
:)
 
And the first one isn't instantiated
 
user1881400
No problem, Nathvi.

@Obviously the second one should be private SomeHelper someHelper = new SomeHelper(); You forgot the variable's name and you set it equal to a non-existent class (because C# is case-sensitive, SomeHelper != someHelper)
 
6:56 PM
@JoshuaLamusga, Very well explained. I think I understand it now
 
7:07 PM
hello guys i have a question
i have a Winforms program
that connected to a mysql database
 
I have the solution. Don't have a Winforms program.
Have a WPF program.
:)
 
HAHA
lets finish
when i insert arabic text it wouldbe ???????(Question mark)
inside the database
what is the solution?
 
What encoding are you using for the aribic?
 
UTF8-generalci
general_ci
 
Is that encoding supported in your version of mysql db? I doubt it
 
7:09 PM
i'd totally add a smart aleck remark... but i'd get tarred and feathered and it wouldn't be taken as 'sarcastic funny' :(
 
this is the DB
CREATE DATABASE sana
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;

CREATE TABLE users(
id TINYINT PRIMARY KEY AUTO_INCREMENT,
fullname VARCHAR(50),
username VARCHAR(20),
password VARCHAR(64),
phone VARCHAR(16),
level BOOLEAN,
salary VARCHAR(20),
salaryunit boolean,
startdate DATE,
starttime TIME)
ENGINE=InnoDB DEFAULT CHARSET=utf8
DEFAULT COLLATE utf8_general_ci;

CREATE table itemcategories(
id TINYINT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(20))
ENGINE=InnoDB DEFAULT CHARSET=utf8
 
@JoshuaLamusga, so, the builder pattern, Is just a way to build an object, in a certain way
so it's basically a constructor, moved to a different class ...?
 
!!tell hamreen format
 
@hamreen Format your code - hit Ctrl+K before sending and see the faq
 
Hey All, I have an application I'm working with that has this in its' <connectionStrings> section:
    <add name="BridgePOADB" providerName="System.Data.SqlClient" connectionString="data source=;initial catalog=BridgePOA;integrated security=False; User ID=; Password="/>
What does the empty data source=; imply?
 
7:13 PM
A broken connection string.
It might default to localhost but I've never seen that before.
When in doubt - connectionstrings.com
 
@mikeTheLiar so if it's in a production application that's a good indication of a bad program?
(obviously not necessarily, but generally?)
 
user1881400
@Nathvi I was thinking, depending on your code structure, you'd use it something like

CreateUdpPublisher()
.SomeParameter(1)
.SomeOtherParameter("abc")
.MaybeAFlag()
.Build()

So instead of having to create a separate class like UDPParameters, you can combine both into one. This sets variables for the object so that when you .Build(), you get the new object with those settings. That way you don't need two classes and you don't need to package up a UDPParameters object just to use in a factory because, at that point, the factory pattern is probably slowing you down.
 
Well. I've never seen it before. That doesn't necessarily mean anything other than the fact that I haven't seen it before.
But yeah. connectionstrings.com is a pretty awesome resource.
 
Hey guys
I need help about creating a database for my c# project, I'll have to show the datas randomly from the database after that and i've created a MS access database(.mdb) file.
Is that a good option?
Using MS access database ...?
 
MS Access should be doused in gasoline and set on fire. i'm just saying.
 
7:22 PM
I mean, It sounds like there are other options like sql database or something else... i need to know which one is the simpler way to do that...
thanks
@Bardicer - Thank you for your cooperation :), But, i just have to know, Which one is the simpler way?
Or at least, Is that a good choice?
 
i'd look into mysql or sql server before i'd go access
 
Hmm, I thought so but, I had access to Ms access first...
 
See also sql Lite
 
i used access back in college... it was a pain in the rear
 
:-?
hmm, looks like a good idea
Yeah, It seems so
but let's do the stuffs with a different way for now ;]
 
7:46 PM
I just want to do a simple connection and read from Table1 some record...How can i show a record in a richtextbox after that?
I'm not sure if this code is working, Taken from: stackoverflow.com/questions/23886747/…
 
richtextbox.text = dt.Rows[1][1].ToString();
 
:-?
Hmm, yeah i knew it some but, An error has just ocoured even before adding some lines like this: imgur.com/a/LEo0w
It seems like the problem is on this: Provider=SQLOLEDB
 
need to see the connectionstrings.com
 
Hmm, yeah
 

« first day (2165 days earlier)      last day (2780 days later) »