Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Jonathan C Dickinson

@Jonathan C Dickinson
About
Posts
157
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Coding Standards
    J Jonathan C Dickinson

    Richard Deeming wrote:

    Whoops - you didn't declare the MyFile file variable at the top of the method! ;-P

    Tsk. Tsk. In that case it's obvious then that foreach isn't allowed.

    IEnumerator enumerator;
    MyFileObj file;
    
    using (enumerator = \_myFileCollection.GetEnumerator())
    {
        while (enumerator.MoveNext())
        {
            file = enumerator.Current;
        }
    }
    

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge help question workspace

  • Problematic Stakeholder: How can I make this work?
    J Jonathan C Dickinson

    Whatever you do if you do bite the bullet and do it his way; make sure it's on paper that he turned down your expertise with his signature.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge asp-net question csharp graphics design

  • Your brain doesn't work right...
    J Jonathan C Dickinson

    I could resist the change in direction for a few seconds. As it turns out I could also easily make my coworkers think there is something wrong with me. Another one you can try is (I learnt this one in primary school): 1. With an open palm rub your stomach in a circular motion. 2. Pat the top of your head with the other hand. One of your hands will follow the other and you will wind up patting your stomach or rubbing your head. Most people can get that one right with some practice though; especially if you are partially or fully ambidextrous.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge adobe question

  • Narfle the Garthok
    J Jonathan C Dickinson

    Rewriting C# Linq expressions that refer to one type of a IQueryable; where the data access layer uses another type (projecting). All because the people who wrote the app decided that they needed to write their own almost identical (but not compatible) models to expose from MVC WebApi.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge question

  • How old were you when you first wrote a line of code ?
    J Jonathan C Dickinson

    7-8 on a VIC 20 (and black and white TV). That would have been around 1994.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge question

  • Which code you suggest?
    J Jonathan C Dickinson

    Second method if security is a concern (methods like that are not vulnerable to timing attacks[^]); first in all other cases (the first method will always execute in N time, the second is O(N)).

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Weird and The Wonderful com question

  • VS 2013 Preview
    J Jonathan C Dickinson

    I think they are going to have a nasty surprise when it goes to market. Considering it's a full year-version bump it means that it's also a full price tag refresh for anyone who isn't an MSDN subscriber (and probably not worth the 15 minutes spent installing it even if they are). Sorry Microsoft, Visual Studio is one of the best pieces of software in existence - but I am going to skip this one (that is, unless there is a appropriated priced upgrade option from VS2012). "Farfegnugen" is spot on - I think VS2012.1 had more feature additions than this. Should have kept it in dev for one or two more years, tsk tsk.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge csharp visual-studio business collaboration asp-net

  • Extension Methods - Satan's favourite construct (controversial to nerds)
    J Jonathan C Dickinson

    Like any language feature they are open to abuse. Just look at GOTO. Bad developers will use bad patterns no matter how limited the feature-set of the language. The reason you feel let down is that Microsoft have given bad developers more tools with which to shoot themselves in the foot. Extension Methods: Allow you to create mixins in .Net by using memberless interfaces (previously impossible). If kept internal they are a less smelly than Helpers.DoSomething(foo), and allow you to rectify what you perceive as shortcomings in code that you do not control (a good example being string.Format). Delegates: Functional code! Don't mock it if you don't know it. I strongly recommend you have a look at a tutorial on monads in C#. They increase clarity if used correctly (for example, TDOP parsers are incredibly clear compared to your run-of-the-mill parsers). Here is a nice comparison[^] of what functional languages bring to the table. C# is not a functional language and will never be: it's a multi-faceted language and this allows me to take advantage of the functional aspects of the language to solve problems, when the problems are suited to functional code. I recommend you have a serious look at these features, because when used correctly they are a serious boost to the repertoire of weapons that you have when facing tricky problems.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge csharp functional linq business regex

  • Hungarian UIs
    J Jonathan C Dickinson

    lblUsername, txtUsername That's why. The 'correct' solution is presented by WPF (and HTML): you don't *need* to name controls. However, when I am doing Winforms: usernameTextBox, usernameLabel. No idea why, it's just style preference (or possibly hungarian aversion).

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge question wpf design tutorial

  • Did some one said Mind Control
    J Jonathan C Dickinson

    We are also pretty good at it. Rat poisons usually dehydrate the rodent - or otherwise make it seek out fluids. The idea is that it will come out of its hiding place to get them (reducing the chance of having a stench from a dead rat that you can't find). Additionally rodenticides don't have immediate and noticeable effects on the rodent, as they will usually eat a small amount of food (to test it) before committing to eating the lot. In all cases it isn't actually "mind control", it's impulse control. The host's or the victim's chemistry is usually altered in such a way that it seeks out traits in an environment that is beneficial to the parasitoid. So for example: "Some species also have mind-control capabilities, convincing the host to travel to a place where the fungus will find optimal growth conditions before the host dies." Achieved by: making the host photophobic (it will go to a dark place). Rabies is another good example, make the host hallucinate and paranoid and they will likely bite things to defend themselves.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge com

  • How long in one place?
    J Jonathan C Dickinson

    5 years at my current gig.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge performance question career

  • I would have to say...
    J Jonathan C Dickinson

    JimBob SquarePants wrote:

    "I don't like change"

    • Change Aversion[^]
    • Cognitive Bias[^]
    • Distinction Bias[^]
    • Notably: Cognitive Fluency[^]
    • Notably: Mere-exposure effect[^]

    Just some of the things that people who complain about VS2012 are experiencing. Not being a victim of those mental processes are a deliberate decision (i.e. "I am going to evaluate VS2012 based on its merits and not what I am accustomed to").

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge visual-studio php com performance

  • I would have to say...
    J Jonathan C Dickinson

    I found 2012 to be much faster than 2008 (and that's on a HyperV VM, i.e. no hardware UI acceleration). Update 2 is especially quick (they got rid of a few of those wait dialogs and mundane things like how fast characters appear on the screen are incredibly fast now). If you use TFS at all the source control explorer is also a lot faster (especially "get latest"), not to mention the parallel project loading (something 2008 is still dreadful at). My cup of tea isn't yours - but I seriously think 2012 is a major step forward. Also, how many extensions do you have loaded up in 2012? Because 2008 didn't have the simple extension framework from 2010/2012 it's a lot more difficult to bog 2008 down with unnecessary crap. Edit: Also Update 2 has a newer, more colorful, color scheme - for those who want it. I personally concentrate on my code more; so all IDEs look the same (colored text on a plain background) - the dull 2012 IDE actually helps with concentration because I get less distracted by the chrome/frame.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge visual-studio php com performance

  • Reversing time, without a flux capacitor
    J Jonathan C Dickinson

    I assume this had something to do with IAsyncResult.CompletedSynchronously[^] (possibly derived from Socket.Available[^])? Interesting because under extreme and consistent load this means that the async loop could cause a StackOverflowException (even with your fixed code); I wonder if there is a way to turn off this 'optimization' without having to resort to:

    private void StartAsyncReadLoop()
    {
    ReadAsyncLoop(null);
    }

    private void ReadAsyncLoop(IAsyncResult state)
    {
    try
    {
    if (state != null)
    {
    var length = _socket.EndReceive(state);
    // ...
    }

        // Ensure that only one level of recursion happens.
        if (state == null || !state.CompletedSynchronously)
            \_socket.BeginReceive(..., ReadAsyncLoop, null);
        else
            // Maybe it's best to just always do this. Although considering how sockets use the thread pool
            // it's very likely overkill.
            ThreadPool.QueueUserWorkItem(\_ => \_socket.BeginReceive(..., ReadAsyncLoop, null));
    }
    catch (SocketException ex)
    {
        // ...
    }
    

    }

    I wonder if Socket.UseOnlyOverlappedIO[^] would have an effect on this, considering Overlapped IO is my 'asyncy' than IOCP.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Weird and The Wonderful csharp announcement

  • Reversing time, without a flux capacitor
    J Jonathan C Dickinson

    I assume this had something to do with

    The Weird and The Wonderful csharp announcement

  • Strangely Refactored Name
    J Jonathan C Dickinson

    The fastest code to execute is code that doesn't exist.

    The Weird and The Wonderful com question

  • Rant - I hate GIT
    J Jonathan C Dickinson

    The problem with Git is that Linus has been quoted in saying something along the lines of "Git isn't a tool [solution], it's a framework." This lead me to believe that you should really have a few scripts set up that do the heavy-lifting for you. SVN is a tool, it does what it is designed for and nothing more: by using SVN you subscribe the workflow imposed by the SVN developers and have no versatility, where Git can be jimmied into basically any workflow. GitHub for Windows also gets rid of a lot of the pain (really, one-click pushing and pulling) - and it isn't only for GitHub repositories[^]. In a similar light, Microsoft have released the GitHub integration for Visual Studio and I assume it will be of the same caliber (read: simplicity) as TFS. I only drop to the CLI when I really need to these days, and haven't needed to in a couple of months: the Windows tooling is great for it, if you know it's there.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge csharp php com collaboration tutorial

  • Stupefying Bread Maker
    J Jonathan C Dickinson

    Also, I thought the point of a bread maker was to take up space (so that your wedding gifts look nice and big).

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Lounge com question

  • The best refactoring I have ever seen
    J Jonathan C Dickinson

    Even though it hurts my eyes a little, I must say that it does demonstrate some prettydamn good knowledge about how the C/++ compiler goes about things. At least it didn't go into stdafx.h.

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    The Weird and The Wonderful c++ visual-studio com json code-review

  • How can I learn about under the hood of .NET?
    J Jonathan C Dickinson

    Honestly the best way to learn how a runtime works is to learn how to debug it at the lowest levels. Read every single article here: Tess Ferrandez on MSDN[^]. Read if from start to end (well, actually end to start) and you should have really good in-depth knowledge (granted, reading and digesting that whole blog will probably take a few months). Real-world experience/stories sticks a lot better than raw theory (at least in my experience).

    He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

    .NET (Core and Framework) dotnet question csharp learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups