« first day (2291 days earlier)      last day (2650 days later) » 
01:00 - 19:0019:00 - 00:00

1:45 AM
Hey
Is there any way of pasting multilined text as a string variable in VS?
I'm trying to copy and paste a json string (formatted)
 
2:02 AM
I'm not sure I know what you mean. Do you mean @"" strings?
 
2:26 AM
I do mean that
I guess @"" doesn't escape double quotes?
:(
 
works for me
string a = @"jello """; prints 'jell ""'
jello*
 
 
1 hour later…
3:53 AM
nah as in, if you copy text containing double quotes you can't directly paste into @""
{
"name" : "Person",
"address" : "123 abc st",
}
for example
 
ah
yeah, you need to escape them
 
4:26 AM
yeh
 
 
3 hours later…
7:22 AM
hey
 
Good morning.
 
.gninrom dooG
 
7:39 AM
ohayou
 
morning :)
@Proxy おはよう
 
@SebastianL ^
 
hello!
 
hi
 
8:09 AM
Morn all
 
8:42 AM
hi
 
just leaving this here ^^
https://www.reddit.com/r/talesfromtechsupport/comments/5pazbo/im_pretty_sure_i_knocked_a_user_out_from_nearly/
oh and that
https://www.reddit.com/r/talesfromtechsupport/comments/5p4pm8/liz_i_dont_like_you_like_that/
 
Morning
I need some help. I like to start coding in c# on my mac. I installed the Mono Framework and using Xamarin studio. When i want to run a basic hello world programm i got this error on console: Cannot open assembly 'Program.exe': File does not contain a valid CIL image.

Can you help me to fix it ?
 
@Traxstar what have you tried so far?
 
Tried the standart compiling of xamarin.
Then i just run the compiling process on console by my own with mcs Program.cs and then mono Program.exe
 
8:57 AM
have you tried to remove all dependencies except System?
 
its just that testcode:

using System;

namespace first
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
 
@Traxstar Command mono is to run compiled programs. You need to compile your hello.cs first with:
mcs hello.cs
 
is it smart to use json.net serializer instead of the default odata one?
 
Then you can execute it with:
mono hello.exe
 
@Ggalla1779 i already did this
 
9:01 AM
2
Q: File does not contain a valid CIL image.

roykasaHey guys i installed mono on my suse 12.1. When i create a file say "hello.cs" and run "$ mono hello.cs " on the terminal, i get this error: Cannot open assembly 'hello.cs': File does not contain a valid CIL image. The contents of the file(hello.cs) are as below class hello{ static voi...

ok
 
why not core instead
 
@SebastianL you got any futher idea ?
 
it may be Mono does not support the .net command your using
 
but how can i code c# on mac then ?
 
War
@Traxstar with .net and VS code perhaps?
or even use VS for mac
 
9:11 AM
the new vs2017 works on mac...no idea if its usable yet
 
War
@Ggalla1779 its running on a mac so ... probably not
 
aye @War I've been looking for you exactly
OData doesn't accept [JsonIgnore] or [ScriptIgnore]
should I switch to json.net formatter?
 
War
@misha130 hmmm i thik recall reading something like this
it has its own attribs
 
there is [datamemberignore] or something
but it completely removes the property
I just want it removed from the json
 
War
4
Q: Exclude property from WebApi OData (EF) response in c#

MartínI'm working with a WebApi project in C# (EF code first) and I'm using OData. I have a "User" model with Id, Name, LastName, Email, and Password. In controller for example I have this code: // GET: odata/Users [EnableQuery] public IQueryable<User> GetUsers() { return db.Users; } If I call ...

OData will serialise everything in the model, you have to remove it from the model
 
9:14 AM
ill try to add notmapped maybe
 
War
the other way is to use a $select parameter in the url
 
thats the reason I was thinking to change odata serializer
its too complicated for my testing team :^)
 
War
~/API/Foos?$filter=Prop eq val&$select=not the prop you want to exclude
yeh that's tough ...
we use postman for testing endpoints here
even a junior tester can get that
 
I use swagger
but still
 
War
hmmm interesting, hats a question I had about swagger
thinking about buildng a simple UI to allow testers / internal power users full crud access to the api
 
9:18 AM
ok
 
War
not sure if I need it though ... as I have a generic view for CRUD stuff
I managed to figure out how to drive the UI properly in JS from meta exposed on the OData controller, so my base controller now has a GetMetadata() method that defines the type
 
eh sounds spaghetti
 
War
prob not the ideal way to go but it works and I can build the meta however I want
I have situations like in workflow where the meta comes from the db
 
well if its like only to display the usage of the api then its fine
 
War
so I can define type info on the fly then build a UI for that type info
 
9:21 AM
I've done that too for dashboards, lots of fun
 
War
its purely to build the various correct inputs on the UI so the correct posts can be constructed back to the API
anything else is simple querying and mvvm bindings
 
well it sounds clean as fuck to be honest
I'll want to note that swagger doesnt support OData properly if you were planning to use it with it somehow
OData 4
 
9:39 AM
Is this code:
string name;

public string Name
{
get { return name; }
set { name= value; }
}
equivalent to: Public string Name {get; set;} ?
 
@MohamedAhmed Pretty much, yeah.
IL decompilation shows a couple of opcodes different.
Once I enabled compiler optimizations, the two are identical, yes.
 
War
10:19 AM
@misha130 yeh i'm using all OData 4
my solution is quite simple, I leverage the telerik framework (so no code there) and I serve up the metadata in the MVC format from a single "generic" base constroller method, that has 1 line in it, that line calls in to a custom meta provider which is only need for a few custom attribs I put in the code
those custom attribs allow me to put things like a [Lookup(typeof(OtherEntity))] attrib on a property to manipulate the meta slightly for the putpose of knowing how to gen the drop down for relationships and what not
might not be absolutely bang on but it's pretty clean
I like the idea of swagger, but when I look at it I think ... did they really need all that code for basically achieving what I did in a single method and a small bit of codeon the js side?
I guess swagger in this case though is also doing what the telerik stuff does too, the advantage I have is that I can use it for all my UI not just that part of it
 
Can anyone surmise why a ConcurrentQueue doesn't have a Dequeue method? msdn.microsoft.com/en-us/library/dd267265(v=vs.110).aspx
 
Because it has a TryDequeue, which may or may not succeed.
Since it's used concurrently and all
 
I just looked at the BlockingCollection's api...
 
Which serves a different purpose.
 
Now it makes sense why ConcurrentQueue need not have it...
 
10:33 AM
Eh? What do you mean?
 
I can pass one ConcurrentQueue instance as argument to a blockingcollection...to ensure the concurrent collection is FIFO
 
A ConcurrentQueue is FIFO, it just doesn't provided a GetConsumingEnumerable and signaling capabilities.
If you need those capabilities, BlockingCollection will serve you well.
If you don't need them, ConcurrentQueue is better.
 
Which blockingcollection provides...
 
That said, ConcurrentBag is faster if order is not needed.
 
I am afraid I've used the blocking collection at start...now the change requirement has come to use something like a ConcurrentQueue...
 
10:35 AM
Then use one? What's the problem?
 
I didn't want to deal with a major refactoring...
Oh wait...the default is ConcurrentQueue underneath
 
I'm not sure what the problem is, but some facts:
- BlockingCollection *is* a ConcurrentQueue with signaling and a consuming enumerable
- ConcurrentQueue *is* a FIFO collection with multi-thread safety.
 
Just realized that...sorry
 
If you just one N producers and 1 consumer, BlockingCollection is fine.
If you need N producers and N consumers, use ConcurrentQueue with manual signalling
 
hmm so whats your suggestion if the case where multiple consumers?
I mean I've used blockingcollection itself...
 
10:39 AM
Just make a custom signaller then, it's quite easy to do.
 
No you really need not...I think the BlockingCollection does that internally
But yes...thats an exercise I'd love to do though
 
BlockingCollection does that too, yes, but remember: it's designed for 1 consumer
With N consumers, BlockingCollection will fail
Unless you make N BlockingCollections on the same ConcurrentQueue
I guess that should work
That said, if you have n producers you don't really know order anyway
so this is all a bit moot, i think
 
please help me on
Are you sure that you've Imported the stored procedure as a Function. Your question is very similar to this but not sure exact duplicate: Getting data from stored procedure with Entity FrameworkS.Akbari 8 mins ago
 
Why do you say it will fail?
 
Because that's what the docs imply
Pretty sure I've read about it as well
 
10:44 AM
> Concurrent addition and removal of items from multiple threads with the Add and Take methods.
Thats what its says...from the docs
 
I guess you're right. Cool :-)
Reference source supports your interpretation
Fuck knowledge I picked up from SO answers
So much bullshit.
 
Seek them and downvote...OR...show me those posts privately so I can answer...I need the score... :P
If I had to choose between creating a temporary (blank) file and moving files between folders...which one to choose?
 
What's the situation?
 
11:00 AM
its hard to say...something to do with a file-based status tracking...we've a mailserver...we need to ensure that each email is processed. So basically it has many states...
the app is a mailserver with some in-memory queues...
 
File-based status tracking sounds bad. So you've got a file per mail and you move it around?
 
Well we don't want to do it with a db...
because the app is highly concurrent...
 
All the more reason not to use files. What's wrong with a good 'ol message queue?
 
we can't use any off-the-shelf solution...we have to build our own... :(
 
... But why?
 
11:04 AM
because we worry about licensing and stuff...
 
deep groan
How about you build an in-memory queue with a simple oplog for recoveries?
It's at least better than thousands of files :3
 
exactly the same feeling...but as long I am paid... its fine...
whats an oplog
operation log?!
 
Yeah. You can just see it as an operation log of all the changes in your in-memory queue. In case of disaster, you can just process the operation log at bootup to reach the same state before explosions occurred.
That said.. a known message queue system is just.. better.
 
Hmm...all of these queues are in a single process...
That was why I thought of creating a temporary blank file in some queue-specific folder...
 
Yet that process can crash, the machine can shut down, power can shut off, updates can install, memory can break, the HDD can crash, etc.
That's of course possible, but be very sure you cleanup properly then.
And log all the states so you recover at any time
Or just go fuck it and deal with the mess if shit crashes
 
11:12 AM
the name of file is a reference to the item to process...
yes...there is cleanup too
 
I'm personally not a fan of non-deterministic solutions but hey, if it works for you guys, why not.
 
That was one approach...the other approach was moving something called a "control file" around into queue specific folders...
you can think of it as a file that uniquely identifies the email that arrived...
 
11:34 AM
TIL: attempting to load plugins using reflection will fail if the DLL carries the Mark of the Web.
Thank you, 90 minutes of my life I won't be getting back.
 
War
WTF is "the Mark of the Web"
 
@War When files are downloaded by browsers, a mark is added to them to signify they originated on the web, and are thus unsafe.
Every tried running an executable and being warned it's potentially dangerous, with a "don't warn me again about this"? That's the mark of the web.
 
11:50 AM
Hey all , I have a 2 parameters method in an abstract class, can i send only one argument to the overriding method in the child class ?
 
@ItayZaguri No. Because then it wouldn't match the signature.
You can declare one of them optional in the base and overriding class, if it's not necessarily relevant, but that would, again, mean that it's optional for all implementations.
 
War
@AvnerShahar-Kashtan huh, never thought that it was something written to the file ... always thought it was a thing that browsers did.
interesting
 
@War Browsers are required, by convention, to add it to downloaded files. It's on the NTFS metadata alternate streams.
For ZIP and other archives, the archiving software is required, by convention, to propagate the mark to extracted files.
 
@AvnerShahar-Kashtan thanks Avner, but what do you mean by Optional ?
 
658
A: How can you use optional parameters in C#?

jitbitSurprised no one mentioned C# 4.0 optional parameters that work like this: public void SomeMethod(int a, int b = 0) { //some code } Edit: I know that at the time the question was asked, C# 4.0 didn't exist. But this question still ranks #1 in Google for "C# optional arguments" so I thought ...

 
11:57 AM
it requires C# 4.0 ?
 
I'm allowed to use 2.0
 
@ItayZaguri 2.0 was released in 2005. Literally a dozen years ago.
 
Maybe there are more things you can do to maximize tech debt?
 
4.0 was released in 2010.
That's 7 years ago.
 
11:58 AM
tell it to my lecturer haha
 
In that case, simply pass null or whatever to the parameter you don't care for.
 
Wow, someone is frozen in time.
 
Or create an overload without that parameter - though again, that will then be available for all overrides of the method.
 
Yes that was i was thinking about !
isn't it a Code Smell sending a null argument ?
 
@ItayZaguri In C# 2.0, if the optional parameter is in the constructor, You can do it like this (and it's better):
 
12:03 PM
Yes, it is. In this case, the smell points to your design including an abstract method that contains parameters that aren't required by all implementations.
 
wrong
wait
    class A
    {
        public A(int nonOptional): this(nonOptional, 1)
        {
        }

        public A(int nonOptional, int optional)
        {
        }
    }
 
@ntohl the optional parameter is an enum anyway ..
 
Remember, though, that code smells are merely that - they're smells, not bugs.
They're there to suggest that there may be a problem, they're not evil themselves.
 
    class A
    {
        public A(int nonOptional): this(nonOptional, ConsoleColor.Black)
        {
        }

        public A(int nonOptional, ConsoleColor optional)
        {
        }
    }
 
you think its better than the other option ?
 
12:06 PM
@ItayZaguri Depends on the specific use case. What does the optional parameter indicate, and why are you ignoring it in your derived class?
 
g'day
 
@AvnerShahar-Kashtan I created an Abstract Class called Powertype and a Refill() method inside, then I Created 2 methods : One for a Fuel using Car and another for a Electric users
These are for cars\bike classes i made also
Now A fuel user car call the Refill with 2 arguments - FuelType [enum] and fuelQuantityToadd[float] while the electric car should call the Refill with 1 argument NumOfHoursToCharge [float]
an electric car should ignore the FuelType then
 
That means your base class doesn't really serve as a base class for both implementations.
It feels like you designed a base class for scenario A, and you're trying to squeeze scenario B into it.
Because your float argument isn't hte same argument in both cases. Even if you only had one float arg and everything seemed fine, it would be bad design because the float means something different in the two cases.
 
War
12:30 PM
@AvnerShahar-Kashtan :)
@AvnerShahar-Kashtan I feel like this feature gets under used
all those api's with like a hundred overloads
 
12:56 PM
guess no one here heard of jspdf before ?
 
Sure I have
 
@RoelvanUden I have this rather serious issue
 
Did you see your doctor?
 
why pdf generated using jspdf would work on chrome browser.. and a little bit on ie 11 and nothing on acrobat reader ?
 
War
@RoelvanUden LMAO
 
12:59 PM
@War that's too funny isn't it !!
 
War
@Mathematics no its just the right amount of funny
 
@War LOL should had worked then :P
 
Hi all. I am new SO chat
 
so the "new guy"
 
1:27 PM
@Mathematics Might be badly formed. The PDF standard is complex and underdocumented.
I have a friend who's been working on a PDF library for years now. Supposed to be pretty fast and effective. Never used it.
 
@AvnerShahar-Kashtan what is that
 
@AvnerShahar-Kashtan interesting but it won't going to work on client side
 
@Mathematics I don't know. Probably corrupt file generated?
If it's the latest jspdf version, report the bug
 
@Mathematics He's got a beta of a cloud-based solution that can be called from client-side JS.
 
1:45 PM
PDF generation is actually a really good candidate for SaaS, Imho. Onto a winner there
 
I found a weird way to declare variables (not in c#)
1 Ticket530	X
1 TicketRup	X
1 listeRup	50
 2 rRepere	9,0
 2 rRef		15
 2 rEan		13
 2 rQte		12,2
listeRup is kind of a C union
 
@TomW I sort of agree
 
am worried there is bright light in sky and there is heat off it....its been so long..think its sun
 
@Ggalla1779 the what?
 
exactly
 
1:55 PM
@AvnerShahar-Kashtan still it will use backend
I can use aspose if I want to go for backend solutions
 
2:19 PM
Hey, guys, I'm having this error when I compile "the type or namespace name 'Office' does not exist in the namespace 'Microsoft'". I've tried adding the reference to the project but it doesn't exist. Do I need to install any additional stuff in order to have the Office dll available or does it come by default with the .net framework?
 
@JoãoPaiva just out of curiosity, do you have the using Microsoft.Office; or whatever it is at the top of the cs file you are trying to use it in?
#readsperfectly
 
actually, another question @JoãoPaiva, are you using COM?
 
Hey, don't suppose anyone knows if it's possible yet to run ASP.NET Core apps on Raspberry Pi 3?
 
@Kieran I don't because every call is being made like Microsoft.Office.smth
@Kieran I tried searching for the reference in the COM but it didn't show up
 
2:25 PM
@JoãoPaiva right
Gimme two seconds
I've used com in a past project
using Microsoft.Office.Interop;
That should be the correct one
I think
Its dependant as to what version of office you have installed as well
 
it still says the same thing :/
 
hm
 
might do it : https://www.thedju.net/articles/asp-net-core-mono-linux
though I didn't read anything official
 
I think this is very weird, and it shouldn't be happening
the reference should be there to add
but it doesn't exist
 
@JoãoPaiva what reference did you add
 
2:28 PM
not even Microsoft.Office
 
hm
 
basically I'm cloning a project
 
@JoãoPaiva you do have office installed right
 
@satibel Thanks, I'll look into it
 
@Kieran I did once, but then I had to uninstall it.
 
2:29 PM
@JoãoPaiva there's your problem
you need it installed to use the api
 
Ah, okay
 
that includes compiling
 
Isn't there a way of getting the dll's without installing?
 
unsure
i've not tried it without having office installed
 
@Tagc That link is for mono, aka old as fuck
 
2:30 PM
because of that office 365 stuff my company doesn't want people with the desktop version of office
that's why we had to uninstall it in the first place
 
@JoãoPaiva does your office not have the 365 version of desktop office?
 
@RoelvanUden Yeah. Best chance I have unless there's something .NET Core specific
 
@Kieran yeah, I guess not
 
welp
you need it
but
 
I read that ARM 32/64 support is on the .NET Core roadmap for 2016 Q4/2017 Q1 but I guess that hasn't happened yet
 
2:31 PM
ahah, okay, I'll try to install it then
thanks for the help :
 
the office you install on your dev machine needs to be EXACTLY the same as the one installed on the server your going to deploy too
otherwise it will not work at all
 
okay, makes sense
I'll do that, thanks!
 
not a problemo
glad i could help
 
@Tagc Aha, if you can wait ;p
 
Yeah it's nothing majorly important
I'll wait, hopefully it won't be too long
Just glad that it's working on Windows and regular desktop Linux :)
 
2:33 PM
ITS NOT EVEN FRIDAY
THATS THE SECOND TIME
First was @RoelvanUden starred one
 
@satibel Hah good one
 
Keep that shit to Friday
It's fucking Monday
 
@satibel i'll slap the shit outta you, i swear to god
pls no more
 
in JavaScript, 2 hours ago, by rlemon
It's Monday! Monday! Gettin Work Done on Monday!
Everybody's lookin forward to the work week. 🎵
 
2:37 PM
@rlemon No
 
pls
 
:D
 
am kil
 
Guess who's back?
 
back again
sati's back
 
2:39 PM
tell a friend
 
I hope you don't begrudge me a kick for comedic effect.
Also that song was released 17 years ago
 
@mikeTheLiar I won't kill you, I'm just going to hurt you really, really bad.
 
@mikeTheLiar my initial reaction to what you just said
 
@mikeTheLiar yes, fuck don't make me feel old
 
2:42 PM
@rlemon How old were you in 2000?
 
14
grooving out to that in HS trying to get all the other socially awkward teens to notice me
 
You're now 17 years older than that.
 
yay highschool
 
@Kieran you want a kick, too?
 
@mikeTheLiar What did i do? :C
 
2:43 PM
If highschool was the high point of your life then I am truly sorry for you.
 
damn teenagers
 
@mikeTheLiar unfortunately my sarcasm wasn't clear enough
allow me to rectify that
 
@Kieran Wrong! the good answer was "oh yes, kick me harder daddy".
 
that's when I officially felt old. saw some kids skateboarding down the road, minding their own business. in the back of my mind all I could think was "fucking teenagers, up to no good I bet"
 
yay highschool
@satibel omfg
 
3:06 PM
lol
they say when you see police and they look like kids then you know your old
 
me : "eh, the printer guys (contractors) didn't fix the printer yet. they said today or tomorrow."
boss: "not today or tomorrow, today or yesterday at most."
 
wat
 
he's calling them x)
 
 
 
2 hours later…
5:45 PM
In this Web API code:
https://gist.github.com/anonymous/1847334f6c74177022d528a48ad64d70 is the:
`List<Task> tasks = Task.getAllTasks();`line called regardless of which route is navigated to?
Or is it only called for GetAllTasks? I believe it's called in both situations, but wanted to check.
 
@Vap0r it might. It's a class member, so it implicitly runs in the controllers constructor
Controllers are probably created for every request but I wouldnt bet on it
 
@TomW That was my concern. While normal behavior would say that it runs everytime, this is Web API and could be different.
6
Q: ASP.net Web API: Why are controllers created per request?

urigMike Wasson's article "Dependency Injection for Web API Controllers" on www.asp.net says: Dependenecy Scope and Controller Lifetime Controllers are created per request... Am I correct in understanding that ASP.NET Web API creates a new controller instance (and satisfies its dependencie...

That seems to indicate we were right. Ok, thanks! g2g to lunch.
 
6:29 PM
@AvnerShahar-Kashtan sorry for the delay, I had a class.
@AvnerShahar-Kashtan the float argument for both cases represents an amount of Fuel/chargeTime to add to the Vehicle
 
user1630889
6:46 PM
Is there any feature or tool within C# to "serialize" code blocks to JSON for reuse on both backend and front-end?
 
user1630889
Say I want to mark a model method as "web" and so when an object gets serialized, its code gets converted to JavaScript as well.
 
@AlexanderPritchard JSON has no concept of code
 
@ItayZaguri No, they're not the same. They're just the same type. One is litets, the other is hours.
 
Surely joules or kWh makes more sense than hours
 
user1630889
@KendallFrey Guess the code could be stored in a string and eval'd or new function'd.
 
6:50 PM
No point in using JSON in that case
 
user1630889
Yes there is.
 
user1630889
Because you're likely serializing to it already.
 
Imagine an abstract method "Delay" which takes an int param. Would it make sense for one implementation to take Hours and another to take Milliseconds?
 
user1630889
And you'd have tight coupling between your storage properties and methods, so an intermediate layer could easily turn your object into a javascript object with those properties and methods.
 
If the code that calls your Refuellable has to know the specific
...type to know what data to pass, your design isn't polymorphic. Or coherent
@ton.yeung Collection initializers (var l = new List<string> {"item"}) work by calling the initialized type's Add method for each item.
But if the type doesn't have one named exactly that, you can now simulate it with an extension method.
 
01:00 - 19:0019:00 - 00:00

« first day (2291 days earlier)      last day (2650 days later) »