« first day (2 days earlier)      last day (4937 days later) » 

6:11 AM
wow, information overload.
 
6:38 AM
hi, does any one knows how to do simple graphics operation in WPF similar to GDI+ in c#??
 
7:00 AM
hi, does any one knows how to do simple graphics operation in WPF similar to GDI+ in c#??
 
7:34 AM
Isn't GDI available in a WPF application?
 
GDI not in WPF
 
But isn't a WPF application just a normal .NET application with a different GUI system? Surely the normal .NET classes are available there?
 
7:59 AM
Petzold wrote a whole book on graphics operations in WFP. That was 3D, so basic graphics must also be possible.
 
@VinodMaurya what sorts of graphics operations?
 
 
2 hours later…
9:39 AM
Hello, does anyone know what exactly this System.Security.Cryptography.RijndaelManaged is used for
 
"Rijndael" is the original name for the algorithm standardised as AES
AES removes many of the Rijndael options for key length down to three.
In cryptography, the Advanced Encryption Standard (AES) is a symmetric-key encryption standard adopted by the U.S. government. The standard comprises three block ciphers, AES-128, AES-192 and AES-256, adopted from a larger collection originally published as Rijndael. Each of these ciphers has a 128-bit block size, with key sizes of 128, 192 and 256 bits, respectively. The AES ciphers have been analyzed extensively and are now used worldwide, as was the case with its predecessor, the Data Encryption Standard (DES). AES was announced by National Institute of Standards and Technology (NIST)...
 
 
2 hours later…
12:02 PM
Gah, ReSharper won't load
 
 
4 hours later…
4:16 PM
Hi all
 
@LasseVKarlsen did you get your R# fixed?
 
4:49 PM
Yeah, had to download and reinstall, apparently known problem
Some trial expiration code that kicked in for a lot of people today
 
ouch
i love resharper
 
it pains me when i go to other developers box and start trying to alt+~, crtl+t around
 
was that the licence expiry problem? I thought they had fixed that
I am running version 5.1.1753.4 and seems fine
you need to follow @resharper on twitter to get the latest updates
 
Yeah, I haven't been on twitter for the past few days
I don't know when they fixed it, could be last week or whatnot, dunno
But easily fixed
 
4:57 PM
@LasseVKarlsen think it was only on Friday
anyone else get the SO feed popups on this room? How do we stop them?
 
it is a room setting, not individual
 
@rchern thanks
@LasseVKarlsen - as the proprietor of this room, can you tame those feed popups? Or is just me that doesn't like them?
 
i've no qualms with it (:
this is also the less annoying of the 2 feed options
 
would be ok if it auto dismissed after a few seconds (:)
 
5:13 PM
that would be something for the Chat Feedback room i guess
 
are these feeds possibly redundant?
after all, if we wanted to, we could log onto so.com and search on the C# tag
 
it's purely a convenience
 
@TimRobinson Yes it is redundant, but the question should be: is its convenient? To which the answer is yes. (Saves remembering to hit F5.)
 
5:36 PM
hi all
 
hi @UGEEN
 
so I take it that it's not just that I cannot find the option to auto-hide the feed panel; the option itself doesn't exist
 
that would be correct. a feed either exists for the room or doesn't.

Chat feedback

Problems with chat? Let us know...
 
Feed removed
 
):
 
5:49 PM
@LasseVKarlsen ty
 
6:00 PM
has anyone here done Java development?
I have some new Java work coming up and am curious what useful info someone who has gone through that transition (C# -> Java) might have
 
@akmad try asking that in a Java room :)
 
@PiersMyers did that, just thought I might get some additional thoughts here :)
 
6:25 PM
Question about n-tier applications. Should the DataLayer know about your other layers? For example, if I wanted to save an "Order" objet I'd pass that to the business layer for validation perhaps and then the BLL sends it down to the DAL. My question is, does the DAL accept the object directly or various params representing the object?
Also when pulling objects out of the DAL, does the DAL pass back hydrated objects or just generic data that the BLL uses to construct the object?
 
You typically have two types of objects in play
Those you return from the DAL, and those you return from the BLL
They may map 1-to-1, but not always
With Linq2SQL and Entities, you usually use the objects defined for those systems in your DAL's
But then create new ones that the BLL return outwards
 
Okay, that makes sense. So having a DAL method of SaveOrder( Order order ) makes much more sense than SaveOrder( int OrderId, int CustomerId, .... ). Obviously you could overload it that way if you ever needed to, but it's "ok" to just pass Business Objects directly into the DAL.
 
Well, you're not passing business objects to the DAL
You're passing Data objects to the DAL
 
Hmmm, ok. I guess I don't understand the distinction as I haven't had the pleasure of working on a properly engineered project. Any good examples?
 
The typical application these days seems to consist of: DB -> Service -> UI, I tend to design my layers so that the fit like this: DB -> DAL -> BLL -> Service -> UI where the DAL deals with db models and the BLL transforms those into ViewModels (or whatever goes to the UI)
the DAL tends to be very small when using an ORM like LinqToSql because it IS the DAL
even when not using an ORM, my DAL is normally concerned with processing DbCommands (or whatever is appropriate for your backing store) but not specific model objects
the goal being to abstract the underlying RDBMS from the BLL which utilizes it
 
6:42 PM
I guess I'm looking at Figure 5 in this article (which was linked from similar SO question) and trying to map it what you guys are saying. In this regard it does seem like the DAL is constructing the BO directly and the BLL is then just passing it along.

http://imar.spaanjaars.com/476/n-layered-web-applications-with-aspnet-35-part-1-general-introduction
But perhaps that's not the best approach. I just started fiddling around with .NET MVC so I get what you're saying about ViewModels (somewhat). That does makes some sense.
 
well, to answer your specific question above... i would not have a SaveOrder method in the DAL at all, that's a BLL concern
the DAL would have stuff like: ExecuteReader(...), ExecuteScalar(...) and the like
and is just a simple wrapper around the ADO.Net base types
so that you can connect to any ADO.Net datasource without messing with your BLL
once again, this obviously assumes that you are using a traditional DB as your data store
 
Agreed, but then how does the BLL tell the DAL how to save the order? Surely the BLL doesn't construct the SQL statement directly (assuming you're not using Linq or Entities).
 
well something has to know how to map an Order object to a sql table, right?
 
Haha, yes this is true.
 
i guess that could be in the DAL, but even without an ORM I would still write something to generate that kind of code
note, this is why LinqToSql is awesome: it's dead simple to get it working and saves you a ton of work
 
6:49 PM
Yeah, it's tedious doing it by hand, but that's the background I'm from. The only two jobs I've had have pretty much done everything with stored procedures, which I do like. I just haven't the exposure I need to any type of ORM and haven't forced myself to use one. I guess that's next on the list.
Perhaps tickering with Linq and/or the Entity Framework will make things more clear. :)
 
Yeah, I found it really helpful just to play around with it
 
7:39 PM
I need to convert a child class to a sibling class. Ex: ItemA and ItemB both inherit from ItemBase but have additional properties. I need ItemA to become ItemB. I've tried casting ItemA to ItemBase then to ItemB but that doesn't work. Should I use an interface to allow the casting? Is there a better approach?
 
that's not a legal cast
 
Could I do something like ItemB newItem = (IItem)instanceOfItemA ?
or = instanceOfItemA as IItem?
 
no
you're confused about how inheritance works
an ItemA is not an ItemB type
 
I know, they both come from the same parent with mostly the same properties, and I don't want to do a line by line equals to convert them. Any suggestions?
 
move the same props into a base class and create a .ctor overload to create one from the other
 
7:43 PM
the same properties are in the base class, ItemA and ItemB directly contain the different properties that are independent of each class
where would you put the constructor? in the child classes? or in the base class as a factory style?
 
the child classes
 
and then do line-by-line equals to copy the values over?
 
note, that's just one option
 
right now I have "To<OtherItemClass>()" type methods but the line-by-lines suck
 
interesting, so you have a generic method that only works with a single type?
 
7:47 PM
sorry, bad syntax
ex:
ToItemB()
{
ItemB newB = new ItemB();
newB.PropA = this.PropA;
newB.PropB = this.PropB;
newB.PropC = this.PropC;
newB.PropD = this.PropD;
return newB;
}
 
I would use AutoMapper
 
here is an example:
 
ah, I understand
 
ToItemB()
{
ItemB newB = new ItemB();
newB.PropA = this.PropA;
newB.PropB = this.PropB;
return newB;
}
ItemBase currently has 5 child classes and about 20 properties
so this is a TON of code that requires a lot of maintenance as the objects change
 
that kind of method is fine as well, and the aforementioned AutoMapper will handle alot of the conversion
 
7:49 PM
Can you iterate over the properties with a foreach() and check to see if the property is inherited from the base class and just copy it over? Seems like that would be possible.
 
if I did reflection, would really rather find a more elegant solution
 
such as AutoMapper ;)
 
i'll look at that akmad
i also considered setting up an AddItem(IItem instance) method to the owner of the ItemA/B instances, and have it handle the conversion but if I can't cast using the interface then it wouldn't work
 
so to answer your original question, you cannot validly cast an ItemA object to an ItemB object
so AddItem(IItem instance) would never work... however
if you only need to perform ItemBase (IItem) operations on things stored in AddItem, then you don't need to try and cast
 
7:53 PM
I also considered changing my item owner (an order with a list of ItemA/B) to have a list of IItem so it doesn't care which class it gets
 
exactly... thus you reap the benefits of an OO design
 
the situation is similar to an order with line items (not quite but close enough), I have different types of orders and different types of items in them, the items are similar and the orders morph from one type to another
and they eventually are morphed into classes outside of my system but I am doing ToXYZ methods to handle that from the ItemBase class (problem solved there)
 
if your items and orders can change from one type to another you might want to consider that a type hierarchy (which doesn't support that) is the wrong design choice
 
if I didn't do type hierarchy, what other options are there?
 
for example, you may want to have single Order and Item types that support changing from one kind to another via property changes or a method
 
7:58 PM
then I have properties that relate to one type and not another shared in the same object
those unique properties are related to the state of the item as it moves along the path
 
what would happen to the unique property values when you convert an item to another item type?
 
it is no longer used
 
so only the common properties that are defined in the ItemBase type get carried over to a new Item instance when the type changes?
 
precisely
 
then do this:
public ItemBase(ItemBase copy) { .... //copy base properties }
as a .ctor in your ItemBase type
 
8:02 PM
yeah, I did consider something similar, I think that will work
 
then any ItemBase subtype could just call that .ctor for new instances from an existing item
 
it doesn't solve the line-by-line equal statements but it cut down the number of times I do it to a single method and keeps that code in the shared location
 
you can still use AutoMapper if you like, but there is a slight perf impact
 
I'd rather have a single method to maintain than to get acceptance for a new library from the high powers
I'll still look at it though, sounds pretty interesting
thanks for your time akmad
 
np!
 
8:28 PM
In my quick mockup, the .ctor(BaseItem item) worked well. I was also able to build a version of it using .ctor(IItem item) but for now I'm going to go with the former
 
9:29 PM
Hello there, I could use some help with getting the lib Html Agility Pack to work properly, I get the following error: 'HtmlAgilityPack.HtmlDocument' does not contain a definition for 'DocumentElement' and no extension method 'DocumentElement' accepting a first argument of type 'HtmlAgilityPack.HtmlDocument' could be found (are you missing a using directive or an assembly reference?)

My code is located here: http://beta.yapaste.com/55
Nobody?
 
are you missing a using directive or an assembly reference?
 
Thats what it sounds like to me
 
But how can I know what assembly reference I need?
 
you need to reference the library you linked to
 
The only one that came with the lib is the one I'm using
I am referring it
 
9:38 PM
sorry, lib you referenced in your error message (not linked)
namespacing issues?
 
HtmlAgilityPack.HtmlDocument ?
 
are you using the lib as compiled by the project group or did you download the source and compile?
 
The one that already was compiled
 
what other errors/warnings do you get?
 
9:40 PM
maybe one about not being able to find the reference
 
what version of the framework are you compiling to?
 
The name 'body_node' does not exist in the current context
 
@Victor, take a screenshot of your references section from the solution explorer?
 
@rc
 
My guess is your project is set to compile to 3.5 or 4.0?
 
9:43 PM
4.0
Client Profile
 
try commenting out the code that uses the reference and building just to get a successful build first
shrugs
 
try changing to just 4.0, i've heard of problems compiling to the client profile
 
Only 4.0 did not succed any better and by commenting the code that uses the reference I get no errors
succeed*
 
Hey its my first time in here, not sure if can post code up but I can't figure out what to put into Google so I thought i'd consult everyone here. If I have a select new projection can I reference one of the properties in another property? I want to extract the extension below without having to dip back into the database:
select new MediaItem
{
Caption = "",
RealFilenameAndPath = GetRealImageFilenameAndPath(i.ImageId),
GeneratedFilename = string.Format("{0}_JPG_{1}.{2}",
p.AGENT_REF, i.SortIndex, Path.GetExtension(/*WHAT HERE?*/)
(excuse the all caps variable name that makes it looks like i dont know what i'm doing, i'm just mirroring the variable names in the RightMove.co.uk API)
What I want in the /*WHAT HERE*/ part is the extension of the RealFilenameAndPath property above it
 
why not:
var filePath = GetRealImageFilenameAndPath(i.ImageId);
// then your stuff using the above variable
oh wait... i see that you're in a Linq context
 
9:52 PM
yeah, its part of a linq selection. I'm converting a collection from one format to another to isolate the RightMove library from the linq to sql
I think it might not be possible but just wondered if there was some notation I didnt know about
 

« first day (2 days earlier)      last day (4937 days later) »