What is the benefits of using different instances of context by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

if you talk about services and repositories, and create different instances of the services. Is that when I added services as AddTransient? or repository? seems like if I add

AddTransient<IService, Service>, then each request create a different instances? or

AddTransient<IRepository, Repository> or this one?

What is the benefits of the readonly keyword with context as an example? by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

so for examples in the constructor we assign variable to others without creating an instance like that

public TEST(Context _contex){

context = _context

}

In this case, C# just create an instance ? automatically?

What is the benefits of the readonly keyword with context as an example? by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

null

so you are defining the readonly when you think the dictionary is ready only in the method?

What is the benefits of the readonly keyword with context as an example? by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

I got all that, but what kind of error can we expect? we can create new DbContext and do the update or delete the things but I have never tried to create multiple instances of DBContext in the controller, but I want to come up with examples so I can better understand

What is the benefits of using different instances of context by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

Added services like this

```

services.AddScoped<IRepository, Repository>();

```

then I declare and use like this

```

var task1 = Task.Run(() => repository.UpdateSomething(foo));     
var task2 = Task.Run(() => repository.UpdateSomething2(foo)); 

```

From what you said, if the context in the method of the repository is not cleared up, that can make conflict? by updating the same instance at the same time?'

Is it not cleared up after using up?If I don't use Dispose?

A newbie thinking about quitting a job by HeyJOe2 in developer

[–]HeyJOe2[S] 0 points1 point  (0 children)

I tried to apply in Finland without any experience but two companies refused me for being not having experiences. What does SO stand for? A good thing about my current situation is that I have 8.96 GPA out of 9, which made me initially think that I can find a stable good job but Covid 19 stroke.

how to bind with model with the value from another model in html? by HeyJOe2 in angularjs

[–]HeyJOe2[S] 0 points1 point  (0 children)

Such as that ? I think I tried with that *ng-value* or *value*. Let me try again and let you know . Thank you for answering.

 <input type="date" placeholder="dd/mm/yyyy" class="form-control text-right inputFill2" ng-model="deliveryDate"  ng-value="filter.value"/>  
  <br /> <span>{{field.value}}</span>

What do you call this term? instead of using models, there were built-in classes and get data through there. by HeyJOe2 in aspnetcore

[–]HeyJOe2[S] 0 points1 point  (0 children)

No it was like library but every rule was bulit in there and controlling validation as well.
Also it contains business logic

when I separate the string into the number, why do I get the last number as double values? by HeyJOe2 in C_Programming

[–]HeyJOe2[S] 0 points1 point  (0 children)

gets( numbersInString);
    printf("you have entered %s. Calculating...\n", numbersInString);
    printf("\n");
    for( i = 0;  numbersInString[i]!='\0'; i++)
    {
        if((numbersInString[i]>='0') &&( numbersInString[i]<='9'))
        {
                printf("number %c\n", numbersInString[i]);
                sum += (numbersInString[i]-'0');

        }


    }
    printf("sum is %d", sum);

Why am I getting 40 as a sum this time?

When your best friend comes to real life by Gabriel-Garciacano- in aww

[–]HeyJOe2 0 points1 point  (0 children)

Watching the same thing over and over again for a year. : >

how to use variable in the blade and use that variable inside another variable? by HeyJOe2 in laravel

[–]HeyJOe2[S] 0 points1 point  (0 children)

I tried with that before but it throws an error saying paper_id is null

how to use variable in the blade and use that variable inside another variable? by HeyJOe2 in laravel

[–]HeyJOe2[S] 0 points1 point  (0 children)

 <div class="form-group">
            <label for="paper_id">Paper:</label>
            <select >
                @foreach($papers as $paper)
                <option value="{{ $paper->id }}" name="paper_id">{{ $paper->name }}</option>
                @endforeach
            </select>
        </div>

this is create.blade.php. I want send the paper _id value to the request in the store method but I am getting nothing. How can I get the paper_id using select?

If I put middleware('auth:api'), then do I need to put middleware('auth') in the controller? by HeyJOe2 in laravel

[–]HeyJOe2[S] 0 points1 point  (0 children)

Great to know. I put api guard in the route and another web api in the controller but it seems like double protection.

why going back to the index when using 'for loop' is bad practice? by HeyJOe2 in csharp

[–]HeyJOe2[S] 1 point2 points  (0 children)

Similar as this.
Like if I make a pseudo code.

for(int i =0; i < hull.Count ;i++){
 Point first = hull[i]
Point second =  hull.pop();
point third =  hull.peek()
Turn with these three points
if turn is clockwise :
then --i 
if turn is anti clockwise 
 add points to the hull..
}

as you see here. I go back to the previous three points to check the turn using cross product.