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
S

Samuel Cragg

@Samuel Cragg
About
Posts
37
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Microsoft Security Essentials.
    S Samuel Cragg

    We use Sophus as well and I find it to be a memory hog (around 200MB) - have you had any issues with it?

    The Lounge security question career

  • Bugger it is cold.
    S Samuel Cragg

    If you take a look at the bottom of Help! -> About Us it says it's at 503-250 Ferrand Drive, which Google says will take me an hour to get to from the CN Tower by public transport (but only 16mins in car!?)

    The Lounge

  • Bugger it is cold.
    S Samuel Cragg

    Thanks for the heads up! Google says it's a 15 minute walk, so no doubt I'll be able to get sufficiently lost in that time... I did want to visit the CodeProject HQ to see the hamsters, but it doesn't look very close to the centre/airport so will have to wait for a future visit.

    The Lounge

  • Bugger it is cold.
    S Samuel Cragg

    That's got to be some kind of sick joke right :wtf: I've got a 10 hour wait between connections there on Tuesday and was planning to do some sight seeing (CN Tower looks pretty), but I guess I'll stay in the airport :sigh:

    The Lounge

  • LoMaPuz
    S Samuel Cragg

    Excel says the formula is y = 1.5833x4 - 15.667x3 + 55.417x2 - 80.333x + 40 so I get 221 for 6!?

    The Lounge com question

  • Friday programming quiz
    S Samuel Cragg

    Actually, if I was doing it again I would use Daniel Grunwald trick to calculate the average only once:

    int closest = (from avg in new [] { inputs.Average() }
    from i in inputs
    orderby Math.Abs(i - avg)
    select i).FirstOrDefault();

    Using the lambda format (as per the rules :) ) I believe this translates to:

    int closest = new[] { inputs.Average() }
    .SelectMany(avg => inputs.OrderBy(i => Math.Abs(i - avg)))
    .FirstOrDefault();

    I believe this solution will iterate over the original collection twice - once for the average, once for the ordering, but have no idea what the big O number is for the ordering.

    The Lounge linq csharp data-structures json functional

  • Friday programming quiz
    S Samuel Cragg

    Not a very efficient approach (and hope I'm not cheating, there is only one semi-colon!) but here goes:

    int closest = (from t in
    from i in inputs
    let avg = inputs.Average()
    select new { Number = i, Delta = Math.Abs(i - avg) }
    orderby t.Delta
    select t.Number).FirstOrDefault();

    The Lounge linq csharp data-structures json functional

  • Fact checking
    S Samuel Cragg

    Just ranting basically. Because Wikipedia didn't have the information I wanted I had to do my own research and found out that the internet is unreliable - full of people who make stuff up and other just copy, who knew ;P

    The Lounge algorithms question

  • Fact checking
    S Samuel Cragg

    I'm writing about the history of connection plates and Wikipedia is rather sparse on the subject <edit>so I had to do my own research as I couldn't just copy from a Wikipedia article - I'm not bashing the reliability of Wikipedia</edit> Searching the internet I land on a page that gives credit to A. Carroll Sanford, who in 1952 patented it. There's quite a few websites that say the same (in fact, Google estimates there are 939 sites that has his name.) After a few searches for his patent I couldn't get anything. After about five minutes searching I do find patent 2827676, however, which was filing in 1954 by Arthur Carol Sanford. Do people (including companies) not fact check anymore, especially something as simple as a patent search?

    The Lounge algorithms question

  • Beyond economical repair
    S Samuel Cragg

    One step ahead of you, I'm using Notepad++ :) (still can't use vim though) How do you explain to someone that Word is a word processor not an HTML editor, when all they care about is what the page renders like? I mentioned page size being reduced, but it seemed lost on them - maybe I need to tell them that every time Word saves a webpage, a kitten is killed (and the resulting HTML is generated by the kitten's death roll on the keyboard.)

    The Lounge sales question

  • Beyond economical repair
    S Samuel Cragg

    When given a rusty pile of metal that used to be a car, a mechanic can advise the customer that it's beyond economical repair as another way of saying that they're best to forget about their old car and find a new one. Has anybody heard of something similar to describe a website that somebody wants tweaking but really it needs starting from scratch (the existing site uses iframes with content generated by Microsoft Word)?

    The Lounge sales question

  • WPF Performance
    S Samuel Cragg

    John Stewien wrote:

    If you want speed try using Direct2D

    Why can't you use both? ;P

    The Lounge csharp performance visual-studio wpf winforms

  • Culture vulture
    S Samuel Cragg

    I think the developer was unhappy with the performance of Decimal.Round so decided to implement it using strings, as we know computers prefer working with text rather than numbers...

    The Weird and The Wonderful com

  • Idea behind month numbering in JavaScript?!
    S Samuel Cragg

    Why is Pi Day celebrated in March then :-\

    The Lounge javascript question

  • iMac and Win7.
    S Samuel Cragg

    I do all my development on a MacBook Air (the original from 2008). Original I used Boot Camp (supplied free by Apple) to switch between Windows and OS-X but after about a two months of never booting into OS-X I removed it and now only have Windows 7 on it. Had no problems at all with Windows, Apple even supplies all the drivers. The only problem I had with the laptop was hardware related. The hinge broke, which is a common problem for the first generation Air, so took it to the local Mac store and they fixed it no problems, didn't matter that it was running Windows.

    The Lounge css database sql-server visual-studio sysadmin

  • Bad, very bad, test unit test....
    S Samuel Cragg

    You could certainly assert the length as part of the test, but the check for null is wrong - you should know if the value will be null or not and do an assertion on that (it may be valid for it to be null, for example if some other property is invalid, but this should be part of the spec).

    The Weird and The Wonderful testing beta-testing

  • Testing frameworks
    S Samuel Cragg

    Just browsing for a testing framework for C++ and came across bullshtml, at which point I burst out laughing (which woke up the Mrs. :doh: ) as I misread it to say something else... Anyway, what a brilliant name for a project!

    The Lounge c++ com testing beta-testing

  • Austin Danger Powers
    S Samuel Cragg

    AspDotNetDev wrote:

    5-letter initials

    In Spanish speaking Latin America (maybe all Spanish nations?) you have two last names - your father's first last name and your mother's first last name. When a woman marries, they add their husband's first last name on to their name (so my wife has five names, excluding the 'del' and 'de'). Our niece already has five names so when she marries she'll have six names!? You think this is strange but every time they ask for my surname they wait for me to say a second one and I have to explain to them I'm British and don't have a second one; they think I'm the crazy one!

    The Weird and The Wonderful

  • English as she is spoke.
    S Samuel Cragg

    I think it's the pluperfect, which basically means an event that occurred before a previous event (if that even makes sense). For example, yesterday I went to the bank (an event in the past) but the bank had closed (this happened before the previous past event). Spanish has the same form (and probably other languages, but it's the only language I know apart from English). This is about the only thing from two years of studying Latin that I remember!

    The Lounge question learning

  • Obsolete domain name in Weekly Newsletter [modified] the problem is all mine...
    S Samuel Cragg

    Not sure I understand - the email I receieved was sent from mailout@maillist.codeproject.com so that domain would be correct :) However, this morning I wanted to change my newsletter settings so clicked on the profile page link in the email and it points to http://www.codeproject.comhttps//www.codeproject.com/script/Membership/Modify.aspx - again, not a major problem but should be a simple change to make.

    Site Bugs / Suggestions com help
  • Login

  • Don't have an account? Register

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