« first day (11 days earlier)      last day (237 days later) » 

2:04 AM
oi oi
 
ahoy
 
:D
 
:3
 
:!
 
:!
 
 
10 hours later…
12:33 PM
morning!
Guys I have a simple Q with designing a program: If I am building an API (dll to be used with another program), so I want to provide functions. The routine now is that the user creates an object (of that class / from the dll) and uses its functions. How can I provide only the functions? Something like: instead of MyDll MyObject; /* stuff / MyObject.DoTask();, do using myDll; / other stuff */ DoTask();
 
No idea with VB
 
Edit: Instead of MyDll MyObject; /* stuff */ MyObject.DoTask();
I want to do:
using myDll; /* other stuff */ DoTask();
 
in c# you can't have that
 
ehmm..
 
only if the consumers create a partial class with the method DoTask
but then they still have to provide a references to either a static class or instance in MyDll
 
12:37 PM
@rene So the best routine now is that the user creates an object of my class (my dll), then uses its encapsulated functions
@Enzokie thanks I will look at it
 
@FirstStep lol nope
 
@FirstStep they use the public interface of the class yes
 
its another phishing site
 
@FirstStep you can provide an factory that returns an interface to the functions you want to be public
 
@rene it is my current design, but I don't know why I imagined I can get rid of that and provide the user with better experience
@rene I think I will stick with this then
@rene I don't want to change the whole design now, maybe future projects
 
12:40 PM
well, DoTask somewhere in a method assumes local scope
 
I forgot the use case where I saw something similar to my Vision :( I don't know why I thought I am able to do that..
 
so if that method isn't in local scope you have to provide something to tell the compiler to bind to another scope
 
like, maybe, in c++ when we say using namespace std; and then you will be able to use all its references
or like a library, #include <string> for instance, then you use string MyStr; without the need to say String::string MyStr; @rene
 
Yeah, but that is what Mydll MyObject is then
MyStr == MyObject
It can be a static reference or an instance
 
You are right
 
12:45 PM
ofc ;)
 
but now, the user will need to keep track of MyObj in all his app
global, (or maybe several copies)
 
Does it need to be thread safe?
 
for example, if I want to provide him a function that apply the addition of two integers. He will need to create an object from MyDll, and whenever he want to use MyFunction: he needs to see MyObj.. Or, create a new MyObj everytime he needs to use that function
 
If not you simply provide a single static class with all public methods on it
public static class MyObject { public static ìnt Add(int, x, int y) { return x+y;}}
MyObject.Add(1,41);
 
Oh so he writes that line of code (declaration of the class MyObj) globally, and then, use it anywhere?
 
12:49 PM
yeah
You can create an instance internally because statics are a beast to unittest
 
I don't know if it needs to be thread safe btw.. I don't think I can answer that accurately since I am not familiar with the term
I think I will go with that, declare global MyObj which has all the functionality that I want to provide (as public functions)
 
If the consumer is able to call your functions from multiple threads and your implementation changes any shared state between calls, you're not thread safe, because each thread will have access to slightly different/incomplete versions of that shared state
 
oh, ehm..
 
public static class MyObject { private static int _x; public static ìnt Add(int x, int y) { _x = x; Thread.Sleep(100); return _x+y;}}
that ^ is not thread safe
imagaine two threads calling Add, you'll never know which x is being used in the return statement. _x is the shared state here. Do notice the difference with my earlier sample that is thread safe. All parameters are local to that call.
 
right
Each question you are answering, you are opening another lol because I want to know everything !
however, what I am thinking of now is that, I still don't know if we need to be "thread safe" since I am not aware of the use of the program (did not tell me and probably they don't know / team + manager)
 
12:57 PM
@FirstStep most .Net classes aren't so you can assume any consumers are aware of that
 
I see
 
I will proceed then, and once I finish I include it with my Documentation (this is not thread safe)
 
OK, great
 
user3956566
@rene hey thanks for helping out!
 
1:00 PM
Yes thank you :) And welcome on board !
 
 
1 hour later…
2:20 PM
are there any javascript we could use for rooms, like be able to copy and paste with formatted input like an excel spreadsheet
@JanDvorak please, I'm all ears
 
Not sure how you would transform chat into tabular data
but I do know that Excel understands *SV just fine.
A full-blown CSV parser might be tricky, but producing valid CSV should be easier
 
@JanDvorak
I made myself unclear
let's say
 
@AndyK
 
I want to paste some text into the chat
like that
EMPL            NAME            08-22-16            08-23-16
123             War             8                   15
888             Andy K          8                   12
789             Shaneis         8                   13
456             Waxi            7                   14
I have to format the text in a pad
then paste it into the chat
 
Does direct copy/paste not work?
 
2:26 PM
are there javascript tools for the chat that can format that?
hello
thanks @rene
Hi everyone
 
17 messages moved from SO Close Vote Reviewers
 
Quick question
thanks @rene
 
← I don't know of such tool, though.
 
@AndyK maybe try in the Javascript room
let me look it up for you
 
@FirstStep thanks
 
2:32 PM
@AndyK Hint: Post one message that includes everything
no problem you are welcome :)
 
thanks @FirstStep
 
good luck
 
blob kyll
hey lynn
@FirstStep o/
 
@ColdFire ey ey ey o/
 
plop @Kyll
 
2:35 PM
Plop Andy
 
blob @Kyll
 
WOW, there's a lot of arrows in Unicode, and there's a Wiki article that lists them all.
 
219x right?
Yeah.
 
yeah lots of Jan
 
The block ends at 21FF
 
2:39 PM
Guys. Is this safe to convert a string to a BitArray:

> BitArray BitStringToBitArray(string _input)
> {
> BitArray output = new BitArray(_input.Length);
>
> for(int i = _input.Length - 1; i >= 0; i--)
> {
> if(_input[i] == 0)
> output[_input.Length - i] = false;
>
> else
> output[_input.Length - i] = true;
> }
>
> return output;
> }
 
@JanDvorak that is a owl on your head right?
@FirstStep sorry no idea btw c++?
@FirstStep i am ahead of you \o/
 
C#?
 
c++ and c#, should work on both. As a design, do you think I am missing anything?
 
Unicode
Actually - do note that 0 !== '0'
 
Right! it should be _input[i] == '0' the char and not the int
@JanDvorak thanks
 
2:42 PM
Seems manual
 
I did not test yet (because I want to succeed in compiling and make it work as a whole from the first execute lol)
 
Ambitious...
 
Testing is doubting?
 
lol
 
it is just more challenging. Why not
 
2:47 PM
Jon Skeet doesn't test. He writes the code in one go, then immediately ships to the customers.
 
did you see @FirstStep what i posted above
 
^ lol John skeets is programming's Chuck Norris
 
@JanDvorak if the code malfunctioned the user throws his device and say sorry to jon skeet
 
@ColdFire yeah congrats, finally an answer eh? I did not answer maybe for the past four days lol
 
self answered haha
 
2:49 PM
Jon Skeets code never malfunctions. It may throw an exception, but that's only when it should throw an exception.
 
lol @ColdFire you are a rep whore :P
 
@FirstStep lol no i am not
 
We don't use those words anymore. It's a rep hunter now.
 
hides behind kyll and blames @Kyll
@FirstStep man it was required to avoid many dups
 
3:23 PM
oh. ops lol ok Hunter :P
 

« first day (11 days earlier)      last day (237 days later) »