Search found 119 matches

by Breakfast
Thu Aug 07, 2014 2:24 pm UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 784422

Re: Coding: Hacks and Snippets

Are dynamic values in C# determined at runtime or compile time? (the auto in the C++ code above are typed at compile time). Runtime. Dynamic was introduced so that C# could interact with dynamically typed languages. The the compiler encounters the dynamic keyword it will emit IL for a variable of t...
by Breakfast
Thu Aug 07, 2014 11:40 am UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 784422

Re: Coding: Hacks and Snippets

I'm guessing that there are patterns in more functional languages that I'm poorly replicating. Anyone have thoughts? It's called the fixed-point combinator , and it's useful for exactly the situation you describe - making recursive functions in an environment where a function is not allowed to expl...
by Breakfast
Sun Jul 27, 2014 12:17 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

It's weird that the first one won't compile but the second one will. dynamic foo = (string s) => s + "foo"; dynamic foo = (Func<string, string>)((string s) => s + "foo"); Why do I need to cast lambda (or a method) to a delegate type before it can be assigned to a dynamic...? I'l...
by Breakfast
Mon Jul 21, 2014 6:13 pm UTC
Forum: Coding
Topic: GUI interface writ in Python
Replies: 28
Views: 8458

Re: GUI interface writ in Python

*Warning* I haven't looked at your code. EDIT: Also, I just realized tonight that the EventHandler object is really just a Listener object with some extra functionality; it's a Listener that distributes events to other Listeners (probably as a result of its notify method). So I don't actually need a...
by Breakfast
Wed Jun 18, 2014 4:44 pm UTC
Forum: Coding
Topic: Code that interacts with files on my HDD
Replies: 7
Views: 2770

Re: Code that interacts with files on my HDD

...I don't know how to do the "Pay attention to this file and act when it is modified" part of this. I'm going to throw around some common buzzwords and terminology for this type of thing. What you're wanting to do is LISTEN for an EVENT and RESPOND to it. Or, your file is OBSERVABLE and ...
by Breakfast
Tue Jun 10, 2014 11:44 am UTC
Forum: Coding
Topic: Object oriented programming is bullshit
Replies: 32
Views: 13198

Re: Object oriented programming is bullshit

It sounds like your real problem is with up-front design? I've actually had a ton of success with object oriented programming techniques and incremental development.
by Breakfast
Mon May 05, 2014 2:38 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

Anonymous recursion and scheme style programming in C#: using System; using System.Collections.Generic; using System.Linq; namespace Scheme { class Program { delegate T SelfApplicable<T>(SelfApplicable<T> self); static void Main(string[] args) { SelfApplicable<Func<Func<Func<dynamic, dynamic>, Func<...
by Breakfast
Wed Mar 26, 2014 4:59 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

@chridd: right. That's what happens when I don't test my code. Devil's advocate argument: why are commas separators but semicolons terminators in languages like C++? That final semicolon on the last instruction in a block is extra. It shouldn't be allowed. I think semicolons shouldn't be allowed an...
by Breakfast
Fri Mar 21, 2014 3:06 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

So that's kind of smart of C#, but also kind of backwards. Now the template instantiation doesn't affect the programmer but it does affect the user. As for template metaprogramming, that's not possible in C# anyway. Sorry, I knew you couldn't do template metaprogramming in C# and I meant to explici...
by Breakfast
Thu Mar 20, 2014 10:08 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

Well it's either that (compile multiple instances of a template), or give up on static typing and enforce that everything is boxed (type erasure like in Java, or dynamic typing altogether). I think the latter price is too high for faster compilation times, especially since most of the time a templa...
by Breakfast
Wed Mar 12, 2014 3:15 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

I've heard that line several times now, but I don't get it. The latest version of MSVC was released last year, it doesn't predate the standard. I'm using 2010, which doesn't predate the standard either, thought it does predate c++11. The first version did, perhaps, but that's ages ago. Surely the f...
by Breakfast
Fri Mar 07, 2014 10:38 pm UTC
Forum: Mathematics
Topic: Imaginary Numbers and Trig Question
Replies: 5
Views: 2500

Re: Imaginary Numbers and Trig Question

Thank you both very much! I didn't expect such a quick and obvious response. Are there other physical world examples that might not be as obvious as harmonic motion?
by Breakfast
Fri Mar 07, 2014 10:00 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

So I finally figured out why sometimes I remember seeing the "Collapse all" in visual studio's solution browser, and sometimes not. Apparently that's a Resharper feature. ... There's an extension for VS 2010 that gives focusing, some decent search features, and (I believe) collapse all. T...
by Breakfast
Wed Mar 05, 2014 2:17 pm UTC
Forum: Mathematics
Topic: Imaginary Numbers and Trig Question
Replies: 5
Views: 2500

Imaginary Numbers and Trig Question

Raising i to successive power creates this cycle: i^1 = i i^2 = -1 i^3 = -i i^4 = 1 i^5 = i and so on... Taking successive derivatives of sin(x) creates this cycle: f(x) = sin(x) f`(x) = cos(x) f``(x) = -sin(x) f```(x) = -cos(x) f````(x) = sin (x) and so on... I'm curious to know if there is some di...
by Breakfast
Tue Feb 25, 2014 9:59 pm UTC
Forum: Coding
Topic: Database Design
Replies: 5
Views: 3419

Re: Database Design

Something else that occurred to me after me initial post. If you'll want to track address / phone / email outside of actual billings you'll want tables for each of those that would be tied to a passenger record. This way you could update [, say,] one phone record as opposed to every billing record f...
by Breakfast
Tue Feb 25, 2014 5:03 pm UTC
Forum: Coding
Topic: Database Design
Replies: 5
Views: 3419

Re: Database Design

Why aren't the airport_to and airport_from columns on itinerary_flights foreign keyed to Ids in airports? Why is customer_billing not linked to passenger_info?
by Breakfast
Thu Jan 16, 2014 12:52 am UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

Troyp, I was a bit unsure of what constituted a topological sort as well. Whether it could be used as a blanket term with different implementations. I'm willing to talk about directed, undirected... anything really. Both are interesting problems. The graph I was presented with always had two edges b...
by Breakfast
Tue Jan 14, 2014 12:45 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

Thanks for the tip on the ascii art. I've been a member for a while but read more than post. What you're describing is essentially what I'm doing if you replace breadth-first with depth-first (...and the queue with a dictionary that holds Ids for nodes and parent counts*). I just wanted to be overly...
by Breakfast
Mon Jan 13, 2014 1:11 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

I'm sorry the problem hasn't been stated clearly enough. Written words and all that... The big problem I was having was dealing with things like this: a / \ b d \ / c Where a, b, c, and d are objects and the edges are properties that let you go from one to another. I'm actually using parent informat...
by Breakfast
Sun Jan 12, 2014 2:05 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

There might. What exactly do you mean by "cyclic object graph traversal"? I mean walking a graph that has cycles (and not infinitely recursing around the cycles). The object part of it was that it was made up of a bunch of instantiated classes that needed to be ordered and operated on. No...
by Breakfast
Fri Jan 10, 2014 6:22 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

I'm glad this thread has reached page 2. And it only took 9 months! And since it's been about two months since that post... I recently worked on an algorithm for a cyclic object graph traversal at work and after some intense thinking and overly complex solutions I came up with something that's pret...
by Breakfast
Tue Oct 15, 2013 12:10 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

Breakfast: I'm not a .net scientist, but that IL for both of those looks sane to me... given some assumptions about how the machine works (and how Nullable works). What behaviour is it actually having for you that you weren't expecting? I realize that the IL looks normal for both instances. Trying ...
by Breakfast
Fri Oct 11, 2013 3:44 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

There's also one in the Visual Studio C# compiler when using Guid.Parse(someString) in a ternary expression when the other option if null. I guess that one is fixed. Or at least not in the version of the compiler/runtime I'm using. I looked through some code history and found the actual code. I gue...
by Breakfast
Fri Oct 11, 2013 1:33 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

It feels really good to spend 5 hours trying to find the bug in your code, only to discover it was actually a bug in the compiler. :) Admittedly, I'm always extremely skeptical when people make such a claim. Can you tells us which compiler and what the bug was? It happens. Just last week a colleagu...
by Breakfast
Mon Oct 07, 2013 12:08 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

That sounds like a good idea. So the sequence of "sets of nodes" is fixed, but nodes may be added within a set, is that accurate? In that case, rather than setting back the bar, you could increase the length of the segment for the set that node was added to (although if you have the progr...
by Breakfast
Fri Oct 04, 2013 6:38 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

So I can't give as much detail as I'd like because it's for work and all but the tree is basically analogous to an application process. Each node contains a specific set of data and all of the nodes together encapsulate the entire application. Ideally, the progress bar would measure fraction of tota...
by Breakfast
Fri Oct 04, 2013 1:55 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

I'm working on a progress bar and want to get people's opinions on ways to "measure" progress. - Given a non-binary tree like data structure would it be good to measure progress with numberOfNodesCompleted / totalNumberOfNodes? - If nodes could be added during regular workflow would you ra...
by Breakfast
Thu Sep 05, 2013 6:38 pm UTC
Forum: Coding
Topic: Why Python is the best programming language in the world
Replies: 116
Views: 27535

Re: Why Python is the best programming language in the world

Qaanol, please feel free to correct me or shout at me if I'm wrong but I think that his point was just that. It's just like every other language. The title of the thread is making a ridiculous claim based on a piece of code that can be reproduced more succinctly in other languages or implemented in ...
by Breakfast
Thu Aug 29, 2013 12:25 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009925

Re: Coding: Fleeting Thoughts

Have a function that takes a delegate/function pointer/whatever you want to call it? int CustomerID = 7; Customer SomeCustomer = Customers.Where(x => x.CustomerID == CustomerID).First(); //This lambda is also a closure, since it references CustomerID which isn't passed as a parameter In this case C...
by Breakfast
Fri May 24, 2013 12:40 pm UTC
Forum: Coding
Topic: Project Euler
Replies: 411
Views: 158416

Re: Project Euler

I'm working on problem 87 in Haskell and I just can't seem to figure out why my solution isn't working. pe87 = length $ filter (<50000000) [result x y z | x <- (primes' 7079), y <- (primes' 373), z <- (primes' 89)] where result x y z = x^2 + y^3 + z^4 prim...
by Breakfast
Mon Apr 01, 2013 8:33 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

I'm not a functional programmer (ha...) so I'm trusting you guys to tell me if this is a typical solution in functional languages. The idea is to use currying, closures and continuation passing style (CPS) to build actions that could be combined to create and manage workflows. Here's a small example...
by Breakfast
Thu Feb 14, 2013 6:03 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

Yeah, I agree. I'm not an OO hater, and I don't think Jeff is either. I just think you're solving the wrong problem by wanting to introduce OO earlier. Beginners are obviously going to use the first tools they learn for just about any problem. I think it's better that they learn to use procedural a...
by Breakfast
Tue Feb 12, 2013 6:08 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Re: Fleeting Thoughts (CS Edition)

I have a friend whose intro CS class was taught like that. If you wanted a conditional, you had to make two classes and use virtual dispatch. (I'm not quite sure how you bootstrapped the procedure.) He says he pretty much hated it. (Though I wouldn't be surprised if he had programming experience be...
by Breakfast
Sat Feb 09, 2013 5:05 pm UTC
Forum: Computer Science
Topic: Fleeting Thoughts (CS Edition)
Replies: 99
Views: 70107

Fleeting Thoughts (CS Edition)

Maybe OOP concepts are so often implemented poorly because when we start to learn about programming we always begin with procedural techniques. If we began by teaching inheritance and polymorphism first would procedural logic and conditionals become the difficult concepts?
by Breakfast
Tue Oct 23, 2012 1:04 pm UTC
Forum: Gaming
Topic: X-Com: UFO Defense / UFO: Enemy Unknown
Replies: 456
Views: 141098

Re: X-Com: UFO Defense / UFO: Enemy Unknown

I played the demo on my PS3 last night and was wondering how the game held up between the console and PC versions. My laptop isn't powerful enough but if it plays well on the PS3 I'll get it for that.
by Breakfast
Fri Apr 27, 2012 2:10 pm UTC
Forum: Coding
Topic: Oracle Java Certification
Replies: 6
Views: 5936

Re: Oracle Java Certification

I'm going to echo the sentiments of everyone else for the most part. Certificates are a good thing because it shows that some organization (Oracle, Microsoft...) recognizes that you of an acceptable level with a certain technology. Certificates are a bad thing because they're only relevant while the...
by Breakfast
Thu Apr 19, 2012 5:02 pm UTC
Forum: Coding
Topic: "Don't use comments"
Replies: 39
Views: 7649

Re: "Don't use comments"

What about this? It's not exactly coding as my example is css but i could see the same happening in code. background-color: #ffb300; /* orange */ If your example appears in code you should do something like: const Color _orange = #ffb300 This way, you can have many places that reference the _orange...
by Breakfast
Wed Apr 04, 2012 12:04 am UTC
Forum: Coding
Topic: Coding and drinking
Replies: 27
Views: 11173

Re: Coding and drinking

How about programming and taking magic mushrooms? This would never work. Things like staring at the sky and turning off lights becomes way more important than coding. I bet you'd get some pretty crazy designs if you managed it though. Documentation would be even better. Alcohol always seemed to mak...
by Breakfast
Wed Mar 07, 2012 4:24 pm UTC
Forum: Coding
Topic: Understanding Code Bases / Refactoring [Discussion,Research]
Replies: 8
Views: 3054

Re: Understanding Code Bases / Refactoring [Discussion,Resea

Foolishly I hadn't read Code Complete until now; and it seems to cover a good deal of the concepts and ideas that I am looking for. It also seems to cover ideas that have been mentioned such as descriptive variable names and the appropriate length of functions and loops. So now that I have good reso...
by Breakfast
Fri Mar 02, 2012 5:45 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1963
Views: 565969

Re: The "IT DOESN'T WORK!" thread

Julian, I've handled optimizations two through four but I'm having a little trouble grasping what needs to be done for: First of all, you're currently doing more swaps than strictly needed. There is no need to move the pivot to the end of the array, and you could be more efficient if you moved indic...

Go to advanced search