justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.


Name: Ask: Human (enter yes):
[newer questions][unreplied] | [replied] | [recent comments] | [all]
[older questions]

Question: One example in STL that you really, really don't like?
Asked by Martin (93.136.22.x) on February 9 2013, 5:43pm
Reply on February 10 2013, 11:06pm:
    I'd have to go make one up, as it's been so long since I've done any STL stuff... OK here's one: I think exceptions are a really awful construct and should pretty much never be used.
Comment...
Question: Do you follow xkcd.com?
Asked by Tinny (88.207.127.x) on February 8 2013, 2:28pm
Reply on February 8 2013, 9:00pm:
    Not really, but I confess I'm not really in to comics.
Comment...
Question: Thanks for dropping the stalking charges haha. Have you seen "Searching For Sugar Man" also check this out bit.ly/TG0ypp
Asked by AnalSeducer (67.215.231.x) on February 8 2013, 5:14am
Reply on February 8 2013, 9:00pm:
    Haven't seen it.
Comment...
Question: Maybe this guy could be added to your list of respected programmers? bellard.org/
Asked by Will (24.234.85.x) on February 8 2013, 12:57am
Reply on February 8 2013, 9:00pm (edited at February 8 2013, 9:01pm):
    I don't really keep a list, but I saw that javascript PC emulator and thought it was completely awesome.
Comment...
Question: Still use winamp?Or use other players?
Asked by gepao (84.79.188.x) on February 8 2013, 12:11am
Reply on February 8 2013, 9:01pm:
    Yep, mostly. Or my iphone.
Comment...
Question: Will you let us style askjf to look better? :P
Asked by Will (24.234.85.x) on February 7 2013, 11:25pm
Reply on February 8 2013, 9:01pm:
    Is it really worth bothering? give me yur css.
Comment...
Question: What blogs do you read?
Asked by ees. (69.15.110.x) on February 7 2013, 7:36pm
Reply on February 7 2013, 7:54pm:
    Off the top of my head, The Old New Thing, Coding Horror, virtualdub.org (rarely, it isn't often updated). I also end up reading blogs via twitter (Paul Krugman, Steven Wittens, others too).
Comment...
Question: What language would you imagine that aliens code in?
Asked by NuttyProfessor (76.226.116.x) on February 7 2013, 2:21am
Reply on February 7 2013, 2:50am:
    assembly, no doubt, but I can't imagine the instruction set.
Comment...
Question: On your b-tree code, wouldn't the lh operand in the return recursively execute before the rh, throwing off the original reqs?
Asked by Will (24.234.85.x) on February 6 2013, 10:44pm
Reply on February 7 2013, 2:49am (edited at February 7 2013, 3:42am):
    Yes (it processes left before right), but no, it does what (as I understood, anyway) the requirements specified, since each top level call to the recursive function only prints a single level of the tree, so the left-to-rightness is what you want. Edit: here, this might be easier to understand (exact same function, just more clear code):
    f(h, levelToPrint, currentLevel) {
        if (currentLevel > levelToPrint) return 0;
        if (!h) {
            if (currentLevel == levelToPrint) print("(null)");
            return 0;
        }
        if (currentLevel == levelToPrint) {
            print(h);
            return 1;
        }
        return f(h.left,levelToPrint, currentLevel+1) + f(h.right,levelToPrint, currentLevel+1);
    }
    
    levelToPrint=0;
    while (f(tree,levelToPrint++,0)) print("\n");
    
Comment...
Question: I was so blind aghhhhh - Justin, thank you so much for opening my eyes with the delay class - you are genius :)
Asked by Franci (89.142.37.x) on February 6 2013, 8:30pm
Reply on February 7 2013, 2:49am:
    Glad I could help!
Comment...
Question: why is reaWASAPI tagged as "experimental"? do you personnaly use it?
Asked by frenchos (46.218.205.x) on February 6 2013, 5:08pm
Reply on February 7 2013, 2:49am:
    Sometimes, but it can be finicky to get it to work right depending on the hardware, exclusive/shared modes, etc.
Comment...
Question: The tracker seems to have ground to a halt. Elevated FRs seem forgotten as nothing happens with them?
Asked by Tinny (88.207.125.x) on February 6 2013, 9:52am
Reply on February 6 2013, 3:08pm:
    Yeah, the tracker isn't terribly enjoyable to use as a developer. :/
Comment...
Question: Does raping the tertiary operator produce faster machine code than writing legible code (the later version)?
Asked by Will (70.173.150.x) on February 6 2013, 8:35am
Reply on February 6 2013, 2:43pm:
    I don't think so, but part of me wanted the two-line f().
Comment...
Question: There was talk a while back about creating an open source plugin SDK, to get around the VST restrictions, and progress on that?
Asked by Mick (203.149.85.x) on February 6 2013, 2:47am
Reply on February 6 2013, 4:13am:
    Not enough of a point, VST is just lenient enough to make it not worth bothering I think.
Comment...
Question: What's a good algorithm to display a binary tree from the top down one level at a time left to right?
Asked by Will (24.234.85.x) on February 5 2013, 10:34pm
Reply on February 6 2013, 4:11am (edited at February 6 2013, 4:37am):
    The obvious way I'd imagine doing it would be O(N*log(N)), which seems reasonable enough I guess?
    f(h, level) {
        if (level == 0) print(h); // h might be null
        return h && level >= 0 ? level==0 ? 1 : f(h.left,level-1) + f(h.right,level-1) : 0;
    }
    
    l=0;
    while (f(tree,l++)) print("\n");
    
    Edit: updated to print null leaves for levels that are printed...
    Edit: further updated to overuse the tertiary operator. Regretting this, here is the less obfuscated version:
    f(h, level) {
        if (level < 0) return 0;
        if (!h) {
            if (level == 0) print("(null)");
            return 0;
        }
        if (level == 0) {
            print(h);
            return 1;
        }
        return f(h.left,level-1) + f(h.right,level-1);
    }
    
    l=0;
    while (f(tree,l++)) print("\n");
    
Comment...
Question: I want to make function which returns input data shifted by x samples (like plugin latency)
Asked by Franci (46.122.98.x) on February 5 2013, 6:57pm
Reply on February 6 2013, 4:02am (edited at February 6 2013, 4:03am):
    Ah, like a FIFO queue? How about:
    class delay {
        double *m_buf;
        int m_len,m_pos;
    public:
        delay(int len) { m_len=len; m_buf=(double*)calloc(sizeof(double),len); m_pos=0; }
        ~delay() { free(m_buf); }
        double process(double in) {
            double ret=m_buf[m_pos];
            m_buf[m_pos]=in;
            if (++m_pos>=m_len) m_pos=0;
            return ret;
        }
    };
    
Comment...
Question: I am trying to program a function which would create a latency on buffer - any ideas where to get an example code ?
Asked by franci (86.61.125.x) on February 3 2013, 5:52pm
Reply on February 4 2013, 11:31pm:
    You want to create a delay line?
Comment...
Question: Have you ever wanted to own a tractor?
Asked by Pinkaso (208.64.185.x) on February 2 2013, 4:59pm
Reply on February 4 2013, 11:31pm:
    I can't say that I have.
Comment...
Question: Did you coin the phrase "skin" for custom UI graphics? If not, where'd you get it?
Asked by Will (70.173.150.x) on February 2 2013, 5:27am
Reply on February 2 2013, 2:32pm:
    We took the term which was used for Quake characters and applied it to UI graphics.. Not sure if it was the first time that was done, but Quake's use of the term was the inspiration.
Comment...
Question: Re: 6k loc. so what you're saying is that i have to beat you too! LOL. I take the argument back -♥- Any plans for something new?
Asked by gio (94.66.27.x) on January 31 2013, 4:49pm
Reply on February 2 2013, 2:31pm:
    Working on a cool inevitable feature for REAPER at the moment. Trying to keep my function size down... ;)
Comment...
[newer questions][unreplied] | [replied] | [recent comments] | [all]
[older questions]
Copyright 2025 Justin Frankel. | RSS