« first day (3841 days earlier)      last day (1090 days later) » 

2:05 AM
 
2:51 AM
Too late. Unless maikrosoft make all version of office suite free for upgrade to latest
only then will I now remember that my company only uses guglo spreadsheet
 
Generally, the simple software does not need custom exception class.
It is enough to throw error message by a new Exception.
 
If no handling then yes, with exception handling, you better derived your own exception
 
yes
simple software always popup a messagebox to show exception messages.
btw: I hate somebody write this:
MessageBox.Show(ex.Message);
 
3:08 AM
Exception has been thrown by the target of an invocation
                                  [OK]
 
Paramenter cannot be null.
Paramenter name: "Name"
                                         [Ok]
One or more errors occurred.
                                    [OK]
 
 
3 hours later…
5:59 AM
Good morning
Looks like you unearthed some of your older projects?
Or mine
 
mr5
6:24 AM
Did nyc predicted what was the other squirrel is going to post or did the other squirrel just copied nyc's format?
 
The other squirrel copied their format in an agreement over how unhelpful it is to send an exception message straight to the error popup.
 
7:14 AM
"An error has occurred during the execution, look at the <X> property to see why. Oh, by the way, we made sure that no logging framework includes that property in their default logging approaches."
meanwhile Java:
"You cannot use streams on an implicit transaction. You can look at these threads to see why: <link1>, <link2>, <link3>.
Also, this should help you to implement the transactions: <link>.
In case you are wondering, for the framework version you are using, you might want to look at this as well: <link>."
 
mr5
7:32 AM
loc would be enough for me
then I google if I can't understand
 
8:06 AM
is it bad practice to have multiple out variables?
 
it is bad practice to have out variables
 
I have a DataTable and I want my method to break it into 2 and return 2 DataTables
should I use out variables or return a list(of size 2)?
 
it is also bad practice to have multiple return values (via tuples) but sometimes it makes sense in small scope
 
what should I do in my case?
I have a DataTable and my method will break it into 2
left table and right table
so better to use a tuple to hold them?
 
probably a list
or a tuple
or a dedicated data class
 
8:11 AM
I will go with tuple
 
mr5
or an anonymous object
 
ignore mr5
 
thanks! xD
 
mr5
or a dictionary
ignore wietlol
izz time!
 
hehe
 
 
1 hour later…
9:19 AM
[Captain Obvious] Looking for opinions
[Captain Obvious] Which is better for auto-generating clients for APIs? Swagger-codegen (aka OpenAPI Generator) or NSwag.CodeGeneration?
[Captain Obvious] I've been using OpenAPIGenerator with swashbuckle generated specs for a little while, but it's super clunky
[Captain Obvious] I love having clients build themselves like magic though
 
mr5
OData
 
mr5
There is also a service integrated in VS that can auto generate API clients for you. I remember my last company is using it but I forgot its name.
@CaptainObvious what is the brand name of your mouse again? That thing that looks like it has bullets
 
mr5
9:58 AM
@mr5 Logitech MX Master 3
 
 
1 hour later…
11:01 AM
[Captain Obvious] Mine isn't the MX Master 3
[Captain Obvious] It's the original one
[Captain Obvious] Also my post-build auto creates an api client project and builds it, and then my azure pipeline (which runs the postbuild obviously) then pushes the client into our nuget feed
[Captain Obvious] So by magic, if I add new methods or whatever to an api or change models, I push the changes to the API to git, then 5 or so minutes later the new client is ready to go
 
for some reason I just remembered...
any of you hear LG is dropping out of the phone business?
 
 
1 hour later…
12:18 PM
[Captain Obvious] Yes, that was like a week ago wasn't it
 
I wonder if HTC is gonna drop, too
 
[Captain Obvious] Nah I think they've been making the last few pixels
[Captain Obvious] Because they're the only company who have so little self respect that they don't mind not putting their own stamp on it
[Captain Obvious] Oh they made the first 2 (except the XL which was made by LG)
 
1:16 PM
!~shiba
 
not now !
 
1:45 PM
yay I finally fixed my bootstrap problem 🎉
 
I have this button within my datagrid:
<DataGrid ItemsSource="{Binding NewRecipes}" SelectedItem="{Binding SelectedItem}" AutoGenerateColumns="False" IsReadOnly="True" Grid.Row="2" Width="300">
    <DataGrid.Columns>
        <DataGridTextColumn Header="Description" Binding="{Binding Description}" />
        <DataGridTemplateColumn Header="Remove">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <Button Content="Remove" Command="{Binding RemoveCommand}" />
                </DataTemplate>
But I get an error that RemoveCommand property not found on object of type RecipeModel
How can I link it to a specific VM?
Got it
0
Q: Why is the click event of a button inside a DataGrid is not fired?

Álvaro GarcíaI am using MVVM pattern and MVVM Light to convert an event into a command, in my XAML I have this code: <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="+" Padding="0,0,0,0" Height="Auto"> <i:Interaction.Triggers>

 
2:16 PM
 
 
1 hour later…
3:20 PM
well I finally got the talk at work; company VPs don't think I'm working enough + too slow, so I'm gonna be showing up here way less often
 
mr5
@CaptainObvious I've tried that OpenAPI thing with swagger, and the generated code is using Newtonsoft plus it also sucks :(
@Freerey time to job hop ;)
 
4:02 PM
they right though
 
 
2 hours later…
6:21 PM
hello.
Since what version of .Net Framework is Dictionary serializable?
I got contradictory info it is not and that is serializable.
 
6:44 PM
no [Serializable] tho...
but yea, I can highly recommend a common serialization strategy, like JSON over .net object serialization
 
 
1 hour later…
8:08 PM
Hello
What is the best way to making parallel WebClient Calls
I need to call API and save the response into DB
There are more than 1 million records and i need to speed things up

I tried parallel.Foreach but iam not sure if that the best solution or not
and also how this affect the CPU ?
for example , there will be maximum number of tasks ?
 
parallel.Foreach can take in a maximum number of concurrency
in simple terms, if you have async, you could just make tasks of all the calls and then await all of them
basically
await Task.WhenAll(operations.Select(async it => await it.DoTheThing()));
but then you have very little control of the concurrency and might spam your database... which wont speed it up that much
42
Q: How to limit the Maximum number of parallel tasks in c#

MathiyazhaganI have a collection of 1000 input message to process. I'm looping the input collection and starting the new task for each message to get processed. //Assume this messages collection contains 1000 items var messages = new List<string>(); foreach (var msg in messages) { Task.Factory.StartNew(() =

might want to look at that
 
8:29 PM
Sorry Can you explaing better
what is the difference between async methods and parallel foreach
I am using Parallel Foreach but i need to speed it up
the single API call takes 200ms
I have million records
when i use parallel foreach it takes around 100 records every 2 sec
and the CPU is 100%
can i speed up this process
 
parallel foreach uses multiple threads in a thread pool
 
8:44 PM
How can i speed it up
i tried to google a lot but can't find suitable solution
1 million records took 4 hours
 
9:01 PM
> How can i speed it up
buy a bigger machine
or more
that also works quite well
if you want 1 million http calls, that will just take a long time
also, you might want to see if you are doing individual insert queries or have them in bulk
inserting bulk would speed it up massively
 
How can i make sure that i am getting the best performance for my current machine ?
I have Xeon 8124M CPU 3 GHZ (4 CPUs)
also is it better to set maxdegreeofparallelism ?
or remove it in my case ?
@Wietlol
 
9:33 PM
ideally, you would have a thread pool of 5 threads
then, process the http requests with a... 16 async concurrency level
then, bulk insert to the database with 10k records per bulk
you could try to fiddle with the numbers a bit, but that is the approximation of optimal performance
can you identify what is the bottleneck?
the web service? the database or the local processing?
 
why you mentioned 5 threads ?
and in case i didn't mention MaxDegreeOfParallelism
How many Threads it will use ?
 
you are using 4 cores?
 
yes 4 CPUs
Xeon 8124M CPU 3 GHZ (4 CPUs)
 
286
A: Optimal number of threads per core

GonzaloIf your threads don't do I/O, synchronization, etc., and there's nothing else running, 1 thread per core will get you the best performance. However that very likely not the case. Adding more threads usually helps, but after some point, they cause some performance degradation. Not long ago, I was...

still, you would probably benefit most by figuring out which part takes the most time and how to optimize that in code
 
I just make call to API
but the total items inside parallel foreach is very large
may be the issue is how to split the million records into chunks
if i made parallel of each on million items @ one , would it better or splitting them first into chunk
 
9:49 PM
that depends on how you get those million records
can you share code?
 
regardless the get request
I have list of 1 million records
1 sec
                // results is 1 Million
                List<NewProperty> results = Operations.GetFullList(id, _connectionToEs);

                //chunks is 1 Million/5 , list of lists
                List<List<NewProperty>> chunks = Operations.SplitList(results, 5);

                Parallel.ForEach(chunks, (chunk) =>
                {
                    ProcessResponse(chunk, id, proxyIndexInt);
                });
the single API call takes 5 records that's why i split them into 5
 
and ProcessResponse is doing what?
 
2 thing ,
1- call API
2- save result to DB
 public void ProcessResponse(List<NewProperty> chunk, string id, int proxyUserIndexInt)
        {
            try
            {
                Task.Run(() => CallAPIHttpClientAsync(id, chunk, proxyUserIndexInt)).Wait();
                UpdateElastic(chunk, id);
            }
            catch (Exception ex)
            {
                Log.Error(id + " ProcessResponse Function Error " + ex.Message + "-" + ex.StackTrace);
            }
        }
With this way , CPU is 100% and it takes about 4 to 5 hours
        private async Task CallAPIHttpClientAsync(string id, List<NewProperty> smallChunk, int proxyUserIndexInt)
        {
            try
            {
                var client = Operations.GenerateHttpClient(proxyUserIndexInt);
                using (client)
                {
                    var requestDoc = Operations.BuildXML(smallChunk, proxyUserIndexInt);
                    client.BaseAddress = new Uri("http://production.shippingapis.com/");
                    client.DefaultRequestHeaders.Accept.Clear();
 
can you put stopwatches around most of theses?
especially
List<NewProperty> results = Operations.GetFullList(id, _connectionToEs);
List<List<NewProperty>> chunks = Operations.SplitList(results, 5);
HttpResponseMessage response = await client.GetAsync("ShippingAPI.dll?API=Verify&XML=" + requestDoc);
Operations.ProcessXMLResponse(xdoc, smallChunk);
^ these
 
10:08 PM
GetFullList executed once at the beginning so there is no issue on this it takes about 30 sec
SplistList , fine melliSeconds
GetAsync 300 ms
I need to understand should i set MaxPallel option or not
and how many threads are running this way
because CPU is 100%
 
you might want to try to set it to numberOfLogicalCores + 1
so, in your case probably 5 or 9
see if that works...
 
ok Thanks
Is there any tool in IIS that help me to see the Threads / Status with their status
 
10:27 PM
not sure, I dont use IIS
 
 
1 hour later…
11:50 PM
Hello
HttpResponseMessage response = await client.GetAsync("ShippingAPI.dll?API=Verify&XML=" + requestDoc);

if (response.IsSuccessStatusCode)
{
var xdoc = (XDocument.Parse(await response.Content.ReadAsStringAsync()));
Operations.ProcessXMLResponse(xdoc, smallChunk);
UpdateElastic(smallChunk, id);
}

why it goes to UpdateElastic Without waiting the result
 

« first day (3841 days earlier)      last day (1090 days later) »