« first day (2080 days earlier)      last day (2870 days later) » 

5:53 AM
good morning.
 
6:22 AM
good morning
 
Jes
6:33 AM
good morning
 
good morning
 
Jes
@AvnerShahar-Kashtan would you be able to help me with regex
 
6:49 AM
Sure, but I can and will bring out the relevant jwz quote first.
> Some people, when confronted with a problem, think
“I know, I'll use regular expressions.” Now they have two problems.
 
hello
Can someone please tell me how htmlfileinput works in web api??
 
@NoughT Badly.
No, really, I remember struggling with it quite a bit about a year ago.
You're trying to post a file from the browser to WebAPI, right?
 
Yes sort of . Please let me explain my situation
 
I don't have access to that code anymore, but it was a question of adding a POST method in your service, adding a [FromBody] parameter but ignoring it, and retrieving the file from the Request.PostedFiles collection.
Or something like that.
 
Jes
I am trying to extract strings from a log file string. I have tried to extract part of it but not 100% hence need some help.
this is my log
Jun 10 14:08:52 gvsansw03 raslogd: AUDIT, 2016/06/10-14:08:50 (EDT), [ZONE-3001], INFO, ZONE, admin/admin/192.168.250.18/ssh/CLI, ad_0/gvsansw03/FID 128, 7.3.1d, , , , , , , Event: cfgadd, Status: success, Info: Zone(s) "CDSFabA_Failsafe;CDSFabA_gvicv7k04" added to Zone configuration "CFG1".
i want to extract the work AUDIT , [ZONE-3001],INFO, ZONE, admin/admin/ as individual strings
this is the regex i have done so far
(^.{0,15})\\s\\w+\\s\\w+:(.*)[(.*)]\\,(.*?),(.*?),(.*?)
 
6:56 AM
@Jes Is this a custom log format or standard output for something?
Because chances are there are good tools that already did the legwork for you.
 
Jes
standard output
 
I try to debug someones code.
HtmlInputFile file = new HtmlInputFile();
 
@NoughT Are you sure that's WebAPI? I think it's MVC.
 
Jes
the second group gives me AUDIT with the date also
but i only want the word AUDIT..
 
Or even WebForms.
 
6:57 AM
then he added this code
file.ID = "Image_1";
 
Jes
tried to include [A-Z] but did nt work
 
@Jes It gives you AUDIT,2016/06/10?
 
Yes of cause
This is WEB API
 
@NoughT HtmlInputFile seems to be a part of WebForms, which is a different framework than WebAPI.
 
Jes
yes
 
6:59 AM
Because of that I am pretty confuse.
But It is working fine in web api.
I can't think how that happen
 
@Jes Try adding the non-greedy quantifier to the second group's .*
@NoughT WebForms and WebAPI might be different frameworks, but they still work on top of HTTP and HTML standards. Posting a file is a standard action, and a file posted by a WebForms control can be received by a WebAPI Controller.
@Jes .*?
 
Jes
@AvnerShahar-Kashtan when i add it crashes
 
Jes
(.*?) does not give anything
 
Why do you have the [(.*)] before the comma there?
 
Jes
7:02 AM
thats is for the next group
 
The date?
It seems like it's looking for two groups before the comma.
 
Jes
no the [ZONE-3001]
 
Thank you.
It seems I have to dig deeper
 
Jes
7:19 AM
@AvnerShahar-Kashtan (^.{0,15})\\s\\w+\\s\\w+raslogd:\\s*(\\w+),.*?\[(.*?)\],\\s*(\\w+), what do you thing of this
 
@Jes It's regex. It's absolutely impossible to have an opinion at a glance. :)
Plug it into a regex workbench or write a small app to test it, and just keep iterating over run-tweak-repeat until it works. :)
 
Jes
yes, would do that
 
@ntohl Oh, hey, just noticed. Congratulations!
 
Jes
7:39 AM
how would i split this one
admin/admin/192.168.250.18/ssh/CLI
extract admin , admin and ip ?
 
var fields = myString.Split('/');
var username = fields[0];
var password = fields[1];
var ip = fields[2];
Don't overthink it. :)
Regex isn't the only tool you have for string parsing. It's a big, heavy and complicated tool that's probably overkill for simple tasks.
 
Jes
agree
 
 
2 hours later…
9:35 AM
TPL dataflow is too hard
I have no idea how to structure my code using blocks
I'm just not getting it
 
Never really got into it.
 
like suppose I want to be able to save images from the web to a file on disk
my input is a Uri and my destination is a FileStream
how the hell do I put that into blocks
I'm just not getting it
 
Just one image?
 
    var downloadBlock = new TransformBlock<Uri, Stream>(uri => httpClient.GetStreamAsync(uri))`
    var fileSaveBlock = new TransformBlock<Stream, FileStream>(networkStream =>
    {
             var filestream = File.Create("file");
            networkStream.CopyToAsync(filestream);
           return filestream;
});
?
 
9:42 AM
yeah I'm just experimenting
 
I did read about it but never really got into it.
It has a sort of monad-y smell to it
 
(This is pseudo-codish, yes?)
 
I really want to master this stuff because I do believe that you can solve a lot of difficult problems with TPL dataflow
but the learning curve omg
 
I would expect these two blocks to be be chainable, one transforming a Uri into a Stream (the one from the server), and the other to save that stream to a filestream.
But again, I only have a cursory familiarity with the framework.
 
I guess if you were writing a crawler you'd also have a block that recurses over links in html documents and passes them on to a downloader block, or something like that
 
9:44 AM
Then you use LinkTo to link the output of the first to the input of the second.
Are you supposed to have sync or async calls inside the blocks?
 
for my problem or in general?
 
IIRC dataflow predates await, maybe that goes some way to explaining why it exists
 
Judging by the "Creating the Completion Tasks" section in this tutorial, it seems like there's a lot of ugly plumbing code in it. More than I'd expect.
 
Building task-based software thought to be tedious; this was one solution; await is elegant enough that dataflow is kind of obsolete
^ a possible opinion, not necessarily mine
 
@TomW Perhaps. The point is to be able to chain async tasks without getting into deeply nested ContinueWith statements.
But I think the point here is to have a more modular architecture where common tasks can be chained independently.
 
9:47 AM
yes
and that's where I'm having trouble
 
But perhaps the common usages of DataFlow were simply to avoid the nesting, which await solves nicely.
 
I feel like it's the opposite of modular
because all the examples put all the code in the Main()
and I don't know how to extract code to classes
 
public class FileDownloadBlock : TransformBlock<Uri, Stream>
There. You have a reusable block.
 
nope
TransformBlock is sealed
try again
 
9:50 AM
:p
 
Maybe you need to implement IDataFlowBlock yourself.
 
So a TransformBlock is basically an async wrapper over a Select() call, and an ActionBlock is an async wrapper over foreach?
 
10:13 AM
I guess this is my best place to start amazon.com/TPL-Dataflow-Example-Reactive-Programming/dp/…
 
 
1 hour later…
11:38 AM
so whats a nice book to read at work
programming book
 
Clean Code is considered a milestone.
Also The Pragmatic Programmer
 
oh yes the pragmatic programmer
ill pick this up right now
 
Just found a method deep in our code base that checks if a given IP Address is internal or external by calling StartsWith on a string against a set of pre-determined prefixes. Oneof which was "10".
Not "10.". Just "10".
 
headdesk
 
So any IPs like "103.240.20.30" would be flagged as internal.
 
11:45 AM
Does this application go screwy roughly 4% of the time?
 
Occasionally data gets flagged wrong. Not always noticeable, since the difference between internal and external isn't that huge, but it means that some checks that are applied to external addresses during data load aren't checked.
For instance, checking a given external IP against the database of known threat actors (IPs that participated in known attacks, known virus hosts, etc) is only done to external addresses.
 
not good.
 
So, if you want to avoid detection, make sure you host your viruses from the 10x.y.z.a block!
 
is there any simple indicator if the ip address is local?
maybe if the gateway is in the subnet or something
or if the subnet is like 255 to be precise
 
There are known nonroutable ranges (10.*, 192.168.*, etc).
And we load per-customer internal network ranges too.
 
11:50 AM
what if its a vpn
 
VPN connections are given an internal address when they connect.
 
well what if you are using IPv6?
2
Q: How to determine if IPv6 address is private?

desautelsjI am trying to determine if a given IPv6 address is private or not in C# and I was tempted to simply use the 'IsIPv6SiteLocal' property on the IPAddress class. However, as explained in this comment, the logic implemented in this property is deprecated. I ran the following unit test: [TestMethod]...

ERGO solution to this particular pickle
 
@misha130 Then everything is screwed anyway, since we don't support it. :)
No, there are many solutions better than the one I found in our code base today. :)
 
its just the "10.*" tickles my jimmies here
 
@misha130 Fixing "10*" to "10.*" was the quick-fix we added just so we won't lose so much data, until we can add a real fix.
 
11:57 AM
it feels like there should be a layer 3 flag on the packets saying whether it should go to the router or stay within the switch
to save hustle, I might be wrong
 
That's too low-level for me to have an opinion.
Apparently the private IPv6 network range is fd00::/8
 
check the answer its sort of interesting
 
A big stinking mess, you say.
 
 
3 hours later…
3:12 PM
there's no constructor for ActionBlock that takes an Action<T, CancellationToken> so if you want that then T has to be a Tuple<T, CancellationToken> or a custom class
I'm extremely underwhelmed
 
3:53 PM
Well that's a bother. It's important that you stay whelmed.
 
4:07 PM
Hello everyone!
Is there something similar to Environment.NewLine that just inserts space?
a space*
 
What would be the point of using a global for that?
Environment.NewLine has a purpose because Windows and *nix have different conventions for what a newline is. A space is a space everywhere
 
ok, thanks for the feedback
 
To answer your question, not that I'm aware of
Some stackoverflow questions asking the same thing, this one suggests what the problem is with that stackoverflow.com/questions/11019561/…
 
4:59 PM
Another quick query, I'm making use of TableCell.Width. Does it only accept/use size in a pixel format? Can I make use of % based sizes?
or TableCell.Height
Found it
TableRow.Width = new Unit("25%"
 
 
3 hours later…
8:21 PM
hmm
I think it's weird that you can't divide or multiply TimeSpan
can't do TimeSpan.FromSeconds(10) / 2
I had to do TimeSpan.FromTicks(TimeSpan.FromSeconds(10).Ticks / 2)
:p
 
8:41 PM
Hello to all
I have a problem really
0
Q: Why -Force Attribute Not Worked In Migration Configuration?

Mohsen ZahediI use this class for configuration Migration .I want update database that already have tables that exist in my database factory.But when it created has error .It's here is already an object named 'MyTable' in the database. Configuration.cs internal sealed class Configuration : DbMigrationsCon...

Please answer to my qustion plzzzzzz
 
8:52 PM
Home sweet home!
 
9:50 PM
a while back I made a library and generated a dll and copied it to a directory and I am able to import that dll into my other programs. I have now updated the library program but I don't know how to regenerate the dll
rebuild solution doesn't seem to do it
i can't see where it puts the dll
or how to generate the dll
 
@barlop You should add a reference to the .csproj, not the .dll
by loading it in the solution you can rebuild it without having to open the original solution
 
oh I don't have to open the original solution unless I want to recode it
which I do sometimes, make amendments
the advantage of the dll is that it keeps the solutions more separate
 
That's not an advantage
you're fragmenting your dependencies
 
ok
 
manually referencing a .dll file is just pain
You should add references to projects or with a package manager
 
10:01 PM
I guess it might be a bit slower if it has to compile a referenced project every time
 
There's no reason it should have to recompile
unless you do something stupid
 
so i guess it's clever and it only compiles once..
and then if I change the original code will it detect that and recompile it?
 
Just like normal
 
yeah I suppose so
ok.. out of interest though, do you know how i'd generate the dll? (though indeed i'll be doing a reference to the csproj project)
 
You mean recompile it?
 
10:03 PM
when I choose build or rebuild it makes an EXE not a DLL
I want a DLL
 
@barlop why?
 
because I want to know how to do that method anyway, as I used to know how to and I like knowing things
but I will ultimately do the csproj method
 
That's not what I asked
 
Why does it make an EXE and not a DLL?
 
right
 
10:06 PM
I don't recall how I created the solution, maybe I made it as a regular winforms application.
but still I was able to make a DLL i'm just not sure how I did
is it default behaviour to create a dll?
 
It depends on what project template you use. There is no default.
 
ah I see.. I was opening a project where the build made an exe, it was an earlier attempt. the project I was meant to open was elsewhere and that one generates a dll on build
anyhow, now i know what it was, i'll do the csproj import!
 
11:09 PM
I can't see an option to add a csproj file i.imgur.com/unaVQjo.png
@VeronicaDeane it offers dll and exe but I don't see .csproj
 
you add the project to the solution and select it under the projects tab in the add reference dialog
 
ah, thanks
 

« first day (2080 days earlier)      last day (2870 days later) »