« first day (3406 days earlier)      last day (1525 days later) » 

1:15 AM
Press <enter> to suicide...

2/12/2020 9:14:06 AM -> 11780 datagrams/s
2/12/2020 9:14:07 AM -> 2165856 datagrams/s
2/12/2020 9:14:08 AM -> 2192538 datagrams/s
2/12/2020 9:14:09 AM -> 2199545 datagrams/s
2/12/2020 9:14:10 AM -> 2169335 datagrams/s
2/12/2020 9:14:11 AM -> 2183304 datagrams/s
2/12/2020 9:14:12 AM -> 2211167 datagrams/s
2/12/2020 9:14:13 AM -> 2203852 datagrams/s
2/12/2020 9:14:14 AM -> 2191119 datagrams/s
2/12/2020 9:14:15 AM -> 2185044 datagrams/s
2/12/2020 9:14:16 AM -> 2222586 datagrams/s
More speed...
 
mr5
2:00 AM
@Wietlol monads are wrapper aren't they? I kept forgetting its definition.
o/
 
2:46 AM
hello!
 
mr5
what do you call to this in English: unit price * quantiy?
total price?
o/ scaledish
 
 
1 hour later…
3:54 AM
409649 allocated objects, with 0 live, but retained 2MB of memory
Xamarin Profiler makes no sense
 
mr5
4:30 AM
Memory leaks?
 
just checking, suspect a leak
Not sure it was a leak, while 0 lives but retains memory not sure howtf is going on
maybe some misunderstanding of memory concept
 
mr5
Maybe those are objects not yet GCd?
 
4:55 AM
Objects still being referenced in somewhere else?
 
mr5
5:14 AM
METHOD="AES-128",URI="path?key1=value1&key2=value2"
1.    line = 'METHOD="AES-128",URI="path?key1=value1&key2=value2"'
2.    foreach(var entry in line.Split(',')) {
3.    	values = entry.split(/=["^]/g)
4.    }
in line number 3, the regex doesn't capture the first entry properly, which is
METHOD="AES-128"
but works on the second entry which is, URI="path?key1=value1&key2=value2"
can you guys suggest me a regex to handle both?
in C#
wait
it's working in JS though 🤔
 
5:38 AM
@mr5 It's your fault to do values = Regex.Split(...); instead of valuesList.Add(Regex.Split(...));
List<string[]> valuesList = ...;
 
mr5
hmm
I think I got it: ideone.com/t5TnVB
 
6:34 AM
hey guys
 
is var only for c# and java
script
 
mr5
r u trying to confuse us with java and javascript
 
Java 10?
 
mr5
oops, I mean to say, "var is now available in Java"
yeah. java 10
 
6:46 AM
lol
 
you misspelled now with no
 
mr5
with Java also having its own Linq, and now it has type inference such as var, I guess Java is becoming relevant again
I still prefer K&R curly bracket style over the Allman style and Java's package over C# namespace
 
var lib = require('yourlib'); is da best!
 
Image Compression in C#
 
mr5
6:51 AM
And Java is faster than .NET
??
 
and .NET core is faster than java?
 
mr5
other way around
 
do u know image compression in c#
my boss is saying me to compress image while uploading
 
mr5
you mean, compress the image before uploading?
 
What kind of compression?
 
mr5
6:53 AM
it would corrupt the file if we compress it during though
 
Lossy vs Lossless
 
mr5
If you want to preserve transparency, go with PNG, otherwise, JPG
if it's a big image with no transparency, prefer to use JPG over PNG
 
@mr5 GZip
 
I have a method that uploads images from form to a folder
but i want to compress and upload images
 
Wait...you mean compress at client or server side?
Before or After
 
6:56 AM
server side or client whatever
just need to compress and upload to www/venue folder
my boss is saying me to complete it by 4 hours
 
In what format?
From what to what
 
just reduce to image size
nothing more than that
set height widht to say 900 * 1200
 
mr5
jc!
first, I would suggest to make your upload method to accept a Stream only
separate the concerns first.
 
Here's the JS library: github.com/nodeca/pica
 
mr5
where are you getting the image file?
@markharringson that is not, by definition, a compression. it's called resizing.
 
7:00 AM
@mr5 Okay thanks resizing
 
mr5
do you want to preserve the aspect ratio?
 
yes man preserve the ar
 
mr5
wait. lemme pull something out of our code base
 
ok mr5
 
mr5
which platform is this again?
 
7:02 AM
.NET core mvc
 
mr5
Windows?
 
Doesn't matter if you do it in web browser
The server just happily accept resized image
 
@DKDhilip yes
 
So I think this is good enough for your case
 
mr5
7:05 AM
wait. we only have resizing for Android and iOS
 
5 mins ago, by DK Dhilip
Here's the JS library: https://github.com/nodeca/pica
 
mr5
Is System.Drawing.Image available to you @markharringson?
 
System.Drawing; is available
 
Good morning.
 
mr5
Here's an existing solution I found in SO: stackoverflow.com/a/1922086/2304737
 
7:07 AM
with system.drawing.image i get
The type name 'Image' could not be found in the namespace 'System.Drawing'. This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly
 
Why do you still need to do that in C#?
Your browser already resize for you before uploading
 
mr5
1. Resize the image.
2. Get the MemoryStream of this image or convert it to MemoryStream.
3. Pass the stream to your upload method
4. (optional) Listen to the progress
5. ??
6. Profit
 
1. [browser] Select image
2. [browser] pica resize image
3. [browser] POST
4. [server] Accept and save to disk
5. ???
6. Profit
 
i have multiple images
 
It's same, just loop it
 
7:11 AM
3 to 15 images will be selected for uploading
 
You only resize selected images
 
@markharringson The obvious winner of client-side processing vs server-side processing is obviously client-side. You won't be wasting bandwidth nor precious CPU cycles on image processing. Just validate on the server-side that the images are within the constraints and let the client-side worry about achieving that as @DKDhilip said.
 
@RoelvanUden client side
yes man
i was thinking i can not solve this problem and i would go to ftp server download all images and bulk resize with PS.
and upload back to server
 
If you cannot solve it, you should spend more time on it to learn how to. This is a normal use-case and has been solved by many people around the globe.
 
mr5
7:21 AM
=["^]
how can I make this match for both METHOD=AES-128 and URI="path?key1=value1&key2=value2"
 
@RoelvanUden Thanks
@DKDhilip I will try it with client side server will be happy
 
@mr5 I suggest not using regular expressions. Use line parsing instead. Then you can switch on states for quotes, dividers and end-of-line.
 
u guys are genius here
 
mr5
@RoelvanUden combination of substring and indexof?
noway
 
Something like this (quick-and-dirty in JS):
var l = '"METHOD=AES-128,URI="path?key1=value1&key2=value2"';
var ls = l.replace(/^"/, '').replace(/"$/, '');
var p = 0;
var quotes = false;
var r = [];
for (var i = 0; i <= ls.length; i++) {
  var c = ls.charAt(i);
  if (i === ls.length) {
    r.push(ls.substr(p, i - p));
  } else if (quotes) {
    if (c === '"') {
      quotes = false;
      continue;
    }
  } else {
    if (c === '"') {
      quotes = true;
      continue;
    }
    if (c === ',') {
      r.push(ls.substr(p, i - p));
      p = i + 1;
 
mr5
7:33 AM
ewwww
that's too long
 
Fine, do it however you wish.
 
mr5
but you still use regex there
 
Only because JS doesn't have trimstart and trimend
 
Good morning.
Spend the morning learning bash syntax to automate some tasks I probably won't be doing much in the future. How's your morning going?
@mr5 How about using a tried and true URL query string parsing library?
 
Spend the morning working with train-wreck mobile code to add a feature that looks hella ugly.
 
7:55 AM
2/12/2020 3:53:21 PM -> 2283445 datagrams/s
2/12/2020 3:53:22 PM -> 2302295 datagrams/s
2/12/2020 3:53:23 PM -> 2334031 datagrams/s
2/12/2020 3:53:24 PM -> 2313479 datagrams/s
2/12/2020 3:53:25 PM -> 2305249 datagrams/s
2/12/2020 3:53:26 PM -> 2318946 datagrams/s
Finally reach 2.3M
 
@DKDhilip What is it?
 
@markharringson Sending UDP messages
 
mr5
@AvnerShahar-Kashtan this isn't about parsing a URL though
It's a line from m3u8 format where each key/value is separated by = where the values may or may not have " (double quotes) in it.
 
good morning
yay! Avner is back! How was your abduction time?
 
@ntohl Fantastic! I was kidnapped and held in a cave on a remote island, blindfolded and fed stale water and muddy bread.
 
8:03 AM
great to hear
 
var s = @"""METHOD=""AES-128"",URI=""path?key1=value1&key2=value2""""";
var parser = new CommonDictionaryParser(s.Trim('"')){PairSeparator=','};
parser.ParseToDictionary();
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(parser.Dictionary));
| {"METHOD":"\"AES-128\"","URI":"\"path?key1=value1&key2=value2"}
 
Noice.
 
@AvnerShahar-Kashtan how do you like it at Google?
 
mr5
@nyconing change your s to this: @"""METHOD=AES-128,URI=""path?key1=value1&key2=value2"""
should it be 5 "s?
@""" METHOD=AES-128,URI=""path?key1=value1&key2=value2"" """
 
Sorry just now realized that was my class, not from .NET framework
Aiya
@"""METHOD=AES-128,URI=""path?key1=value1&key2=value2"""
any different?
 
mr5
8:10 AM
URI value will not have a pairing double quotes I think
 
@ntohl Nice so far, but still mostly learning.
 
output: {"METHOD":"AES-128","URI":"\"path?key1=value1&key2=value2"}
but URI is not valid? since it dont have a " at the end
 
mr5
"METHOD=AES-128,URI=\"path?key1=value1&key2=value2\""
this is more understandable
 
if you add a quotation mark at the start, presumably you'd need one at the end too
though the importance of the quotation mark is only as relevant as how you use it
if you just cut off the first character, then having one quotation mark at the start is just fine
 
8:16 AM
well like this does it work?
 
var s = @"""METHOD=AES-128,URI=""path?key1=value1&key2=value2""";
var parser = new CommonDictionaryParser(s.Trim('"')){PairSeparator=','};
parser.ParseToDictionary();
Console.WriteLine("Hello, world!");
Console.WriteLine(s);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(parser.Dictionary));
Console.WriteLine(new CommonDictionaryParser(parser.Dictionary).ToString());
> Hello, world!
> "METHOD=AES-128,URI="path?key1=value1&key2=value2"
> {"METHOD":"AES-128","URI":"\"path?key1=value1&key2=value2"}
> METHOD=AES-128;URI="path?key1=value1&key2=value2
^ the class
Wrote few months ago, I dont even know I have make this class if you use, take your own risk
 
how do you handle null values?
 
iDunno, since I dont even know I have this
 
I think it would just show "null"
@nyconing I'm going to push it to production now
 
yeah, if you put KEY=null, it should have a "null"
 
mr5
8:25 AM
@nyconing why public new string ToString()?
instead of override?
 
It had better work!!!!
 
not a override, just a new method from object.ToString()
 
mr5
I was thinking of negative lookahead for regex
 
it's difficult to properly parse a string value if you allow escaping
1.) Find all contents between quotation marks. 2) Find all contents between quotation marks which doesn't have a \ character preceding it. 3) Find all contents between quotation marks which doesn't have a \ character preceding it, provided that that \ character doesn't itself have a \ character preceding it.
4) Find all contents between quotation marks which doesn't have a \ character preceding it, provided that that \ character doesn't itself have a \ character preceding it, unless that \ character preceding itself has a \ character preceding it..
 
if you allowing separators inside the scope, much more difficult
 
8:31 AM
Shit! I need more servers...
 
@nyconing though it may be possible if you just simply ignore all double mentions of \ characters
 
mr5
@Neil actually, a simple .split(',') will remove most of the issues
 
Not enough power to push more UDP messages
 
mr5
so I just need to focus on split the actual key/value
 
need more DDOS power?
 
8:33 AM
true, but that's the difference between parsing and using it for validation
if you know the input is valid, it would be better to use .split(',')
 
Yeah, LAN only
 
(?:([])\1)*
 
mr5
@Neil yes. the parser I want to make doesn't need to worry about its validity. it will just simply throw.
 
(:3)*
 
8:50 AM
(?:([\])\1)*
damn escapes
it removes the \\ in \] but not the \\ in \1
wait wut?
 
mr5
=["^]
^ this one is the closest I got
 
["^] means either a " or a ^ character
if you mean to say "not a quotation mark character" then it is [^"]
I know.. confusing
for the same reason that [a-z] is way different than [-az]
 
Malaysia just get a warning from WHO for possibility of wider covid19 transmission are raised
 
good luck
 
Goood Game
 
9:01 AM
I mean the proper good luck. Not from Taken.
 
Hehe
Will human get extinction
 
mr5
why won't it wont if I swap the position of ^ and " then?
@nyconing what's covid19?
oh
 
Yeah it wont because covid19 is still weak on lethality
 
mr5
they even put year on it
last time it was only ncov, now it's covid 19
 
the confirmed name of ncov-19
 
9:10 AM
I sure picked a bad time to start playing Pandemic Legacy.
 
no. It's the perfect time to be not boring
 
9:33 AM
I think the best way to learn C++, going forward, is to assume that any pre-C++11 code is simply invalid and only learn how to do things in C++>=11. That seems safe.
I have a lot of bad practices I don't need to unlearn.
 
Hell\o
I am trying to get Visual properties from an InputElement. In the debugger these properties show, and the type of object required to get these properties
But in code I am unable to get to these properties, no matter the cast I perform
Is it possible certain properties are only available during runtime, thus never achievable in code?
 
code runs in runtime.
 
not what I mean.
 
What do you mean?
 
one moment
 
9:39 AM
WPF or winforms?
 
wpf
 
I can appreciate downgrading the threat of corona virus, but 2% is still pretty f'ing high
 
I want these properties
 
I wouldn't take a flight with a 2% chance of crashing
 
So I cast to a System.Windows.Media.Visual
the properties are not there
 
mr5
9:43 AM
I fucking hate Xcode's interface builder!! AAAAAAAAAAAA!!!
 
My current fear is that I will start to like and appreciate C++.
Also, I managed to get my bluetooth headset to work on this linux desktop, which has so far been my biggest technical hurdle at Google.
 
I want the relative position (to the opened window) of the object, I can't seem to retrieve the property "Visual Offset" (only in debugger watch)
 
@AvnerShahar-Kashtan Welcome to the dark side. >:)
 
So I tried the following:
Point relativePoint = myVisual.TransformToAncestor(rootVisual).Transform(new Point(0, 0));
But I also am unable to get the rootvisual from the properties, only in debugger with a watch
it's very frustrating
 
C++ has an odd appeal to it
 
9:46 AM
I tried a ton of casts already, none of which shows me the property Visual Parent
 
I don't use C++ as much as I used to, and it's a shame. Maybe it was because it was my first language, but it felt like I could write anything in that language
 
@AvnerShahar-Kashtan great. Which distro?
 
@Neil That's because you can :-P
 
well technically yes, just like I can do anything in Java
Just feels more hands-on.. I guess
which is funny to say considering there's nothing hands-on about a programming language
 
@mr5 as far as I understood it, Functors are wrappers, Mondads are Functors that can also be flattened
 
mr5
9:54 AM
 
for example, a thing inside a wrap inside a wrap could easily be converted to a thing inside a wrap
 
mr5
LOOK AT THIS STUPID SHIT XCODE!
 
Dont you pressed your keyboard?
 
once you pressed on the keyboard, the mouse input is bork?
 
10
A: Navigating up the visual tree in WPF

L.TrabacchinCodeNaked answer is good, but i don't like the fact that the code in that article use recursion to accomplish this simple task, so here's a modified version, which can possibly avoid a stack overflow (not sure WPF can be nested so much, but is it worth risking ?) public static T FindParentOfType<T>

you need VisualTreeHelper to find visual parent programatically
 
9:56 AM
Of course, but IInputElement already gives me a parent
 
mr5
@Wietlol in C++, functors is a function pointer
@nyconing I did. It won't scroll down.
 
I just need this parent to be a Visual object so I can use it as parameter in the method
casting the parent to Visual doesn't make it swallow it
cannot convert from Dependency object to Visual
 
@mr5 in Java an ArrayList is good, in C# an ArrayList is horrific
 
@MwBakker in your case it's a Grid
so the inheritance is Object
DispatcherObject
DependencyObject
Visual
UIElement
FrameworkElement
Panel
Grid
why can't you cast it to Grid?
 

« first day (3406 days earlier)      last day (1525 days later) »