« first day (929 days earlier)      last day (4036 days later) » 

6:01 PM
@Oleg - Maybe later when the staff is off I can. That would be in about 4 and a half hours
k
 
BVR
0
Q: How to overcome the exception "The Type Initializer for "SAP.Middleware.Connector.RfcConfigParameters" threw an exception - Error#:-2146233036"

BVRWe have applications which is fetching data from SAP systems through DCOM SAP connector. Recently we have replaced with .NET connector. After deploying into production it worked for one day. Suddenly it is giving the specified error while accessing one RFC. The exception message is The Type I...

Hi
This issue we have tried to reproduce in our own and dev and test and stage servers
couldn't able to
What else I can do in order to reproduce in our machines
Unless we reproduce we can not able to fix
Veterans, Please help me
 
the ctor throws
easiest might be to write a unit test for the ctor and debug it
 
@JohanLarsson: no, the cctor throws.
Not the ctor.
cctor == the class constructor == static constructor == type initializer.
 
user142019
public delegate Tuple<T, IEnumerable<char>> Parser<out T>(IEnumerable<char> cs);
// src/ParserCombinator.cs(6,60): error CS1961: The covariant type parameter `T' must be invariantly valid on `Ø.Parser<T>(System.Collections.Generic.IEnumerable<char>)'
 
user142019
Why do I get this error?
 
user142019
6:12 PM
Dammit System.Tuple<T, U> y u no covariance.
 
You cannot make a covariant Tuple<T>.
 
user142019
Oh right, tuples are mutable.
 
Only interfaces and delegates can be variant.
@rightfold: no, tuples are immutable, but the C# compiler can't see that.
 
user142019
Wait.
 
user142019
@Steven I can't class ParseResult<out T>?
 
6:15 PM
If ParseResult is a class.... no.
 
user142019
WTF
 
user142019
Lol this is going to be a big ugly hack.
 
You will have to place an IParseResult<out T> interface on that class. That's valid.
 
maybe ParseResult<T> : IParseResult<out T>
 
6:16 PM
@JohanLarsson: Great minds think alike ;-)
 
lol but I'm slow :D
 
Slow minds think alike as well :)
 
user142019
public interface IParseResult<out T> {
    T Value { get; }
    IEnumerable<char> Leftover { get; }
}

private class ParseResult<T> : IParseResult<T> {
    public T Value { get; private set; }
    public IEnumerable<char> Leftover { get; private set; }

    public ParseResult(T value, IEnumerable<char> leftover) {
        Value = value;
        Leftover = leftover;
    }
}
 
user142019
Thanks for the help guys.
 
6:26 PM
<- fail
 
45 minutes until i can go home
man the clock is moving so slow
 
My clock ain't moving at all.
 
My clock is moving too fast.
 
45 minutes? Yeesh, I have 6 hours
well, maybe 5
 
@Steve - Let's trade :)
 
6:36 PM
@Steve: Nothing to do @ work? Why not do some self-study. For instance: learn dependency injection ;-)
 
lol
 
user142019
I'm confused.
 
Clarity, you need.
 
user142019
> src/Parser.cs(8,39): error CS1503: Argument '#1' cannot convert 'T' expression to type 'System.Collections.Generic.IEnumerable<Ø.AST.Declaration>'
 
user142019
What does this mean? What's a T expression?
 
6:40 PM
Why are you using that symbol ?
T expression is usually a generic type
 
@rightfold: Have a bit more context for us? More code?
 
^
 
@Steven no, i busted my balls today and finished early, already know DI
 
user142019
public delegate IParseResult<T> Parser<out T>(IEnumerable<char> cs);

public static Parser<AST.Module> Module() {
    return
        from declarations in Many(Declaration())
        select new AST.Module(declarations);
}

public static Parser<AST.Declaration> Declaration() {
    return Choose<AST.Declaration>(SubDeclaration(), StructDeclaration());
}

public sealed class Module {
    public readonly IEnumerable<Declaration> Declarations;

    public Module(IEnumerable<Declaration> declarations) {
 
user142019
The error is on the sixth line.
 
6:42 PM
@TravisJ If all love's insanity...
 
give me more things to google
 
@kendall - Zedd is pretty cool :), I like this song youtube.com/watch?v=Ezoa-J3EOs4
 
user142019
declarations on line five is of type IEnumerable<Declaration> since Many<T>(Parser<T>) returns Parser<IEnumerable<T>>.
 
@Steve blue waffles
 
NO
lol
 
user142019
6:45 PM
LOL
 
i fell for that one once already
 
@Steve: In that case, try something new. Learn a functional language.
 
dang
 
i recently made my first winform application - a simple notepad.
 
graTS :)
 
6:46 PM
How about 'anencephaly'
 
how did it go?
 
I also published it and learnt that visual studio automatically creates the installer
 
VS sucks at creating installers.
Just warning you.
 
now I want to know how I can customize the installer
 
WiX is the way to go.
 
user142019
6:46 PM
Installers suck FTFY.
 
Ben
Anybody willing to take a look at a question I posted? Having trouble finding a solution and not getting much response.
 
@Ben: Pass us the link
 
@Ben You should ask if it is okay to ask such a question first.
 
i'll take a look, but probably won't be much help, i just learned programming last week
 
Ben
6:47 PM
@Steve Wow, it only took you a week to learn all of it? :)
 
troll alert beep beep beep
 
:p
 
I will look into Wix, but can you customize the Visual Studio installer, just wonderin
is it possible
to customize installer in vs
 
@Ben LOL. @Steve is goood.... it took me at least 3 weeks.
 
Are you referring to ClickOnce, or an installer project?
 
6:50 PM
@ben - That is simple. IE never properly displays websites. ASP or otherwise.
 
i'd help, but trying to figure out why IE displays everything wrong is the last thing on my todo list
 
You want to do that just before you die?
 
Ben
Well, from what I've read IE10 is a lot better about standards compliance than 8, but 8 displays it exactly as Firefox and Chrome do.
 
yes
 
@KendallFrey A simple installer, a.exe file, the way you install any normal application like CCleaner for example.
 
6:51 PM
Or you want to die right after doing it?
 
it will probably be the cause of my death
 
lol
 
You don't install a normal application with an exe.
I consider msi a normal installer.
 
agree
 
But you still haven't answered my question. Is it ClickOnce?
 
6:52 PM
does msi create .exe installers as well?
 
No, it creates msi installers.
 
Does List<SomeStructType> use boxing? How about SomeStructType[]?
 
I have never heard of ClickOnce :|
 
@FredOverflow pretty sure List does not box
 
user142019
@FredOverflow the latter surely doesn't.
 
6:54 PM
@AnkurSharma Is it a VS installer project then?
 
it is a winform project
 
9
Q: In C#, are the values in a List<struct> boxed?

romkynsSuppose I declare a generic List containing values of a struct type: struct MyStruct { public MyStruct(int val1, decimal val2) : this() { Val1 = val1; Val2 = val2; } public int Val1 {get; private set;} public decimal Val2 {get; private set;} } List<MyStruct> list...

 
in visual studio
 
The installer is?
ewww
 
I don't think it boxes either.
How would it retain its type of it were boxed?
 
6:55 PM
> If a value type is used for type T, the compiler generates an implementation of the List<T> class specifically for that value type. That means a list element of a List<T> object does not have to be boxed before the element can be used, and after about 500 list elements are created the memory saved not boxing list elements is greater than the memory used to generate the class implementation.
interesting
 
how do i check the installer?
i dont know what mine is?
 
How did you make it?
Installers don't drop from the sky.
 
in visual studio winform designer
 
@FredOverflow probably huge benefit in speed
 
then i just published it using the publish button
 
6:56 PM
So, ClickOnce.
And what sort of customization do you want to do?
 
add my own license agreement terms for example
 
@FredOverflow: Interesting indeed. We often forget the overhead of extra code generation.
 
@AnkurSharma ClickOnce doesn't let you do that?
 
ok, i will go for wix then
thanks
 
I'd think surely it would let you customize it, but if it doesn't, it's not worth using.
Protip: If you want a simple low-budget self-extracting installer, try IExpress.
 
7:00 PM
@FredOverflow: But don't forget that a JITted type will never be unloaded from memory, while those boxed items will be disposed when that List gets dereferenced,.
 
@Steven I'm a C++ programmer, I'm used to template code bloat.
 
another newb question, why would you need dll files when the compiler automatically fits everything into the exe file.
 
um...
@NinjaEcho $google dll
 
You create dlls to share code among applications, or to modularize the code.
The alternative is a .lib. Which is not really a good thing.
 
7:09 PM
So are dlls like classes
 
otherwise each exe in windows would be 10GB
 
@AnkurSharma No.
 
Classes are blocks of code that can be shared among applications? (In actionscript, you could use packages and classes between many projects)
Oh I see, are dlls equivalent to swc in actionscript 3
 
Classes consist of two parts: data that is used to form objects, and code that is used to manipulate them.
Every class is contained within an assembly (dll or exe)
A DLL can store many classes.
 
ok i understand
thanks
kendal, i see that you have hosted your website on 000webhost for free. Did you also get .com domain for free? just wondering...
 
7:15 PM
Nope.
 
are u using a ready made cms, or did you create your own cms, or are you editing html whenever you want to change your website.
 
editing html. php actually
except the only php is the page template system.
That's about 15 lines.
 
isnt it a pain in the ass to edit soure code everytime?
 
Why?
all I'm ever doing is writing text.
 
user142019
Will someList.ToList() always create a new object?
 
user142019
7:21 PM
Or can it return this?
 
is there a way to stop the debugger everytime an object (or its contents) is changed? short of putting a breakpoint everywhere
 
@rightfold Read the code.
 
user142019
It's not open-source.
 
Yes it is.
 
user142019
It is?
 
7:23 PM
@NinjaEcho are you actually a bot?
 
Yes and yes.
 
@NinjaEcho $google test
 
oh yes it is a bot.
 
@NinjaEcho $google (function(){alert("!");})()
 
@NinjaEcho what are you
 
I am a bot who goes by the name Ninja Echo.
 
^ the code
 
@NinjaEcho - who are you?
 
@NinjaEcho $flip
 
7:27 PM
Heads
 
$flip
@NinjaEcho $flip
 
Wait, when I have a List<SomeStruct> in C#, there is no way to manipulate the objects in place, lol
I have to copy them out, manipulate them, and then copy them back in. Retarded.
 
Guess it hit the spam filter.
 
@NinjaEcho $help
 
@Kendall - I found an interval of 1750 to be easier to avoid the filter
 
7:30 PM
Right?
 
interval? what?
@FredOverflow Right
@rightfold The answer is yes.
 
Doesn't C# have return by reference or something?
 
user142019
Thanks.
 
    public static List<TSource> ToList<TSource>(this IEnumerable<TSource> source) {
        if (source == null) throw Error.ArgumentNull("source");
        return new List<TSource>(source);
    }
 
user142019
@FredOverflow return a reference type?
 
7:31 PM
@FredOverflow Yeah, that's called a reference type.
 
80
Q: Why doesn't C# support the return of references?

Tom SarduyI have read that .NET supports return of references, but C# doesn't. Is there a special reason? Why I can't do something like: static ref int Max(ref int x, ref int y) { if (x > y) return ref x; else return ref y; }

Hm, return by reference would probably make the GC a lot more complicated.
 
It's like returning a pointer to a local variable in C++. It 'works', but the variable is deleted after you return.
 
Not if you return a data member by reference. That's what std::vector<T>::operator[] does.
 
how do you create a function which can modify the value passed to it. For example -
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
the Read function modifies the buffer
 
Arrays are reference types. Just pass the reference by value.
 
7:33 PM
Um, it just modifies the object?
it's a reference type, so it just modifies the object passed in.
 
Passing buffer does not copy the array, it just copies the reference.
What Read cannot do is make buffer point to a different array.
 
Pointers are essential for every programmer to understand.
 
not in Haskell
 
Yes, in Haskell.
Because I said so.
 
Haskell has no notion of pointers or references or whatever.
 
7:34 PM
pointers, the reason i gave up on c++
 
user142019
Any respectable Haskell programmer can use the FFI.
 
Neither does JS. Your point is?
 
@AnkurSharma You almost never need pointers in C++.
 
user142019
@FredOverflow There is Ptr a.
 
user142019
And Addr#.
 
7:35 PM
@FredOverflow What???
 
user142019
 
What bad UI choice.
That site fails lol
"Modern C++: Uncaught TypeError: Cannot read property 'classList' of null " owned
 
the term 'passing reference' just means passing a pointer?
 
17
Q: Why are pointers not recommended when coding with C++

jpartogiI read from somewhere that when using C++ it is recommended not to use pointers. Why is pointers such a bad idea when you are using C++. For C programmers that are used to using pointers, what is the better alternative and approach in C++?

320
Q: Why should `new` be used as little as possible?

BelugacatI stumbled upon the Stack Overflow question Memory leak with std::string when using std::list<std::string> and one of the comments says this: Stop using new so much. I can't see any reason you used new anywhere you did. You can create objects by value in C++ and it's one of the huge advan...

 
I use(d) pointers all the time.
@AnkurSharma Pretty much.
 
7:40 PM
@AnkurSharma Depends on what language we're talking about.
 
* &
 
user142019
@KendallFrey because you learned C++ from bad sources. :)
 
and a pointer is basically a hexadecimal number representing a memory location, right?
 
Are you calling my brain a bad source???
 
basically
 
7:41 PM
@AnkurSharma Why would it be hexadecimal? lol
 
user142019
@KendallFrey I mean bad sources that teach C++, also known as: everything not that is not on the book list or Code Puppy.
 
@AnkurSharma It's not a hexadecimal number. It's just a number.
If 14 isn't a hex number, then 0xE isn't either, because they're identical.
 
user142019
"Pointer" is an abstract concept.
 
user142019
It doesn't matter how it's implemented.
 
user142019
In POSIX, a file descriptor is a pointer of type int.
 
7:43 PM
@rightfold Are you sure you don't mean a reference?
 
user142019
Reference is also an abstract concept.
 
Pointers are pointers because of arithmetic.
 
Usually a pointer is an offset, which is why it is a number.
 
user142019
@KendallFrey Not really.
 
user142019
A pointer is a value that points to another value.
 
7:45 PM
so when passing an array like this - myFunc(arr), is it same as myFunc(0xE) where 0xE is the location of the arr
in c#
 
@AnkurSharma No.
You can't pass a number instead of a reference.
 
user142019
@AnkurSharma That's a type error.
 
Because 0xE is not an array
 
@OlegOrlov Why are you using new? Just write B object2 = B(); in C++03 or B object2{}; in C++11.
 
user142019
You can do this if you want:
 
user142019
7:47 PM
unsafe void MyFunc(int* xs) { … }

var xsArray = new int[42];
fixed (int* xs = xsArray) {
    MyFunc(xs);
}
 
Then I guess I didn't understand the question. No sane C++ programmer would ever write B object2 = *(new B());
 
user142019
Probably you can also do (int*)new IntPtr(0xE) but it's a terrible idea.
 
What exactly do you mean by "catch a pointer"?
 
user142019
@OlegOrlov You are allocating a new object on the heap and then copying it to object2. And potentially leaking memory.
 
@rightfold operator* returns an lvalue, so it's definitely a copy and never a move.
 
user142019
7:50 PM
Please ask your question again but this time in English.
 
try {
    throw "hello world";
} catch (const char* p) {   // catch a pointer
    std::cout << p << '\n';
}
 
lol
 
user142019
@OlegOrlov That's possible but a terrible and stupid idea.
 
user142019
Never use new and delete except when implementing allocators or make_unique.
 
@OlegOrlov Doesn't that have the potential to free unallocated memory?
 
user142019
7:52 PM
@KendallFrey well, memory not allocated by new yes.
 
user142019
B b{};
B c{*new B{}}; // "fine"
B d{b}; // UB
 
Now comment on my solution how to catch a pointer!
 
user142019
@FredOverflow You're doing it wrong. That should obviously be the following:
 
user142019
try {
    throw "hello world";
} catch (const char* const& p) { // catch by CONST REFERENCE DAMMIT
    std::cout << p << '\n';
}
 
Why would I want to catch a pointer by reference?
I suppose you cannot catch auto&&, can you? lol
 
user142019
7:55 PM
 
user142019
@FredOverflow No.
 
Or how about template<typename T> catch (std::vector<T>& v)?
 
user142019
If you want to catch all exceptions, catch std::exception const& and don't be a moron to throw anything that doesn't derive from std::exception.
 
user142019
@FredOverflow you cannot do that.
 
user142019
T must be known at compile-time lol.
 
7:56 PM
stupid inflexible exception system
 
user142019
@FredOverflow because it's always recommended to catch by const reference.
 
I'm gonna continue catching my ints by value, tyvm.
 
user142019
C++ should enforce throw to be used only with types that derive from std::exception.
 
user142019
It should also enforce initialization of PODs because this is completely moronic.
 
user142019
You cannot deal with copies if T is covariant. T will need a virtual clone function. You need to copy the pointer, and that only works with reference counting or garbage collection. And the semantics are different.
 
7:58 PM
@OlegOrlov C++ already has std::shared_ptr and std::unique_ptr, no need to handroll your own.
Basically, if you write your own smart pointer, you must peer-review it. If your peers don't find at least three serious errors or design defects, they don't know nothing about C++.
 

« first day (929 days earlier)      last day (4036 days later) »