justin = {
main feed
,
music
,
code
= {
cockos
,
reaper
,
wdl
,
ninjam
,
jsfx
,
more
}
,
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:
Could you explain at a high level how C code can call run-time created machine code? How do you set that up programtically?
Asked by Will (24.234.128.x) on September 28 2010, 11:35am
Reply on September 28 2010, 6:29pm:
You can see how EEL2 does this, but I'll give a basic explanation here:
First off, this is highly dependent on architecture, compiler, OS, etc. Generally, though, this is the process:
Generate the code you wish to run. This can be done by writing the opcodes to a buffer, or by combining stubs of code (Using nasm can be helpful, otherwise you can use __declspec(naked) on MSVC and use inline assembly, or you can use gcc and inline assembly and strip out the compiler generated code, etc).
Mark the pages of code as executable, using VirtualProtect() on win32 or (from memory, I think it is) mprotect on posix.
Execute the code -- you can do this using inline assembly or an assembly stub function, and it would essentially do: "mov eax, address ; call eax". or similar.
Watch things explode! Your code will likely need to save registers, align the stack, etc. The devil is often in the details.
Comment...
Question:
Cockos rocks but that might not be enough; so are there any open source projects that you recommend for source code reading?
Asked by _gio (62.103.65.x) on September 26 2010, 1:19am
Reply on September 27 2010, 12:31pm:
I've enjoyed doing some git hacking, but generally I'd say look at the source to stuff you like to use.
Comment...
Question:
Can you elaborate on your statement: "My Windows programming until maybe 2002 was pretty awful. Now it's just a little awful".
Asked by Chuck (150.101.96.x) on September 25 2010, 4:29pm
Reply on September 27 2010, 12:34pm:
Yeah, the Windows code I wrote back in the day was ugly and often broken or wrong. Code I write now probably is too, to a lesser extent. Example: recently it came to my attention that DM_GETDEFID was the same as WM_USER; so if you use WM_USER for some purpose on a dialog, you might get surprises).
Having said that, Win32 is pretty forgiving, too, allowing for broken software to run (mostly) successfully.
Comment...
Question:
Does this make you happy? yro.slashdot.org/story/10/09/24/2059221/Most-Software-Patent-Tro...
Asked by roberttheiii (71.234.18.x) on September 24 2010, 3:03pm
Reply on September 25 2010, 3:14pm:
It could be worse sure, but no, that doesn't make me particularly happy. It still means people often have to put up a ton of cash to defend cases.
Comment...
Question:
Times must be tight for fluffers these days, do you still keep up with your former female co-workers?
Asked by James (68.225.40.x) on September 24 2010, 12:39pm
Reply on September 25 2010, 3:15pm:
I'm not sure if I have any transgender co-workers, if that's what you mean... OK I know it's not.
Comment...
Question:
Have you ever tried any BlackBerry phones? What do you think about BlackBerry?
Asked by Dave (117.136.25.x) on September 24 2010, 7:58am
Reply on September 24 2010, 10:51am:
I've played with other people's, but never had one as my own.
Comment...
Question:
Regarding EEL and the compiled code system, did you cross compare with interpreted system? Performance gains realized?
Asked by Will (24.234.128.x) on September 23 2010, 2:23pm
Reply on September 23 2010, 3:46pm:
I haven't done any real comparisons since we first made EEL for AVS. These days, with things like Lua, I have no idea. I can't imagine any interpreted language being even close to as fast, though.
Comment...
Question:
Any general tips on implementing undo in an application? (something I'm struggling with)
Asked by schmoe (96.55.149.x) on September 22 2010, 5:15pm
Reply on September 22 2010, 10:38pm:
Well, generally, I would make it so your application can serialize its state (either as text, binary data in memory, or file, etc). Once that is supported (presumably load/save of file would use this), you could also use it for undo/redo, keeping a list of states and creating new state points on user actions.
If you want to optimize memory use, you could also reduce duplicate blocks of memory, of course this adds complexity and possibility of mistakes being made.
Comment...
Question:
You said you learned win32 as you wrote winamp. Did you read petzold? How'd you get started learning win32 for the project?
Asked by Will (24.234.128.x) on September 22 2010, 3:43pm
Reply on September 22 2010, 10:39pm (edited at September 22 2010, 10:40pm):
I did read some of Petzold's book (Programming Windows 95, I believe), but didn't much mesh with the style of programming. My Windows programming until maybe 2002 was pretty awful. Now it's just a little awful.
There was a lot of experimenting, and I didn't use version control back in the day, so things were a bit chaotic.
What was funny, though, is at some point Winamp because ubiquitous enough that audio hardware driver makers would use Winamp to test with, so it was widely supported (even though it wasn't necessarily "correct" to begin with). Heh.
Comment...
Question:
who/what inspired you make signal processing studio and then jesusonic the way it is?
Asked by _gio (62.103.65.x) on September 22 2010, 1:44pm
Reply on September 22 2010, 10:41pm:
Well, it was a logical extension of AVS for audio, and it used the same basic compiled code system (EEL). Christophe and I wanted programmable FX in pedal form for guitar playing...
Comment...
Question:
If winamp never happened, and you had to program at a company like Neo (The Matrix) do you think you would end up hating it all?
Asked by AnalSeducer (76.220.32.x) on September 21 2010, 6:34pm
Reply on September 21 2010, 10:17pm:
Haha who knows. I'd hope I'd be able to find a gratifying job programming other places...
Comment...
Question:
Should I pursue a career that is more likely to make me reasonably well off financially or one that might make me happy?
Asked by roberttheiii (71.234.18.x) on September 21 2010, 4:32pm
Reply on September 21 2010, 6:16pm (edited at September 21 2010, 6:18pm):
I suppose if the one that makes you happy provides enough so that you're not constantly dealing with making ends meet, it might be the better choice.. but hell if I know, I've had been very fortunate to get paid to do what I enjoy...
As I pontificate more, it seems more likely that you'd do something you enjoy and end up making decent money at it (with careful compromises), than the alternative of learning to enjoy something you despise.
Comment...
Question:
I feel it so hard to understand "CopyBeforeWrite" (also "CopyOnWrite"?), could you please give me some easy ideas to learn this?
Asked by dave (222.90.231.x) on September 20 2010, 8:22pm
Reply on September 20 2010, 9:59pm:
A simple summary: suppose you had a sheet of paper, and on it was information you wanted to keep and possibly change. You have a monkey sitting on each side of you, and any time you go to change a word, as you're about to write over it, the monkey on your left distracts you briefly, while the monkey on the right scribbles down on a separate piece of paper the word (or paragraph containing the it) you were about to overwrite.
Kinda like that, except instead of two monkeys, you'd have the OS kernel, which would tag the page of memory as "read only", and if you go to write it, it would cause an exception, which the kernel would handle, copying the page of memory elsewhere, and marking the old page as writeable, and resuming.
Comment...
Question:
A real question! I want to purchase from a group I like. They have Apple Lossless format and mp3 320kbps. What Would Justin Do?
Asked by AnalSeducer (76.220.32.x) on September 20 2010, 1:11pm
Reply on September 20 2010, 1:52pm:
Same price? Losslesss all the way (since you can convert to mp3/aac/ogg/whatever you want).
Different price? Well, depends, then...
Comment...
Question:
Do you know much about paired-programming? i think i would hate it, but a lot of people are using it
Asked by tacotime (170.146.225.x) on September 20 2010, 9:29am
Reply on September 21 2010, 9:45am:
Not really; I do know it's handy to have other people check your work, but it seems like forcing that could be annoying.
Comment...
Question:
slashdot.org/comments.pl?sid=159570&cid=13365387 Do you agree with Carmack? When is ASM "good" these days?
Asked by James (70.173.150.x) on September 18 2010, 9:04pm
Reply on September 18 2010, 10:13pm:
Yeah, he's spot on. Compilers (even ICC) still can't generate great SSE code. Which isn't to say I'd spend time writing assembly at this point -- it's rarely worthwhile.
Having said that, I also agree with Carmack's point that knowing assembly is extremely valuable, as it enables you to optimize your higher level code more effectively (never mind debugging, as well).
Comment...
Question:
How did you get started with programming? What books did you read (tutorials?)? Did you start with C on unix?
Asked by Will (24.234.128.x) on September 18 2010, 2:16pm
Reply on September 18 2010, 7:23pm:
BASIC on Atari 800XL then Turbo Pascal on a 386sx, Turbo C++ 3.0 (programming C), then Watcom, then djgpp and gcc on linux, and so on.
I really enjoyed the K&R C reference, as well as various books by Michael Abrash, and others (early on I was very into graphics stuff). When I look at my old code, though, it was bad. bad bad. Anyway.
Comment...
Question:
haha jk hey, I wasn't that one who asked if you needed a 'contractor.' Everyone becomes a stalker by accident via google :p
Asked by AnalSeducer (76.220.32.x) on September 18 2010, 11:57am
Reply on September 18 2010, 7:23pm:
:) I totally net-stalk people, too. Or wait that's just reading their blogs, err...
Comment...
Question:
What's your opinion on functional programming (e.g., Haskell, Clojure, etc.)? Way of the future or just another fad?
Asked by Jordan (70.67.190.x) on September 18 2010, 11:22am
Reply on September 18 2010, 7:24pm:
Never used it enough to form an opinion; never knowingly used software made with it to be intrigued.
Comment...
Question:
Your thoughts about C++0x? the good things that you would love to use or the bad points you want to avoid.
Asked by _gio (62.103.65.x) on September 17 2010, 2:38am
Reply on September 18 2010, 10:38am:
Most of it seems a bit extraneous, but a few things could be useful, like lambda functions, although I wasn't impressed with their syntax.
Comment...
[
newer questions
]
[
unreplied
] | [
replied
] | [
recent comments
] | [
all
]
[
older questions
]
Copyright 2025 Justin Frankel
.
|
RSS