• What do you need help with? V. 3.0
    4,884 replies, posted
[QUOTE=sim642;32990002]The program is trying to access memory that it hasn't allocated (think of it as requested for use). There's probably nothing you can do to fix it if it isn't your own program. EDIT: More in depth explanation is on wikipedia: [url]http://en.wikipedia.org/wiki/Segmentation_fault[/url].[/QUOTE] Ah alright, thanks :)
[QUOTE=mechanarchy;32985197]For anyone else who searches for this later: [url]http://love2d.org/wiki/love.graphics.setMode[/url] If you use that function in love.load it'll set up the default 800x600 pixel window first and then reset it to this one, causing the window to flicker out of existence momentarily and look kinda dodgy. You can fix this, but you'd need to write your own\copy and edit the existing [url=http://love2d.org/wiki/love.run]love.run[/url] function (I think).[/QUOTE] No. The window is created before love.run. You have to use the conf.lua file (and correctly, like the dude found out how to). However, if you [i]really[/i] want to create your window in love.load you can put this in your conf.lua: [lua] function love.conf(t) t.screen = nil end [/lua] This will leave creating a window up to you.
Ok, So I really do have two options here, One is to fix this error (Only happening on Tiny C C) [code] tcc version 0.9.25 -> kernal.c <- kernal.o tcc version 0.9.25 -> loader.o -> kernal.o tcc: undefined symbol 'sin' tcc: undefined symbol 'cos' tcc: undefined symbol 'sqrt' tcc: undefined symbol '__tcc_int_fpu_control' tcc: undefined symbol '__tcc_fpu_control' tcc: undefined symbol 'isActive'[/code] This is happening because I included math.h Or I can ask, Does anyone have a copy of GCC i586 compiler? (For windows, I can't get it to compile on linux, Plus windows is more convenient)
You should -lm to link the math library as well [editline]28th October 2011[/editline] Also, "kernel"
[QUOTE=esalaka;32996650] Also, "kernel"[/QUOTE] A [b]really[/b] bad habit of mine. Also: [code]tcc version 0.9.25 -> kernal.c <- kernal.o tcc version 0.9.25 tcc: cannot find -lm[/code] I kinda regret using TCC. GCC seems to be more clever but slower but my issue is not speed at the moment.
[QUOTE=benjojo;32996601]Ok, So I really do have two options here, One is to fix this error (Only happening on Tiny C C) [code] tcc version 0.9.25 -> kernal.c <- kernal.o tcc version 0.9.25 -> loader.o -> kernal.o tcc: undefined symbol 'sin' tcc: undefined symbol 'cos' tcc: undefined symbol 'sqrt' tcc: undefined symbol '__tcc_int_fpu_control' tcc: undefined symbol '__tcc_fpu_control' tcc: undefined symbol 'isActive'[/code] This is happening because I included math.h Or I can ask, Does anyone have a copy of GCC i586 compiler? (For windows, I can't get it to compile on linux, Plus windows is more convenient)[/QUOTE] MinGW with an i586 output?
If you've seen my updates in WAYWO, I'm sending a map over a network. It works fine (aside from the whole.. crashing when you lose focus thing), but it's kind of slow. No, it's terribly slow. I like to think I have a good understanding of the way TCP connections work. Looking for a thumbs up / down on something. Right now I'm sending 512 bytes, and waiting for the client to say "Ok! Got it!" then I send another 512 bytes. I know, fucking brilliant, right? The client knows the size of the file, so I'm thinking I'll just send the entire file. Let the client receive it at its own pace (the files aren't that big). Then once the client has received the number of bytes equal to the size of the file it'll tell the server "Ok! Done!" I'm thinking this is how most things do it. Just sounds like a bad idea in my head. Anyone have any input on this?
Choose a transmission speed based on the client's available bandwidth (maybe let them select a setting, like how steam does). Then stream that many bytes per second down your TCP connection. The client never needs to send the server a packet beyond the handshaking at the start - TCP guarantees that all the data will reach the client. If the server detects the connection was lost before all the data was sent, you know there was a transmission error. If you're fussy about making sure there aren't any errors, you can have the client send a confirmation packet at the end containing a hash of the file.
[QUOTE=jalb;32998310]If you've seen my updates in WAYWO, I'm sending a map over a network. It works fine (aside from the whole.. crashing when you lose focus thing), but it's kind of slow. No, it's terribly slow. I like to think I have a good understanding of the way TCP connections work. Looking for a thumbs up / down on something. Right now I'm sending 512 bytes, and waiting for the client to say "Ok! Got it!" then I send another 512 bytes. I know, fucking brilliant, right? The client knows the size of the file, so I'm thinking I'll just send the entire file. Let the client receive it at its own pace (the files aren't that big). Then once the client has received the number of bytes equal to the size of the file it'll tell the server "Ok! Done!" I'm thinking this is how most things do it. Just sounds like a bad idea in my head. Anyone have any input on this?[/QUOTE] The clients don't need to reply - TCP does that for you. Anything you send is guaranteed to be received. With that in mind, send as much data as you can as quickly as possible and TCP will sort it all out for you.
How would you constantly get and update an x,y value in lua? I tried something like: function love.update(dt) local x, y = love.mouse.getPosition() if x == 30 and y == 30 then love.graphics.print("Text", x, y) end Which in the end apparently didn't update it. Could anyone explain how?
You guys are always so helpful and quick to respond (though I had to leave shortly after posting). [QUOTE=thomasfn;32998387]maybe let them select a setting, like how steam does[/QUOTE] Got this implemented and it's working fantastically! I had also never thought about confirming the hash with the server. I think I'll implement that once I figure out how it's done. [QUOTE=Catdaemon;32998780]With that in mind, send as much data as you can as quickly as possible and TCP will sort it all out for you.[/QUOTE] I actually had issues with this. Seems the "send" function can get overloaded if you send too much all at once. I started getting "EWOULDBLOCK" errors back (common from recv, but I didn't know send would ever throw that back). After further investigation it turns out I was shoving too much into the stack all at once, or something. The client received everything fine when the send didn't get overloaded, though. Once I added in a limit to how many kb/s were sent, it was smooth sailing.
[QUOTE=WitheredGryphon;33001099]How would you constantly get and update an x,y value in lua? I tried something like: [code]function love.update(dt) local x, y = love.mouse.getPosition() if x == 30 and y == 30 then love.graphics.print("Text", x, y) [u]end[/u] end[/code] Which in the end apparently didn't update it. Could anyone explain how?[/QUOTE] Are you actually trying to only print the text when x and y are both 30? If not, you should use: [code]function love.update(dt) local x, y = love.mouse.getPosition() love.graphics.print("Text", x, y) end[/code] Also, use [code] tags to post code, it's much easier on the eye :)
[QUOTE=mechanarchy;32988869]NB: ThePuska, it is the floor of the logarithm, not the ceiling: compare log10(34) == 2.53; floor(log10(34)) == 2. There aren't 3 digits in "34" :smile:[/QUOTE] No, it's the ceiling. You have the wrong value for log10(34).
[QUOTE=benjojo;32996844]A [b]really[/b] bad habit of mine. Also: [code]tcc version 0.9.25 -> kernal.c <- kernal.o tcc version 0.9.25 tcc: cannot find -lm[/code] I kinda regret using TCC. GCC seems to be more clever but slower but my issue is not speed at the moment.[/QUOTE] can you not use minGW
[QUOTE=ThePuska;33011028]No, it's the ceiling. You have the wrong value for log10(34).[/QUOTE] This, but you have to add one to the number before taking the logarithm. It would be like [i]ceiling(log(n+1)/log(base))[/i] For example log(1) = 0 so ceiling(log(1)) = 0, but 1 isn't a 0-digit number.
[QUOTE=ROBO_DONUT;33011938]This, but you have to add one to the number before taking the logarithm.[/QUOTE] No, no. Just take the [I]floored[/I] logarithm and add 1 to it.
[QUOTE=ROBO_DONUT;33011938]This, but you have to add one to the number before taking the logarithm. It would be like [i]ceiling(log(n+1)/log(base))[/i] For example log(1) = 0 so ceiling(log(1)) = 0, but 1 isn't a 0-digit number.[/QUOTE] [QUOTE=esalaka;33013389]No, no. Just take the [I]floored[/I] logarithm and add 1 to it.[/QUOTE] I initially responded intuitively, but we can do the math as well. ROBO_DONUT is correct. Start with the knowledge that with n digits you can express integers in the range of [img]http://latex.codecogs.com/gif.latex?[0,%20B^n%20-%201][/img] in a positional system of base B. Thus, the problem of finding the amount of digits in a number x is equivalent to finding the lowest n for which [img]http://latex.codecogs.com/gif.latex?0%20\leq%20x%20\leq%20B^n%20-%201[/img] Only considering the right part of the inequality, move the constant to the left side and take the logarithm of base B: [img]http://latex.codecogs.com/gif.latex?\log_B(x%20+%201)%20\leq%20\log_B(B^n)[/img] Simplify, swap sides to make it more obvious: [img]http://latex.codecogs.com/gif.latex?n%20\geq%20\log_B(x%20+%201)[/img] The function that gives us the lowest possible n that is either greater than logB(x+1) or equal to it is ceiling. ROBO_DONUT's answer is correct: ceil(logB(x+1)) The number 0 is a curiosity, though. Is it correct to say that with 0 digits you can only express the number zero?
Could anyone give me some tips on how to clean up this Bubble Sorting code? I've been doing an assignment and I can't get it to loop correctly so just made it loop an arbitrary amount of times, which I don't particularly like. [code] void bubbleSort(int * array, int arraySize) { int SubArrayEnd = arraySize; for (int i = -10; i < SubArrayEnd; i++) { for (int currentIndex = 0; currentIndex < arraySize; currentIndex++) { if (array[currentIndex] > array[currentIndex + 1] && (currentIndex + 1) < arraySize) { std::swap(array[currentIndex], array[currentIndex + 1]); SubArrayEnd = currentIndex; } } } } [/code]
[QUOTE=ThePuska;33013829]Is it correct to say that with 0 digits you can only express the number zero?[/QUOTE] Nah; Zero is one digit long. It's just a special case (Which would probably be fixed by my idea - although on the other hand for every number that is a power of B it would be one too large I think)
[QUOTE=sambooo;33009507]Are you actually trying to only print the text when x and y are both 30? If not, you should use: [code]function love.update(dt) local x, y = love.mouse.getPosition() love.graphics.print("Text", x, y) end[/code] Also, use [code] tags to post code, it's much easier on the eye :)[/QUOTE] Yes, only when the x and y values are the equivalent of 30.
[QUOTE=WitheredGryphon;33014485]Yes, only when the x and y values are the equivalent of 30.[/QUOTE] [code] function love.update(dt) x, y = love.mouse.getPosition() end function love.draw() if x == 30 and y == 30 then love.graphics.print("Text", x, y) end end [/code] My coding isn't great at all, but that should work.
I really have no idea how this would, or could, be done, but is there any way to get the audio information a specific program is outputting? Basically, my goal is to be able to get the fft of a specific program that outputs audio (Browser, winamp, itunes, etc.). The reason I think this might be possible as in windows you can already modify the output volume of specific applications (Though I only want its output, not to modify it): [img]http://i51.tinypic.com/wr28p.png[/img] Tell me if I need to clarify something, I tend to not explain things very well.
[QUOTE=nath2009uk;33015349][code] function love.update(dt) x, y = love.mouse.getPosition() end function love.draw() if x == 30 and y == 30 then love.graphics.print("Text", x, y) end end [/code] My coding isn't great at all, but that should work.[/QUOTE] Didn't work, thanks for trying though.
-Snip had the wrong thread open-
[QUOTE=WitheredGryphon;33016065]Didn't work, thanks for trying though.[/QUOTE] Actually I just tested it now and it works fine; not sure why you'd want to check exactly for X/Y 30 though.
[QUOTE=nath2009uk;33016263]Actually I just tested it now and it works fine; not sure why you'd want to check exactly for X/Y 30 though.[/QUOTE] So when you hovered the mouse over the x=30 point and y=30 point it displayed "Text" over it? I also want to check for 30,30 because I placed something there and I want to give the effect of hovering over it, however I was asking because I can't get that effect to work.
[QUOTE=WitheredGryphon;33016331]So when you hovered the mouse over the x=30 point and y=30 point it displayed "Text" over it? I also want to check for 30,30 because I placed something there and I want to give the effect of hovering over it, however I was asking because I can't get that effect to work.[/QUOTE] Yep. Use some simple debugging stuff such as: [code] function love.draw() love.graphics.print(x..y, 10, 10) end [/code] to check the X / Y coords. Took me a while to hit it with my shitty mouse :(
[QUOTE=WitheredGryphon;33016331]So when you hovered the mouse over the x=30 point and y=30 point it displayed "Text" over it? I also want to check for 30,30 because I placed something there and I want to give the effect of hovering over it, however I was asking because I can't get that effect to work.[/QUOTE] The problem is that 1 pixel is such a tiny target to hit. It would work, but your cursor has to be exactly over the correct pixel.
Ok blkducky makes a good point, so I'll give his method a try and update on how that works out. Edit: It works, thanks so much!
Does anyone know how to use serial ports here? I'm running Windows 7 and have a USB thingy that gives a serial port to my laptop which normally doesn't have one. It's TRENDnet TU-S9. It works fine. My question is, how do I read/write to this serial port from a C/C++ program?
Sorry, you need to Log In to post a reply to this thread.