• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=Dienes;44122909]Did you check that sizeof(Targa_Header) == 18? Just a wild guess here, but if the compiler adds padding to your struct, then you not only will read wrong data in the header, but in the end also access the file outside its boundaries, which might set the failbits.[/QUOTE] The Header's padding isn't a problem (I've rearranged the struct so it wouldn't happen) and its compensated for before I set the header. [thumb]http://i.imgur.com/s6cTNJl.png[/thumb] [thumb]http://i.imgur.com/1D8wGsC.png[/thumb] The fact that the 2nd one is brighter means it's working, but as you can see it abruptly stops there. I have a feeling it may be an input sequence that's triggering something strange in ifstream, but I'm not sure why that would be in iostream.
I asked before but it was for a different site. I want to do some data mining on Metacritic and was wondering if anybody could give me a decent project to do it on?
Since I don't wanna post the whole thing, I'll put a link to my problem. [url]http://answers.unity3d.com/questions/656051/photon-onphotonserializeview-syncing-objects-color.html[/url] Basically, I'm using Photon Cloud, for unity. And I'm not sure how to sync a player's color on join.
[QUOTE=Over-Run;44135231]I asked before but it was for a different site. I want to do some data mining on Metacritic and was wondering if anybody could give me a decent project to do it on?[/QUOTE] A "you might also like" thing would be nice, no idea if they have the data for that though.
The first thing I'd think of is the discrepancy between user and official ratings. After that you could do lots of things with it: try to find a correlation between the marketing budget of the publisher and the discrepancy, maybe make a bar graph that shows the amount of games with a large discrepancy per publisher, maybe compare the individual sites (IGN, GameSpot, all that crap) and see which one deviates the most from user ratings. Make sure to take into account the amount of user ratings though. You might want a lower bound, [URL="http://andrewgelman.com/2007/03/21/bayesian_sortin/"]or do fancy statistics if possible.[/URL]
[QUOTE=Tamschi;44140694]A "you might also like" thing would be nice, no idea if they have the data for that though.[/QUOTE] That's what my problem is, I'm not sure what data I can get or what I can do with it EDIT Also I'm doing a module on computer graphics this semester. We are going to be using OpenGL with C. Any good starting points people can recommend? Books or tutorials would be nice thanks
Im trying to code some winforms in monodevelop, but the window just comes out blank. Anyone know why this might be? [csharp] using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace FormTest { class Form1 : Form { public WebBrowser browser; public Form1() { browser = new WebBrowser(); browser.Navigate("https://www.google.co.uk"); this.Size = new Size(800,600); this.FormBorderStyle = FormBorderStyle.FixedSingle; browser.Location = new Point(0,0); browser.Size = new Size(800, 600); this.Controls.Add(browser); } } class MainClass { [STAThread] public static void Main (string[] args) { Application.EnableVisualStyles(); Application.Run(new Form1()); } } } [/csharp]
[QUOTE=Over-Run;44141959]That's what my problem is, I'm not sure what data I can get or what I can do with it [/QUOTE] Well you should first investigate what data you can get a hold off and then the things you could do with it will probably show up by themselves. Freshman physicists do this all the time with their lab reports. :v:
-snip-
I'm helping my friend with an intro computers course, he has to write a javascript form and take some input and do some calculations and show some output, do I just make an .html file and code in that and open it in a browser to see if it works?? Also how will I get the input from text boxes on a button click event? I've coded in C, Java and Python, I'm not afraid of javascript at all seems pretty simple, I just don't know how to code for it
Anyone know how to get a Fortran compiler running on Windows 7 x64? I can't find any binaries and I've never built a fortran compiler before...
[QUOTE=Number-41;44150219]Anyone know how to get a Fortran compiler running on Windows 7 x64? I can't find any binaries and I've never built a fortran compiler before...[/QUOTE] GCC has a Fotrtran compiler, so I'd assume MinGW has one too.
[QUOTE=bull3tmagn3t;44149824]I'm helping my friend with an intro computers course, he has to write a javascript form and take some input and do some calculations and show some output, do I just make an .html file and code in that and open it in a browser to see if it works?? Also how will I get the input from text boxes on a button click event? I've coded in C, Java and Python, I'm not afraid of javascript at all seems pretty simple, I just don't know how to code for it[/QUOTE] You can give names to the input boxes and you'll be able to access them from the script, for events, there are onClick events that'll trigger javascript code. It's very, very well documented around, just search for HTML 'scripting'.
[CODE]package catapult01; import java.util.Arrays; import java.util.Scanner; /** * * @author Cranberrysauce */ public class Catapult01 { /** * @param args the command line arguments */ static Scanner keyboard = new Scanner(System.in); public static void main(String[] args) { String[][] plane = new String[10][19]; //1. 0 0 0 0 0 0 0 0 0 0 //2. 0 0 0 0 0 0 0 0 0 0 //3. 0 0 0 0 0 0 0 0 0 0 //4. 0 0 0 0 0 0 0 0 0 0 //5 0 0 0 0 0 0 0 0 0 0 //6 0 0 0 0 0 0 0 0 0 0 //7 0 0 0 0 0 0 0 0 0 0 //8 0 0 0 0 0 0 0 0 0 0 //9 0 0 0 0 0 0 0 0 0 0 //10 0 0 0 0 0 0 0 0 0 0 // this.wait(how many milliseconds) // method to push int x = (int) (1 * Math.random() * 10); int y = (int) (1 * Math.random() * 10); Point myLocation = new Point(x, y); String dir; int count = 0; long seconds = 1000; //Store x and y in the direction while (myLocation != null) { Point temp = findTrajectory(plane, myLocation); printGrid(plane, myLocation); dir = choice(); myLocation = direction(plane, myLocation, dir); while (dir.equals("w") || dir.equals("a") || dir.equals("d") || dir.equals("s")) { printGrid(plane, myLocation); myLocation = direction(plane, myLocation, dir); count++; System.out.println(count); } try { //make sure we're synchronized with the test variable synchronized (myLocation) { //notify (unlock) the object myLocation.notify(); } } catch (Exception ex) { ex.printStackTrace(); } } System.out.println(""); } public static Point findTrajectory(String[][] plane, Point myLocation) { int x = myLocation.getX(); int y = myLocation.getY(); System.out.println("X " + y); System.out.println("Y " + x); for (int i = 0; i < plane.length; i++) { plane[x][y] = "*"; //start point for (int j = 0; j < plane[i].length; j++) { if (plane[i][j] == null) { plane[i][j] = "0"; } } } Point returnPoint = new Point(x, y); return returnPoint; } public static void printGrid(String[][] plane, Point myLocation) { for (int i = 0; i < 10; i++) { System.out.print("-"); for (int j = 0; j < 10; j++) { } System.out.print("|"); } System.out.println(); for (int i = 0; i < plane.length; i++) { for (int j = 0; j < plane[i].length; j++) { if (j == 0) { System.out.print("-"); } System.out.print(plane[i][j] + ""); } System.out.println(""); } } public static Point direction(String[][] plane, Point myLocation, String dir) { int x = myLocation.getX(); int y = myLocation.getY(); Point up = new Point(x - 1, y); Point down = new Point(x + 1, y); Point left = new Point(x, y - 1); Point right = new Point(x, y + 1); if (dir.equals("w")) { for (int i = 0; i < plane.length; i++) { plane[x - 1][y] = "*"; plane[x][y] = "0"; return up; } } if (dir.equals("a")) { for (int i = 0; i < plane.length; i++) { plane[x][y - 1] = "*"; plane[x][y] = "0"; return left; } } if (dir.equals("s")) { for (int i = 0; i < plane.length; i++) { plane[x + 1][y] = "*"; plane[x][y] = "0"; return down; } } if (dir.equals("d")) { for (int i = 0; i < plane.length; i++) { plane[x][y + 1] = "*"; plane[x][y] = "0"; return right; } } return null; } public static String choice() { String dir; System.out.println("W = up \n" + "S = down \n" + "A = left \n" + "D = right"); dir = keyboard.next(); if (dir.equals("w")) { return dir; } if (dir.equals("a")) { return dir; } if (dir.equals("s")) { return dir; } if (dir.equals("d")) { return dir; } return null; } } [/CODE] I'm trying to familiarize myself with objects. So I'm moving this star across this grid and want it to move almost like snake, so the user inputs the direction of where they want to go. How do I use the wait() method for it to work? Someone showed me threading and I thought that was really helpful! I just don't know if I can use it with what I have...
can someone explain to me what the fuck is going on here: [code] internal class Program { private class Wat { public Wat() { throw new Exception("how do i exception"); } } private static T FuckShitUp<T>() where T : new() { return new T(); } private static void Main(string[] args) { try { FuckShitUp<Wat>(); } catch(Exception e) { Console.WriteLine("fuck: " + e.Message); } } } [/code] somehow it's impossible to catch that exception when i use the FuckShitUp function, if i just do new Wat() it works fine [editline]7th March 2014[/editline] it only happens when throwing exceptions from the constructor, if you call a method that throws an exception like this it works fine: [code] internal class Program { private class Wat { public void Fuck() { throw new Exception("fucking exceptions"); } } private static T FuckShitUp<T>() where T : Wat, new() { T t = new T(); t.Fuck(); return t; } private static void Main(string[] args) { try { FuckShitUp<Wat>(); } catch(Exception e) { Console.WriteLine("fuck: " + e.Message); } } } [/code] [editline]7th March 2014[/editline] also this doesn't work: [code] internal class Program { private class Wat { public Wat() { throw new Exception("how do i exception"); } } private static T FuckShitUp<T>() where T : new() { try { return new T(); } catch(Exception e) { Console.WriteLine("fuck: " + e.Message); return null; } } private static void Main(string[] args) { FuckShitUp<Wat>(); } } [/code]
[QUOTE=Goz3rr;44159488]can someone explain to me what the fuck is going on here: [code] internal class Program { private class Wat { public Wat() { throw new Exception("how do i exception"); } } private static T FuckShitUp<T>() where T : new() { return new T(); } private static void Main(string[] args) { try { FuckShitUp<Wat>(); } catch(Exception e) { Console.WriteLine("fuck: " + e.Message); } } } [/code] somehow it's impossible to catch that exception when i use the FuckShitUp function, if i just do new Wat() it works fine [editline]7th March 2014[/editline] it only happens when throwing exceptions from the constructor, if you call a method that throws an exception like this it works fine: [code] internal class Program { private class Wat { public void Fuck() { throw new Exception("fucking exceptions"); } } private static T FuckShitUp<T>() where T : Wat, new() { T t = new T(); t.Fuck(); return t; } private static void Main(string[] args) { try { FuckShitUp<Wat>(); } catch(Exception e) { Console.WriteLine("fuck: " + e.Message); } } } [/code] [editline]7th March 2014[/editline] also this doesn't work: [code] internal class Program { private class Wat { public Wat() { throw new Exception("how do i exception"); } } private static T FuckShitUp<T>() where T : new() { try { return new T(); } catch(Exception e) { Console.WriteLine("fuck: " + e.Message); return null; } } private static void Main(string[] args) { FuckShitUp<Wat>(); } } [/code][/QUOTE] I copypasted your code to Visual Studio and it worked correctly - meaning it threw an exception. I had to add "using System;" though. The exception it throws is a System.Reflection.TargetInvocationException. Visual Studio 2012, .NET 4.5
[QUOTE=Goz3rr;44159488]can someone explain to me what the fuck is going on here: [code][/QUOTE] That's extremely stange. Try asking on Stackoverflow (and post a link to the question), maybe one of the language developers will read it. [editline]7th March 2014[/editline] [QUOTE=ThePuska;44159682]I copypasted your code to Visual Studio and it worked correctly - meaning it threw an exception. I had to add "using System;" though. The exception it throws is a System.Reflection.TargetInvocationException. Visual Studio 2012, .NET 4.5[/QUOTE] Interesting, that shouldn't happen if the bind succeeds since the generic call is usually direct. Maybe it's a weird visibility corner case. What does the decompiled program look like? [editline]7th March 2014[/editline] Ah! I know this one.
[QUOTE=ThePuska;44159682]I copypasted your code to Visual Studio and it worked correctly - meaning it threw an exception. I had to add "using System;" though. The exception it throws is a System.Reflection.TargetInvocationException. Visual Studio 2012, .NET 4.5[/QUOTE] which of the two did you try, and i know it's throwing exceptions (It doesn't throw a TargetInvocationException though) but i'm trying to catch them, VS2013 .NET 4.5 [img]http://puu.sh/7miR2.png[/img] [editline]7th March 2014[/editline] [QUOTE=Tamschi;44159723]That's extremely stange. Try asking on Stackoverflow (and post a link to the question), maybe one of the language developers will read it. [/QUOTE] [url]http://stackoverflow.com/questions/22254963/unable-to-catch-throw-from-constructor-in-generic-method[/url]
The call to the constructor isn't actually direct, since that's not possible in .NET. (You can't call a method of a generic type, only virtual ones one base types with restricted mutation up to the generic one.) It's actually branching on whether it's a class or value type and then invoking the constructor through reflection. [editline]7th March 2014[/editline] I think I posted about this before... [editline]7th March 2014[/editline] Here it is: [URL="http://facepunch.com/showthread.php?t=1323892&p=42961302&viewfull=1#post42961302"][C#] Generics: The new() constraint[/URL] That should answer your question. [editline]7th March 2014[/editline] I sec, going to repost that on Stack Overflow to reap a few points :v:
[QUOTE=Tamschi;44159773] That should answer your question. [/QUOTE] I'm not sure how, why is this preventing me from catching the exception
[QUOTE=Goz3rr;44159865]I'm not sure how, why is this preventing me from catching the exception[/QUOTE] I explained it a bit more explicitly on Stack Overflow just now, the gist is that VS doesn't complain about the exception being unhandled, it complains about the exception not being handled by [I]your[/I] code.
[QUOTE=Tamschi;44159983]I explained it a bit more explicitly on Stack Overflow just now, the gist is that VS doesn't complain about the exception being unhandled, it complains about the exception not being handled by [I]your[/I] code.[/QUOTE] I see, that makes much more sense. I'm not too sure how IL etc works so i assumed my try/catch would still handle whatever happened to it. It seems when i don't attach the debugger it will work fine and throw a exception that gets caught properly where the InnerException is the actual expression thrown. My guess is with the debugger attached it somehow decides that it is unhandled before reaching my try/catch I would upvote your stackoverflow post but i don't have enough reputation so have this informative rating instead
Hi everyone, I've got a slight problem with getting set up to make a game using C++ through CodeBlocks. I've made things in Java with Swing, but I don't see anything like that in C++ (I might just not be looking in the right places). Anyways, after doing some research I decided that I would like to use OpenGL for the project. I opened up the OpenGL sample in CodeBlocks but it was written in C. Some helpful people said I should look into GLUT (OpenGL utilities?) but I couldn't seem to find the correct download from the GLUT website, one was missing the library folder entirely, another was missing some file in the library that CodeBlocks seemed to need to create a GLUT project. Right now I'm just looking for basic drawing capabilities, some 2D polygons with text on them. However I do want to use shaders and the third dimension in the future. Does anyone here have any experience with this kind of thing? If so, could you explain to me how to set myself up?
Don't use GLUT, it's horribly outdated.
[QUOTE=Bumrang;44176336]Don't use GLUT, it's horribly outdated.[/QUOTE] What should I use then? Is there some easy to use OpenGL library that I can download and use?
[QUOTE=Killdozer;44177067]What should I use then? Is there some easy to use OpenGL library that I can download and use?[/QUOTE] [url=http://www.glfw.org/]GLFW[/url]
[QUOTE=esalaka;44177114][URL="http://www.glfw.org/"]GLFW[/URL][/QUOTE] Thanks! I downloaded version 3.0.4 and found a [URL="http://www.glfw.org/docs/latest/quick.html"]webpage [/URL]that offers some example code. But even though the I've included glfw3.h, the compiler does not recognize some functions like glfwSetWindowShouldClose(). I copy pasted the example code directly so I do not think that it is a code problem. I didn't see a lib directory anywhere, but the error is [CODE]undefined reference to 'glfwSetWindowShouldClose'[/CODE] which usually means that the library was not linked?
Can someone help me with out parsers and stuff? I'm writing a program for class about checking for expressions and he wants us to print error statements manually when it detects an error in this format "Line-number:char-number:“line”: ERROR: Error Description" What to do .... Also I am using a STACK ADT [editline]9th March 2014[/editline] It's java too*
[QUOTE=Killdozer;44177422] I didn't see a lib directory anywhere, but the error is [CODE]undefined reference to 'glfwSetWindowShouldClose'[/CODE] which usually means that the library was not linked?[/QUOTE] Did you download the binaries or the source package?
I'm trying to use the leap motion SDK with C#. I have added required .dll files to the project directory, but I am still unable to use them. Any ideas? Screen capture here: [url]http://i.imgur.com/iqwG6CD.png[/url]
Sorry, you need to Log In to post a reply to this thread.