« first day (2042 days earlier)      last day (2892 days later) » 

Bmo
1:01 PM
I might have a colleague who was the keynote speaker at DumbCon
 
lel
 
@Michael draw.io ?
 
@Bmo lol
 
Checking in a lot of code at 16:00 on a Thursday. A step up from my usual 16:55.
 
user47589
good morning
 
1:04 PM
good morning
 
morning
 
Good morning Amy!!
 
Good murnin
 
Hi guys, I am working on an MVC .Net project. I have a controller where I have two methods: GET and POST. Now on Get method, I am filling some text boxes in the view with the model properties. What I need is to have the same instance of this model object returned back to the POST method. Is there any way I can do this?
 
no
 
1:07 PM
@Hanady nope
 
It's not possible
 
WebAPI people. I got something that doesn't sit right. There's two(ish) ways to declare an action in a controller...
[HttpGet]
public async Task<ActionResult> GetThing() {
   return Ok(new Thing());
}

[HttpGet]
public async Task<Thing> GetThing(int id) {
   return new Thing();
}
the first approach is clean and HTTP-esque.
the 2nd approach means you can generate really nice documentation for your API.
Which do you use? and why?
(ignore the crappy broken async pseudocode)
 
@Hanady Why do you need it
 
@Sippy ohh so how can i keep the model info if i need to update it in the database? for example if I have a class having 3 properties, and i updated one of them, how can i return back the same model object to the POST method?
 
@Hanady Can't
That's not how it works.
 
1:10 PM
For the first approach, the new MVC5/core approach doesn't have the ability to decorate your actions with typing.
For the 2nd approach, you have to throw exceptions if you want to return non-200 HTTP status results
 
You can pass the values back, you cannot pass the object back.
 
it stinks and I don't know the right way D:
 
any specialist with outlook api?
 
@Hanady do you have different view models and database models?
 
Bmo
    [HttpGet]
    public IHttpActionResult GetThing(string id)
    {
        try
        {
            return Content(HttpStatusCode.OK, new Thing());
        }
        catch (Exception ex)
        {
            return Content(HttpStatusCode.InternalServerError, ex.Message);
        }
    }
 
1:11 PM
lol. From today's TDWTF:
if (Thread.CurrentThread.ThreadState != ThreadState.Running)
    return false;
3
 
@Squiggle clean and http-esque, because you shouldn't be writing code based on how nice the docs will be
 
@mikeTheLiar lol
 
@Sippy ohh.. but what is i don't have all the properties of the class in the view?
 
Bmo
Is what I've been using but I'm feeling around in the dark.
 
@Hanady That's what HiddenFor is for.
 
1:12 PM
@NicolásCarlo I sort of agree - but do you know how you can decorate the actions with type information for Swagger docs?
 
@Squiggle In WebAPI, return concrete types or IQueryables/IEnumerables. If you need a non-200, just return null and set the status code.
 
@Squiggle no you got me there
 
(thus the latter)
 
@Squiggle yes i have the models created in the data project and the view models that I manually created and i am using automapper
 
@RoelvanUden this is my preference.
 
1:13 PM
I have never seen a serious WebAPI project that returns ActionResult's. I didn't even know you could!
 
@Sippy yeah i thought about this option but what if the properties are many, this is why i was searching for a new way
 
@Hanady Then you're doing it wrong.
Why would you send a shitload of information to the client, not display it to them, then send it back to the server again
That sounds pretty herpaderp to me.
 
because HTTP is stateless :-D
 
@RoelvanUden there's a huge problem with ambiguous documentation online. There's probably 5 different ways to do this sort of thing.
@RoelvanUden you mean like this:
HttpContext.Response.StatusCode = 403;
return null;
 
You can just do Response.StatusCode = HttpStatusCode.NotFound; or whatever.
 
1:17 PM
@Sippy because actually i am displaying some info that are not in the database class: i have database model that has x properties and have the view model that has x+y properties. i just wanted to preserve the y properties so on when calling the POST method they will be displayed again
 
user47589
most of my web api methods return IHttpActionResult
 
Seen plenty of WebAPI projects that return IHttpActionResult with ResponseType annotations
@Squiggle ResponseType annotations don't help with docs?
 
@Hanady And why can't the modelbinder do that
 
@NicolásCarlo there's no ResponseTypeAttribute in the new stack.
 
interesting
 
1:18 PM
@RoelvanUden Can't you just do return NotFound()?
 
user47589
you shouldn't use an annotation to determine the response type. let content negotiation handle that
 
@Sippy i don't know about the modelbinder honestly
 
FFFFF.
 
@Hanady Go read :)
 
user47589
feeling white today, @Tomw?
 
1:19 PM
@Amy this is for C# typing in docs, not mime type etc.
 
DefaultModelBinder
 
hey
 
user47589
@Squiggle oic
 
server actually dispatching based on the response type HTTP header? W3contortist's wet dream :-D
 
@Sippy ok thanks
 
1:20 PM
Thank Odin for coffee
 
Where's Odin? I want some too
 
@TomW fffFFFFFFFf?
 
!!youropinions
 
I just resorted to embedding C# inside a macro expression in an XML file, which gets compiled and executed by a transformation utility to do per-environment config files
 
user47589
1:20 PM
i just made a pot of coffee
 
Odin is with us all.
 
just like that
 
Especially in our coffee
 
This functionality was not designed by me.
 
@TomW You filthy bitch
 
1:21 PM
I just want to set the bastard SAS key Microsoft, is that so much to ask
Why do you have to make everything so difficult
 
Work just got a new coffee machine that makes real coffee. Current status: caffeinated.
 
sooo jelly
 
Honestly? It's not BizTalk that makes BizTalk projects complicated. It's the Heath Robinson machines you have to build to work around its stupid quirks
 
@Squiggle Does it respond with a 418?
 
I have to resort to sipping beer in office
 
1:23 PM
@scheien it's on my list of things to check.
although it should. It's not a teapot.
 
I might just move into JS and say fuck it to full stack
 
@Sippy just the tip of the stack?
 
You can be a full-stack JS developer
 
Enterprise isn't ready for .NET4 yet.
 
...just the tip...
 
1:24 PM
just use Node.js
 
Insofar as you can be a JS "developer"
 
@scheien Not if you define a concrete type as return
 
I mean, I'm not calling the kid playing with Legos an architect
 
^ job advert in Manchester.
 
1:25 PM
inline js
would not reply
 
If I were given that code to review in an interview I would walk out.
 
Those types of ads are always so cringy
 
inorite
 
That's what happens when you let HR write webpages
 
A build a outlook email sender but I never send. I open the pre-build email in outlook and the user need to send. It is possible to handle the sendbutton for this email only? and doing something in my form?
 
1:26 PM
if ('underway')
 
if(you.needAJob())
    OutShittyCompany.Apply(you);
 
CRIIIIIIIIIINGE
 
wow...thats a new level of not funny, not creative waste of space
 
user47589
how can i identify the JS that is removing a css class from a particular element?
 
that indentation, tho
 
user47589
1:27 PM
my page loads and immediately deletes a class of an element, and i have no idea why
 
#innovationdistrict
 
Who was it again that once got a subject line you.GetAvailability(job) and replied null? :P
 
i didn't even notice the indentation
 
@Amy put it in a lineup with other js methods
 
how can you fuck up a simple piece of html that much
 
1:27 PM
this.leave(oldJob).then(()=>this.join(newJob))
 
if(!you.AreFiltyPleb)
 
god damn filty plebs
 
HAHA
 
@RoelvanUden aha. Good to know.
 
!!pleb
 
1:28 PM
Sippy is a pleb
 
<?php echo "We've got ambition!"; ?>
 
I'm a filthy dev
but not so filthy as to use PHP
 
as i throw up in my own mouth from reading inline php
 
just enough to not shave
 
PHP and JS in the same advertisement. Are we sure this isn't a advertising mercy killings?
 
@mikeTheLiar It is, the only devs who would respond to that advertisement will kill that company hahaha
 
That's salad code. You take multiple different languages and mix them into an isotropic mix.
 
The devs who reply to that ad are the ones who use lines such as "I dream in code..." and think its new and clever.
 
@JanDvorak and then you toss it
 
People who want to make revolutionary mobile first cloud first applications
 
1:31 PM
lol
 
user47589
oh jesus, i'm looking at the wrong goddamn website
2
 
mobile first = take ages to load on desktop?
 
@Amy lol
 
user47589
that explains how the impossible was happening
 
okay i asked this last night but no one gave a sht so i'm going to ask again
using EF code first but this may be more of a generic SQL question/wonderment, some people (like those here: stackoverflow.com/questions/7639637/…) suggest that multiple addresses should be stored as a separate table of addresses and then related to entities via join tables...but is it BAD per se to use an address table for each entity with entityID in each address table making the relationship?
I've used the recommended approach in the past, was a pain in some instances with the joins and ended up with a ton of join tables, i guess i'm failing to see the advantage
 
1:35 PM
@NicolásCarlo, I still don't give a shit
 
@Nathvi thats fine
 
(I'll read it now)
@NicolásCarlo Hey, if it works, it works. I honestly don't give a fuck about joins because EF will manage that for me anyway.
 
user47589
yeah
 
can I have a default and non defult constructor in the same class?
 
user47589
1:36 PM
just do it whichever way. i don't think you'll find any consensus on the "best" way
 
@RoelvanUden so there's nothing wrong with using each address table for each entity rather than one giant address table with multiple join tables?
 
user47589
@Mr.Toxy yes, have you tried it?
 
@Amy interesting, that makes my life and planning this crap a lot easier
 
@Amy yes but sometimes when I pass a paramater (wich is for the non default constructor) it keeps saying that there is no constructor that takes an argument.
 
user47589
@NicolásCarlo i think it'll work fine either way
 
1:38 PM
@NicolásCarlo Sure. The most important thing, imho, is that you aren't fighting your tooling. If you're using EF as you say, just see if it recognizes/understands the way you're planning and works well with its Include function. If it doesn't, you're just fighting yourself all the way to do something unnatural according to the tool you use.
 
user47589
@Mr.Toxy if you add a constructor to a class that takes a single argument, then the default constructor becomes unavailable unless you actually create it too
 
like this?
public CdpsiUpdateSql(OracleConnection connectionString)
        {
            this.OraConnection = connectionString;

        }

        public CdpsiUpdateSql()
        {


        }
 
Pretty much.
 
user47589
yes
 
@RoelvanUden makes sense, thanks. and thanks @Amy
 
1:39 PM
Nobody should ever write code like this. I hate myself.
 
:^)
 
@TomW Don't worry, we hate you too.
 
^
 
its that sometimes I need to initialize the OracleConnection object but others I just need to get it no need to pass nothing to the constructor
 
user47589
@TomW don't worry, we hate......goddadmn it @RoelvanUden you're too fast
 
1:40 PM
that's what she said
 
user47589
@Mr.Toxy the code you pasted is perfectly valid. what's the problem?
 
what Amy said
 
@Nathvi in fact, it is
 
@Amy Harr harr harr.
 
@Amy is that what I explained. if I instanciate it and I pass nothing to the constructor it says that there is no constructor that takes 0 arguments
 
1:41 PM
@TomW (But do share!)
I love a good programming horror story.
 
user47589
@Mr.Toxy but the code you pasted clearly has a constructor that takes no arguments. this makes no sense at all. you're leaving something out
 
was that xml spaghetti yours @TomW?
 
hmmm I'll check again to make sure
 
@misha130 no, it's a tool I'm trying to get to do what I want
 
I see
 
1:42 PM
@TomW no, you're a tool!
 
user47589
@Mr.Toxy by "leaving something out", i dont mean your code. i mean here, in your explanation.
 
@Amy oh I found the problem. I instantiate another dll wich has the same method but it's a different class and I didnt noticed it. thank you
 
@RoelvanUden OK, well I'm trying to script the deployment of a component that needs credentials. Microsoft in their wisdom haven't bothered to implement the usual, straightforward method of providing credentials from encrypted storage like they have elsewhere in this framework
 
a z u r e?
 
Anyone remember in Web Form's how to ensure a ascx control doesn't load when an aspx is rendered?
 
1:43 PM
I would very much prefer that those credentials never make it into cleartext, but failing that, being in cleartext in a temporary file that is immediately deleted is acceptable
 
I thought you already gave up once with the vault key
 
@misha130 different
 
user47589
your credentials belong in cleartext.
 
When a client writes in an email that we (me and them) have a great cooperation. Some light in the daily shadows
 
user47589
that way we can take them
 
1:44 PM
All your credentials are belong to us.
 
@RoelvanUden [half an hour of boring explanation later] I now have an XML configuration file containing snippets along the lines of: &lt;Credential&gt;${script=HorribleLibrary.Get("key")}&lt;/Credential&gt;
 
Ah....
 
@Greg can you comment it out?
 
I'm trying to get the tool to run the bit after script=
Internally it's using CodeDOM and compiling an in-memory assembly
 
@RetroCoder No, they linked an .aspx to all of this.
 
1:47 PM
Yes, that is escaped XML inside an XML document
Yes, that is how BizTalk is designed.
 
@Greg Is the ascx is references at the top of the aspx page?
 
@RetroCoder Yes, sadly.
 
Holy crap it worked
 
@Greg Sounds like you may be able to remove that reference and then remove all C# references in the code behind to the control. Or just comment it out.
 
Translate languages in realtime directly to your ear. Pretty neat
 
1:56 PM
@RetroCoder But I need it to load, but on demand not automatically.
 
@JakobMillah Yeah and is it going to work properly? I doubt it.
 
@JakobMillah were you posting pictures of yourself to /r/beards recently?
 
@RoelvanUden That is the question. I guess all the noise around and other people talking would make things somewhat annoying..
@mikeTheLiar Nope :)
 
Because there was a guy from Sweden posting pictures of himself that looked a lot like you
 
Actually never entered that subreddit haha
 
1:59 PM
@JakobMillah Plus, how advanced is speech recognition really, and transcribing that to text and then to spoken text again?
 
@Greg on the page_load of the control you may just exit or return; if it matches a session variable or other parameter on the user control like a hidden variable.
 
It's pretty bad, even with one of the worlds most innovative technologies behind it (looking at you Microsoft).
Skype Translator is a technical brilliance but it's still not good enough
 
@RoelvanUden It's definitely getting better. It has reached an understandable level at least. I mean, translating using google translate do work pretty well.
 

« first day (2042 days earlier)      last day (2892 days later) »