« first day (2199 days earlier)      last day (2735 days later) » 
06:00 - 13:0013:00 - 00:00

6:43 AM
posted on October 23, 2016 by Scott Hanselman

I've been doing .NET Open Source since the beginning. Trying to get patches into log4net was hard without things like GitHub and Twitter. We emailed .patch files around and hoped for the best. It was a good time. There's been a lot of feelings around .NET Open Source over the last decade or so - some positive, some negative. There's been some shining lights though and I'm going to do a few b

 
7:04 AM
uhmm is there someway for me to change "\\n" to an array of strings to compare with?
array = array.Where(w => w != "\\n").ToArray();
 
7:17 AM
hi
any bidy ccan help me ?
0
Q: create sql view in C#

Kianoushi create this view in sql server 2014 . now i need using this view in C# . how i use that ? pleas guid me . in SQL : USE [AnbarDB] GO /****** Object: View [dbo].[View_ShowProductPrice] Script Date: 10/23/2016 10:20:40 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDE...

 
 
1 hour later…
8:21 AM
Omg, this C# won't use my DataContext!
 
8:57 AM
@Kianoush You need to tell us more info about your question, since what you just said can have too many answer depend on how or where your writing your code lol
 
9:24 AM
@JasonBrown myArray.Contains(w)
 
Hey guys,
I have a Window in WPF XAML, and it has it's own DataContext.
And the MainWindow has this: <Frame Width="700" Height="507" Source="Pages/Dashboard.xaml" />
For that particular WPF Page, I have set a DataContext like this:
public Dashboard()
        {
            InitializeComponent();
            DataContext = new DashboardViewModel();
        }
And in my XAML, I have a command:
<Button Style="{StaticResource MenuButton}" Grid.Column="2" Grid.Row="1" Command="{Binding ViewStatistics}">&#xEA37;</Button>
When I click it, it does not execute, unfortunately.
    class DashboardViewModel : ViewModel
    {
        private MainViewModel parentViewModel;

        public DashboardViewModel()
        {
            this.parentViewModel = new MainViewModel();
        }

        public ICommand ViewStatistics
        {
            get
            {
                Console.WriteLine("Hello!! TEST!!!");
                return new ActionCommand(p => this.parentViewModel.LoadPage("Statistics"));
            }
        }
    }
That is what my class looks like.
The Console writeline is not triggered.
Anyone has any idea why?
 
How do you know that it's not triggered?
I don't know where writes to console go in WPF applications, probably nowhere
 
The "Hello! TEST!!!" does not seem to appear.
It goes to Debug window.
 
where were you expecting it to appear?
 
Nevermind it appears in the debug window
 
9:30 AM
OK, that sounds like expected behaviour
 
lol xD
 
But even before executing the command
It just appears
As soon as the Window launches
 
I guess the command is retrieved by calling ViewStatistics at the time the button is created
it's a property of the button, so that makes sense to me
 
But, when I click
It doesn't do it
 
Well i can't help you on this, even tho i did a bunch of WPF projects, i never used Command property of button, ( didn't even knew it exist :P )
 
9:33 AM
Doesn't write to console, you mean?
I wouldn't expect it to
 
@PEdram Ohhh, lmfaoo.
 
triggering a command from a control doesn't get the command again, it executes the command
 
Wait, I'll give you my "ActionCommand" class. I think there's an error there.
 
so you're expecting it to run this.parentViewModel.LoadPage("Statistics") - and nothing happens?
Can you tell whether parentViewModel.LoadPage is entered at all?
 
I'll check. Looks like ActionCommand is right
Yes, it is executed.
public void LoadPage(string pageName)
        {
            Console.WriteLine("Load page entered!");
            this.CurrentPageTitle = pageName;
        }.
But then, Two way data binding doesn't update the parent frame.
private string currentPageTitle = "Dashboard";

public string CurrentPageTitle
{
    get
    {
        return this.currentPageTitle;
    }
    set
    {
        currentPageTitle = value;
        NotifyPropertyChanged();
    }
}
<Label Style="{StaticResource TitleBarTitle}" Content="{Binding CurrentPageTitle}" ></Label>
The Label is bound to the CurrentPageTitle property.
Ok, found the problem. NotifyPropertyChanged is not called.
 
9:40 AM
Hmmm. How can that be?
 
Ok.
It's called. The handler is null.
Don't know why though.
 
the binding mechanism is supposed to add an event handler to that event, I think
{Binding CurrentPageTitle} I wonder if that's right
I don't know a lot about binding, it might be that it's different depending on whether you want to bind to the datacontext of the label, or the datacontext of the label's parent window
what about {Binding Path=CurrentPageTitle}
 
I think you're right.
Let me check
3
Q: How to bind a simple .net property to a label and have it auto update

KyleI'm kinda new to data binding and obviously don't really understand it. I'm trying to bind a simple .net property to a label, and have that label updated whenever the property is changed. It's not working and i'm not sure where the problem lies. Here is my XAML <Label Content="{Binding Path=...

As per that, I set the EventHandler
public event PropertyChangedEventHandler PropertyChanged;

        // [CallerMemberName] automatically resolves the property name for us.
        protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChangedEventHandler handler = PropertyChanged;

            Console.WriteLine(handler == null);
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
Returns True... wtf
(The console.writeLine)
 
did you change the binding syntax?
still doesn't register an event handler?
 
9:56 AM
Yes, I did. Still doesn't register an event handler.
<Label Style="{StaticResource TitleBarTitle}" Content="{Binding Path=CurrentPageTitle, UpdateSourceTrigger=PropertyChanged}" ></Label>
For that Window,
using System;
using System.Windows.Input;
using VexLibrary.Windows;

namespace VexLibrary.DesktopClient.ViewModels
{
    public class MainViewModel : ViewModel
    {
        private string currentPageTitle;

        public string CurrentPageTitle
        {
            get
            {
                return this.currentPageTitle;
            }
            set
            {
                currentPageTitle = value;
                NotifyPropertyChanged();
            }
        }

        public void LoadPage(string pageName)
This is what the MainViewModel looks like.
 
Exhausted the limits of my knowledge now, I'm afraid
but it does look like something to do with that binding syntax
 
Just the event is not registered.
 
10:10 AM
I ended up creating a SO question.
I cannot seem to find the mistake
It's so weird.
My previous project, all this worked perfectly.
10 views.
Still no replies. Haha
 
War
10:49 AM
Anyone know how I might go about setting up routing rules on a network to route traffic on all ports based on machine name?
Might have to ask some server guys about it
 
11:03 AM
I have a string, that looks like this "Wow... thats amazing.. I dunno what to do...."
I need to change groups of 2 periods to 1, Leave groups of 3 periods alone, and Change groups of greater then 3 periods to 3 periods EG:
"Wow... thats amazing. I dunno what to do..."
any suggestions would be appreciated. I am unsure how to get any of the replace functions to ignore certain groups =S
 
sounds like a job for regex
p.s. what an odd requirement
 
Im trying to fix up a machine translation, that auto injects intself into the program, but i need to optomize the strings so they fit while keeping the context the same..
 
I'll give you a clue, the syntax for 'at least three' in regex is {3,}
 
oh? thats really useful i think
Im pretty bad with regex and linq and all that stuff, just started to learn linq lol
 
so something like [.]{3,} I think (character range 'dot', at least three of)
the [] is important because . is a regex keyword meaning 'any character'
 
11:09 AM
Lol ah
this look accurate?
tidy = Regex.Replace(tidy, "[.]{3,}", "...");
 
I think you'll also need some syntax which says 'and assign this capture an index I can refer to' which I'm not 100% sure how to do
about right yeah, if that works go for it
 
its not gving me a syntax error ... Now how can I select groups of less then 3.?
 
As a guess, {,2}
but be aware that a group of 3 periods contains a group of two periods :)
 
Hate how I haven't learned regex well enough yet tried that and it gave me syntax error
crap...
 
hey I don't know it either
Actually, your rule is . > leave as is, right
.. > .
 
11:14 AM
yes
 
so actually you want to match exactly two
 
[.]{2}
 
but wouldnt that mess with the groups of 3 still
?
 
err yes possibly
 
11:16 AM
    tidy = Regex.Replace(tidy, "[.]{3,}", "...");
    tidy = Regex.Replace(tidy, "[.]{2}", ".");
Would screw up the string so 3 became 2 ...
then id have to run regex again and change the 2's to 3... :s
 
I think what you want is called a 'greedy match' and I believe the {} operator is greedy by default
but try it
 
very well lol
damnt found another situation I have to clean up text for lol least its not as complex
 
OK, I was wrong, this is not quite right
 
yeh the 3's became 2's...
 
11:21 AM
wait is this correct?
    tidy = Regex.Replace(tidy, "[.]{0,2}", ".");
nvm...
 
hmm what would matching . 0 times mean?
 
Lol oops good point
also tis is to replace " " 1 or more Spaces with 1 space...
tidy = Regex.Replace(tidy, " +", " ");
thats what i need the [.]{3,} to be doing
 
Kendall is a wizard with regex, I know a bit but not a lot
 
Im sure Il figure it out
I think this is suitable
    tidy = Regex.Replace(tidy, "[.]{2}", ".");
    tidy = Regex.Replace(tidy, "[.]+", "...");
having more then 4 or 5"." in a row is unexpected however I guess it could happen...
argh if i match the groups of 2 like that then it selects .... as 2 groups...
 
11:40 AM
unit test the hell out of it
 
heh... no idea how to unit test :D everything i do by hand xD
 
Definitely an important thing to learn
 
shh il get to that when im doing things that I expect to break all over the place :D
lol
 
well it's really useful for experimental stuff like this
especially if you use a test framework that supports continuous run
every time you change something you can see straight away which of N cases don't work the way you expect
 
welll.. im not really sure thats going to help me if I know its not working xD
this works to make greater then 3 periods in a row into 3
		var str3 = Regex.Replace(str2, "[.]{3,}", "...");
but I cant find a way to select 2 periods on their own...
Its picking the 2 out of that group of 3 and so I get .. where I should have ...
var str4 = Regex.Replace(str2, "[.]{2}", ".");
 
11:46 AM
I think you need some way of saying 'and then no more'
 
pretty much.. I dunno if regex has a way to define that though? :S
 
try [.]{2}(?:\w+)
(?: ) is a 'non-capturing group'
so it says 'must be here but don't include it in the selection to replace'
 
... hmm
 
\w+ is one or more word characters (i.e. letters)
hmm no that's not right
 
also that syntax doesnt work in dotnetfiddle.net
 
11:48 AM
This is why I didn't want to give advice on that because I know it exists but don't know how to use it properly
 
Lol thats ok
 
yeah that's because \ is an escape sequence in C#, you need \\
 
yeh
 
sorry should have mentioned that
 
@War You want a route to change ports pending the machine? not the request?
 
11:50 AM
its k @TomW im still trying to think if regex.replace is the best way to do this
or if i should write a function that can modify the string myself...
 
I think it is...using it properly is tricky though
 
lol yeh... regex is a bit complicated with its confusing syntax
 
the variable number of characters to match will make it tricky to code it yourself, I think
string.Replace won't work for example
and if the first person to look at your code just says 'why didn't you just use regex?' it'll be like...fml
 
yeh string.replace wouldnt work, but I was thinking I could Split "." (I have a function that includes the split characters in the array)
scan the array and make note of where there is 3+ "." in a row, and make note of when its just 2"." in a row
it just seems like that would be take more time processing wise then a regex lol
 
Damn, does David Anderson ever get inside this room
 
War
12:10 PM
@juanvan no i want all ports on a given sub domain to go to the machine
 
trying to think how that would work
 
War
so I have a root level domain forwarded to my network "mydomain.com" and I want say "sql.mydomain.com" to be routed to a vm that handles SQL
I plan to open only the right ports on my router so only certain open ports will even get to my mv host
then the host needs to be able to say "oh here vm, some traffic for you"
 
oh using the Name of the domain
 
War
or maybe i'm thinking about it the wrong way as the vm's themselves have ip's
 
so if you have www.domain.com it goes to vmA and cart.domain.com go to vmb
 
War
12:13 PM
but how do I configure my router to say "mydomain.com" goes to one server and "foo.mydomain.com" goes to another server?
on the same port
 
that is the tricky part
because it works on IP and Name
 
War
hmmm ... not sure ... my router seems to only have options to forward a port and that's it
 
request comes in, router knows Outside.101 -> Nats to 172.16.10.101
 
War
so I can say "port 80 goes to my vm host" (that got me thinking I could do something on the host to figure it out
 
ya but that won't work in this case
 
War
12:15 PM
yeh ... that's what mae me think "i need a networking guy"
 
think you need a load balancer like machine between them to forward the requests
<- Does networking
 
had a pint with an infrastructure architect last night, he'd know for sure
he was explaining the Dyn attack to me
 
that is a Fun topic
 
War
hmmm ok @juanvan sounds like im in the right place :)
 
He says the root cause ultimately is that ISPs often don't prevent packet forgery
I was amazed that the whole network backbone basically lets you lie
 
12:17 PM
that is a router that should drop the packet
 
War
@TomW nice ... as a programmer ... despite coding some insane shit ... I still feel like networking is a bit of a black hole
 
see a miss formed packet and drop it
 
@War yeah likewise
 
War
@TomW yeh isp's don't check or verify anyhting
that's how you get low pings
 
so the ddos attack sent forged packets to Dyn asking for a huge list of records, using a packet with the target's IP in it
 
12:18 PM
forged as is created
 
War
nice!
 
so Dyn responds to that IP with a massive overload of traffic, and it's on their DNS service, so they can't stop listening
 
War
presumably the forged packets were sent from a botnet
 
yep
 
because you can Ping a server with a HUGE packet from command line
 
War
12:19 PM
10k machines in => response to one machine => bang!
 
probably does quite a lot of damage to Dyn as well, as they've got to generate and send said traffic
 
we were talking about what happened if they did the same thing to the root hint servers
 
but mainly to their customers
so two things should come out of that
firstly, it should be illegal to sell a device with a default password that isn't unique
secondly, network backbones should blanket ban any ISPs which don't prevent packet forgery
 
when you say packet forgery, you mean?
 
sorry, your regulatory regime is inadequate, we won't route any traffic from [country]
 
12:22 PM
mean a packet is a packet
 
Think I figured it out tom lol yay
 
the wife is SOO huge over..
 
@juanvan I may be muddling terminology, but what I mean is a packet that lies about what IP it's from
 
nvm failed
 
like an open relay in a mail server
 
War
12:25 PM
@TomW that would surely result in multiple internets each with their own rules
 
@War I hear there's rumours on the internets
 
War
can we at least try to think about my routing problem? (although I do like this conversation)
@TomW isn't the dark web basically its own internet
 
Well I don't know, so not really, no
 
dark web is just a p2p network that passes encrypted requests to their locations I think
depending on which one ur refering 2
... I hate regex Lol
L>Regex Pro :D
 
War
@JasonBrown na i think it's smarter than that, like tor but with DNS servers of its own
 
12:30 PM
as i said it depends on which dark web ur refering to lol
 
War
hmmm that's given me an idea ... maybe if i build my own dns server I can resolve the subs to different ip's within my lan
 
lol i dont got any idea what your trying to do :), but good luck!
im still fiddling with rage inducing regex
 
War
basically from my router I want to open say port 80 to allow web traffic through
 
@War won't fix your problem
 
War
having done that, if the traffic is domain 1 go to server 1 if its on domain 2 go to server 2
this has to be doable surely
 
12:33 PM
oh...
 
War
it can't be a networkig impossibility
 
could u trace route it back to its location to determine its domain?
or at least where it came from
 
War
erm ... huh?
i'm talking about the domain name used in the request
 
lets lay out some Routes
 
I dont know networking much Lol
 
12:34 PM
www.Domain.com ip 12.12.12.12 - goes to machine A
cart.Domain.com ip 12.12.12.15 goes to machine B
 
War
^ exactly like that
 
that is easy
 
War
and my public ip is 1 ip (different to those) ... router receives all traffic and sends it where?
both domains point at (from the worlds point of view) my routers ip
 
if you wanted cart.Domain.com 12.12.12.12 goes to Machine B, that is a problem
 
War
but internally they need that route table setup
 
12:36 PM
that you need some Route Magic
and in the sonic wall you would make that Route I think
 
War
assuming the range 12.12.12.* is my LAN ip range
 
let me check my sonic wall
 
War
sonic wall?
 
its Dells ~~ to Cisco NSA
 
War
uh oh
maybe forward all open ports to a VM that then reroutes the traffic internally perhaps
i just spent like £2k on my current setup
 
12:40 PM
that would be my Guess, but there is something that can be done
 
War
between my recent pc upgrades and the new hyper-v host i'm poor
 
Poor is Good, money to come later
you should see what I dumped into mine, Dell Cage 6ft, one server, one switch and router/firewall
 
War
hmmm ... if i run my own dhcp and dns server I think I can do this
@juanvan a 6ft server?
or a 6ft rack with a single 1u server lol
overkill (although I am considering a smaller 5u or something rack)
would be cool
 
it's a 24u I think
 
War
yeh my "datacenter" is under the stairs
no room for that
but a smaller 5u or possibly even a 10u might work
 
12:44 PM
lol ya that is at my work, I vpn in
 
War
for work I'm still convincing the boss that we need a domain (small company and the boss is freaking out about it atm)
 
ya you should have one, if only for mail
 
War
I figured if I proved the concept at home on a intel nuc I could literally just drop in to the office one day with this tablet sized box and go "here's what I mean, network in a shoebox"
Im using enterprise msdn to set all this up ... not started on domain controllers or anyhting yet
just built myself a dev environment
got a hyper-v based vm host running baout 4 or 5 vm's so far
 
@TomW who was the regex expert u mentioned earlier?
 
War
web, sql, media, download, ect
hmmm this might work for me ...
47
Q: Running DNS locally for home network

Roy RicoI have a small home network that just got larger (new roommate, my existing roommate got a laptop (on top of her computer), my friends coming over with laptops, etc.). I'd like to run a local DNS server for lookups of my local network stuff (fileserver.local, windowsTV.local, machineA.local, m...

not sure how to configure my router to tell the LAN that my dns server is a vm though
that could be interesting ... but it is basically just a linux box ... so worst case i can ssh in to it and hack it
 
12:52 PM
@JasonBrown Kendall
 
k thanks
 
pinging him now is probably eh
usually if he's awake and you mention regex he'll chime in
 
lol
so if i ping him right now he prob not respond?
 
@War you need a 3rd vm that is a Proxy server
 
meh its work a shot is it not?
 
12:53 PM
that will take All the requests, and forward them onto the Right VM
Pending DNS/Port
a firewall/router won't do it, just got off the phone with my network guy
 
War
@juanvan hmmm ... shouldn't need it surely?
 
taking a read over that question
www.Domain.com ip 12.12.12.12 - goes to machine A
cart.Domain.com ip 12.12.12.15 goes to machine B
If that is what you want no Proxy needed
www.Domain.com ip 12.12.12.12 - goes to machine A
cart.Domain.com ip 12.12.12.12 goes to machine B
Need a Proxy
 
War
not sure i'm entirely following this
 
Do you have more then 1 external ip address?
 
War
so instead of a dns ... surely just a proxy could do it right?
or did I miss something ?
I have 1 external ip
my plan is to have a single root level domain pointing at it
then when I want to get to various parts of my lan I will prefix that with a sub domain name
and the root will probably just forward web traffic to a default web server
and probably a few other subs too
planning to have my website (blog and stuff) running on my web box
so i'll have stuff like "www.mydomain.com" and "blog.mydomain.com" point at a web server
then stuff like "nas.mydomain.com" point at my nas control panel
 
06:00 - 13:0013:00 - 00:00

« first day (2199 days earlier)      last day (2735 days later) »