|
Been doing some work in Maple the last few days. Maple has a thing I haven't seen elsewhere, where you can define "sequences" (comma-separated lists of Maple values) and assign a sequence to a variable. So you can writecode:
code:
Is there a name for this kind of behaviour?
|
# ? Jan 20, 2012 21:12 |
|
|
# ? May 15, 2024 03:02 |
|
Not sure. You can do it in python too though with slightly different syntax. code:
code:
|
# ? Jan 20, 2012 21:22 |
|
Hammerite posted:Is there a name for this kind of behaviour? Flattening? Unpacking? It's what happens when you pass arrays to functions in Perl.
|
# ? Jan 20, 2012 21:27 |
|
JawnV6 posted:gcc's being lazy about the stack. It's compiling a function and after the args are consumed it just slaps new data into [esp] and [esp+4] before calling another function. Are there any flags that will force it to play nice and actually push the args? That might be sibling call optimization (which permits it to reuse the stack frame when tail-calling a function with the same stack space requirements as the caller); perhaps -fno-optimize-sibling-calls? If that doesn't work, I have no suggestions, but you can always try turning down the optimization settings until the problem goes away, then looking at the list of specific optimizations enabled by the setting you just turned down and doing a binary search on them to find the specific one causing the problem.
|
# ? Jan 20, 2012 21:39 |
|
Strong Sauce posted:First you should understand that Rails is a full-stack web framework built on Ruby and node.js is a collection of system functions/tools based in javascript designed for event-driven high-scale applications. Right now I believe the most popular web framework for node.js is Express. Python has always rubbed the wrong way for some reason, and it's a combination of Job Skill/personnel project. Guess I'll go with Rails since I'm going to be learning everything from the ground up, don't want to frequently get into the situation where there's no documentation on what I want to know. Thanks for the input!
|
# ? Jan 20, 2012 22:47 |
|
Hammerite posted:Been doing some work in Maple the last few days. Maple has a thing I haven't seen elsewhere, where you can define "sequences" (comma-separated lists of Maple values) and assign a sequence to a variable. So you can write In R, we refer to that as vectorization. That's not exactly correct usage, but it's definitely a similar idea. Edit: It's probably better to say that this isn't exactly what people in parallel computing refer to as vectorization, but it's a good word for it.
|
# ? Jan 20, 2012 23:38 |
|
The way you do certain things in Maple is... idiosyncratic. It is entertaining from time to time. As well as sequences (comma-separated lists of values) you also have lists, which are sequences encased in a set of square brackets; and sets, which are sequences encased in a set of braces. So you can have code:
There is no built-in function to append an element to a list. You can do that as follows: code:
|
# ? Jan 21, 2012 00:09 |
|
ToxicFrog posted:That might be sibling call optimization (which permits it to reuse the stack frame when tail-calling a function with the same stack space requirements as the caller); perhaps -fno-optimize-sibling-calls? ToxicFrog posted:If that doesn't work, I have no suggestions, but you can always try turning down the optimization settings until the problem goes away, then looking at the list of specific optimizations enabled by the setting you just turned down and doing a binary search on them to find the specific one causing the problem. The particular call is in a #define but that shouldn't change calling conventions, right? Something like this code:
|
# ? Jan 21, 2012 00:55 |
|
The convention is that the argument space is scratch space and can be used by the callee for whatever the hell it wants. If you're relying on the arguments not being touched, you are relying on promises not given.
|
# ? Jan 21, 2012 01:49 |
|
rjmccall posted:The convention is that the argument space is scratch space and can be used by the callee for whatever the hell it wants. If you're relying on the arguments not being touched, you are relying on promises not given. Great, thanks for a load of theory bullshit that doesn't affect my problem or offer insight towards an answer. Got any thoughts on RISC/CISC while we're out here in the theoretical wastelands?
|
# ? Jan 21, 2012 02:07 |
|
JawnV6 posted:Great, thanks for a load of theory bullshit that doesn't affect my problem or offer insight towards an answer. Got any thoughts on RISC/CISC while we're out here in the theoretical wastelands? RISC is going to change everything.
|
# ? Jan 21, 2012 02:10 |
|
"I have a square peg and I am inserting it in a round hole. Why is this a pain in the rear end?" "Round holes are designed for round pegs. A square peg won't work in a general case." "gently caress you. I HAVE a square peg and I'm putting it in the motherfucker. I don't care about theory."
|
# ? Jan 21, 2012 02:14 |
|
JawnV6 posted:Great, thanks for a load of theory bullshit that doesn't affect my problem or offer insight towards an answer. Got any thoughts on RISC/CISC while we're out here in the theoretical wastelands? Your problem is that you're modifying the stack pointer in your inline assembly which (to my knowledge) gcc doesn't allow.
|
# ? Jan 21, 2012 02:14 |
|
JawnV6 posted:Great, thanks for a load of theory bullshit that doesn't affect my problem or offer insight towards an answer. Got any thoughts on RISC/CISC while we're out here in the theoretical wastelands? As far as I know, GCC never generates PUSH/POP instructions to deal with the stack on x86 architectures. It always prefers to track local values by their absolute offset from the stack frame, because that happened to be a much easier way to write the compiler and it's allowed by the calling convention. I admit it's been a while since I poked around inside GCC, but I think you're just out of luck if you want it to behave that way. Maybe try putting your assembly stuff in an inline function?
|
# ? Jan 21, 2012 02:17 |
|
JawnV6 posted:Great, thanks for a load of theory bullshit that doesn't affect my problem or offer insight towards an answer. Got any thoughts on RISC/CISC while we're out here in the theoretical wastelands? I did miss that this is inline assembly instead of a separate function coded in assembly, so I will graciously cut you some slack. GCC does not make any promises at all about the layout of the frame, including the arguments area. You need to use inline assembly constraints to tell GCC that you're using values from the local context.
|
# ? Jan 21, 2012 04:01 |
|
Internet Janitor posted:"I have a square peg and I am inserting it in a round hole. Why is this a pain in the rear end?" More to the point, I'm certain you don't have a firm enough grasp on the discussion to be throwing stones. ShoulderDaemon posted:As far as I know, GCC never generates PUSH/POP instructions to deal with the stack on x86 architectures. It always prefers to track local values by their absolute offset from the stack frame, because that happened to be a much easier way to write the compiler and it's allowed by the calling convention. I admit it's been a while since I poked around inside GCC, but I think you're just out of luck if you want it to behave that way. rjmccall posted:I did miss that this is inline assembly instead of a separate function coded in assembly, so I will graciously cut you some slack. GCC does not make any promises at all about the layout of the frame, including the arguments area. You need to use inline assembly constraints to tell GCC that you're using values from the local context. pseudorandom name posted:Your problem is that you're modifying the stack pointer in your inline assembly which (to my knowledge) gcc doesn't allow.
|
# ? Jan 21, 2012 07:48 |
|
JawnV6 posted:I'm pretty sure I can work around it regardless of that limitation. It just seemed like there'd be a way to get it to emit the stack-based instructions for function calls as well. Why? It's the most efficient way to allocate a stack frame. And there's nothing wrong with using LEAVE without ENTER, I'm not sure why you'd be upset about that either. Basically, you should probably step back and reconsider what you're trying to do, because from here it sounds like you're trying to solve the wrong problem.
|
# ? Jan 21, 2012 08:55 |
|
You've gotten patronized because you're communicating poorly and then being rude to people who misunderstand you, and because your approach reeks of a very rookie mistake with inline asm, which is to try to work around the compiler's code emission patterns instead of adequately expressing your intent to the compiler. Also, this is a very standard code-emission pattern for calls, so acting surprised like GCC is misbehaving somehow does not really give you much credibility. Okay. You have an inline asm block which wants to access the stack. My initial guess was that you were trying to access your procedure arguments "directly". My second guess was that you were trying to access some other local variable. Apparently neither of those is true. My third guess is that you're trying to communicate between multiple inline asm blocks (or multiple executions of the same block). If that's not it, my fourth guess is going to be that you're trying to pass extra stack arguments to a call that GCC is otherwise emitting for you. If that's not it, my fifth guess is going to be that you're trying to set extra information in some canonical place in the frame for the use of some stack-crawling tool. At some point, maybe you should consider letting us in on the secret, because what you need to do varies a lot on what you're trying to do.
|
# ? Jan 21, 2012 09:10 |
|
pseudorandom name posted:Why? It's the most efficient way to allocate a stack frame. pseudorandom name posted:And there's nothing wrong with using LEAVE without ENTER, I'm not sure why you'd be upset about that either. rjmccall posted:You've gotten patronized because you're communicating poorly and then being rude to people who misunderstand you, and because your approach reeks of a very rookie mistake with inline asm, which is to try to work around the compiler's code emission patterns instead of adequately expressing your intent to the compiler. I'm seriously not too concerned with your understanding of my problem. You haven't once given my posts an honest reading and now that I've got a working solution my drive to hold your hand through it is gone. Terribly sorry.
|
# ? Jan 21, 2012 19:06 |
|
You haven't once explained your problem. You have been a rude rear end in a top hat on multiple occasions, though.
|
# ? Jan 21, 2012 20:29 |
|
pseudorandom name posted:You haven't once explained your problem. Actually, he did. Hope this helps.
|
# ? Jan 21, 2012 20:54 |
|
I can't tell if I'd rather see the actual problem with a solution, or if I'd rather JawnV6 just gently caress off.
|
# ? Jan 21, 2012 20:55 |
|
tef posted:Actually, he did. Hope this helps. His problem is (paraphrasing) "I'm doing something that isn't allowed under any circumstances for no reason I'm willing explain to anybody, how do I do this thing?!? No, I won't tell you what I'm really trying to do in order for you to help me find a solution that will actually work and do what I want. Shut up you condescending jerk, stop trying to help me."
|
# ? Jan 21, 2012 21:32 |
|
"I have a specific problem with assembly and GCC". Shoulderdaemon replied with "Well, try turning off -O, otherwise you're hosed" The rest of you started off by calling him an idiot for asking a question. Hope this helps. I am pretty sure I know what being a patronising oval office on the internet looks like. It's how I post. tef fucked around with this message at 21:56 on Jan 21, 2012 |
# ? Jan 21, 2012 21:54 |
|
pokeyman posted:I can't tell if I'd rather see the actual problem with a solution, or if I'd rather JawnV6 just gently caress off. I think I can put it together. He has a function something like this: code:
The solution is to create a local variable (with alloca if it needs to be variably-sized) and use asm constraints to stash the data in that rather than pushing and popping around the call. ETA: this is one of those situations where a little pseudocode goes a long way. rjmccall fucked around with this message at 22:27 on Jan 21, 2012 |
# ? Jan 21, 2012 22:21 |
|
I know jack poo poo about Windows programming. In fact, I know jack poo poo about C++ in general. However, I'd like to get notifications of audio device changes as described in this MSDN article in a Python program I'm writing. Is this possible in any way?
|
# ? Jan 21, 2012 23:32 |
|
Thermopyle posted:I know jack poo poo about Windows programming. In fact, I know jack poo poo about C++ in general. pywin32 will bridge to COM, but having never used it, I can't say if it's advanced or suitable enough for you to implement a client interface. The harder, but maybe more sensible option (depending on your needs) would be to implement the functionality you need in C++ (since it's pretty straightforward to work with COM that way) and expose it using Boost.Python.
|
# ? Jan 22, 2012 01:23 |
|
pseudorandom name posted:You haven't once explained your problem. pseudorandom name posted:You have been a rude rear end in a top hat on multiple occasions, though. rjmccall posted:ETA: this is one of those situations where a little pseudocode goes a long way.
|
# ? Jan 22, 2012 21:32 |
|
Not really a programming question but something I've been curious about for a while how would you make a large MMO save state? I mean, you'd be dealing with huge amounts of changes per second that need to be saved (every skill addition, every experience gain, every item move or transfer) that would completely gently caress over iowait if you did them realtime, do you just throw huge arrays of SSDs and hardware at the issue or do you do something like save state in memory then do a mass-dumpout to transaction log/database once every x seconds?
|
# ? Jan 22, 2012 21:45 |
|
JawnV6 posted:I apparently explained it with enough fidelity for others to understand, discuss, and answer. That's what really gets me about this chorus of "you didn't explain it," did y'all just completely miss the discussion I had? I've even got a solution (non binary patching) that's working and doesn't interfere with gcc's stack frame. You explained your immediate difficulty with the fragile and broken method you use to solve your problem, but have never explained what your actual problem is. "How do I get gcc to stop being gcc?" isn't your actual problem, your actual problem is whatever your final goal is that your broken inline assembly hack is trying to accomplish.
|
# ? Jan 22, 2012 21:54 |
|
pseudorandom name posted:You explained your immediate difficulty with the fragile and broken method you use to solve your problem, but have never explained what your actual problem is. I'm fine with the "broken inline assembly hack" and really don't care to explain the details. I can assure you, I've read the wiki page for the XY Problem and for this specific instance there's really no other way. If not, I'll just live with the shame of adding 6 asm instructions to a flow that used to be 3 that leave the stack untouched for gcc. I just thought there'd be an easier way. JawnV6 fucked around with this message at 22:21 on Jan 22, 2012 |
# ? Jan 22, 2012 22:19 |
|
But how do you know there's no other way if you refuse to explain what the problem is to anybody else who might know an answer? That's the crux of the issue. Worst case scenario, you get people agreeing with you that, yeah, that's the only way to do it and commiserating with the difficulties you've encountered implementing it. Best case, you get an elegant solution that will work without trouble regardless of compiler version changes, optimization flags and whatever else may come up. Oh, and thanks for bringing up the "XY problem", I've been trying to remember what this was called since this conversation started, and the best I was able to find on Google was the "A-not-B error", which is a development psychology thing. pseudorandom name fucked around with this message at 22:55 on Jan 22, 2012 |
# ? Jan 22, 2012 22:52 |
|
Biowarfare posted:Not really a programming question but something I've been curious about for a while For things I've worked on (not MMOs), we had clear definitions of what was critical and non-critical, as well as thresholds for how much data was an acceptable loss e.g. for an MMO you'd consider absolute position of a character as non-critical as if something bad happens it's low-impact for player to lose [threshold] seconds of movement vs. losing any experience or an item they've gained. I think most decide to keep everything in memory and write to disk in bulk at a reasonable rate, making sure to have mechanisms to recover/write to disk immediately if there is a fault (Diablo 2 is an example of the other side of this, each game server kept it's state in memory and wrote it periodically, unfortunately if a server/game crashed the state would be lost and up to a few minutes of progress could disappear). It's something that takes a lot of planning and a lot of developers get it wrong (understandably) by under or overestimating requirements (whether that be the hardware requirements, or the tolerance of it's users to losing an amount of progress if something breaks).
|
# ? Jan 22, 2012 22:54 |
|
Can we let the JawnV6 stuff go? Yes it's annoying, but at this point you're just getting trolled and genuine questions from people without such an attitude problem are in danger of getting lost in the noise.
|
# ? Jan 22, 2012 23:10 |
|
Biowarfare posted:Not really a programming question but something I've been curious about for a while At a guess, you push the rarer events (item gains, achievements, quest flags, experience) to the DB server immediately, while the constant-stream events (positions, mostly) can be polled on a timer. As for how bad it is, hmm. Say you've got a WoW server just after an expansion. They let something like 2000 people on at the time, and I don't think they will kill more than one creature every 10 sec on average. That's 200 exp gain updates/second, plus about the same amount of gold and item updates, and somewhat fewer quest flag updates. If you poll positions every 10 sec as well, you get something like 1000 updates/second. That sounds manageable enough for a decent DB server?
|
# ? Jan 23, 2012 21:34 |
|
Does anybody have a good book recommendation for concurrency and asynchronous programming? I'm hoping to find some structured material that goes beyond semaphores, mutexes, producer/consumer, and basic crap like that. I'm thinking like using tasks, promises/futures, thread pools, testing methodologies, and common ways that different things tend to end up colliding while trying to use a resource.
|
# ? Jan 24, 2012 20:18 |
|
This should be a simple question but I've just been at work to long. I'm trying to arrange some images like so: code:
Right now I am just going to do 1, 2, 3, 4... and have each of those be a group of 4. I just hate hardcoding stuff. That way if you've touched inside group 1, where in the group was it, area 1 2 3 or 4? I'm just looking for a cleaner or more elegant way that isn't obvious to me right now.
|
# ? Jan 24, 2012 22:40 |
|
Bob Morales posted:This should be a simple question but I've just been at work to long. code:
For converting an image index to coordinates, you first check if the index is odd. If so, the x coordinate is the index, divided by two (round down), plus one. The y coordinate is 1. Otherwise, the x coordinate is the index divided by two, and the y coordinate is 2. For converting a coordinate pair to an index, you first check the y coordinate. If the y coordinate is 1, then the index is the x coordinate, multiplied by two, minus 1. Otherwise, the index is the x coordinate multiplied by 2. ShoulderDaemon fucked around with this message at 22:53 on Jan 24, 2012 |
# ? Jan 24, 2012 22:51 |
|
Just add a y offset if it's even? Pseudocode: code:
code:
|
# ? Jan 24, 2012 22:53 |
|
|
# ? May 15, 2024 03:02 |
|
Bob Morales posted:This should be a simple question but I've just been at work to long. This works but is probably horrible. code:
code:
Carthag Tuek fucked around with this message at 23:10 on Jan 24, 2012 |
# ? Jan 24, 2012 23:07 |