« first day (728 days earlier)      last day (4218 days later) » 

5:00 PM
@Jason I think that UserExperience is also in maintenance
 
hello everyone
 
Hey! :)
 
got an issue/question about mvc, and as the mvc chat is empty, anyone willing to help me? :p
 
@fjdumont What's MVC?
 
its some type of asp.net (web) application that tries to separate data, visualization and business logic
(model, view, controller --> data, visualization, logic)
 
5:05 PM
Sorry I do not think that I know this :D
 
was worth a try though :)
 
I don't use MVC much, but have tinkered with it
what's the question?
 
What were you going to ask, @fjdumont?
 
hmm, let me try to explain it concisely
the idea is to input an unindented xml into a textarea, submit the form and have it back formatted and indented
so theres a strongly typed view that has a Html.TextAreaFor(m => m.Xml)
and an appropriate function that has an argument IndentXml(IndentXmlArgs args), applies the formatting and writes the result back into args.Xml
just before returning the view via return View(args)
somehow, the input element doesnt show the new (formatted) data
 
mmmm math for breakfast
 
5:13 PM
is IndentXmlArgs a type you've defined?
and what's the type of its .Xml property?
 
IndentXmlArgs is a custom model, yeah
.Xml is a string
 
Hmm.
Is it an entity type?
or a POCO?
 
its a poco
 
typically 'I return the instance and nothing happens' smacks of something funny with argument-passing semantics (ref vs value etc) but I don't think that should be a problem here
and if it's a POCO there's no weirdness to do with entity updates or anything
have you dumped the formatted result to, say, a log or the immediate window to see that the process is actually happening?
 
the process is happening, the debugger told me
from within the action, everything looks perfectly fine
need to say that i'm fairly new to mvc, though
maybe i just missed an important concept that i should know of :p
 
5:22 PM
oh yeah, I don't really know MVC either, been poking around at it but haven't used it in anger
everything you've described sounds sane
can we see the content of IndentXml()?
 
sure, just a sec
the signature is string IndentXml(string xml)
and here's the view and controller, in case you can spend a few seconds on checking it :p
oh well, theres the problem
 
is the output neither indented nor newlined?
or newlined but not indented?
 
both :p
@Html.TextAreaFor(m => m.Xml) is the bad guy
 
hrm.
yeah?
 
he escapes all \r\n to nothing
 
5:34 PM
F4U12
 
@Html.Raw(Model.Xml) works just fine
 
thanks a bunch, MVC team
why would you want that?
 
meh, fiddling with this took me over an hour
i feel so dorky when playing around with newer stuff
anyways, thanks a lot for your ideas and input!
 
wait, what the hell
how could that behaviour ever possibly be useful for anything?
So if you pass it a page of prose, it forces all the newlines together? That's utterly useless
 
you wouldnt use Html.TextAreaFor for that case ;p
probably something like <p>@Model.Prose</p>, which would work fine as well
 
5:45 PM
Ah. Now I think about it, duh. Presumably that element wraps when rendered by the browser
 
5:59 PM
-4
Q: stackoverflow - when is the time to say thanks

dorjeduckNow I think. Thank you stackoverflow team and people active here for all the answers I found here which would have taken me ages to figure out alone if at all. As I read your about your efforts around the datacenter you are making this weekend i felt like posting this and happy to be down voted...

Lol
You would think it would be accepted with grace :P
 
@LewsTherin Page Not Found
:D
 
The author removed it. Lol, I guess he didn't expect a flood of downvotes
 
Hahahahaaha :D
I suppose it was going to be closed anyways
 
Yep, true that.
 
Lews, got a twitter :D ?
 
6:02 PM
I never use it.
I created it once to test something I was developing.
Never logged in since then.
 
Oh, Okay.
 
I was actually thinking of canceling the account. Annoying emails trying to get me to log on
 
You can unsubscribe from their mail service
 
Yeah might do that.
Just too damn lazy to find the little link
 
        public static AngleUnitValue ToUnitValue<T>(this double value, IAxis<T> axis) where T : AngleUnit
        {
            return new AngleUnitValue(value,axis.AxisUnit);
        }

        public static LengthUnitValue ToUnitValue<T>(this double value, IAxis<T> axis) where T : LengthUnit
        {
            return new LengthUnitValue(value, axis.AxisUnit);
        }
Why is that illegal?
 
6:05 PM
It's included with every message you receive from them.
It's a Hyperlink with a 4-6 Font size at the end of the message
 
@JohanLarsson Can't you only specify constraints when declaring the type?
 
@LewsTherin how do you mean?
 
@PicrofoEGY Ha ha clever tards
 
One of the methods is legal
 
@JohanLarsson What do you mean by illegal?
 
6:06 PM
@JohanLarsson Oh ok nvm then.
 
but it says that the methods have the same signature
 
Well it does.
I see now
The return type does not define the method signature.
Many make that mistake ;)
 
@PicrofoEGY It says the two methods have the same signature which is true in a way but still
 
anyone familar with IOC containers?
 
@JohanLarsson ?
 
6:08 PM
@JohanLarsson AngleUnit could inherit from LengthUnit or vice versa
 
@LewsTherin I make mistakes all the time with generics except for the simplest cases
@TomW +1
 
having some issues getting my head around how they should be correctly implemented
 
Sorry, no experience whatsoever
 
@HansRudel You are probably better than me but post code?
I have only played around with them briefly
 
@JohanLarsson ill copy it over to pastebin, 2 secs
 
6:14 PM
        public static AngleUnitValue ToUnitValue<T>(this double value, IAxis<AngleUnit> axis)
        {
            return new AngleUnitValue(value,axis.AxisUnit);
        }

        public static LengthUnitValue ToUnitValue<T>(this double value, IAxis<LengthUnit> axis)
        {
            return new LengthUnitValue(value, axis.AxisUnit);
        }
That complies^^ but then I can drop the <T>
 
I guess IAxis<T> for both methods could be both AngleUnit and LengthUnit
Why not just have one sig?
 
I tried that but did not compile, w8
 
@JohanLarsson pastebin.com/KNGYwNYK
sorry for delay, VS was having a spaz
so atm im not using anything
im manually creating the classes. Prob is they are hanging around for the entire duration of the app
this app is small, but id still like to learn how to do this correctly
 
:5763431
        public static UnitValue<T> ToUnitValue<T>(this double value, IAxis<T> axis) where T : Unit
        {
            if(axis.AxisUnit is AngleUnit)
                return new AngleUnitValue(value,axis.AxisUnit as AngleUnit);
        }
 
from what ive gathered, i need to map the dependencies to IOC container. Is this always done in program.cs?
 
6:20 PM
Like that I get other compiler errors, it is in moments like this object or dynamic is tempting, spend a lot of time on something seemingly simple
@HansRudel I am not sure I understand completely
What framework are you using?
 
havent chosen one yet
 
is the question how you map?
public static class StructureMapBootstrapper
{
    public static void Load()
    {
        // Load the static ObjectFactory container
        ObjectFactory.Initialize(x =>
                                     {
                                         x.For<IDummyClass>().Use<DummyClass>();
                                         x.For<ISingletonClass>().Singleton().Use<SingletonClass>();
                                     }
            );
    }
}
 
no, should the mapping be done in program.cs. What does the constructors of the the classes look like?
 
hm, I dont know so add salt to the following!
Anyway here goes:
I would say keep separation between the IoC and you project, put the IoC in a separate project (it will have a lot of dependencies)
Next suggestion I have heard is to hide the actual IoC behind an Interface (not like my sample)
I instantly get a feeling of regretting writing that^^ (can be very wrong)
 
hmm ok
 
6:28 PM
but my feeling is that if you wire everything up in the Gui project it will create a lot of depencencies to be able to do the wiring
Is it a big solution by the waY?
 
no, its small. <5k LOC but id still like to do it properly for when things get larger
@KendallFrey have u got any experience with IOC?
 
Say no say no
Messing ;)
 
:5763580
        public static UnitValue<T> ToUnitValue<T>(this double value, IAxis<T> axis) where T : Unit
        {
            if(axis.AxisUnit is AngleUnit)
                return new AngleUnitValue(value,axis.AxisUnit as AngleUnit) as UnitValue<T>;
            if (axis.AxisUnit is LengthUnit)
                return new LengthUnitValue (value, axis.AxisUnit as LengthUnit) as UnitValue<T>;
            throw new ArgumentException("Axis does not have the correct unit","axis");
        }
 
@LewsTherin lol, @KendallFrey seems to be hiding anyway.
 
that compiles but not pretty, just moved the problems to runtime
 
6:34 PM
If it is going to be either AngleUnit or LengthUnit can't you just make them inherit an interface and constrain on that interface?
@HansRudel Probably waiting for a dramatic entrance.
 
they both inherit from Unit
 
So no need to check the type?
 
@KendallFrey, Drum roll. Explosions. Naked chicks dancing.
 
I need to check before casting
 
I don't know much about generics, but what you are doing so can't say.
 
6:36 PM
@LewsTherin above didnt seem to work :(
 
@HansRudel Cant you write the bootstrapping code in a separate class at least?
 
@HansRudel You'd think he would show up for naked chicks ;)
@JohanLarsson There should be no need to cast if they both inherit from Unit.
 
and new that from the entrypoint, same thing but a bit cleaner
:5763617 But I do this ugly thing:
            if(axis.AxisUnit is AngleUnit)
                return new AngleUnitValue(value,axis.AxisUnit as AngleUnit) as UnitValue<T>;
 
@JohanLarsson probably. As i said, i havent used it before so... Not too sure how it should be done. Done a few things in the past where i though i was doing it right. only later to find out i was wrong.
 
Gonna write tests for it now, then I will know better
 
6:38 PM
axis.AxisUnit is of type Unit right?
 
appreciate ur suggestions though + will keep them in mind
 
@LewsTherin yep
@HansRudel remember the salt
 
@JohanLarsson ;)
 
@JohanLarsson What does UnitValue take?
 
I think Kyle is experienced with IoC @TomW is better than me for sure
@LewsTherin LengthUnit, TimeUnit, AngleUnit, MassUnit etc.
 
6:41 PM
Ah nvm.
I just realized you had return new AngleUnitValue(value,axis.AxisUnit as AngleUnit)
 
but axis can only be LengthUnit or AngleUnit
 
Why not make your constructors take Unit?
Make life simple
 
and AngleUnitValue : UnitValue<AngleUnit>
I thoughht there is a point in separating them then it is easy to prevent LengthUnitValue + AngleUnitvalue
 
Right
Hopefully one day I understand it in depth.
 
If it is any comfort I struggle pretty hard with this and it is relatively simple
 
6:49 PM
Nah it isn't ;)
 
There is not much code at least
 
Not the size that bothers me
Just the <T> :
 
haha, you nailed it!
 
But the C++ one looks even scarier.
template<T> SomethingHere::blah(T int)
Or something like that
 
is that STL?
 
6:55 PM
Can't remember the exact syntax.
@JohanLarsson Nope, stl is just a library for collections and stuff.
 
@LewsTherin unit tests indicates that the above works
Really nice to have tests for that type of ugly
 
You must be a unit test pro ha ha
Which is really good.
I find it hard to write tests for code..
 
You guys are still talking about the code I did not understand? :D
 
Lol
I don't understand it too ;)
 
:5763802
        [Test]
        public void FromDoubleTest()
        {
            double expected = 2.0;
            AngleUnit angleUnit = AngleUnit.Radians;

            UnitValue<AngleUnit> unitValue = expected.ToUnitValue(angleUnit);
            AngleUnitValue angleUnitValue = (AngleUnitValue) expected.ToUnitValue(angleUnit);

            Assert.IsInstanceOf<AngleUnitValue>(unitValue);
            Assert.AreEqual(expected,unitValue.Value);
            Assert.AreEqual(angleUnit,unitValue.Unit);
Maybe not the perfect test but it tests that it works (does not throw)
If I change something inthe future it will throw and i get feedback from a red dot instead of a phonecall from Japan :)
 
7:00 PM
expected.ToUnitValue()
Is that method really there?
 
Should probably figure out som edge cases to test to
:5763820
        public static UnitValue<T> ToUnitValue<T>(this double value, T unit) where T : Unit
        {
            if (unit == null)
                throw new ArgumentNullException("unit");
            if(unit is AngleUnit)
                return new AngleUnitValue(value,unit as AngleUnit) as UnitValue<T>;
            if (unit is LengthUnit)
                return new LengthUnitValue(value, unit as LengthUnit) as UnitValue<T>;
            throw new ArgumentException("Unknown unit", "unit");
 
@JohanLarsson Did you do this?
 
Extension method, (I overuse them)
@PicrofoEGY One could argue you did it
No @LewsTherin did it
He suggested only one method
 
I don't understand it anyways :D :D
 
@JohanLarsson I can see why now ;) EM are tempting to use once you know how.
 
7:03 PM
what part?
 
I understand the content of the method but I do not know what do you mean by (T) and (where T)
 
2
Q: Is there a way to improve intellisense for extension methods?

Johan LarssonI have been looking for a feature that would give intellisense for extension methods etc. I am aware of the feature to auto-include namespaces upon class creation but that is not exactly what I'm looking for. I want Resharper to to keep a couple of frequently used dll's in cache so it could provi...

this line then:
public static UnitValue<T> ToUnitValue<T>(this double value, T unit) where T : Unit
 
@PicrofoEGY T just specifies the type that the generic method will take. where T says the type the method takes it must be of type T
The way I explained it is confusing.
 
@JohanLarsson Yes. :D
 
there are a couple of details:
where T : Unit means that T must be deriving from the class Unit
 
7:05 PM
@JohanLarsson Bookmarked
 
@LewsTherin Confusing! :D
 
Lol
 
@LewsTherin The answer is so sick <3 SO
 
@JohanLarsson Okay I understand this
and (T) is an object?
 
T is a type more
 
7:06 PM
Array?
 
Have you used List<T>?
 
@JohanLarsson Yep
List<string>
 
@JohanLarsson Yeah ha ha. Can't comprehend it now :(
@PicrofoEGY T can be a complex or primitive type.
 
@LewsTherin Like... :D ?
 
@LewsTherin just write . (dot) and shift + alt + space (if you have Resharper) Then you will se a list of all available extension methods
 
7:07 PM
@PicrofoEGY int or string
@JohanLarsson Oh yeah/
Might change the shortcut.
 
@PicrofoEGY If T must be a class you can write where T : class
if T must be value type you write where T : struct etc
 
Can you have a class definition Class<T[]>?
Doesn't make sense I guess.
 
Nevermind guys :D
 
@LewsTherin dont know
@PicrofoEGY w8
 
I think it is just T.
 
7:09 PM
@LewsTherin +1 :D
 
Lol
SO is down again. FFS
I <3 Astro
 
not for me
 
What?
 
SO up
 
What isn't for you?
Yeah it is back
 
7:16 PM
my d**k is not up :)
 
Lol
 
Duck? You said duck, right?
 
yes duck
 
Nawww, I just passed 400 rep and was all excited about it - now SO is down again lol :(
 
@JamesKent Down?
It is up for me
Kent! :P
 
7:24 PM
Yah, it's still down after a refresh of page for me: "Stack Exchange is currently offline, we'll be back shortly!"
Ah well, it's 6am over here.. time for bed I guess lol
 
Time for bed at 6am?
 
yeah, been working on a site for the last 18 hours. I get too distracted and forget to sleep sometimes lol
see ya's :D
 
What subject should I use when sending an email to a potential employer that hasn't contacted you, but you were told to contact them via a mutual contact?
I'm so awkward it hurts.
 
7:34 PM
@LewsTherin Listening to it right now :D
@SpencerCole "How are you" :D
 
@LewsTherin Feeling blue?
 
@LewsTherin He's very slow :D
The music is good tho
 
@PicrofoEGY Just the way I like :P
 
Reminds me of Coldplay
 
@JohanLarsson How do you mean?
 
7:36 PM
@PicrofoEGY I..? No? What?
 
but Coldplay is a bit faster
 
@SpencerCole Id say keep it simple, Hello I'm available
 
@PicrofoEGY I don't like cold play
 
@LewsTherin ballad
 
I wouldn't say it is ballad.. mmn
 
@PicrofoEGY The only Coldplay song I like is the famous one.
Viva la vida or something.
 
@LewsTherin Viva la vida is my favorite song
 
Two songs may be. Can't remember the second one.
 
@LewsTherin Violet Hill? Clocks? US Against the World? Paradise? :D
 
7:38 PM
Clocks
 
Yeah it's a good song
Ever listened to Usher?
 
@Bryan nice
wtf pic^^
 
@JohanLarsson watch the video without sound
 
Kinda lol but really good song
http://vimeo.com/11219730
Cool video + song
 
@JohanLarsson Listening to it :D
 
7:43 PM
it was a fkn swastika in the cover pic for the first vid for some reason
 
Never mind my connection was slow :D
It's loading
 
when discussion vid + song this should be mentioned (fastforward 3+ minutes of profanity)
http://vimeo.com/17634210
 
The video is hardly rendered by my Graphics Card! :D
 
lol
 
7:47 PM
Anyone ever listen to Mumford and Sons?
 
@LewsTherin yes.
I love them.
 
I loved (and love) Snow Patrol :D
 
@SpencerCole Great band ;)
@PicrofoEGY Loved?
I love
 
@LewsTherin My favorite song of theirs: youtube.com/watch?v=eltHv58l8ig&feature=related
 
7:48 PM
That is such a good song, but Gave You All trumps it :D
 
@LewsTherin The background music is awesome
 
Which background music? The one I posted earlier?
 
Here, listen to this song:
 
@LewsTherin That was better
 
@LewsTherin Mumford and Sons'
 
7:49 PM
Yeah it is really good.
@SpencerCole Will listen to it now
 
It's a great song.
 
Any SGU fans?
 
@SpencerCole Listening to it :D
 
Then you probably like:
http://www.youtube.com/watch?v=hFxwq33rVAs
Fits really nice with the scene a 1+ minute
 
7:52 PM
@SpencerCole Is it just music?
 
No
It's got lyrics.
 
Dying has never been so cool.
 
@SpencerCole Oh he started singing :D
 
@PicrofoEGY he does that =D
 
This hat looks awesome :D
 
7:55 PM
@LewsTherin +1 I really like Jonny Cach when he got old, his broken voice gives serious goose bumbs <_spelling?
 
Johnny Cash.
 
@SpencerCole I think that I enjoy the video more than the song :D
 
@PicrofoEGY Same lol
 
I must have listened to those two 1000+ times, so sick live. Tight uptempo and mesmerizing stage performance
 
7:56 PM
@JohanLarsson Soul?
 
@PicrofoEGY It is a great video.
I love the song, too.
But yeah.
 
@LewsTherin soul? I dont understand
 
Alright, I'm off to go get some food before I head out to this Halloween Party. Ciao, folks.
 
@SpencerCole See you later Spencer :)
 
@JohanLarsson soul music
 

« first day (728 days earlier)      last day (4218 days later) »