« first day (2112 days earlier)      last day (2841 days later) » 

1:21 AM
Back.
 
I have multiple routes to one controller method (attribute routing) [Route("A")] [Route("B")] etc. I'd like to, once I'm inside the method, be able to tell which route was called to get there. Is this possible?
 
@Bardicer Well, if it's passed as an argument, you can check that way. If not, then idk
 
yeah, i'm trying to avoid that
 
static variables? Wouldn't think that'd be the best idea though :P
 
yeah
it's either figure out how to do it this way - or i write up four methods that are 98% identical and return the same view
 
1:26 AM
So, why do you not want to use arguments?
 
i already have three parameters being passed in
 
I would think 4 would be fine, but idk what you're doing :P
 
there's a route attribute on the controller, and then multiple route attributes on the method
 
The only thing I can think of off the top of my head is static lol
Then again, i r nubskrub
 
so like the controller has [Route("ControllerName")] and the method has [Route("MethodA")] [Route("MethodB")] etc
and to get there you go to domain/controllername/methoda
logic says there should be a relatively easy way to, inside method, say "Oh hey, i got called by going to "MethodA" instead of "MethodB"
hehe no worries
this is a first attempt for me
 
1:31 AM
Idk
I'd think adding a route parameter would be the best way to do this, but i r nubskrub, so idk
 
hmmmm maaayyybbbeeee i figured it out
\o/
Request.Path.Split('/').Last()
 
Seems good to me
\0 I guess. Not sure why you want to change what it does based on where it's called from though
 
 
2 hours later…
3:16 AM
Anyone bored enough to do this? i.imgur.com/d7abAD2.jpg lol
 
3:29 AM
there is no "the" there
 
4:06 AM
NUUUUUUUUUUUUUUUU
 
4:37 AM
@Darkrifts did you find it?
 
 
2 hours later…
6:16 AM
I found teeth
also eth is a word
 
6:38 AM
interesting arguments against semver gist.github.com/jashkenas/cbd2b088e20279ae2c8e
 
That thing where you're not quite awake and you're like "I'm really hungry and I need coffee" then you realise you have coffee and cake literally in front of you on your desk.
2
:|
 
agree to both except where's my cake
I didn't get any
 
7:04 AM
morning people
and amphibians who live in the depths of the sea
 
I live in the depths of a legacy code base
 
good morning
 
7:20 AM
@StevenLiekens how "legacy"? Does it retain the database structure from the original Access 2000 implementation?
Does it use XML for everything?
o/ @ntohl
 
@Squiggle legacy starts where XML was not mainstream yet. XML is too sci-fi for legacy code
legacy is like VB6 code converted to C#
with classes like Ultimate and Joker to deal with compatibility issues...
 
it uses xml for some things
it uses a custom ORM written around DataSet APIs
 
ooo that's a legacy smell right there
 
God dayum regex
 
and VB6 class with helper functions to work with VB6 legacy. Functions like Redim
like the code I'm working with...
 
7:25 AM
@ntohl do not talk to me of these things. You're triggering me.
 
<- sad face
 
The code I'm working on right now is... 3 months old at the most.
<3
 
Core class is dated 2011-05-20
a little bit older than 3 months
 
Do you guys write licence statements etc in your code files?
 
Nope.
If anything, the info goes in AssemblyInfo.cs
UNLESS we're sharing the code with 3rd parties
 
7:33 AM
@TomW 1 person writes.
 
@ntohl do you mean, one person does it, the others don't bother?
 
yes. When I extended his code, I wrote too
 
Yay consistency
 
we had license statements in some code files written by a supplier
I went ahead and regexed them away
legal department needs to stay out of my code
:p
 
most of the company doesn't know about it should be done, and there is a template in the guidelines, where copyright information is there
 
7:37 AM
I guess you kind of have to have copyright info comments if you release the code outside the company
 
OK, glad to know I'm not shirking my responsibilities then
or we all are
 
7:52 AM
it's not your responsibility if nobody tells you it is
 
Oh were that to be true
Managers never think of anything, you have to do everything for them, you know that
 
also does not adding copyright info to every code file somehow make it less protected by copyright?
say you have a license.txt or copyright.txt file
shouldn't that be enough
 
¯_(ツ)_/¯
 
I'm trying to pass a DateTime from a view to the controller, but it isn't getting set. I've written this in the view:
@Html.TextBoxFor(m => m.OutboundDate, new { @Value = Model.OutboundDate.ToString(PerRequestStorage.Culture.DateTimeFormat.ShortDatePattern), @class = "dateFrom", @readonly = "readonly" })

But it just comes back as today's date (which is what I set it to in the controller that called the view initailly)
Any ideas?
 
I've dealt with a couple of contracts that tried to get an agreement on code licensing. Nobody actually understood what it all meant.
 
7:56 AM
you know I was just thinking about ways to persist data for the duration of a request
it's kinda funny to see PerRequestStorage in there
 
@StevenLiekens why?
 
It was like banging one's head against the wall. Code licensing, kids: Just Say No.
 
because PerRequestStorage sounds like what I need
 
@StevenLiekens It's a class I've written.
It stores the culture of the customer and changes when they change the language
(I say I've written it, I haven't but someone here has, it's not a .net thing anyway)
Never mind, fixed it
 
8:08 AM
as a consultant, are you allowed to tell your boss that you don't wanna work for a particular customer?
just because the customer is a arse
 
You can say it. Don't mean it'll change their decision
Also why should them being an arse excuse you from working for them, but not whoever it is that they send instead?
 
that customer being an arse to 2 other consultants already
haha
oh well
switching from a product team member to consultant is a huge difference for me haha
 
Hmm. I actually haven't fixed my problem. It doesn't work if the culture is set to US. It works except in the US the date has month/day/year and so the value isn't passed to the controller. Anyone know how I might be able to tell the model to expect a string in US date format?
 
8:24 AM
Am trying to figure out how to navigate from a page once I get a result from an async method in windows phone app.
 Dispatcher.RunAsync(
                CoreDispatcherPriority.High,
                () =>
                {
                    Deocode(_writeableBitmap.PixelBuffer.ToArray(), BitmapFormat.Unknown);
                });
 
@captainjamie use ISO date format, always
except for display purposes
 
I have the dispatcher call my async decode barcode function then once result is gotten I try to stop cameracapture and navigate
 private async void Deocode(byte[] rawRgb, BitmapFormat bitmapFormat)
        {
            await Task.Run(() =>
            {
                if (_decoding)
                    return;

                _decoding = true;

                var decoded = _reader.Decode(rawRgb, (int)_width, (int)_height, bitmapFormat);

                if (decoded != null)
                {
                     PhoneNo = decoded.Text;
                     Task.Run(() => Stop());

                }
stop function is as below
 private async Task Stop()
        {
            _cameraPreviewImageSource.PreviewFrameAvailable -= OnPreviewFrameAvailable;
            _timer.Stop();
            await _cameraPreviewImageSource.StopPreviewAsync();
            Frame.Navigate(typeof(TestPage), PhoneNo);
        }
but frame.navigate never gets hit in breakpoints and no navigation occurs
The nesting of async await tasks plus dispatcher has me abit confused.
 
@StevenLiekens But it is displayed. The user types in the date (actually uses a datepicker) so it needs to be typed in in a US format
I need some way of saying if culture = "en-US" then expect date to be MM/dd/yyyy, else dateformat = dd/MM/yyyy
 
is this in a web app?
 
It's a website yes.
MVC
 
8:31 AM
if you use input type="date" then you are required to use yyyy/mm/dd
 
if you have a html5 <input type="date">... then it depends on the browser, actually
 
browsers should take care of formatting for culture
 
IE11 and Chrome work differently. I forget which way round.
 
right now only chrome shows a localized date picker
but it will still submit yyyy/mm/dd values
every other browser... fall back to a custom date picker
 
but it will probably select the date in local time, with timezone offset
which is a problem if your client and server exist in different timezones
DatePickers are a right bastard
 
8:33 AM
there's no more datetime input type in html
gotta use a separate field for that now
or multiple fields
 
td;dr: glhf
 
@type = "date" hasn't worked. Not it's just totally broken for everyone...
 
it works in chrome
 
I need it to work in every brower the user might work.
 
and it works in other browsers as long as you stick to yyyy/mm/dd
 
8:34 AM
*choose
I can't "stick to" yyyy/mm/dd, the user will expect dd/MM/yyyy except in US where they will expect MM/dd/yyyy
 
not possible
 
Then... you'll have to write your own input parser and mask based on the browser's locale.
 
Maybe with some javascript that reformats their date in a hidden input
 
@captainjamie don't forget that in most .eu countries the inputs are written as dd.MM.yyyy instead
 
yeah, that works fine
dots don't matter, as long as it goes dd/mm/yyy
 
8:38 AM
what sort of data are you inputting?
 
How do you mean?
 
from/to dates like booking a hotel? date-of-birth?
 
like to book a hotel, yes
from and to
 
so a standard javascript widget could suffice?
 
I guess so, but I don't really know much javascript. I try to do as much as possible in c#
 
8:40 AM
protip: check the docs for date.toLocaleDateString()
The HTML/JavaScript spec has already solved many of these problems. Don't try to re-invent the square wheel.
 
Yeah, I mean, we've already solved these problems, but for some reason in the culture update to the core, it's broken all the websites.
I'm tempted to make a new field in the model where it takes a string, stoe the date there and convert it in the model.
*in the controller even
 
So what's the actual problem then? the culture info in your controllers is different to that in the browser?
 
We don't use the culture in the browser. We store the culture based on what the user selects as a cookie and update the cookie whenever the user changes language
The view looks at the cookie, formats the date according to the user's cookie, and then stores the date in the model, and passes it to the controller.
that works for every culture except US where it goes MM/dd/yyyy not dd/MM/yyyy
 
8:58 AM
do you at any point attempt to parse the date in javascript?
 
@StevenLiekens Possibly. Now that you say it, that might be what's happening. I'll change the class name to disable any javascript
 
Guys, does it happen to you that when opening VS for the first time, the loading time is too much? On later times it opens fast, only the initiating one.
 
I've never noticed that, but mine's on an SSD so it opens very quickly
 
not really on mine as well and its a normal hdd
 
When i run it, it takes like 3-4minutes start up when i boot up the pc. I am using hdd as well :/
 
9:03 AM
maybe you start it up immediately your os starts up and there still services trying to start up
what is the implication of calling await task.run(() => having task.run => someasync method?
does it mean the 1st task waits until the last someasync method runs or how does it sequence the tasks
?
 
 
2 hours later…
10:55 AM
told my boss I quit, he doesn't want to hear it
 
@StevenLiekens wat
"That's it, I quit!"
"No."
 
basically
 
Go get a sandwich, take maybe an hour
then come back into the office, put your feet on the desk and eat it
 
Lol
Go play pokemon go for a while lol
 
lol no
 
10:58 AM
@TomW there are people here who do that and are still keen on being employed
 
"I don't work here anymore, so if you want to throw me out then go for it, I don't mind"
"I'm just taking advantage of the air conditioning"
 
Unless my boss won't take back what he has said I'm out of this company
 
that sounds childish
 
What did he said? "Get out of this company"
 
10:59 AM
lmao
 
@StevenLiekens that's not mine, actually, found it on reddit somewhere
 
greetings
anyone got experience with automapper?
 
bad experience, sure
 
anyone got good experience?
not all at once...
 
11:04 AM
no because it's automapper
don't mistake automapper for a good product
 
roflmao
 
and since it has about 40M downloads, I figured I could find some helpe here.
Guess I was mistaken
 
Most people here don't use it
Because it's unnecessary overhead
 
pff everything I use is a bad product according to you
well then
 
We're not a helpdesk sorry
 
11:05 AM
well 40M people are wrong not to come here and ask for my professional opinion
 
We're all about good practices
 
hwo should you map from models to viewmodels
if not with automapper
 
Make a method
It's literally not difficult at all
 
I'd say 'just write the code' personally
 
right. I'm not gonna make 50 methods
 
11:05 AM
You needn't.
I mean you could.
Ask TheGreat@Roel
He loves Automapper
 
with 50 tables and even more viewmodels... I don't see a better option than automapper
 
That is a ton of different domain objects, why so many?
 
because someone wanted a stock-application nested with training-application nested with personel-management
glances at boss
 
All hail AiO!
 
so I guess I'll just move back to the documentation and hope I find some answers there, even though I've been there all day
 
11:08 AM
can you tell me how execute method from object?
I have different classes and method with same name
 
Well I'd say that with automapper instead of writing code for 50 different transformations, you have 50 different places that automapper can do something you didn't intend and break something
 
@Sippy I agree, my DataLayer projects have both ViewModel classes and DataService classes which maps EF entities to VM
I don't know if that's a good practice but works for me since at least a half of year
 
problem is this database keeps changing over and over
 
yea that's a problem
 
I'ts bad enough I have to adapt things in database, viewmodel and cshtml
 
11:10 AM
0h
that's sounds like a real PITA
 
PITA?
 
What is your actual problem with automapper
pain in the ass = pita
 
pain in the a...rsenal
 
PITA?
 
11:11 AM
I love pita
 
okay
 
its the best bread
 
@misha130 no, not the buns :D
 
oh.. ;(
 
well the problem is
I have a viewmodel PersonelVM and InterimOfficeVM
 
11:12 AM
@Sippy Hahahaha no, I preach against AutoMapper.
 
but when Mapping, InterimOfficeVM mapping doesn't work
 
@RoelvanUden Le sarcasm
 
@misha130 how about a good mutton kebap?
 
Help the poor girl
 
lol yes very much
 
11:12 AM
AutoMapper is this black magic box filled with rules that works absolutely wonderful if you have both classes on the same file in the same view but becomes a fucking terrible shithole as your project grows larger.
 
maybe some schewarma
 
PersonelVM{
InterimOfficeVM interimoffice {get;set;}
}
I just wanna know how to map the office...
and then be able to map the officie's adresVM :/
 
@misha130 and perhaps a lawash mmm
 
@VictoriaS. what does the documentation say?
 
documentation doesn't go that deep
I have something similar to this

Mapper.CreateMap<FatherModel, Father>()
.ForMember(x => x.Son, opt => opt.MapFrom(model => model));
Mapper.CreateMap<FatherModel, Son>()
.ForMember(x => x.Id, opt => opt.MapFrom(model => model.SonId));

that maps the personel's adress, which works fine
but doesn't for the office
 
11:16 AM
what does 'doesn't work' mean?
 
"Object reference not set to an instance of an object."
on the view
 
what object?
 
the IterimOffice object
 
What are you mapping to PersonelVM?
 
threw it in a fiddle
Personel has an Adress and InterimOffice
InterimOffice has an Adress
 
11:19 AM
I don't see a ForMember for interimoffice
 
last line in the first createmap
 
Can you tell me how call method from object?
I have different classes and method with the same name.
 
Interimoffice is interimkantoor in my code
 
Oh, you translated it, right
 
@marbel, what do you mean by that?
 
11:20 AM
@marbel82 question unclear
 
yea, sorry. I tend to translate things to english when asking questions
 
var meth(object obj) {
obj.Fill();
}
 
object doesn't have a method called Fill()
 
wow
is that code even legal?
 
Use the correct type for the method parameter, then you'll be able to call methods from that type
 
11:23 AM
I know I could use interface, but it is about TableAdapter
 
so why are you using object when it's a TableAdapter?
 
That's also not a legal method declaration
 
object[] ta = {myDataSetTableAdapters.karta1TableAdapter, myDataSetTableAdapters.karta2TableAdapter}

void FillAll() {
for (... i++)
ta[i].Fill(dataTable[i]);
}
 
That doesn't answer the question
Why are you typing them as object when they're TableAdapters?
 
TableAdapter is autogenerate class so I can not change it?
public partial class karta1TableAdapter : global::System.ComponentModel.Component {

from myDataSet.Designer.cs
 
11:31 AM
Aah crap, I see. You have two different table adapters. They have no inheritance relationship with one another so that Fill() you're trying to call in both cases is not the same method. You can't treat them as the same base type and expect this to work, sorry
 
eny way
I am looking for something like this:

MethodInfo[] m = typeof(TestUserControl).GetMethod("Fill");
m.invoke();
 
myDataSetTableAdapters.karta1TableAdapter.Fill();
myDataSetTableAdapters.karta2TableAdapter.Fill();
Oh you could use reflection but why on earth would you want to
 
I found how to call properties:

PropertyInfo[] props = typeof(TestUserControl).GetProperties(BindingFlags.Public);
object o = props[0].GetValue(this, null);
 
how does that even work
you have no instance
and you get value from no instance?
and call methods from no instance?
 
--shorthand--
object[] ta = {new myDataSetTableAdapters.karta1TableAdapter(), new myDataSetTableAdapters.karta2TableAdapter()}
 
11:35 AM
Yeah don't do that, unless you want to make it impossible to understand what you're asking
 
hi all. How can i do this piece of cody without of clusures:
P p = Console.WriteLine;
foreach (var i in new int[] { 1, 2, 3, 4 }) {
int j = i;
p += () => Console.Write(j);
}
p();
 
interface IAwesomeMapper<TIn, TOut>
{
    TOut Map(TIn value);
    void Merge(TIn value, TOut existing);
}
@VictoriaS. that should be your mapping framework
 
@StevenLiekens, I honestly have no idea what to do with that
 
create classes that implement that interface for each entity to VM mapping in your application
 
...
in english now?
 
11:41 AM
@GLeBaTi I don't think you can. What you're doing is a closure, end of
Unless you call Console.WriteLine with a literal, maybe
 
@GLeBaTi I was gonna say that should be easy, but it's impossible.
 
class FatherMapper : IAwesomeMapper<Father, FatherModel>
 
@VictoriaS. your code looked fine, you'll probably have to look through the automapper source to find out why it isn't doing what you want
And this is why automapper sucks
 
FINRE
I'LL DELETE AUTOMAPPER
:(
 
Couldn't you have just started by explaining that it doesn't map a certain property and you can't see why?
Would have saved a lot of time
 
11:45 AM
private IEnumerator CreateGalaxy()
{
yield return null;
for(int i = 0; i < 100; i++)
{
obj[i].SetEvent<PointerEventData>(EventTriggerType.PointerClick, (eventData) => {
var starId = i;
GalaxyScript.GalaxyInstance.SelectedStarId = starId;
MapLogic.GameInstance.ToStarSystem(starId);
});
}
}
 
it's the only thing I've been hearing since I came to ask for help
It's what I said
 
starId is always 100. Why?
 
can't help it that you all won't listen
 
No, you said it "Doesn't work"
I had to ask several more questions to find out what you actually meant
 
@GLeBaTi The function is being evaluated after the loop is finished
var starId should be at the start of the loop
 
11:49 AM
:31982037
private IEnumerator CreateGalaxy()
{
yield return null;
for(int i = 0; i < 100; i++)
{
var starId = i;
obj[i].SetEvent<PointerEventData>(EventTriggerType.PointerClick, (eventData) => {

GalaxyScript.GalaxyInstance.SelectedStarId = starId;
MapLogic.GameInstance.ToStarSystem(starId);
});
}
}
not working
starid always = 100;
 
I told you the exact error I got and gave you the code I had
What more do you want? sheesh.
Every time I ask for help I give you guys everything I know and you STILL don't understand a word.
FUCK IT.
 
you're white. Nah. you will be favored, Victoria.
 
How do you know?
 
@VictoriaS. woah :-/
 
No, I've changed my mind, don't answer that. If anyone is considering saying something racist; say it somewhere else. This will be your only warning.
 
11:57 AM
can you measure someone's programming skills by how much coffee they drink
 
@StevenLiekens no, but you can generally measure them by the quality of the coffee they drink.
 
@VictoriaS. It was 16 minutes between you first speaking and giving some explanation of what the actual problem was. It's right there in the transcript.
Ask clear questions, get straight answers. Whine about it and at best you'll be ignored. That's my advice, quit being a whiner and you'll get on better here.
 
@VictoriaS. I just read through the conversation. There's really not enough information to diagnose the problem you described there. Tom was doing his best. Don't ragequit - we're still happy to help, but you gotta give us something more to work with :)
 
@GLeBaTi Must be because it's a yield return function, which turns it into a field
 
@KendallFrey i resolve problem after i wrap "setevent" into individual method
interesting problem (closures and enumerators)
 
12:03 PM
I think the easiest way to fix it is to write a function that returns a function
aka partial application
then the closure will be inside the function and you don't need to worry about the yield return stuff.
 
true
 
user47589
12:19 PM
damn, i missed victoria's meltdown
 
@Amy ?
 
user47589
scroll up a little
 
ahh
 
@KendallFrey you think that's a riot? Nah
 
12:30 PM
Hockey is literally the only thing that will get Canadians to riot.
And IIRC they burned a bunch of stuff too that day
 
well... Vancouver, eh? They're different over there
 
Also, idk if you've seen this, the most famous scene from the riot
 
lol
#England
#accidentallyrenaissance
 
It's a very classically composed picture
 
I love it
 
12:44 PM
such artistic
 
very mancunian
 
I love the fat guy
"Paint me like one of your french girls"
"With my beer."
 
"Well street" - indeed they are
 
rofl
very observant
 
then there's the legendary 'girl using slice of pizza as a pillow'
(it wasn't, it's her handbag, which is obviously loads better)
 
12:49 PM
hold my beer while I become famous on the internet
 
user47589
holds beer
 
knocks beer from amy's hands
 
:O
 
I need the tiny allen key from a meccano set
halp
 
@TomW ┐
yw
 
12:51 PM
┐┐
_
 
user47589
i have failed holding your beer due to unforeseen circumstances, @StevenLiekens
 
it's OK @amy it was tom's fault. He didn't have the right allen key.
 
user47589
it all makes sense now
 
Can the Action argument routeValues be a non-anonymous type? For example if an Action took 1 parameter of type Person, could the routeValues argument be an instance of person?
I'm assuming the answer is yes. I suppose I could always try it and find out.
 
When running tests in parallel (MSTest) is there a good way to initialize resources shared between all test processes?
 
12:59 PM
@KendallFrey ...singleton?
 
Across process boundaries?
 
or group them all into the same fixture, and init on fixture setup
 

« first day (2112 days earlier)      last day (2841 days later) »