« first day (2417 days earlier)      last day (2529 days later) » 

1:01 PM
btw that store.emit() bothers me. That still implies, that You have to code the whole x.y.z thing, because x have to pass store, or the changeName function up the line to z.
Fody.PropertyChanged take care much of the NotifyPropertyChanged boilerplate, and .emit() stuff
 
Jezus christ why don't you go read the docs and try it instead of picking every little fucking thing apart
I just put that there to show how it works CONCEPTUALLY
Otherwise you'd be asking shit like "BUT HOW DOES IT KNOW STATE CHANGED?!"
 
@AvnerShahar-Kashtan It was offensive, I agree. But at the same time it was (at least for me) quite a down-to-earth conversation breaker in that stiff chat.
 
it conceptually bothers me...
 
It really triggers me its not the global too
 
Good god why do I even bother
 
1:03 PM
and not in a service
WHY DO YOU BOTHER
 
Yeah, I think the main difference between React's model and WPF's MVVM is the shadow dom you mentioned, which it uses to diff the state and see what changed.
 
I dunno, I thought you guys were open to learning and being challenged.
 
haha, no way
all jokes aside ngrx is alright
 
@AvnerShahar-Kashtan Yeah which enables you to drop all two-way bindings and just operate on the application state. It's a very simple change with HUGE implications
 
I'm, that is why I even bothered to parse the pseudo-code. Tho I don't believe in magic, that is why I start to search for key component in the pseudo-code, which might break the magic
 
1:05 PM
Sometimes I wonder why I even bother though.
@ntohl What the fuck was magic in that?
 
@RoelvanUden not a fucking thing
 
If you are a MVP expert, here you can get free SO reputation points.
 
only magic thing is "it automatically refreshes the right things" statement
which was not included in the pseudo-code
 
you mean render part?
 
1:07 PM
@RoelvanUden that's actually a bit wasteful, and some games do deal with it e.g. by not rendering something that doesn't update all the time (GUI, or parts of the screen when the character is not moving) and also sometimes using the shiny new free/G-sync. (not refreshing )
 
actually its not rendering everything
only the needed part
 
@satibel Not exactly, game loops usually use update+render differentiation. You always call update on everything to see if a 'thing' wants to update, and if so, you re-render the affected parts. If anything.
(Grossly simplified)
(Which is exactly what React does)
 
@RoelvanUden so from what I understand:

You just call UI.update, and it checks what has been changed since the last render, and automatically finds that stuff's update implementation and calls it, so that it only rerenders those?
 
Noice.
 
1:12 PM
You can hint it about things to optimize it if ever needed. But that's way beyond a "This is how you think about it and that's what it makes it so much nicer" talk.
 
Ugh. Internet's back.
I wanted to say earlier that this sort of thing might be possible to build on top of WPF's binding engine.
@ntohl Binding is full of magic already.
 
Sure. If you make a similar shadow-structure that represents the entirety of what WPF elements exist and then do a diff on that and re-do the exact parts where needed, there is no reason why it can't be done on WPF.
Or anywhere else really. But conceptually, it's a super simple thing that's super powerful.
 
Especially for simple data apps that aren't that performance-intensive, auto-diffing the datacontext shouldn't even be noticeable.
 
@KamilSolecki the yeahs remind me of some cheap ass pop song going ♪ Yeah, yeah, yeah beat drops yeah, yeah, yeah♫
 
@RoelvanUden Yeah, I'm thinking about doing it cleanly, hooking a behavior to catch the NotifyPropertyChanged event, diffing, and propagating the relevant changes to the view. Should be doable.
 
1:16 PM
I build a 'complex' data application (heh, it's not really complex with this architecture, but it has a lot of stuff going on). We hear often how fast it is :-P It's just React being super smart about it, and it's way better than us most of the time. :-]
 
@RoelvanUden some (e.g. a test project I did, and probably more) do set "dead zones" behind menus etc... that don't get rendered even if something in it did got updated.
 
@AvnerShahar-Kashtan Yeah.. but that's the whole point, you don't want INotifyPropertyChanged's. React doesn't need them. You just tell it "update now". That particular signal should not come from the model itself.
 
though, that probably is harder to do in 3d
 
@RoelvanUden would you recommend React for building SPA pages?
 
@KamilSolecki Absolutely. No question about it. It's the best thing I've ever worked with for GUI development.
 
1:20 PM
so basically go from MVC to MRC? :D
 
Eh. ASP.NET MVC5 is really nice and has a lot of good things going. Just because React/SPAs are 'hip and happening', doesn't mean it's the best choice. Your application may be better suited with a traditional request/response model using everything you know and love. With that said, React can undoubtedly do everything you need it to do, but always determine if the learning curve will get you a benefit you truly need/want/should want.
 
@RoelvanUden Raising a INPC is like doing store.emit. You need a trigger.
 
@AvnerShahar-Kashtan Yes, but not from the model itself.
 
@AvnerShahar-Kashtan exactly that was in my mind
 
The model should be dumb.
 
1:22 PM
@RoelvanUden The store here serves as a viewmodel - it wraps the model and handles things exactly like that.
 
In C# terminology, I want the application state to be a set of POCOs that does NOT IMPLEMENT ANY INTERFACE.
 
Same as in MVVM - the VM is there to allow the M to remain dumb.
 
I also don't want any VM.
That's what React is.
 
only V calls changeName?
 
Hey guys, quick question. Does anyone know if IIS express blocks calls to and external api such as a zipcode checker? I have tested my code in a console application and it works fine. I try to run it in asp.net mvc and it never returns.....
 
1:23 PM
Yeah, if changeName is defined in the React scope, than React is effectively your generic VM.
 
I always put my changers in an 'actions' model.. example, real code:
import * as app from '../';
import * as mycompany from 'mycompany';
import ourProduct = mycompany.api.ourProduct;

/**
 * Represents each alert action.
 */
export let alertActions = {
  /**
   * Promises to refresh the detail.
   * @param revision The alert identifier.
   * @return The promise to refresh the detail.
   */
  refreshDetailAsync: app.store.reviser('ALERT_REFRESHDETAIL', async (state: app.IApplicationState, revision: number) => {
    state.alertDetail = await ourProduct.alertService.getDetailAsync(revision);
So from anywhere you can call these actions
 
@RoelvanUden I have almost no web dev knowledge (except for EF, bootstrap, VERY basic JS and all I had learned about MVC so far (very little). Which path would you reccomend for me to go?
 
And where are the calls to store.emit?
 
@AvnerShahar-Kashtan Abstracted away, a 'reviser' here automatically does that after the func.
 
1:29 PM
They also have a unique name for logging and replay-ability (time travel capabilities :P)
 
So your alertActions object is similar to a viewmodel. It wraps calls to the model and adds view-specific functionality. Such as raising the rendering event.
 
@KamilSolecki React sounds okay then. Be prepared for a learning curve, but you will be able to build web SPAs, mobile apps, and desktop apps using the same skills. Which s nice.
 
A bit different too, though, since it's universally accessible, like a client service.
 
@AvnerShahar-Kashtan No it isn't. It doesn't sit between the view and the model.
It processed data, mutates the model, and raises the 'shit changed' event.
 
> raises the 'shit changed' event.
 
1:31 PM
@RoelvanUden A nuance, I think. The store is the actual VM-analogue, but it's a "dumb" VM.
 
if only that was a thing
 
@JABFreeware Hey, I have a 5 month old baby. It is a thing.
 
this.on('shitChanged' func.........
@AvnerShahar-Kashtan ewwwww
 
@JABFreeware I was never very squeamish about bodily functions to begin with, but with two kids, I've lost any repulsion I used to have.
 
@AvnerShahar-Kashtan redux.js.org
Read 'The Gist'
 
1:33 PM
@AvnerShahar-Kashtan I'm not squeamish per se. Its just a too much trouble not enough reward thing to me. Like a puppy. Super cute not worth the drama.
 
> I've smelled things you people wouldn't believe. Dirty diapers on fire off the shoulder of Orion. I watched pee streams glitter in the dark near the Tannhäuser Gate. All those moments will be lost in time, like poop in rain. Time to change.
 
@JABFreeware Puppies grow up quicker ;-)
 
@RoelvanUden Yeah, when you said logging and replayability I assumed there would be redux behind it.
 
@RoelvanUden true
I nearly got one but I dont have the patience
 
@AvnerShahar-Kashtan :D from the "does robot baby dream about electric sheep"
2
 
1:35 PM
@AvnerShahar-Kashtan I actually don't use Redux, but the same principle as Redux. But I don't want to make my state immutable because I'm a lazy fuck basically.
But conceptually it's the same.
 
its time for breakfast. Burrito or cereal ?
!!choose burrito or cereal
 
@JABFreeware burrito
 
hmmm
 
You got it >D
 
!!choose burrito or cereal.
 
1:36 PM
@RoelvanUden I've read up on redux before. React+redux is an interesting remixing of the concepts that MVVM also uses, taking it a bit on a 90 degree angle. Instead of having the VM bridge have observable state+logic, I just keeps observable state, and moves the logic to a different entity.
Hey, Cap's back.
 
anyone?
 
@RoXaS I don't believe it does. IIS Express limits incoming connections, but once it's running your code, it shouldn't have any problems.
 
@AvnerShahar-Kashtan Jup. But another key difference is that, unlike WPF, there is no VM per view component. That's what happens in MVVM, you break up your views into components and each component may or may not have its own VM with its own observable nature and logic. Thus, you have quite a few observables. Breaking that all out into a single point is just simple. It doesn't work with WPF because WPF is inferior (it just lacks the shadow), but if it would, that'd be the most simple way to do things
 
@AvnerShahar-Kashtan hey thanks for your reply. its just so weird. they share aproject and my console application runs the same line just fine..
 
@RoXaS What errors are you getting?
 
1:39 PM
@AvnerShahar-Kashtan nothing it just wont ever go beyond the await
while the console application is near instant
 
That seems like a threading issue.
 
Does it return if you wait long enough?
 
Are you using HttpClient?
 
@AvnerShahar-Kashtan yes
@RoelvanUden waiting long enought involved like a minute of 4 now
 
@RoXaS And awaiting it, right? Not calling GetAsync().Result.
 
1:42 PM
 using (var httpclient = GetHttpClient())
            {
                ZipcodeInput input = new ZipcodeInput()
                {
                    PostalCode = postalCode,
                    HouseNumber = houseNumber.Value.ToString(),
                    Addition = addition
                };
                var response =  await httpclient.PostAsJsonAsync("", input);
                if (!response.IsSuccessStatusCode)
                {
                    ResultCode code = ResultCode.ServerError;
 
IIS runs in a different threading model than a console app, and manually calling Result, which will work in a console app, can hang under IIS.
5
Q: Is .GetAwaiter().GetResult(); safe for general use?

CyanI read in a few places that .GetAwaiter().GetResult(); could cause deadlocks and that we should use async/await instead. But I see many code samples where this is used. Is it ok to use it? Which are the cases where it can deadlock? Is there something else I should use, like Task.Wait?

 
dont be fooled by the "" in postjsonasync
 
@RoXaS Please edit the message and press Ctrl-K to format it.
@RoXaS Yeah, that just posts to the BaseAddress.
 
quick question: how to test a method that calls another one/that does dangerous stuff?
e.g.
 
like a civilized fucking human
 
1:42 PM
int myMethod(bool test){
  if(test){
    nukeDb();
    return 1;
  }
  return 0;
}
 
dependency injection with mocks
 
@satibel for unit testing?
 
@satibel You extract the nukeDb call to an IDbNuker, inject it in the constructor, and replaceit with a MockDbNuker when testing.
 
@AvnerShahar-Kashtan alright
 
@RoXaS Seems OK. Anything unusual in GetHttpClient()?
Also, is this call straight from the Controller? Any fishy task-related action before it?
This might help:
202
Q: HttpClient.GetAsync(...) never returns when using await/async

Benjamin FoxEdit: This question looks like it might be the same problem, but has no responses... Edit: In test case 5 the task appears to be stuck in WaitingForActivation state. I've encountered some odd behaviour using the System.Net.Http.HttpClient in .NET 4.5 - where "awaiting" the result of a call to (...

 
1:45 PM
@AvnerShahar-Kashtan Straight from the controller, only filling headers in gethttpclient
 
You got an answer there from Stephen Cleary, which is about as authoritative as it gets, for async/await.
 
ok, thank you, that was more or less what I thought I could do, but making a whole interface+class for 1 method seems a bit heavy, no?
 
@satibel That's the sort of thinking that makes you accidentally nuke the DB during testing. :)
Classes with one method aren't necessarily a problem. They're exactly what the Strategy pattern is about.
 
who makes classes without methods?
 
@AvnerShahar-Kashtan Im trying to understand that post, but as far as i understand now im executing it like test1
 
1:48 PM
Technically speaking, instead of an interface+class, you can have a delegate+method, which is basically like a method-only interface.
But it will feel weird and less native in C#.
 
int myMethod(bool test,Func<void, void> nukeDb){
  if(test){
    nukeDb();
    return 1;
  }
  return 0;
}
 
IComparer, for instance, is an interface with only one method, and with a lot of classes that implement it, and are passed in as a strategy.
 
so this^?
 
    delegate void DbNuker();
    public MyClass
    {
         private DbNuker _dbNuker;
         public MyClass(DbNuker nukerDelegate)
         {
               _dbNuker = nukerDelegate;
         }
         public void MyMethod()
         {
              var shouldNukeDb = DoLogic();
              if (shouldNukeDb)
                     _dbNuker();
         }
}
         }
Instead of having an IDbNuker, you simply have a DbNuker delegate. Instead of implementing a class, you pass in a method (say, () => {} for a mock nuker).
And your method will simply invoke the delegate.
The IDbNuker, in this context, is simply a contract for a class that contains the NukeDb method. So the delegate is a leaner contract for a NukeDb method.
 
@AvnerShahar-Kashtan if i made my controller method as an async Task<JsonResult>. would that fix it?
 
1:54 PM
@RoXaS Might. I try to make all my controller methods async Tasks because, well, it just works, and the MVC framework handles it for me transparently.
 
@AvnerShahar-Kashtan It does not work
 
thanks.@AvnerShahar-Kashtan
 
@AvnerShahar-Kashtan any advice to basically make the calls synch?
 
@RoXaS Have you tried setting ConfigureAwait(false)?
The problem, I'm guessing, is that the synchronization context that the Post call started from is busy (maybe with a different request?) when the Post returns. I don't know why it deadlocks.
But with ConfigureAwait(false), you don't care about the original context. Just grab a threadpool thread and continue execution.
 
@AvnerShahar-Kashtan im trying to use .Result on the async calls now
 
1:58 PM
@RoelvanUden Okay. I will get some reading going then. Do you by any chance have a hint on the app schema (ie. generally what to use for what)? So far Im assuming that there will be React for view rendering, connected with MVC. Is there any additional libs / tools that I should consider learning about / using, that will make my life easier here?
 
@RoXaS No, no. That probably won't work.
 
@AvnerShahar-Kashtan it does actually xD
 
Embrace async! Let go of your threads, your contexts yearning to breathe free!
@RoXaS Good, but I'll be wary. There's a reason it's warned against explicitly, and I've gotten deadlocks with it before
 
@AvnerShahar-Kashtan Yeah i guess asp.net just screwed it up for some reason
and now it treats the code as async
 
@RoXaS HttpClient is async. Always async.
 
2:01 PM
@AvnerShahar-Kashtan i meant threats the code as if it were sync
 
When you call .Result, you're blocking on the async call and waiting for it to return. If it tries to return, it might try to return on the same synchronization context that it's blocking on.
Ok, now it's time to head out.
 
@AvnerShahar-Kashtan I wanna do this best as possible, but i dont know how to fix it otherwise
 
@RoXaS Tried ConfigureAwait(false) on both await calls?
 var response =  await httpclient.PostAsJsonAsync("", input).ConfigureAwait(false);
 
@AvnerShahar-Kashtan where should i call that?
@AvnerShahar-Kashtan ty, you read my mind
 
It tells the await that it doesn't have to resume execution in the original thread it started from.
(It's a very, very badly named method, and really unintuitive to use)
 
2:03 PM
@AvnerShahar-Kashtan aaah ill try
@AvnerShahar-Kashtan works like a charm
thank @AvnerShahar-Kashtan
you are a lifesaver
 
let the man go hom
e
 
im done
 
@RoXaS Glad to help.
I'm gone! I'm gone!
 
2:45 PM
@KamilSolecki TypeScript, React, React-Router, React-Redux. Then just connect to WebAPI for data exchange.
 
Any1 got ideas?
0
Q: Reaction on item.PropertyChanged in an observable colleciton WITHOUT INotifyPropertyChanged

Nerd in trainingI have an ObservableCollection<Person> persons. Person does not implement the INotifyPropertyChanged interface. I change the Name Property of persons[0]. e.g. person[0].Name = "Hans" Now I want to react that ANY property of ANY item in persons has changed. Is there a way of doing this? pe...

or is it just not possible?
 
anyone*
not*
 
any3
#buuuuurn
 
fix your abominations
 
I WILL NEVER DO SO JABAWOKY SIR!
 
2:56 PM
@Nerdintraining No. In React, it would be possible...
 
Only the nor mistake
 
insert trollface here
 
@Nerdintraining I will find you
and I will kiss you
 
tenderly?
 
piercingly
 
2:57 PM
@Nerdintraining You can fake it. Raise your own CollectionChanged event with the person that changed added + removed.
 
@RoelvanUden i was never expecting less to hear from you today sama-senai-senpai
@JABFreeware then i kindly reject :D
 
> @Nerdintraining You can fake it.
 
Laik a woman.
 
@Nerdintraining what I hear is yes please
 
@RoelvanUden But it still needs me to modify the Person class right? Or did i just get you wrong?
 
2:59 PM
You got me wrong.
 
wrong hole
 
such a masterpiece
 
Then you mean that i raise the event when the... No wait i am brain fucked right now :D
You are hinting on that when i set persons[0] = "hans"; i should do persons.RaiseEvent right?
 
#GettingBrainFucked
 
3:03 PM
#betterThanButtseks
 
thats going to get flagged
 
@Nerdintraining Ye!
@Nerdintraining than*
 
Corrected
@RoelvanUden Well then my Binding is the Problem. I am binding thourh persons to person.Name
 
Hi there
Is there a difference passing lambda expressions vs method handles as a parameter?
values.Any(str.Contains) vs values.Any(value => str.Contains(value))
 
3:10 PM
@Nerdintraining You can do explicit UpdateSource if You really don't want to implement propertychanged
@JamieLester no. First just figures out the second
 
So personal preference essentially
Thanks @ntohl
 
@JamieLester yes... basically. First is more functionalish.
 
@ntohl how would setting it to explicit help?
 
@Nerdintraining why was Your question about not implementing IPropertyChanged? (because I answered that question)
@Nerdintraining why don't use Fody.PropertyChanged?
 
What is fody? now you are confusing me^^
i will be back in 5-10 mins
 
3:16 PM
 
3:35 PM
@ntohl intresting thanks
 
C4u
Hi everyone :)
Anyone of you know a good way to unsort a list to move equal items apart? Instead of having `1,1,1,2,2,2,3,3,3...` I would need `1,2,3,1,2,3,1,2,3`. In my case these entries arn't numbers. They are strings. And the `equal` part is a partial piece from this string.

Imagine I would try to unsort a list of mail-addresses where the unsorting function should take care of the providers only (@gmail.com, @hotmail.com...).

Regulary I'm always up sorting things instead of creating chaos.
I could write some ugly loops for that. Dont know if there is something short.
 
4:30 PM
Cya guys
 
@Nerdintraining go in pieces my son
 
4:53 PM
Quick question:
private static void SampleAggregator_FftCalculated(object sender, FftEventArgs e)
        {
            int dimensions = e.Result.Length / 4;
            Bitmap bpm = new Bitmap(dimensions, dimensions);

            for (int i = 0; i < dimensions; i++)
            {
                float x = e.Result[i].X;
                float y = e.Result[i].Y;
                double IntensityFromFFT = Math.Sqrt(x * x + y * y);
                bpm.SetPixel(i, (int)(IntensityFromFFT * (dimensions * 2) + (dimensions / 2)), Color.Red);
does anyone sees a memoryleak ?
or has an idea where it could come from?
 
nvm
well, actually
this still applies
where do you dispose of the Bitmap
 
you were right :)
i didnt
so
thats where it was leaking, as i thought when removing all references would be enough
@milleniumbug ty
 
generally you need to dispose your IDisposables, except in very specific cases (like Task<T> or Task)
if your IDisposable is scope-bound, use using statement
if it's bound to some kind of external context (like a window or unit test fixture), you need to search the docs for an appropriate place to dispose it (event, virtual method or whatever)
 
5:21 PM
I have a large file that I need to populate a few fields with. String.Format hasn't been the most pleasant to use because I have curly braces in the file which I need to manually escape. I thought of using RegEx, but for a large file that may be slow. Would String.Replace("{sub0}", value) be performant, or is there a better alternative?
 
i'd still go with regex
if your file is larger than 1gb id replace while reading the file
 
5:39 PM
Alright, will do. Thanks.
 
6:12 PM
@RoelvanUden senpai sama are you here?
 
okay
il try tommorrow then
 
you worked a bit with react native?
 
I haven't.
 
6:14 PM
besides their official documentation
oh
ah nvm then
sorry for the summoning then
 
whats going on here?
 
For the anime fans, Koe no Katachi (A Silent Voice) movie has been released. You may want to pick it up.
I haven't seen it yet; no spoilerz.
 
@RoelvanUden the main character dies
not a spoiler because I haven't seen it
just saying
 
It.. what. That actually disturbed me for a bit.
You asshole.
 
@RoelvanUden haha
 
6:18 PM
it has created quite a buzz
shame its not playing in cinema here
 
@Proxy coke does that
 
i prefer pepsi though
 
we're not friends
 
i know
 
and never will be
 
6:19 PM
we have been over that though
 
Kimi no na wa was great too. Watch it.
 
but drugs aside actually I like pepsi better
 
yeah i missed that one as well
 
@RoelvanUden was blu-ray version released already
 
@milleniumbug No, October I think.
 
6:22 PM
I'm using nullable values. After I check to make sure the value isn't null, the functions/etc that use it need it in its standard form. What's the appropriate way to convert it? int? a -> (int)a I assume?
 
a.Value
 
Thanks
 
You can also use .HasValue to check.
 
Is that just a matter of preference, or is there a good reason to use HasValue over != null?
 
only preference
they're equivalent in CLR bytecode
 
6:24 PM
Thanks again
 
Preference. It's quite explicit if you use .Value too, in my opinion. But you can't choose if you don't know :P
 
personally I use != null, unless the project already uses .HasValue all over the place
 
Yeah, thanks for the info Roel
 
6:49 PM
is using an ORM really that much better/faster
in terms of development?
I've always pretty much just written my queries in SQL etc.
but it seems everyone looks down on that
all I hear about it entity that entity this
 
 
2 hours later…
9:12 PM
@JABFreeware if you use an ORM, you need to pay a little bit of attention to the queries you write but basically you don't write data access code
You just access that shit.
 
Hey guys, needing some help on my project, finnaly almost done with it :D
 
And when I say queries, it grabs the data when you try to use it, so if you want one thing out of a list but you grab the whole collection every time
you'll have issues
 
I need some help "connecting" 2 lists that I created.
I have 6 doctors listed like this: (one example).
ListDoctor.Add(new Medico(01, "Antonio", 555444333, "antonio@gmail.com", "Dermatologista"));
And I want to assign to each of these 6 Doctors, 1 member of this list (20 members).
ListSickPeople.Add(new Utente(100001, "Pedro", 914754123, "pedro@gmail.com", GetRandomColor()));
This is an Hospital simulation, I want each Doctor to have a Patient assigned but it has to respect the color hierarqy.

This is the color code I used.
static ConsoleColor[] colors = { ConsoleColor.Red, ConsoleColor.Green, ConsoleColor.Yellow, ConsoleColor.Magenta }; //Ticket Colors.

    static ConsoleColor GetRandomColor()



    {



        return colors[random.Next(colors.Length)];

    }
The order of gravity is Magenta, Red, Yellow and Green which I am assigning randomly each time I start my program.
How can I do something like this?
 
 
2 hours later…
11:31 PM
I had this idea, think this could work?
public static class PrioridadeUtente
    {
        public ConsoleColor ToConsoleColor(this PatientPriority p)
        {
            switch (p)
            {
                case PatientPriority.VeryHigh: return ConsoleColor.Magenta;
                case PatientPriority.High: return ConsoleColor.Red;
                case PatientPriority.Medium: return ConsoleColor.Yellow;
                case PatientPriority.Low: return ConsoleColor.Green;
                default: return ConsoleColor.White;
            }
 
hi c# friends
 
im not your friend, buddy
 
lol
fair point
hello c# lovers
 
the correct response is "I'm not your buddy, guy"
to which I say "I'm not your guy, friend"
and then we go on like this for a while
 
anyways
how do you multiply elements in multi demensional arrays
 
11:37 PM
:(
 
i know we can use a foreach loop
to go through each element inside the array
but lets say i had an array like int [,] ThreeByTwoArray= new int[3,2] { {5,1}, {3,-1}, {-4,-3} };
and i want to multiply 5 by 1 and 3 by -1 and -4 by -3
i know i can access each element by using GetLength
but im just stuck
idk what to do here
with the foreach
 
so you want to multiply all elements of each element?
 
ironically this would be easier if it was a jagged array
 
my next assignment is a jagged array lol
 
11:41 PM
haha
 
i know how to multiply all the elements together
but i dont know how to multiply elements of elements
 
hint: find how to access the element of the multidimensional array with indexing
 
ok thats with GetLength
but can this be done in a foreach loop tho
?
i was told: You must not hardcode any loops. Instead you must use the methods foreach to sum
all the elements in the array and GetLength to control looping through each row and
column in the array for printing the elements and building the sum of the products of
each line.
 
whats the output?
array of sums?
[5,-3,12]
 
ha! a requirement! thankfully we've been able to discover it before we have wasted too much time
 
11:48 PM
int [,] ThreeByTwoArray= new int[3,2] { {5,1}, {3,-1}, {-4,-3} };
so like (5,1) (3 -1) (-4 -3)
 
yeah, but what comes out the other end
 
also: GetLength(int dimension) doesn't get you the element, it gets you (exactly as the name tells you), the length
 
The product of line 0 is 5
The product of line 1 is -3
The product of line 2 is 12
 
hint nr 2: modulo operator
 
Melleniumbug i thought it got me the element based on this link: stackoverflow.com/questions/2044591/…
 
11:50 PM
Anyone can Help me with me question?
 
modulo
hmm
the only thing i know modulo for is using it to find the remainder
 
hah, new int[10,11,12] and new int[] { 10,11,12 } are different
 
@Dany4k you asking about that switch statement you wrote earlier? i see no reason why that wouldn't work
 
also you haven't bothered to read the description above the code in that answer
 
whoops
 
11:52 PM
Yes, I was asking about that @Cauterite
@Cauterite Im just having problem how to implement that code in my main()
 
@Brogrammer hint nr 3: what happens if you apply modulo operator with a known modulus on an increasing sequence of numbers, like 0,1,2,3,4,5...
 
@Dany4k why's that?
 
i dont know how to answer that mill
 
I'll leave you with that one
 
@Cauterite Im mentally blocked. What am I gonna write on my main that will assing the patients to the doctors using those exceptions I wrote.
 
11:58 PM
@Dany4k what's this about exceptions now?
 

« first day (2417 days earlier)      last day (2529 days later) »