mozie

GDNet+ Basic
  • Content count

    304
  • Joined

  • Last visited

Community Reputation

194 Neutral

About mozie

  • Rank
    GDNet+
  1. Being a GNU Contributor

    [quote name='SimonForsman' timestamp='1306968595' post='4818447'] Why would it raise potential concerns for their intellectual property ? If anything a free software developer would be less likely to steal his employers IP since he'd get caught almost immediatly. The fact that alot of GNU software attempts to provide equivalent functionality to that of proprietrary software is a non issue as pretty much all proprietary software does exactly the same thing, thats how the software industry works. (Some things are protected by patents but the FSF respects those even if they don't agree with the concept of software patents). [/quote] This just sounds a little bit like saying "it is okay to use your knowledge of the inner workings of a program, as long as you tweak it a little": [quote] [b]2.1 Referring to Proprietary Programs[/b] Don’t in any circumstances refer to Unix source code for or during your work on GNU! (Or to any other proprietary programs.) If you have a vague recollection of the internals of a Unix program, this does not absolutely mean you can’t write an imitation of it, but do try to organize the imitation internally along different lines, because this is likely to make the details of the Unix version irrelevant and dissimilar to your results. For example, Unix utilities were generally optimized to minimize memory use; if you go for speed instead, your program will be very different. You could keep the entire input file in memory and scan it there instead of using stdio. Use a smarter algorithm discovered more recently than the Unix program. Eliminate use of temporary files. Do it in one pass instead of two (we did this in the assembler). Or, on the contrary, emphasize simplicity instead of speed. For some applications, the speed of today’s computers makes simpler algorithms adequate. Or go for generality. For example, Unix programs often have static tables or fixed-size strings, which make for arbitrary limits; use dynamic allocation instead. Make sure your program handles NULs and other funny characters in the input files. Add a programming language for extensibility and write part of the program in that language. Or turn some parts of the program into independently usable libraries. Or use a simple garbage collector instead of tracking precisely when to free memory, or use a new GNU facility such as obstacks. [/quote] [url="http://www.gnu.org/prep/standards/standards.pdf"]http://www.gnu.org/p...s/standards.pdf[/url]
  2. Being a GNU Contributor

    I am currently 3 semesters into my AS for Computer Science, I will be going for my BS afterwards through a distance learning program at a University. After I finish my AS I would like to get a job working in the field while I finish my BS. Ideal, I know, I'm sure everyone wants to do this so I'm trying to get my resume together for when I do complete my AS degree. I wanted to have something that would put me apart from the other 2-year applications. I'm not expecting a "good job" right away, but I want to get into something CS related instead of my current call-center tech-support gig. In order to be a step above a regular graduate; it seems like you either have a nice collection of programs that you are proud of, or you work on some kind of project group. It's my opinion that being on the group would be a more powerful statement. To me, it seems to imply that you have already been accepted as a programmer worthy of contributing to a project. I'm sure most of you can imagine that it would be completely possible to join some random persons project online and claim to be on a team or such, even with minimal coding experience or contributions. So then the problem becomes getting on a team that is already recognized as being a respected team of programmers. Thats when I looked into how to become a GNU Contributor. After looking and finding something that I thought I wanted to help with, I reflected on some of the other things I saw on the site. I think most prominent is that - grossly overstated, I'm sure - "every Official GNU program is an attempt to provide the same functionality that some other particular proprietary program does." I think that sounds great from the user's perspective, but what about an employer who is looking at an employee. I'm afraid that it might be some kind of red-flag to wrong people. My reasoning has reduced my opinion to two scenarios: Being a GNU Contributor would be good for a resume because it shows that you can work with a team while providing functional code independently. Being a GNU Contributor would be bad for a resume because of potential concerns by the employer for their Intellectual Property, or other such trust related issues. Of course, you know this boils down to: if I do deem it to be a bad idea to help with GNU, then I would need to find another group. Any suggestions? Maybe there is something completely different that you think I could consider for boosting my resume. Thanks![img]http://public.gamedev.net/public/style_emoticons/default/biggrin.gif[/img]
  3. [quote name='Antheus' timestamp='1306276400' post='4815342'] [quote name='mozie' timestamp='1306275681' post='4815338'] [quote name='alvaro' timestamp='1306167579' post='4814635']It turns out "5" is the correct answer according[/quote] Huh, I guess I don't see why. Cool example though! [/quote] [url="http://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29"]Covariance[/url] and auto type conversion. 0 is integer. function returns a double. Ternary operator can only work on same type: int = cond ? int : int, for example, or more generally, T = cond ? T : T. Ternary operator should throw an error for: X = cond ? T : U. Imagine T = string and U = vector<int>. There is no possible conversion and no type that could hold both. I know that in Java this is an error. It should be in C/C++ as well, but it may go unreported since with primitive types casting and default construction/copy construction converts the types on the fly. Since Price has a () operator defined, the returned Price is evaluated, it returns double, which is cast to int. Or the int is converted to double. This example points more to dangers of operator(). [/quote] Thanks! So, would changing the 0 to a 0.0 resolve it? Because then it would result in double = (cond) ? double : double.
  4. [quote name='alvaro' timestamp='1306167579' post='4814635']It turns out "5" is the correct answer according[/quote] Huh, I guess I don't see why. Cool example though!
  5. Reading from a text file (c++)

    If you are going to do it that way (roll your own), I think the basic process is: 1) read the [i]line[/i] 2) find offset of '=' 3) read before the '=' into a token variable 4) read behind the'=' into a value variable 5) switch on the token to assign the value variable to the correct program variable. 6) repeat with next line
  6. I think the first example could be overcome by deleting the file if it already exists. I think you are basically starting over with its data while reusing its name, right? For the 2nd example you might have to get more creative like copy "log.txt" to "_log.txt" and then delete "log.txt". Then open new file "log.txt" copy over the data from "_log.txt", then delete "_log.txt" and continue on working with "log.txt". Sounds pretty lame, but so is getting that error when its not really an error for you.
  7. So does the file successfully get updated with the open/write/close functions? I wonder if its picking up that "the file does indeed exist" but handling it in the fstream functions properly because of the modes given. I have heard some [i]cool[/i] things about Win32 API, maybe this is one of its [i]features[/i].
  8. Something to consider is when the circle is very small or very large. If it is very small and only takes up something like 10 pixels wide on the screen, you will have solved for many angles that have the same screen point. If the circle is very large on the screen, like 1000 pixels wide, you can end up with gaps where you would need to solve for non-integer angles in order to get a complete circle. This is assuming that you want to draw the circle on your screen. Here is some old C# code that I had used to draw circles on the screen. It scans both x and y axis to alleviate the gaps that can result when solving for only 1 axis. I think the code looks terrible, its been a while since I did this and I just threw it together in order to make it work. I thought it would be good to share. It uses a point on the circle to determine radius (because thats what my solution at the time called for), but it could easily be changed to a radius parameter. [code] private void DrawCircle(Vect2D center, Vect2D pointOn, Color drawColor) { Bitmap viewBitmap = new Bitmap(pictureBox_View.Image); int x, y; Vect2D v = new Vect2D(); v = pointOn - center; double r = v.Magnitude(); x = center.x - (int)r; // draw along x while (x < center.x + (int)r) { y = center.y + (int)Math.Sqrt((r * r) - (x - center.x) * (x - center.x)); if (x>=0 && x < viewBitmap.Width && y >= 0 && y < viewBitmap.Height ) viewBitmap.SetPixel(x, y, drawColor); y = center.y - (int)Math.Sqrt((r * r) - (x - center.x) * (x - center.x)); if (x >= 0 && x < viewBitmap.Width && y >= 0 && y < viewBitmap.Height) viewBitmap.SetPixel(x, y, drawColor); x++; } // draw along y y = center.y - (int)r; while (y < center.y + (int)r ) { x = center.x + (int)Math.Sqrt((r * r) - (y - center.y) * (y - center.y)); if (x >= 0 && x < viewBitmap.Width && y >= 0 && y < viewBitmap.Height) viewBitmap.SetPixel(x, y, drawColor); x = center.x - (int)Math.Sqrt((r * r) - (y - center.y) * (y - center.y)); if (x >= 0 && x < viewBitmap.Width && y >= 0 && y < viewBitmap.Height) viewBitmap.SetPixel(x, y, drawColor); y++; } pictureBox_View.Image = viewBitmap; } [/code]
  9. You can cut out the conversion here, since Pi/2 (radians) = 90 (degrees). [code] degrees = MathHelper.ToDegrees(pRot); degrees -= 90; pRotStrafe = MathHelper.ToRadians(degrees); [/code] [color="#1C2837"] [/color] [color="#1C2837"][size="2"]would become...[/size][/color] [color="#1C2837"] [/color] [color="#1C2837"][size="2"][code] pRotStrafe = pRot - Pi/2; [/code][/size][/color] [color="#1C2837"] [/color] [color="#1C2837"] [/color]
  10. If we make a couple of changes like saying that the difference between N1 and N2 is equal to the difference between N2 and N3 such that (lets call the difference here 'k'): n < n+k < n+k+k Then, N1 + N3 = (n + n + k +k) = 2n + 2k and 2*N2 = 2*(n + k) = 2n + 2k Then you could say that: 2n+2k = 2n+2k I just thought it was neat, but I wonder what the problem the OP's question came from.
  11. By the way, you can solve for k or t if you know both the initialPopulation and newPopulation along with one or the other of k or t. k = ln( newPopulation / initialPopulation ) / t; t = ln( newPopulation / initialPopulation ) / k; The function "ln(...)" is in the C++ header <cmath>. If the initial population is 6 billion, and we wonder [b]how long it will take[/b] to reach 15 billion at a growth rate of 1.2% then we are solving for t. t = ln ( 15,000,000,000 / 6,000,000,000 ) / 0.012 t = ln ( 2.5 ) / 0.012 t = 0.91629... / 0.012 t = 76.358 years If the initial population is 6 billion, and someone tells us that it will be 10 billion 50 years from now, what is the growth rate? Solving for k. k = ln ( 10,000,000,000 / 6,000,000,000 ) / 50 k = ln ( 1.666~ ) / 50 k = 0.5108... / 50 k = 0.0102 The growth rate would be 1.02%.
  12. Your form is close. I added the exponential growth formula to your code, its the one that prints 2nd. Notice the difference when you input something like 500 years (and then work each formula with that t value to see why its different) [quote] Enter year increment: 500 12106 12182 [/quote] Your form does something like this (using the provided values in your code) 1.005 to the power of t (number of years) multiplied by the initial population equals the new population. The exponential form does the following. Initial population multiplied by: 'e' to the power of (0.005 * t) equals the new population. I think your form is more intuitive, but since everything else uses newPop=initPop*e^(rate*time), I suggest that you use that. The 0.005 is your 'k' value above. It represents a percent as a decimal, that is 1% is the number 0.01. Your (birth-death)/initpop results in (24-19)/1000 = 0.005 so this is your k value, a population increase of 0.5% per year (t). Google up "Exponential Growth" to see more detail about it. This formula is used often enough that it is pretty handy to have memorized and understood. [code] int main(void) { double initpop=1000; double births=24; double deaths=19; double birthdeathrate=(births-deaths)/initpop+1; unsigned int population; int t; cout << "Enter year increment: "; cin >> t; population = initpop*(pow(birthdeathrate,t)); cout << population << endl; population = initpop*exp( (births-deaths)/initpop * t ); cout << population << endl; return 0; } [/code] Hope this helps!
  13. Look for the "standalone (or offline) redistributable". Here is one for 4.0: [url="http://www.technixupdate.com/net-framework-4-full-setup-offline-standalone-installer-offline-installers/"]http://www.technixupdate.com/net-framework-4-full-setup-offline-standalone-installer-offline-installers/[/url] They often use the web installer to save on content download, because the offline one needs to contain the files for the many combinations your clients might have (32 or 64 bit, Win Xp, Vista, or 7). Thankfully the 4.0 one I linked shows only 48.1 MB for the offline download, compared to 896 KB for the web installer. If they are getting your software from anywhere online though, they may end up downloading more data if you bundle the offline one. What about if they are current or newer than the requirements? The web installer will detect that.
  14. What are you using to view the source? I was able to locate this on line 6 of a standard Google search: <div id=resultStats>About 756,000,000 results<nobr> (0.14 seconds) </nobr>
  15. DirectX Terrain and a dirt path

    Maybe you could get a path finding algorithm and use it to follow the low points in the height map from two points. Modify the terrain geometry vertices where the path is found to make it more level, like a road - you might be able to 'paint' some average to the height map gray scale so that it generates the vertices for you. You should probably also alter the displayed texture based on the two dimensional coordinates of the path, so that it has a uniform color. The path finder could probably also be set with a height delta threshold so that it goes over some hills instead of strictly following the absolute lowest points (but I have never written any path finding so I can't tell you how). That might make for some interesting off-roads. It is going to be a lot of work whatever you do, but that is where I would start. Getting as far as you have, this should be doable.