I'm making a file sharing program that connects with a FTP server.
First i made an test application to test out the functions of FtpWebRequest and Response objects and it all worked.
But now i tried to add these functions to my class Project and i mostly copy pasted the code but now i get a "UnauthorizedAccesExceptions: Access to the path '<path>' is denied.".
I tried to make the folders not-"read only" and even gave "Everyone" the 'Full Control' Permission.
What could be the problem here?
EDIT -fixed
I forgot a "\\" between the path and the filename.
[QUOTE=Richy19;36228050]All give OpenGL Invalid Value.
Even tho I am adquireing the NormalsID in the same way I do any other ID and those work fine.[/QUOTE]
Make sure the normal variable is being used in your shaders, or the GLSL compiler will optimise it away.
So I finally got the menu to kind of work:
[vid]http://dl.dropbox.com/u/34571219/03oam2d8a.webmvp8.webm[/vid]
The problem(as you might've already noticed) is that it checks for keypress only after the animation function is over.
What I need is the keypress "checker" to run in the background and return the value as soon as the key is pressed, not after the current function is finished.
Yes, I've heard about threading, but there must've been another way of doing this back when CPU's only had one core.
[URL="https://sourceforge.net/projects/rogueclone/"]There's an old project on Sourceforge[/URL] that I've taken interest in, and I'm trying to convert it to C89. It's written in good ol' K&R (sometimes) and it has a lot of dependencies in DOS and Windows, so my next step is to make it portable. However, ANSI compliance of course comes first.
I'm looking for a decent guide on porting; does anyone have one?
In addition, I could also use some help with make. The makefiles included with the source are, of course, rather outdated and I don't have any experience with makefiles or the tool.
I can't figure out a way to turn a number into positive or negative 1, for example -1324 would become -1 and 3423 would become 1. I've tried x^0 but that doesn't seem to work in C++.
[editline]dadasdds[/editline]
Just tried pow(x,0), but it only gives back positive one.
[QUOTE=chonks;36236672]I can't figure out a way to turn a number into positive or negative 1, for example -1324 would become -1 and 3423 would become 1. I've tried x^0 but that doesn't seem to work in C++.[/QUOTE]
[CODE]
#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#endif
pow(number, 0);
// '^' is a binary operator in C++, not exponent[/CODE]
[QUOTE=chonks;36236672]I can't figure out a way to turn a number into positive or negative 1, for example -1324 would become -1 and 3423 would become 1. I've tried x^0 but that doesn't seem to work in C++.
[editline]dadasdds[/editline]
Just tried pow(x,0), but it only gives back positive one.[/QUOTE]
Divide it by the absolute value of itself.
[QUOTE=Tinker Toy;36236719][CODE]if (num < 0) num = -1;
else if (num > 0) num = 1;[/CODE][/QUOTE]
Fuck me.
[QUOTE=chonks;36236672]I can't figure out a way to turn a number into positive or negative 1, for example -1324 would become -1 and 3423 would become 1. I've tried x^0 but that doesn't seem to work in C++.
[editline]dadasdds[/editline]
Just tried pow(x,0), but it only gives back positive one.[/QUOTE]
[cpp]
template <class T>
static inline T Clamp (const T min, const T max, const T num)
{
if(num > max) return max;
if(num < min) return min;
return num;
}
[/cpp]
clampedNum = Clamp(-1, 1, myNum);
Hey guys, bit of an interesting problem
I need to send a UDP packet with different contents depending on which key presses are currently active (out of WASD) (I.E W pressed sends forward, S pressed sends backward,etc.) to an arduino. I would really like this to be in a web page, so I thought a Java applet would be perfect. Turns out Java applets need digital signing before they can use UDP (unless the UDP receiver is the server the webpage is on, which it isn't!)
So getting Java applets to directly send packets is out the window. However, I thought perhaps I could get the applet to send a POST request or something similar to a PHP page, and get the PHP page to relay the message to the arduino by sending the UDP packet itself.
NB: the system only needs to send packets when the current key-pressed combination changes (E.G from W to W and A)
If you guys could think of a better method, please do let me know! My current idea is a bit of a hack, it would seem. Cheers
[QUOTE=WhatTheEf;36236545]
What I need is the keypress "checker" to run in the background and return the value as soon as the key is pressed, not after the current function is finished.[/QUOTE]
Your application design doesn't permit this, you need a [url=http://en.wikipedia.org/wiki/Game_programming#Game_structure]game loop[/url].
[QUOTE=WhatTheEf;36236545]
Yes, I've heard about threading, but there must've been another way of doing this back when CPU's only had one core.[/QUOTE]
You don't have to have more than one core to do threading.
How do you think applications can have 10 threads when there's only 4 cores on the system?
[QUOTE=dajoh;36237437]Your application design doesn't permit this, you need a [url=http://en.wikipedia.org/wiki/Game_programming#Game_structure]game loop[/url].
-snip-[/QUOTE]
It took me a while to realize the need for a game loop when I was trying to write a game on my TI-83 in class. I had multiple discrete programs that did different things (one moved a cursor, one moved the "ai", etc.) but I had no clue how to integrate them without them blocking one another. It seems so trivial in retrospect but it didn't at the time.
[QUOTE=WhatTheEf;36236545]
What I need is the keypress "checker" to run in the background and return the value as soon as the key is pressed, not after the current function is finished.
Yes, I've heard about threading, but there must've been another way of doing this back when CPU's only had one core.[/QUOTE]
There isn't another way to do it, unfortunately. Either set up a multithreaded solution with function callbacks (which is elegant, but complicated) or make a game loop that repeatedly checks for input in between animation frames (which seems clunky, but actually works fine in most cases).
[QUOTE=Larikang;36242779]There isn't another way to do it, unfortunately. Either set up a multithreaded solution with function callbacks (which is elegant, but complicated)[/QUOTE]
Wouldn't ever call this elegant, it's going to turn into a mess very fast with all the synchronization that you will have to do.
A game design like this is going to be very hard and time consuming for a newbie to implement.
[QUOTE=Larikang;36242779]make a game loop that repeatedly checks for input in between animation frames (which seems clunky, but actually works fine in most cases).[/QUOTE]
Not clunky at all, and works in pretty much every case.
Thanks for the input (pun not intended).
What I managed to do is check for the key press in the loop that reads each line from the txt file.
[QUOTE=WhatTheEf;36246165]Thanks for the input (pun not intended).
What I managed to do is check for the key press in the loop that reads each line from the txt file.[/QUOTE]
I think what you need to do is set up a proper game loop. You might need some additional libraries.
[QUOTE=Mr_Razzums;36246625]I think what you need to do is set up a proper game loop. You might need some additional libraries.[/QUOTE]
When I'll do a proper game I'm going to use an external library (most likely SFML). Right now I'm just messing arround
[QUOTE=WhatTheEf;36247003]When I'll do a proper game I'm going to use an external library (most likely SFML). Right now I'm just messing arround[/QUOTE]
Even though you are only messing around it might be a good idea to do it the right way while the program is so small; refactoring around a game loop shouldn't take too much work.
[QUOTE=PortalGod;36200137]so I'm trying to find a method to optimize drawing with rectangles, using the least amount of rects possible. I got it to check horizontally:
[img_thumb]http://puu.sh/ySLm[/img_thumb]
but no matter how hard I try, I can't get it to check vertically as well. The code is really ugly, but the logical steps behind how I did it are like this:
[code]
I don't even know if the rectangles are just getting overlapped, because LOVE sucks with debugging
is there a better way to do this? or an example I can look at?[/QUOTE]
My attempt: [img_thumb]https://dl.dropbox.com/u/9618970/funny2out.png[/img_thumb]
with 140 blocks.
The algorithm is like this: Go through all possible rect sizes, starting with the largest (width by height), and test all possible positions (the largest having only one, the smallest (1x1) having the most) when it fits, mark pixels and store the found block.
For this 15x15 pixel image the order of blocks is something like [code]15x15, 14x15, 15x14, 14x14, 13x15, 15x13, 13x14, 14x13, 12x15, 15x12, 13x13, 12x14, 14x12, 11x15, 15x11, 12x13, 13x12, 11x14, 14x11, 10x15, 15x10, 12x12, 11x13, 13x11, 10x14, 14x10, 9x15, 15x9, 11x12, 12x11, 10x13, 13x10, 9x14, 14x9, 11x11, 8x15, 10x12, 12x10, 15x8, 9x13, 13x9, 8x14, 14x8, 10x11, 11x10, 9x12, 12x9, 7x15, 15x7, 8x13, 13x8, 10x10, 9x11, 11x9, 7x14, 14x7, 8x12, 12x8, 7x13, 13x7, 6x15, 9x10, 10x9, 15x6, 8x11, 11x8, 6x14, 7x12, 12x7, 14x6, 9x9, 8x10, 10x8, 6x13, 13x6, 7x11, 11x7, 5x15, 15x5, 6x12, 8x9, 9x8, 12x6, 5x14, 7x10, 10x7, 14x5, 6x11, 11x6, 5x13, 13x5, 8x8, 7x9, 9x7, 4x15, 5x12, 6x10, 10x6, 12x5, 15x4, 4x14, 7x8, 8x7, 14x4, 5x11, 11x5, 6x9, 9x6, 4x13, 13x4, 5x10, 10x5, 7x7, 4x12, 6x8, 8x6, 12x4, 3x15, 5x9, 9x5, 15x3, 4x11, 11x4, 3x14, 6x7, 7x6, 14x3, 4x10, 5x8, 8x5, 10x4, 3x13, 13x3, 3x12, 4x9, 6x6, 9x4, 12x3, 5x7, 7x5, 3x11, 11x3, 4x8, 8x4, 2x15, 3x10, 5x6, 6x5, 10x3, 15x2, 2x14, 4x7, 7x4, 14x2, 3x9, 9x3, 2x13, 13x2, 5x5, 2x12, 3x8, 4x6, 6x4, 8x3, 12x2, 2x11, 11x2, 3x7, 7x3, 2x10, 4x5, 5x4, 10x2, 2x9, 3x6, 6x3, 9x2, 2x8, 4x4, 8x2, 1x15, 3x5, 5x3, 15x1, 1x14, 2x7, 7x2, 14x1, 1x13, 13x1, 1x12, 2x6, 3x4, 4x3, 6x2, 12x1, 1x11, 11x1, 1x10, 2x5, 5x2, 10x1, 1x9, 3x3, 9x1, 1x8, 2x4, 4x2, 8x1, 1x7, 7x1, 1x6, 2x3, 3x2, 6x1, 1x5, 5x1, 1x4, 2x2, 4x1, 1x3, 3x1, 1x2, 2x1, 1x1[/code]
All I want is to write a method in Java that somehow makes text scroll down on a JFrame, like putting a textArea on a JFrame and making the text just go down vertically like credits, but smoothly moving down.
Any help would be appreciated
OpenAL : Recording from MIC :
So, if I grab 2048 samples at once, the wave looks nice. really, it does.
Record.ReadSamples(buffer, N ); //i get nice wave
But, if grab 1024 samples twice, then reconstruct those two samples into one piece again (2048), the wave doesn't match..
Call 1
Record.ReadSamples(buffer, N/2 );
Call 2
Record.ReadSamples(buffer, N/2 );
Reconstruct - the wave is broken at middle... no mater how i arrange them (buff 1 first or buff 2 first)
i also looks like buff1,buff2 are same
[editline]9th June 2012[/editline]
fuck this shit, ignore it, but fuck this is dumb, 4 hours spent on fucking NOTHI.. fuck jsut good night or somthing
[editline]9th June 2012[/editline]
nevermind, rage seemed to help me solve a problem (but also fucked whole form in visual studio)
-snip wrong thread-
in c++ why can't you do this
[code]
class FooBar
{
//constructor destructor methods etc
private:
using std::string;
string foo;
}
[/code]
but you can do this
[code]
class FooBar
{
//constructor destructor methods etc
private:
typedef std::string string;
string foo;
}
[/code]
should I be using the second example or is that bad (it feels wrong)? should I be using something else? The reason for wanting to use using inside the class is so I don't pollute everything else (I am under the impression that using using in the global namespace is really bad practice and you should use using inside methods, am I right in assuming that?)
[QUOTE=Asgard;36220670]Is there any easier way than putting all my .lua files with main.lua on top in a .zip, change it to a .love and execute it everytime I make a small change?
Lua + Love2D.[/QUOTE]
You can just drag & drop the folder on the Love.exe file.
[QUOTE=Liquid Helium;36260990]in c++ why can't you do this
...
should I be using the second example or is that bad (it feels wrong)? should I be using something else? The reason for wanting to use using inside the class is so I don't pollute everything else (I am under the impression that using using in the global namespace is really bad practice and you should use using inside methods, am I right in assuming that?)[/QUOTE]
You should namespace your project, then you can do this:
[cpp]
namespace Foo
{
using std::string;
class Bar
{
private:
string fooBar;
};
}
[/cpp]
[QUOTE=Tinker Toy;36236635][URL="https://sourceforge.net/projects/rogueclone/"]There's an old project on Sourceforge[/URL] that I've taken interest in, and I'm trying to convert it to C89. It's written in good ol' K&R (sometimes) and it has a lot of dependencies in DOS and Windows, so my next step is to make it portable. However, ANSI compliance of course comes first.
I'm looking for a decent guide on porting; does anyone have one?
In addition, I could also use some help with make. The makefiles included with the source are, of course, rather outdated and I don't have any experience with makefiles or the tool.[/QUOTE]
Those goto's make me cringe.
Hello all. I posted here before regarding my difficulties installing Microsoft Visual Studio (with an .exe file not working, and no alternatives functioning) earlier and ended up giving up. That was months ago, but damnit, I want to code. I'm not entirely sure why, but everytime I attempt to install ANY version of Microsoft Visual Studio, a .exe doesn't appear, no matter what, and no alternatives previously suggested have functioned. Does anyone know WHY it wouldn't be installing properly, or at the very least, have an idea? It's frustrating as hell to not be able to get passed the first page of my programming book.
I don't know if this can be really considered programing but I'm really in need of help in a project of mine in Xilinx.
I don't know if this is the right place to do it, but I have an assignment to present next friday and I've been having issues with Xilinx 10.1.
Now before you say anything about the outdated version, yes, it's the version we use at university and therefore it's the version I use too.
So I've been making a multiplier in Digital Systems. We have a 2 bit A variable which will represent the number we want to successively sum (multiplicate) and a 3 bit B input which is the number we want to sum A B times.
Then for outputs we have 6 bit C which is the result, a stop output and a OK output. Stop means the end of each sum and OK means the operation is complete.
Problem is when testing the functionality of the design in the test wave bench, some outputs of the C variable present themselves in a red line with a U for "undefined".
This is really driving me crazy since I have to program a CPLD board with this and it won't let me with this error.
If this information is not enough I can post my work and work objectives so you can help me further. Either way, does anyone have any idea of what this is?
Thank You!
PS - If someone does get to help me, I will mention him on my assignment's report!
[QUOTE=esalaka;36226331]Did you try -std=gnu++11[/QUOTE]
So it turns out C++11 is enabled by default... except VS 2010 only has a handful of features implemented. And even 2012 doesn't have range-based for loops.
[editline]9th June 2012[/editline]
[QUOTE=NateDude;36264844]Hello all. I posted here before regarding my difficulties installing Microsoft Visual Studio (with an .exe file not working, and no alternatives functioning) earlier and ended up giving up. That was months ago, but damnit, I want to code. I'm not entirely sure why, but everytime I attempt to install ANY version of Microsoft Visual Studio, a .exe doesn't appear, no matter what, and no alternatives previously suggested have functioned. Does anyone know WHY it wouldn't be installing properly, or at the very least, have an idea? It's frustrating as hell to not be able to get passed the first page of my programming book.[/QUOTE]
There are alternatives.
[url]http://www.mingw.org/[/url]
[url]http://www.cygwin.com/[/url]
Sorry, you need to Log In to post a reply to this thread.