« first day (2859 days earlier)      last day (2090 days later) » 

mr5
1:24 AM
o/
@Wietlol hey, how do you "part time" a bachelors degree?
 
\o
 
mr5
which country?
 
the netherlands
 
mr5
how often do you go to school?
 
once a week
 
mr5
1:27 AM
whoa that's cool
I stopped school because I can't support myself financially. But if the school allows me to attend it once in a week, let's say, every weekends, I would probably have a degree
 
mr5
1:50 AM
Nice implementation of grids there
 
 
2 hours later…
3:59 AM
Curious what the hell is running there? Blocking VisualStudio 76secs on I5 4660 and 12G ram?
Maybe they did re-compiling the whole resharper
 
 
1 hour later…
5:19 AM
could someone help me write a lexer in C?
I've found a dozen ones online and ran them successfully but they're all 50+ lines.
I mean look at this one line:
char keywords[32][10] = {
    “auto”,”break”,”case”,”char”,”const”,”continue”,”default”,
    “do”,”double”,”else”,”enum”,”extern”,”float”,”for”,”goto”,
    “if”,”int”,”long”,”register”,”return”,”short”,”signed”,
    “sizeof”, ”static”,”struct”,”switch”,”typedef”,”union”,
    “unsigned”,”void"
}
I find this SO ugly.
Is there some keywords.h library? Perhaps a lexer.h which could give me a neat one-line sol'n
I did find one Lexer.h online but I'm not sure how it's supposed to work.
 
5:41 AM
Goooood morniiing CeeSHaarp! Have you used any previously unknown UI frameworks lately?
@MisterGeeky I suppose you could shove that "keywords" array into a .h file and use that? I'm no c coder so I'm not very well versed in those norms.
 
@Squirrelkiller nope, I should. I want UI frontend for my lexer now.
@Squirrelkiller no way, that's bad design. The language should know what its keywords are.
 
Also how else would you write a lexer but hard coding all the keywords/operators and checking if those arrays contain your current symbol?
The *compiler should know what the keywords are
 
yeah
 
For C# that's roslyn, and it lets you install coe analysis tools to build a sourcetree, which is practically what you want
 
I was hoping word in __keyword__ or perhaps \ __isKeyword__(char[] word) would be there natively.
 
5:45 AM
THe thing is, I have no idea how that works in C. There isn't one authority to go to. Gotta look for compiler tools.
Could message some mingw people and ask for a sourcetree generator?
Or something
natively most probably not, but maybe in some compiler's code analysis library
 
@Squirrelkiller this is where I am. How do I get to a compiler's anal lib?
 
Just ask nicely and hope they're ok with that I guess? Or wait for your birthday, I heard that's the right day to propose something like that.
 
how does gcc recognize c keywords? perhaps, I could use whatever they're using.
 
yo
@MisterGeeky They probably have an array with keywords and ask that?
There isn't really much else you can do. Compilers aren't magic either. They see text, they check with a set of known keywords, and then know if it's a keyword or not.
 
6:02 AM
Surely not my array.
 
Everybody reading a source file sees text.
They might have that split up into several things, since enum makes an enum and not a variable, return is a command and not a variable and might be compiled to a single rts statement, that kinda stuff.
But if you just want to count keywords, yours will work.
 
that sounds more like a counter than a lexer
4
Q: Building a lexer in C

HickI want to build a lexer in C and I am following the dragon book, I can understand the state transitions but how to implement them? Is there a better book? The fact that I have to parse a string through a number of states so that I can tell whether the string is acceptable or not!

also, it turns out I'm not the niel armstrong of c lexers in c
From GCC:
>>> The C language lexer function c_lex() calls the libcpp function cpp_get_token() which handles the preprocessor keywords.
 
6:17 AM
That seems to be written in cpp, doesnt it?
Also *Neil Armstrong
 
It's ugly looking, I don't understand it and most probably, it does not do what I think it does.
 
ohayou
 
Morning Proxy o/
 
Could a static, pure method be called a function?
 
6:23 AM
@Squirrelkiller Call it whatever you want. The words "method" and "function" are very context-dependent anyway.
 
Hoq about squill
Damn squill already exists, it's a flower
 
GoOoOoOoOoOoOoOoOoOoOoOd Mornin' squirrelerinos!
 
@Squirrelkiller But yes, a pure, idempotent method matches what is usually called a function in the sense of "Functional programming".
 
can an idempotent method be pure?
I tohught idempotent means: No difference if I call it once or 5 times. Nullipotent: no diffference if I call it 5 times or not at all.
doesnt that mean an idempotent method might change something the first time around?
And therefore isnt pure?
Also nullipotent/idempoten methods might depend on internal or global variables, while a pure method is basically functional programming
 
6:39 AM
Idempotent means you will get the same result every time. Pure means it has no side effect. They're not contradictory. () => 5 is pure and idempotent.
 
So "purity" goes standardMethod -> idenpotent -> nullipotent -> pure -> functionalIGuessIfStatic ?
 
It's not a scale.
 
() => 5 is also nullipotent
 
a.f(x) and b.f(x) are functions and not methods iff <blank>
 
wait i gotta read about nullipotent again
 
6:41 AM
@MisterGeeky I don't think the distinction is very interesting. It's just labels.
 
and that's why we can't make babies
 
The distinction between idempotent and nullipotent is very slight, I think, and not always interesting.
() => 5 is both idempotent and nullipotent. () => File.WriteAllText("c:\temp.txt", "blah") is idempotent (because it will override the file if it exists) but not nullimpotent (because the first time it's called, the file will be created) and not pure (it leaves behind the file, a side effect)
The distinction is important to writers of compilers and runtimes. Pure, idempotent functions can be memoized. Nullipotent functions can be precomputed.
 
mr5
@MisterGeeky I don't think a nameof equivalent exist in C so this might be the best solution you will get
 
So my scale does work :P
And yes, I'm aware it's not an actual purity scale, that's why that's in quotes
 
Not necessarily. () => rand.Next() is pure but not idempotent or nullipotent.
Actually, it's not even pure.
 
6:46 AM
@mr5 eww, that's a gross thought.
 
But () => DateTime.Now is pure
 
DateTIme.Now depends on global vars, no?
 
mr5
@MisterGeeky why would it be gross?
 
Hmm, yes, it would be considered impure because it doesn't depend on the arguments.
I need to refresh my definitions.
 
Ya me too
 
mr5
6:48 AM
I also wonder how such time gets retrieve from the low level
 
So "pure" and "nullipotent" are pretty much synonyms here.
 
mr5
Does it gets stored in a special memory location?
 
@mr5 i would want a native iskeyword() and list_keywords in C
 
@MisterGeeky that doesn't really seem like the sort of thing C will go for.
 
Isn't nullipotent still dependant on internal/global vars? Can't find it right now, my google-fu fails :(
 
6:54 AM
@AvnerShahar-Kashtan why not? are they afraid of making lexographical analysis easier?
 
@MisterGeeky C devs? Yes, I think they are.
 
mr5
@MisterGeeky so you're looking for an existing code that does this?
why not look how gcc does this
or other compilers
 
Damn The Fat Rat is catchy :3
 
@mr5 could you find one? besides clang (I see there's a one line command but I don't have sudo on this ubuntu to apt get)
 
Yup definitions are right.
idempotent = every result is hte same as he first
nullipotent = every result is the same as doing it zero times = no side effects
pure = output is entirely input dependent, no internal/global vars.
 
7:11 AM
Morning
@juanvan did you manage to get it eventually? It was a convertible Lenovo, 500-600€ discount
 
Buenos dìas
 
Can anyone tell me if the dictionary class has an Except method that allows you to pass in a string list? I have a list of keys that I want to remove, but wondered if C# offered a nice built in way with LINQ or something?
 
Isn't there a LINQ .Remove or something?
Or RemoveAll maybe?
like, .RemoveAll(o => !list.Contains(o))
 
good morning
 
Morning ntohl o/
 
7:24 AM
77
A: Best way to remove multiple items matching a predicate from a c# Dictionary?

JaredParHere's an alternate way foreach ( var s in MyCollection.Where(kv => kv.Value.Member == foo).ToList() ) { MyCollection.Remove(s.Key); } Pushing the code into a list directly allows you to avoid the "removing while enumerating" problem. The .ToList() will force the enumeration before the forea...

sorry not that stackoverflow know of
 
7:35 AM
@Squirrelkiller Linq is for querying, not modifying.
 
What's RemoveAll for then?
 
It's from List<T>, not from LINQ.
 
I see
 
@VoiDHD Dictionary does have an Except method by virtue of being an IEnumerable<KeyValuePair<K,T>>, but it won't help you with a list of keys.
 
mr5
2
A: Remove elements from Dictionary<Key, Item>

L.Bdict.Keys.Except(list).ToList() .ForEach(key => dict.Remove(key));

 
7:42 AM
@mr5 That would remove all keys except those in the list. But @VoiDHD asked about removing the ones in the list.
 
mr5
then list.ForEach(key => dict.Remove(key)
 
list.ToArray().ToList().ToArray().ToList().ToArray().ToList().ToArray().ToList(‌​)
NaughtyProgrammerException thrown
 
Just to make sure it's really, really, absolutely enumerated.
 
mr5
Why does Razor PageModel does not have virtual method of OnGet and similar http verbs?
This whole ASP.NET + MVC + Razor is very overwhelming. I feel like I live in the past not knowing a single thing about how this framework works
 
mr5
8:07 AM
Both are loaded using "Empty Cache and Hard Reload"
Razor page is even hosted locally
 
Guess your pc sucks
and stackoverflows servers dont suck
 
mr5
It's Google servers
 
Good point. Their servers dont suck even harder.
I have an else in my method that can actually never happen, unles...dont know, I switch numbers around in the debugger or something. WHat do I throw? not implemented? THere's nothing to implement. I have all the cases in different if/else if blocks. Could technically change the last elseIf to no-if-at-all, but verbosity.
 
8:38 AM
Razor has to interpret itself, transform into markdown and output the resulting HTML. That takes time, as opposed to loading content dynamically through scripts... That's my guess
Besides, Razor wasn't made for performance, but rather to make HTML object-oriented so you could treat it like you do your backend for a seamless development
 
Many tried that, and it never really stuck.
I heard of WebForms, which seemed to suck big time.
I'm using Visual WebGUI right now, basically winforms but it compiles to asp.net, which still kinda sucks.
There was silverlight...or kinda still is. Nice idea, but I didnt really ever hear anything good about it.
And now people complain about razor, which seemed so great (although I haven't used it in a serious project yet).
 
@Squirrelkiller if there is something that can actually never happen, I usually throw an UnreachableCodeReachedException (or UnreachableCodeException)
but you should only do that if that code is actually never reachable
 
It's literally a case I handle at the very beginning of hte method.
(including a return in that if block)
 
then i am not sure why there is this if else at the bottom
 
verbosity
 
8:46 AM
redundancy? was that what you mean?
 
MCVE:

if(day > 1 || day < 31) return day-1;

if(day == 1) return 30;
if(day == 31) return 29
throw new UnreachableCodeException();
the lower two ifs were if / else if a minute ago
 
private void Bar()
{
	throw new Exception(); // for some reason
}

private string Foo()
{
	Bar();
	throw new UnreachableCode();
}
the Bar in some cases was a Redirect of ASP.NET which threw a thread abort exception
for example
in your case, I would basically switch some stuff
also
your entire code after the first if is practically unreachable
> if (day > 1 || day < 31)
^ Expression is always true
 
Oh shit you're right
 
private int Bar(int day)
{
	if (true)
		return day - 1;
	throw new UnreachableCode();
}
 
mr5
@Squirrelkiller or you can use range-based switch if you don't like the syntax stackoverflow.com/a/44078916/2304737
 
8:54 AM
wait it's actually
day>1 && day<31
 
ok, so that leaves <=1 and >=31
there your other ifs come in place
 
and then you are left with <1 and >31
 
We're not on C#7 yet :/
 
input with those values will reach that "unreachable" code
 
8:56 AM
input is actually a datetime and I just read hte da.Day
 
mr5
are you writing a calendar app?
 
So this would work until the next calendar change in a few hundred years or so
Nope, still working on interest day count conventions
 
private int Bar(int day)
{
	if (day < 1 || day > 31)
		throw new ArgumentException();
	if (day == 1)
		return 30;
	if (day == 31)
		return 29;
	return day - 1;
}
@Squirrelkiller and you assume that it is between a certain range
pls dont assume assumptions are assertions
 
Why handles date yourself
 
because he is fancy
 
mr5
I'm calling the cops GDPR
 
lol
Why not just removing that
 
I paste code here all the time
usually because I want to show off how amazing our codebase is
 
mr5
that code looks like it will blow up in the next few weeks
 
It's basically "give me the day before this one".
But when it's a 30-day-convention, 30th and 31st are one day, so if it's the 1st, I gotta return the 30th, but if it's 31st I gotta return 29th.
I got TDD on this class bro
 
9:02 AM
needs more SLA
:p
 
Service Level Agreement?
 
Single Level of Abstraction
why do I always write Abstractation?
 
Too big expections
 
@Squirrelkiller I would throw an illegal state exception (if that is a thing)
 
I have 1978 lines of crap to refactor into good. Wish me luck
All in one class
 
9:04 AM
all in one method?
 
mr5
@LeeButler you encountered a god object
 
It's more like a god window
 
@Squirrelkiller you should probably fix this issue
 
Unfortunately I've already removed everything which could be stripped stright out
 
9:06 AM
Who said I'd actually use it :P
 
mr5
wait. are you two working on the same code base?
 
RIght now, almost. He has like 50% of my codebase.
!!woosh mr5
 
@Lee let resharper make a single LINQ statement from it.
 
There's so much duplicated code
 
9:10 AM
@LeeButler but is there duplicated effort?
 
I don't think so. But I do know the amount of effort I've put in to work around this mess in the last 2 years or so is huge compared to what it should be because it's a mess
 
Duplicated code is one of the nicer refactoring opportunities.
 
Removing unused code is the best
 
dedded code is the würst
 
I'm too paranoid to remove "unused" code because our codebases very spcial handling of reflection
 
9:13 AM
make Reflection be a compile time error
 
I created a solution which has every single project in it, and we don't make much use of reflection so it's "pretty safe"
"pretty safe" being famous last words
 
Reflection is part of the framework we bought, which isnt supported anymore, but is so fucking deep that we cant even try to guess where it uses reflection.
We do have the sources though
So we're removing any reflection calls we come across, so we can slowly get rid of it.
 
reflection is nice under the hood
 
It's never gonna go away at that rate
 
but you should never use it yourself
 
9:22 AM
Even the under the hood reflection isnt justified
(in our case)
it's just because it was ported from a multiple-inheritance language
 
I had a nice usecase of reflection. In WinForms if you set binding to updatesource=notifypropertychanged, than textbox wont trigger for each key press. So I made a reflective code (which should be reflection anyway, because of how binding works), which updated properties where NotifyProperty was called upon, to their value.
so basically it was fixing a bug
 
@Squirrelkiller reflection can be used to do fancy stuff
for example, in Jaba, JPA entity managers use reflection to be able to change final (readonly) and/or private members
this way, you can have your entities be built the way you, as programmer, want to use them without having to satisfy some framework's constraints
 
I mean,, reflection is basically giving us wpf data binding, so yeah. Can be fancy.
 
EF doesnt do this that well and has some stuff that makes me bash my desk with my head
 
Yeah! Use Reflection to bypass licensing control.
 
9:31 AM
licensing control?
 
Licensing? Whats that
Why is it not reach - raught - raught
 
No I cant say here. As it was public
Just forget it
 
Reflection is scary
 
i am scary
reflection is reflection
 
I tried it for the first time a couple of months ago an didn't like it
 
9:45 AM
I look at the mirror and see my face, and I'm like "What if I was a recursive function".
Oh BTW I eventually bought the convertible, they took it another 100€ down form yesterday
So on friday I'll have a Yoga. Wish me luck.
Because I honestly don't know the reason why it was 700€ off.
 
damnit, having a flexible computer doesnt mean you are flexible
why do hoomans not understand this?
 
I can put both my feet behind my head
 
Are you okay Hector?
 
i can put both your feet behind your head
 
I have an effective 270º of movement in my left shoulder, i.e. I can make my left arm point right from behind me.
 
9:49 AM
you wouldnt like it though
 
And I can do a split.
@LeeButler Sure, why wouldn't I
 
You're talking all sorts of weird shit
 
First C# class written with both feet is behind the head.
 
find the differences
there are 2
 
9:56 AM
nsmgr and childmesses
 
nope
those are the same
 
I mean they aren't
 
they are the same
 
"nsmgr" =/= "nsmgrMess"
Same with the other one
Actually there's a lot of differences
 
string.Replace("Node", "Mess").Replace("item", "mess")
 
9:58 AM
Goood day :D
 
different code highlighting
 
To everyone except android emulators
 
Hola Xariez
 
I've developed an extreme hatred for Xamarin Forms bullshit as of lately, seeing how it refuses to accept changes to a collection that's already on the screen from other threads
 
Gotta manipulate collections from the thread they were created by
 
10:01 AM
Yeah you should kick the update command back to the main thread
 
Put someone in charge of those collections
a collectioneer
or collectionator
 
A Collector
 
i dont even know how the item thing works
 
@Wietlol It looks for a very special tag, nested deeply in that xml document
 
ow wait, i think i got it now
 
10:04 AM
<xmlDocument>
  <Mess1>
    <Mess2>
      <Mess3>
        <Mess4 />
      </Mess3>
    </Mess2
  </Mess1>
</xmlDocument>
 
(except that continue is not an expression)
 
Wait forget my whole thing
It jsut checks if all of the messes are non-existent
 
Oh my god it's like the conversation I was having last night
 
way easier than I thought
 
use an XML parser
 
10:05 AM
What the hell kinda stuff do you talk about with your girlfriend, Lee?
 
lmao
 
> girlfriend
 
"Tell me about those sexy nodes babe"
 
/r/AbsolutelyNotMeIrl
 
"How deep can it go?"
 
10:06 AM
"Yeah baby nest that tag in another tag"
Nest it reaaally deep
 
It can go as deep as you want it ( ͡° ͜ʖ ͡°)
 
Jesus christ that has to be the quickest star i have seen ever
Deeper
 
!!giphy deeper
 
Deepest
 
10:07 AM
(͠≖ ͜ʖ͠≖)
 
uh
 
Damnit Cap
 
/r/UnexpectedGifs
Also screaming in pain when you realise it's super painful to pull out (go up from a node)
!!giphy go deep
 
thats not a creepy smile, no sir
Does anyone know if giphy is actually SFW? Or does it contain.. things?
 
mr5
10:10 AM
@Xariez heyy. this is still your problem?
 
!!giphy deep
 
Define this ? @mr5
 
mr5
your collection issue last week
 
err
No, that got fixed, actually
 
mr5
10:13 AM
by code-behind hack?
 
Not really, no
Created a new collection from the one in the ViewModel based on the filtered data, then raised the property and it worked
Right now im trying to modify a collection, in order to do so i need to go to the main thread, and Device.BeginInvokeOnMainThread() doesnt work. So thats nice.
 
make a new collection instead
 
Explain?
 
mr5
It seems like you're using an outdated XF
 
Create a temporary collection that we add data to which we then use to populate the "actual" collection?
 
mr5
10:16 AM
We only encounter that issue on XF 2.4, and the issue went away after upgrading to 2.5 , 3.0
 
We're using XF 3.1.0 atm
 
mr5
That's strange
 
@Xariez replace the "actual" collection? so that the new collection is the "actual" collection?
 
Yeah
List<string> temp = new List<string>();
temp.Add("Blah");

ActualCollection = new ObservableCollection<string>(temp);
 
hmm... i just thought about how I would do it in Jaba, but now I am wondering how well implemented the stream souces are
it could destroy the lazyness of the streams
 
10:28 AM
@LeeButler So it's weird to be flexible enough to become a human paper clip, but it's not creepy to have arms like Popeye
 
10:38 AM
who has arms like popeye?
 
I dont get it.. This app has worked pretty flawlessly, and now all of a sudden literally no collections get any data because it cant be modified from different threads?
 
make them concurrent collections
 
Heyyo
 
I mean damn, thats not even good looking
He looks like a misformed dinosaur
Disformed?
 
Malformed?
!!define malformed
 
Terraformed?
 
hi all
 
Cap iz ded
 
10:50 AM
!!giphy pepehands
 
No she's not
And that's not PepeHands god dammit
 
!!define hello
!!help define
 
@HéctorÁlvarez define: Fetches definition for a given word. /define something
 
/define malformed
 
10:51 AM
It's not fetching anything
!!define hello
It ain't working
 
!!googleme define malformed
 
hm
 
!!urban malformed
 
@Squirrelkiller malform The false female emotion of sexual [rejection] as if she is not attractive, when the true reason was ultimately [too much alcohol] on the male's part aka: [whiskey dick].
 
10:56 AM
PFFFFFFFFFFFFFFFFFFFHAHAHAHAHAHA
 
Right. Thanks Cap.
 
I'm gonna unstar only because it's not a proper thing to keep pinned, but you can take it as an instant like.
Even more so after Xariez asked how deep can it go.
 

« first day (2859 days earlier)      last day (2090 days later) »