« first day (2699 days earlier)      last day (2475 days later) » 

13:00
There's nothing to be gained from adding a new String.GetRandomString() instead of StringEx.GetRandomString(), whereas making myString.IsNumeric()` appear to be an instance method, instead of StringEx.IsNumeric(string), helps the syntax be more uniform and standard.
EmptyArray<int>()?
@MohamedElshawaf You can't do that. You can do ArrayEx.EmptyArray<T>, though, as @Wietlol suggests.
Although I don't see how this is simpler than new int[0].
@AvnerShahar-Kashtan also reduces stuff that you dont understand...
wait... lemme search for the right words
reduces surprises
Enumerable.Empty<int>().ToArray()
@Wietlol The Principle of Least Astonishment.
Or Least Surprise, yes, I guess.
13:02
@AvnerShahar-Kashtan arrays just cant easily be generic
IMHO string.EmptyArray wouldn't surprise me
I kind of discourage arrays in languages though as written like that
having Array<Type> is just more consistent
of course in Haskell this is just []
Arrays don't play well with inheritance anyway.
in F# it's [| |]
13:03
@Wietlol Yes, well. In C#, arrays predate generics.
it's kinda string.Empty for me. So why not string.EmptyArray?
You can use Span<T> if you want to abstract it away.
@ntohl I don't understand the need for string.Empty in the first place
Don't embed yourself in bad conventions
I think it's ok to have NullObject constructor on classes
@KendallFrey but what if "" changes?
13:05
so for example Node.Empty is ok for me also (Node is user defined)
as long as there is no type classes
@ntohl Would you like to be able to override the default() operator and return, e.g., Node.Empty?
I think non-nullability by default is better than some "empty" value
!!> "" == []
@Squirrelintraining true
13:08
@AvnerShahar-Kashtan well. I haven't used default(...) operator much. But it's also natural for me.
!!>hackcap.exe
@Squirrelintraining "ReferenceError: hackcap is not defined"
@CapricaSix but for a completely different reason
@KendallFrey (Y)
13:16
@ntohl because String.Empty is an empty string
and String.EmptyArray is not an EmptyArray string
it would be Array<String>.Empty
@AvnerShahar-Kashtan yea, I cant blame "older" languages for it, but I do praise the newer ones that do it with the "generics" way
@Wietlol C# seems to be trying to address it with Span<T>, which abstracts away arrays and also unmanaged memory.
its hard to "fix" it by adding new stuff
in the end, you will end up with simply 16 different ways to define arrays
and at least 5 of them are "thé way"
Sometimes. But it's no different than adding Generics - suddenly you can do both List<object> and also ArrayList.
@AvnerShahar-Kashtan What's the difference between Span and List?
List and List<Object>
13:21
The Java way, of course, is to avoid doing anything for as many years as possible until forced to. :)
ow wait...
its C#
> System.Span<T> is a new value type at the heart of .NET. It enables the representation of contiguous regions of arbitrary memory, regardless of whether that memory is associated with a managed object, is provided by native code via interop, or is on the stack. And it does so while still providing safe access with performance characteristics like that of arrays.
@AvnerShahar-Kashtan apart from some things taking quite a while, I must say that most things that come with Java are pretty thought through
13:22
So it's like a view.
Where a List** holds the data, Span is just a view of some data?
there are a few things I am still missing, but its mostly related to language limitations
@WilliamMariager It's a lightweight view on top of contiguous data, yes.
and to make things clear, those limitations also exist in other languages, like C#
Working with pointers is nice. Although I doubt the performance is great.
@WilliamMariager I don't remember ever working with unsafe code in C#. It's useful for very specific circumstances which I've never run into.
There are some internal string/StringBuilder operations done using unsafe code, I think. Span<T> can be a nice abstraction on top of those, I suppose.
13:29
The reason I suspect performance is bad is because you can't use pointers and generics together. But with the ref stuff going on, it might not need to do so
yay, time to process xmls
13:48
@Wietlol Array.Empty<T>();
im not sure, but notepad++ seems to hate me at this moment
13:59
@WilliamMariager I like working with pointers, too. They're good dogs, Willyam.
I liked pointers, and then I learned C#. Now I jsut think "Why would I ever need pointers?"
Pointers are there for well-defined, tightly-encapsulated uses.
@Squirrelkiller If you ever need performant interop, you'll praise your pointers again.
Also, why would you assume that using pointers is a performance hit?
Something as simple as a memory mapped file
14:02
And there are pointers all over the place in C#, they're just abstracted away so you don't have to think about it.
Pretty sure I can use interfaces for tightly.encapsulated uses
Are you comparing interfaces and pointers ... ?
@Mike exactly - they're abstracted away so I never have to think aboutt hem and don't have to be careful
Nah, pointers and references
reference = easy pointer
Then what's the comment about using interfaces?
pointer can do more, but I don't see how I need that
The comment about using interfaces is a reply to @Avner about tightly-encapsulated use cases
Yeah, he's talking about pointers. You bring up using an interface?
Also, you need pointers for the same reason you need high performance code. Which means you likely wont need it 99% of the time. But when you do, you need them.
@Squirrelkiller Not sure what your point is. Interfaces are a useful tool in C# for a wide variety of uses across the system. Pointers are for very specialized tasks.
I just can't think of a reason I need a pointer for a tightly-encapsulated use case
Anything with encapsulation is pretty much solved with interfaces
Tightly-encapsulated doesn't mean OOP-encapsulation.
14:06
Why would I need a pointer there?
...what kind if encapsultion?
No, I think you misunderstood me. Let's say, you have code which requires high-performance memory manipulation. Using managed byte[] simply doesn't cut it, and profiling shows that this can be improved with unmanaged code.
You would then replace that specific chunk of code with unsafe pointers, but only in that conceptually encapsulated part of your system. It's not something you won't go making your entire project unsafe, or start using pointers for regular tasks.
Pointers for EVERYONE.
You get a Pointer, You get a Pointer Your Get a POINTER
I want dynamic pointers!
void* for everyone!
@WilliamMariager They're all dynamic! That's the beauty!
You don't want a char*? Just cast it! Casting is the way to separate good memory from bad.
14:09
IntPtr dynPoint = &(new dynamic()); // ?
dynamic is basically a Dictionary<string,object>, isn't it?
Pretty much yeah
thats an ExpandoObject
isnt dynamic prety much a javascript-like var?
dynamic is compiled at run-time as far as I know. It does some compile-time logic at least.
It's weird.
But like pointers it has it's merit.
14:11
It's simply dynamic dispatch, with probably a lot of optimizations for speed.
14:52
@Wietlol legit
15:14
my god, I showed the "I'm an expert" sketch here at the office and everyone suddenly started slacking and telling bad jokes about it.
Best retards
@HéctorÁlvarez Did you know it's part of a series?
It is? Link!
@MikeTheLiar Hey, that's Zelda!
@KendallFrey I loved it when he fought the donkey
15:24
@MikeTheLiar Shrek never fought the donkey.
he totally did in the season finale
Shrek fought donkey when Donkey figured out that Light was Heisenberg the whole time
hya,
I have this xml:
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.afm.nl/WfdExternRegister/Export/3.0">
	<child>foo</child>
</root>
why does document.SelectSingleNode("//child") return null?
it seems to be the properties on the root node
but I have no idea what the heck they are
xmlns="http://www.afm.nl/WfdExternRegister/Export/3.0"
You set the namespace
Does it work if you remove it?
xsd and xsi shouldn't matter
if I remove that last one (the xmlns) then it works
Yeah, so it's the selector path that needs the namespace as well
Or change it into something that doesn't look for the name.
15:31
so, what selector path do I need?
Or just use LINQ to XML.
does that convert linq to xml?
(or is that just a horrible name?)
That's just the XDocument/XElement/etc classes.
Called LINQ to XML.
Instead of using xpath, just use .Descendants(name)
If you need xpath, try //[local-name()='child']
@KendallFrey No I didn't
@hilli_micha That's the one where Harry killed Darth Vader by pinching his neck, right?
15:35
yes, my favorite part of the anime
@WilliamMariager descendants require to be direct descendants?
@WilliamMariager that also doesnt work
@Wietlol Yes, but so does your SelectSingleNode?
var xDocument = XDocument.Load(...);
var children = xDocument.Root.Descendants("child"); // gives you all child nodes
var child = children.FirstOrDefault();
Oh wait, direct descendants, I think I know what you mean
To find direct descendants, you use .Element/.Elements, to find any descendant you use .Descendants
@hilli_micha Who doesn't like midget scavenging stories from middle east?
@Wietlol XPath is a bit finicky, but the issue is the namespace. You need to prefix child with the namespace somehow. I don't remember how you do it if it's a global namespace.
@WilliamMariager select single node uses an xpath
//child results in all "child" nodes
all of them in the entire document
i want to find all nodes with "Name" that are a few nodes deep
they arent direct children
15:44
@Wietlol Yeah, but it's still a descendant on the node you use as the root.
So .Descendants does what you need.
It goes through all nodes and subnodes.
@WilliamMariager not necessarily
XPath won't search up, unless you use a parent step.
Which you can do with LINQ to XML as well
XPath does search up
except if you prepend it with ./
.//Child will search only downwards
//Child searches in the entire document
15:46
That's weird behavior.
but Descendants does seem to work
In any case, just use .Descendants from the root.
nvm
descendants also fails because of the namespace
33
Q: XmlDocument.SelectSingleNode and xmlNamespace issue

Shlomi KomemiI'm loading a string to an XML document that contains the following structure : <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Compile Include="clsWorker....

this does seem to work though
.Descendants fails?
Silly namespaces
In that case though, you'd just do .Descendants(XName.Get("child", "http://www.afm.nl/WfdExternRegister/Export/3.0"))
16:18
I have to do "//msbld:stuff/msbld:other"
and pass the namespacemanager all around
I might be able to just get rid of the namespace... maybe
17:03
17:13
@Wietlol Considering it's a root namespace, it shouldn't be too important.
But, some validation might still complain if it's missing.
18:07
how can be cross[i].Count translated to java ?
@WilliamMariager I tried taking the root elements inner xml and doing it on that, but it still messes up
in the end, I thought I could just as easily remove the attributes from the first element at the string level before it is parsed
the issue is that this string is ~171MB
mumbling stupid people stupid xml stupid data stupid shit
@WilliamMariager at least working hours are over now
back to my super duper logical LLVM
@milleniumbug ohai
you saw my awesome drawing about pointers?
@Feeds Funny, this is how I felt the first time I had to develop using GIS.
18:17
@O.Rares probably as "cross[i].getCount()"
@Wietlol doesn't work,can't believe it's that hard to translate a program from c# to java
you should post more context
what's the type of cross[i]
Java collections provide .size() (if it's an array, .length)
@O.Rares (considering Count is a relatively often used attribute of Collection stuff, size() would be the equivalent in Jaba)
cross=new List<int>[6002];
but [i] might be a compiler error in Jaba
18:20
if (p[i] <= min && cross[i].Count > 0) { min = p[i]; idx = i; }
you might want to try .get(i)
can you do "Count" on an int?
ow wait
its a Array<List<int>>
try cross[i].size()
all code is here but it gives an error for some reason
first I tried java to c# to make it complete
this is C#
18:22
then I tried c# to java
this is not Jaba
why did you do java to c#?
to complete the code to solve a problem.That problem is generating a map of steps for a character that moves left and right and forward .The c# code generates the number of cells where the character didn't moved and I need to find the smallest square that includes all the area where the character moved
and the code you have that works is in C# and you want to have the same code in Java?
18:26
and if I find that solution then I go to the next level of the problem and have a better view of my problem and can complete in java the code that is not working
yes
btw, what IDE do you use for Jaba?
the thing is,I already made the problem in Java but has some bugs when the character makes rights
java you mean?
i mean Jaba
i never write plain java code
i always write either a different JVM language
or Java with compiler plugins
since it becomes confusing if we mean plain Java or other Java, we call plain Java Java (because that is what everyone calls Java) and the other, we call Jaba
which we took from a pun (typo) Michael made
18:30
IntelliJ
for example, cross[i][0] is invalid in Java, because it doesnt allow [x] to be used on Lists
only on arrays
a compiler plugin I have does allow it
:D
in any case, you could try to translate it to a different JVM language
for example groovy
you're like a jack of all trades
I am the trades, I abuse the jacks
I write in more than 15 programming languages :D
for the code in c# I tried to print all the array of list but doesn't work,if I could I would solve the problem
> doesn't work
pretty vague
18:33
why you write code in c# if you can write in java ?
Jaba*
ahaha
because a different language is good at different stuff
C# makes it easier to write command line tools
apart from that, Jaba and C-harp arent that different
for example, its easier to name reasons for using Jakartascript as well
I see
or to use Python
because they are used for different things
tools you can also make with python
at work, we ussually work with C#
except we are moving to Jaba slowly
@milleniumbug you didnt answer my question:
18 mins ago, by Wietlol
you saw my awesome drawing about pointers?
(removed)
18:43
why would those lines give an error
for (int i2 = 1; i2 < 50; i2++) {
for (int j2 = 1; j2 < 50; j2++) {
Console.WriteLine("{0} ",cross[i2][j2]);
}
Console.WriteLine();
}
in C#?
because the collection "cross" and its values do not have 50 elements?
so in c# cross isn't initialized ?How I could print it then?
What is the error?
Where is cross instantiated?
Also
18:46
cross.Length doesn't work also
!!tell o.ra format
@o.ra Format your code - hit Ctrl+K before sending and see the faq
!!tell O.Rares mcve
@Wietlol Command mvce does not exist. (note that /tell works on commands, it's not an echo.)
@O.Rares If you would like assistance, please create a Minimal, Complete, and Verifiable Example
@CapricaSix here it is ideone.com/HtaXvH
18:47
Is there a design pattern where a class has different members? I'm creating a filter class that can have only one of these three options; (1 or more AccountType) OR (1 or more IDs) OR (1 or more Names). I'd like to be able to have one function that takes one of these three filters.
This is what I was thinking, but the empty abstract class 'feels' wrong: gist.github.com/anonymous/030b8a6ac79a1e99cfda51c98e8ea7a7
the print code is at the end
@Hpjchobbes interfaces
Holy hell man, give your variables names
@Wietlol sorry, I've missed it.
no, I haven't
more specific "Marker Interfaces"
Also you haven't told us what the error actually is yet
Also this is far from "minimal"
18:49
@milleniumbug
getelementptr and load are "opcodes" of llvm
it's a runtime error,I compile it online and the error is Unhandled Exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index....
i8** and i8* are pointers to bytes
nice, I think it's better than mine i.sstatic.net/FsYrn.png
@milleniumbug I spent HOURS figuring out how the heck "getelementptr" returned the SAME type as the "array" argv
since that is the one where I pass the index of the element I want to get
Oh duh
It's right in front of my face
@O.Rares you're using cross.Length for both loops
18:52
@Wietlol with your 15 languages if you would forget now all of them and would have to take an internship with what language would you work and why?
I suspect for the inner loop you want cross[i2].Length
@MikeTheLiar if I put 50 instead of cross.Length I get the same result
@O.Rares probably one that demented people can still use
@O.Rares then that array does not have 50 elements
prog.cs(122,49): error CS1061: Type System.Collections.Generic.List<int>' does not contain a definition for Length' and no extension method Length' of type System.Collections.Generic.List<int>' could be found. Are you missing an assembly reference?
that is for cross[i2].Length in inner loop
18:53
Count instead of Length
(can we remove arrays from C-harp?)
I am amenable to this suggestion.
Personally I wouldn't mind if arrays had disappeared from existence
We have more than enough collection classes to go around
@MikeTheLiar ofcourse, most of those would break... for example List
Dictionary would probably break
I'm not saying remove it from the runtime
18:55
i know
@MikeTheLiar I put 2 instead of 50 and the error is the same,the array has 10 elements
DEAR GOD MAN
just make it internal or w/e
THERE ARE NOT THAT MANY ELEMENTS IN THE ARRAY
Use a debugger.
@O.Rares what do you use to write your C# code?
Visual Studio?
Rider?
18:56
vs
frigging Notepad++?
Put yeah, if you really need an array a Dictionary<int, T> would serve just fine
wordpad
in VS, you can put breakpoints on lines
Petition to rename breakpoints to breakdancers.
18:57
i have no problem with that
HAMMERTIME!
they ussually tend to dance around your code
especially if you use delegation and stuff
public static void Touch(this T thing) { throw new IllegalOperationException("can't touch this"); }
halt
HAMMERZEIT!
19:00
Better.
19:25
stop
HAMMERTIME!
lol
cease
She's got at least one more but I guess it's not that
caesum
or is is sistite?
MALLEUS TEMPUS!
19:30
i keep forgetting how it changed
19:54
I thought there was one other. The Latin one seems to break for some reason.
Somebody linked to the source once
@MikeTheLiar the only other one i know of is stahp
HAMMAHTIME!
That was the one I was thinking of, I can't believe I forgot that
Thanks, Inspiro.
20:20
Help!
I'm looking for a verb to use in the beginning of this sentence:
I (witnessed?) the rise and fall of some JavaScript libraries. (off course I didn't)
I think there's a verb more powerful than witnessed
invented?
it sure as hell is more powerful
I've seen things you people wouldn't believe. Servers on fire off the shoulder of Redmond. I watched JavaScript libraries glitter in the dark near the Mozilla offices. All those moments will be lost in time, like tears in rain. Time to die.
RIP MikeTheLiar
I hate the moment when I try to remember a word I don't even know :(
but there should be
20:27
I corroboratored the rise and fall of some Javascript libraries.
wot?
can I create extension method on witnessed?
user5500750
Is there a collection type where I could specify a selected item? For example;
user5500750
string[] cities = string[] {
	"London",
	"Paris",
	"NewYork", <- Selected item
	"Tokyo"
}
not that I know of
it breaks on most collections
you need to have a reference to the entry (considering the entries are mutable and not overwritten on write operations of the collection)
or make the collection immutable
user5500750
Or any object that could act like that.
20:40
it all depends on what you want to do with it
user5500750
Just an object that contains a list of objects that keeps reference of a selected object from the list.
If you dont mind it being simple, make a new class, give it 2 properties, a readonly list and a selected item
give it 2 more functions, one which sets the selected item to the given index and one that does the same but then with the given element
(these cannot be overloads)
user5500750
I think SelectList Class does what I am looking for. But there isn't that many examples and it is in the System.Web.Mvc I am not sure whether I could use that in a WPF app.
it is mostly used to show a <select> html element
that is what it was made for and what it is designed for
20:59
In WPF I believe it is a ListBox.

« first day (2699 days earlier)      last day (2475 days later) »