Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

androidi androidi
  • Most epic method you've seen?

    Quick report: I got the "epic code" project in the op working. Hardest part? It had to do with Windows 8.1u1 VPN connection set-up. Bunch of 0x8... "Unknown error". After some twiddling around I found a note that CN, connection host name and computer name all need to be same and imported to the Trusted authorities, automatic destination didn't seem to work and use SSTP with MS-Chap v2 (couldn't get the EAP to work). (or perhaps the issue was that I was using the manager's main page make cert dialog instead of the servers Encryption menu's)

    Minor notes: Even though technically all parts of the software could be entirely run in user mode, the installer still wanted admin privileges and the server seems to want them too even though it's not needed for this scenario.

  • Most epic method you've seen?

    @cheong: That was more about how the error handling is done. Since I don't like exceptions perf hit and I don't like C style "12345 unknown error, go google this number after hex conversion" & I don't like writing error codes as I don't know what the error might be called beside a random number if it's some new lines of code I just came up with - here's a pattern I'm going to be testing (I just came up with it) out as solution to all 3 issues.  

    SpecializedResult TryNonThrowing(...) {

    if(!z.TryBlah(out w)) return g.MethodThatCreatesObjectThatWrapsStateErrorAndExceptionInformation("blah fail",this,z);

    try {

    StuffThatThrowsForNoGoodReason();

    }

    catch (Exception e)

    {

    return g.MethodThatCreatesObjectThatWrapsStateErrorAndExceptionInformation(e);

    }

    if(y?.a ==1 && w?.a ==2) g.Result()...  // or something specialized for this class - open question: what would this look like in order to use the results in most succint manner in the caller in the most typical case

    return null; //no result and no error

    }

     

    class g contains global stuff, like shorthands for debug/tracing/breakpoint stuff.

    g.Result and g.MethodThatCreatesObjectThatWrapsStateErrorAndExceptionInformation

    have the caller info attributes for creating a log of the lines with the if(blah blah).

     

    Why would I do things in this convoluted manner vs using more classes and small methods with .NET's built-in tracing? Largely due to : if I was using more methods and classes, that would mean more 1) navigating around 2) time wasted inventing descriptive method/class names or not wasting time and creating confusing names that may get stale as changes are made (I have huge difficulties in coming up with names I like so my solution here is to code first and then when the code and what it does has taken shape, I'll use extract method, not before)

    So I tend to write spaghetti monster methods that I need to be able to quickly re-arrange and keep everything visible on the screen while having high performance detailed non-stale tracing (error codes might get stale while the design is still taking shape). Only when the code is not changing anymore and what it does is crystal clear, I'll refactor and by then the method/class names needed will also be clear.

    And using the if(Try...) { do stuff instead of returning error } extensively in my use would lead to a lot of nesting and problems in re-arranging the code since while the functionality is still in design-flux, I might need the out variable from the Try somewhere later and not just in that if's scope.

     

  • Most epic method you've seen?

    I'll add to previous that yes, running the kind of configuration I explained does increase risk of the attacker gaining access to other computers running the VPN software but in my specific setup I am more concerned about detecting an attack than trying to keep them out. The security issue is about whether the attacker can get quickly access to the monitoring software and make it look like the attack didn't take place.

  • Most epic method you've seen?

    @figuerres: Scroll to the bottom of this link (GetSniNameFromSslPacket).

    https://raw.githubusercontent.com/SoftEtherVPN/SoftEtherVPN/master/src/Mayaqua/Network.c

    Personally if I came across this code on something I was actually working on I'd leave it alone unless it stopped working. I'm not expert in C so if I started manually fiddling around with it I think there's a high risk I broke it. Even if it was in C# I'd still be hesitant to manually re-arrange it - as long as it works, I'd rather be working on new features or fix something thats broken. (Yeah there's Extract Method in C# but if I was writing this same function from scratch, the result wouldn't look like what doing a bunch of Extract Method's here would, so I'm not tempted to do that here just for sake of removing the nesting)

  • Ebola spreads to USA

    @jinx101: Someone on the internets claimed without sources that you can still be contagious some months after recovery. But lets assume that's not a real concern. I think the worst case scenario is that someone gets infected, isn't yet found and then also gets flu. Could they now be spreading flu+ebola together - could the flu droplets be infectious with ebola while the persons immune system is good enough that he's not getting so ill as to be noticed as ebola case? I'd say this is a low probability scenario but if this thing keep going on for extended time then there could be a panic worthy event. And what are the government plans if such is detected? Too little too late probably.

  • Most epic method you've seen?

    @cheong:

    That's certainly true in the typical scenario, what's not seen in the above is that in this case it's a case of "all this really belongs here".

    I suspect that C# code will soon see a lot of the above, thanks to if(x.TryDat(out var derp)) { if(derp.TryDerp(out var doh)) { ... } }

    This could be avoided by modifying the IDE to auto-infer and generate the derp & doh definitions with optional in-line editing of the type and default value.

    That would avoid the same issue I have with async keyword. ie. when you are writing some new code, suddenly it's not valid unless you go back a few lines and add a new code there and then you have to go back to what you were previously writing. And when relying on IntelliSense instead of memorizing every TryApi, you can't reliably plan ahead, so you just have to type the !TryBlah(out thistypehere) to get a hint of the "thistypehere", which then needs to go on some line earlier.

    The only problem with this auto-generation is where would it be generated. I say just generate it on the line previous to the if(!x.TryBlah(out ...)) return Oops; - as I can move it later if need be.

     

  • Most epic method you've seen?

    This is pretty impressive. http://imgco.de/133NQS.png

     

  • Yoga 3 Pro

    Not so huge fan of the "Yoga" name phonetically but it does fit in marketing terms.

    +Broadwell

    - Broadwell could get "obsolete" sooner than usual given it was delayed, of course Skylake could be delayed should the channel be full of Broadwell inventory.

    +Comparable weight/dimensions to Surface Pro 3, usability as temporary tablet device could be close (not sure if Yoga's pen support is comparable so that could be a minus), usability as laptop better given no need for stand

    So if people are looking for long term laptop replacement, SP3's advantages seem to be price and perhaps the pen, weaknesses are that it started shipping with older CPU and for laptop replacement use it seems more of a compromise than the Yoga Pro 3.

     

    As long as the Yoga is starting at 2x price of surface, it'll probably give Surface some room in the market but if the price drops to near $1000 then Surface could be in trouble.

    Recently there was a Surface 2 (RT) sale for about $200-250 and it was sold out quick. I'm bit bummed still that I missed that as it was so close to my target price at which I said long ago that Surface RT would sell very well - largely because at that price it starts to make sense for other purposes (like embedded devices but for home/office use) and you'd want to have it in addition to your main computing devices.

  • Any experience using 0mq.net with ​protobuf.​net?

    Quick look at the github history suggests the C# port is still getting quite a bit of modifications so there's bound to be few rough edges somewhere but if the basics are already solid that's good enough as I don't need much special stuff at this point. I'd just want to use something that accommodates probable future needs.

    The pdf linked on the 0mq site paints quite positive picture but the comparison isn't really looking at existing .NET/C# stuff and it's few years old. I'm just not really aware of what to compare it to in the .NET world beside perhaps WCF.

    EDIT: Looks like there's a few locations for the project source. I was looking at https://github.com/zeromq/netmq  - the others seem older/stale.

     
  • How to keep VS debugger temporarily in a specific scope during stepping?

    Lets say I am debugging a multithreaded scenario where stepping tends to switch from one thread to next almost randomly. I know the problem is in a particular scope, whether that be a method, class or project etc. While stepping through the method, I do not want the IDE to leave the particular method or class that I am interested in.

    Ideally I would like to somehow specify the projects/classes/methods or just highlight the code in which I would like the debugger to break into when pressing F10 or F11. So even if I press "step into" , if that method I'm stepping into is not in the debug-time specified scope, it would not step into it. The logic here is that I can keep pressing F11 rapidly following the execution and keep the debugger in the area of interest.

    The only solution I so far have come up with would involve breaking the problem code into another project which should cause Just My Code to ensure the debugger doesn't go into other projects. And if JMC is disabled, then disabling full debug info from all the other projects. It's a bit hackish workaround and this problem is so common that I'd like to think there was another way. Sometimes it's just not practical to start isolating code into a new project.