• What Do You Need Help With? V6
    7,544 replies, posted
Sorry if it's a bit off topic, but it really doesn't need its own thread, and it's a bit related. Do any of you know any Lua MySQL library that will work with Lua 5.1.x? ( Being that Lua is very common around this forum, people assume it's for Garry's Mod, no, it's not ) I just want easier access to my cPanel without going through the trouble of logging in and stuff.
Like [url=http://www.keplerproject.org/luasql/manual.html]LuaSQL[/url]?
[QUOTE=ZeekyHBomb;43391778]Like [url=http://www.keplerproject.org/luasql/manual.html]LuaSQL[/url]?[/QUOTE] Ah, it's even Object Oriented, I'll give it a try. Thanks
[url]http://physics.stackexchange.com/questions/92087/how-does-this-formula-for-calculating-the-mass-sum-in-a-collision-translate-to[/url] Anyone who can help me with the question? The suggested formula seems to work well for the normal impulse, but it makes the friction impulse jitter a lot (which it shouldn't, at all).
[QUOTE=SleepyAl;43391364]Anyone here have any experience with AutoHotkey? Some background info to my problem: Where I'm working (it's more like volunteer work for the town but I get paid to do it), I've been asked to do some data entry since I'm "good with computers." The place I'm working at is switching their database of clients over from some weird-ass homemade program from the nineties that's really buggy and non-intuitive to a web client. The web client they're switching to isn't finished, and there's a problem where when you edit an entry it duplicates it, and they guy says it's going to take a while to fix, but in the meantime I can just put some new data into an empty field that was never used before in the old client and he'll just make it so when the new program populates the data it'll correct for that. Here's the problem: it's a shitload of tedious data entry that will take forever, and I know I can speed this up and get it done really fast, so I thought I'd give AutoHotkey a try. What I need to do is get the email addresses from an excel file and put them into the new program, but it's a really old program so I can't just import the data, and there's other quirks that are making this harder. Here's what I want to do: [CODE]Loop: Activate excel document. Get the next person's last name from excel document. (Click on a cell, double click on formula bar, copy) Activate Database Program. Hold backspace to clear any text typed in before the parsing since can't highlight and delete, 4 seconds should be enough. Type in last name that was copied from excel [B](cannot paste it, though, so have to parse each individual letter into a keypress {this is where I'm stuck!}), [/B] Double click on first result that should always be in a specific spot. Click on a specific spot. Activate Excel document again. Copy email address from cell next to the person's last name (click on last name, press right, double click on formula bar, copy, then click back on last name, press down, click on down arrow bar to move excel screen to make next last name at top) Activate Database program Click on another spot Paste in text. Click on another spot Repeat. End when empty string copied at any point.[/CODE] [B]I can do basically everything except parsing the last name string and getting a letter, typing it, parsing the next letter, typing it, and repeating until the name ends.[/B] That's what I need help with. I haven't done any coding since a java class in highschool, and that was very basic stuff. I know I probably need an array and some way to split this stuff into substrings, but I'm at a loss at what to do. At worst, I could just do this manually, but I'd rather get it done quick so I can get back to doing my regular stuff at my job. Any help would be greatly appreciated. You don't have to write the whole code, just help with that one spot I'm stuck on would be nice or at least giving me some clues on how to do that would be appreciated.[/QUOTE] Haven't used AHK in a while, but a quick search turned up the [url=http://www.autohotkey.com/docs/commands/LoopParse.htm]loop[/url] construct which operates on a string. For example, if your string is in LastName, you'd do something along the lines of: [code] Loop, parse, LastName { ; do something to generate keypress for whatever letter is in %A_LoopField% } [/code]
Im trying to implement phong shading, because at the moment my terrain isnt being given the correct normal values. Im using [cpp] for( int y = 0; y < SIZE; y++ ) { for( int x = 0; x < SIZE; x++ ) { glm::vec3 p1( x, NoisePP.Generate( x, y ) * 50, y ); mVertexList.push_back( p1 ); if( p1.x != 0 || p1.y != 0 || p1.z != 0 ) { mNormalList.push_back( glm::normalize( p1 ) ); } else { mNormalList.push_back( p1 ); } } } [/cpp] And using the normals as the RGB color draws like: [IMG]http://i.imgur.com/Z550SKM.png[/IMG] Is there anyway I can just take a vertex and do something like Normal(x, y+1) + Normal(x+1, y) + Normal(x, y-1) + Normal(x-1, y) rather than iterating over the hole plain?
Trying to compile with G++ but I'm not so sure winsock is included with G++.. Been googling this error but apparently im an idiot, lol. [thumb]http://puu.sh/67WUD.png[/thumb]
I've always wanted to know how to properly use headers and source files. I've never been to school for this so I am not sure what terms to search for. Using the C++ language. What I have been doing with my header is declaring classes, including namespaces, other headers that my class/namespace will use. Then in my source I've been defining my class methods followed by including the matching header. In main I just include whatever header I needed. So basically I've been doing: [code]// main.cpp #include "class.hpp" int main() { Class c("Hello World"); return 0; }[/code] [code]// class.cpp #include "class.hpp" Class::Class(string t) { cout << t + "\n"; }[/code] [code]// class.hpp #include <iostream> #include <String> using namespace std; class Class { public: Class(string t); };[/code] Can someone tell me how to do this the "RIGHT" way?
[QUOTE=P1raten;43400911]Trying to compile with G++ but I'm not so sure winsock is included with G++.. Been googling this error but apparently im an idiot, lol. [thumb]http://puu.sh/67WUD.png[/thumb][/QUOTE] Fixed this by replacing Cygwin with MinGW. MinGW.sublime-build [code] { "path": "c:\\MinGW\\bin\\", "cmd": ["mingw32-g++.exe", "-static", "-o", "$file_base_name", "$file", "-lws2_32", "-static-libgcc", "-static-libstdc++"] }[/code] The last 2 static parameters were added since without them I got the following error: [code]The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.[/code] Which is why I made them static instead.
[QUOTE=false prophet;43401230]I've always wanted to know how to properly use headers and source files. I've never been to school for this so I am not sure what terms to search for. Using the C++ language. What I have been doing with my header is declaring classes, including namespaces, other headers that my class/namespace will use. Then in my source I've been defining my class methods followed by including the matching header. In main I just include whatever header I needed. So basically I've been doing: [code]// main.cpp #include "class.hpp" int main() { Class c("Hello World"); return 0; }[/code] [code]// class.cpp #include "class.hpp" Class::Class(string t) { cout << t + "\n"; }[/code] [code]// class.hpp #include <iostream> #include <String> using namespace std; class Class { public: Class(string t); };[/code] Can someone tell me how to do this the "RIGHT" way?[/QUOTE] Don't do "using namespace *" in headers, because it will leak into implementation files including that header. And you need include-guards to prevent multiple definitions of the same symbol.
I am using include guards, I just forgot them in that quick example. Should I just be using namespaces in the source files then?
[QUOTE=false prophet;43401491]I am using include guards, I just forgot them in that quick example. Should I just be using namespaces in the source files then?[/QUOTE] The safest thing to do is not "using namespace"s at all. This would then require you to fully qualify any names:[cpp]std::cout << "foo" << std::endl;[/cpp]Using a namespace always means that you import all symbols from there into the global namespace, where they can freely collide with everything else, so you are nullifying the purpose of having a namespace in the first place. However, you can import names in a more selective manner:[cpp]using std::cout; using std::endl; // ... cout << "foo" << endl;[/cpp]Or in a scoped manner:[cpp]void bar() { using namespace std; cout << "foo" << endl; }[/cpp]Or, of course, a mixture of both.
[QUOTE=Rayjingstorm;43394772]Haven't used AHK in a while, but a quick search turned up the [url=http://www.autohotkey.com/docs/commands/LoopParse.htm]loop[/url] construct which operates on a string. For example, if your string is in LastName, you'd do something along the lines of: [code] Loop, parse, LastName { ; do something to generate keypress for whatever letter is in %A_LoopField% } [/code][/QUOTE] Thanks a ton, this works perfectly! This speeds up my workflow immensely.
While we're on the topic, I like the avoid using #include as much as possible in header files. Using your example, I would #include <iostream> in class.cpp, because that's where the functionality is needed. I also try to forward declare instead of including headers wherever possible, the most notable time this doesn't work is if you're deriving from a class. In that case, you must include the parent class' header file.
The topic of when to include headers and when to forward declare can become quite complex. There are some helpful posts by Herb Sutter that deal with this: [URL="http://herbsutter.com/2013/08/12/gotw-7a-minimizing-compile-time-dependencies-part-1/"]Minimizing Compile-Time Dependencies, Part 1[/URL] ([URL="http://herbsutter.com/2013/08/19/gotw-7a-solution-minimizing-compile-time-dependencies-part-1/"]Solution[/URL]) [URL="http://herbsutter.com/2013/08/19/gotw-7b-minimizing-compile-time-dependencies-part-2/"]Minimizing Compile-Time Dependencies, Part 2[/URL] ([URL="http://herbsutter.com/2013/12/31/gotw-7b-solution-minimizing-compile-time-dependencies-part-2/"]Solution[/URL]) [URL="http://herbsutter.com/2013/12/31/gotw-7c-minimizing-compile-time-dependencies-part-3/"]Minimizing Compile-Time Dependencies, Part 3[/URL]
I don't think this is the issue, but are you including <string>?
Are you sure that the code you showed is responsible for that? The error says that you are trying to assign a std::ofstream to another. What does loadFile() do? Are you implementing or deleting the copy-assignment for your class?
[QUOTE=bootv2;43412321]FileIO debugMSG1; Is declared outside of a function, inside of the FileIO class[/QUOTE] Are you saying your FileIO class has an instance of itself as a member? I don't see anything wrong in the code you posted so far. The error says that somewhere a std::ofstream is being assigned to another one. This happens when you do something like[cpp]FileIO lhs, rhs; lhs = rhs;[/cpp]which then calls the default copy-assignment operator, which tries to call operator=() on the std::ostream member of lhs. To find the place where this happens, you can delete the operator[cpp]FileIO& operator=(const FileIO&) = delete;[/cpp]and recompile. The new error should then point to the line where the assignment happens.
Been working with in java with jtables again. jTables have a built in feature to sort the rowws, which I am fairly glad that this is there. However it seems the table doesn't get updated with it's values at all. Example: Let's say Value5 is in row 5 and value1 is in row 1, sorting the table now when clicking a header results in Value5 being now in row 1. Now I want to get the value from row 1 from the current table, but I receive Value1 insted of Value5. I get the values from the table like this: [code] table.getModel().getValueAt(table.getSelectedRow(), 1) [/code] So I get the value from the second cell in the selected row. Possible to get the value from the now sorted table instead of the default one? Here to illustrate the problem: Sorted after online or offline, first row selected, outputs beyondthesummit (which was in row 1 before sorting) [IMG]http://i.imgur.com/u3iRvQ1.jpg[/IMG] [B]Edit:[/B] Actually fuck jTable all together! Created my own sorting algorithm and added new stuff (out of frustration) [img]http://i.imgur.com/aI6QfAz.jpg[/img]
-snip-
[QUOTE=diwako;43415513]Been working with in java with jtables again. jTables have a built in feature to sort the rowws, which I am fairly glad that this is there. However it seems the table doesn't get updated with it's values at all. Example: Let's say Value5 is in row 5 and value1 is in row 1, sorting the table now when clicking a header results in Value5 being now in row 1. Now I want to get the value from row 1 from the current table, but I receive Value1 insted of Value5. I get the values from the table like this: [code] table.getModel().getValueAt(table.getSelectedRow(), 1) [/code] So I get the value from the second cell in the selected row. Possible to get the value from the now sorted table instead of the default one? Here to illustrate the problem: Sorted after online or offline, first row selected, outputs beyondthesummit (which was in row 1 before sorting) [IMG]http://i.imgur.com/u3iRvQ1.jpg[/IMG][/QUOTE] This might help you: [url]http://stackoverflow.com/questions/6417018/retrieving-jtable-line-content-after-user-sorted-content-by-clicking-on-column[/url] Looks like the sorting is only done in the View and not in the underlying Tablemodel, and the usual approach to getting a row only works because they're the same when unsorted.
[QUOTE=Slipperss;43415991]Why won't this compile? I'm using a book on how to c++ and I've been over the code like 10 times now and I just can't spot the damn error. [code]#include <string> #include <iostream> using namespace std ; int main() { string text = "9" ; string term( "9 " ) ; string info = "Toys" ; string colour ; char hue[4] = { 'R', 'e', 'd' '\0' } ; colour = hue ; info = "Balloons" ; text += ( term + colour + info ) ; cout << endl << text << endl ; return 0 ; }[/code] the errors it gives me: [code]string.cpp: In function 'int main()': string.cpp:12:32: error: expected '}' before '\x0' char hue[4] = { 'R', 'e', 'd' '\0' } ; ^ string.cpp:12:32: error: expected ',' or ';' before '\x0' string.cpp: At global scope: string.cpp:13:2: error: 'colour' does not name a type colour = hue ; ^ string.cpp:15:2: error: 'info' does not name a type info = "Balloons" ; ^ string.cpp:17:2: error: 'text' does not name a type text += ( term + colour + info ) ; ^ string.cpp:18:2: error: 'cout' does not name a type cout << endl << text << endl ; ^ string.cpp:20:2: error: expected unqualified-id before 'return' return 0 ; ^ string.cpp:21:1: error: expected declaration before '}' token } ^ [/code][/QUOTE] First error, you're missing a comma, it should be; [code]char hue[4] = { 'R', 'e', 'd', '\0' } ;[/code] Second to fourth error, I can't actually see why it's complaining myself. They are declared as std::string so it shouldn't complain. However, see if fixing the first error solves the problem, it might just be that one error.
[QUOTE=Slipperss;43415991]Why won't this compile? I'm using a book on how to c++ and I've been over the code like 10 times now and I just can't spot the damn error. [code]#include <string> #include <iostream> using namespace std ; int main() { string text = "9" ; string term( "9 " ) ; string info = "Toys" ; string colour ; char hue[4] = { 'R', 'e', 'd' '\0' } ; colour = hue ; info = "Balloons" ; text += ( term + colour + info ) ; cout << endl << text << endl ; return 0 ; }[/code] the errors it gives me: [code]string.cpp: In function 'int main()': string.cpp:12:32: error: expected '}' before '\x0' char hue[4] = { 'R', 'e', 'd' '\0' } ; ^ string.cpp:12:32: error: expected ',' or ';' before '\x0' string.cpp: At global scope: string.cpp:13:2: error: 'colour' does not name a type colour = hue ; ^ string.cpp:15:2: error: 'info' does not name a type info = "Balloons" ; ^ string.cpp:17:2: error: 'text' does not name a type text += ( term + colour + info ) ; ^ string.cpp:18:2: error: 'cout' does not name a type cout << endl << text << endl ; ^ string.cpp:20:2: error: expected unqualified-id before 'return' return 0 ; ^ string.cpp:21:1: error: expected declaration before '}' token } ^ [/code][/QUOTE] Never worked with c++ but eh: [code] string.cpp:12:32: error: expected ',' or ';' before '\x0' [/code] Seems pretty clear to me? You missed a comma there.
[QUOTE=mobrockers;43415998]This might help you: [url]http://stackoverflow.com/questions/6417018/retrieving-jtable-line-content-after-user-sorted-content-by-clicking-on-column[/url] Looks like the sorting is only done in the View and not in the underlying Tablemodel, and the usual approach to getting a row only works because they're the same when unsorted.[/QUOTE] Thanks, for some reasons didn't see there was a new page in this thread. Well I "fixed" it when creating the table and added a new feature to it.
Okay so for an assignment I have to make a reddit app for Windows 8. I saw there is an API called RedditSharp that will make this way easier. I have never used an API before and was wondering how do I go about getting it working right? I have downloaded RedditSharp but I don't know what I'm meant to do really
Reddit's down right now. IS THIS YOUR FAULT
Whoops
Im looking into mapping a flat plane onto a sphere in order to achieve a planet, but only have to modify heights and such on the plane(Making it much easier to work with) Whilst looking around I found this SO question [url]http://gamedev.stackexchange.com/questions/45167/square-game-map-rendered-as-sphere[/url] in which the answer looks pretty much what I want to do. But im not really sure I understand the method that he used... Also in looking at the conversion of Cartesian-Spherical coordinates, what are inclination &#952;, azimuth &#966;? Im right in assuming the radius is the height? therefore the other 2 must be latitude and longitude right? Apparently populus used a similar method: [url]http://gamedev.stackexchange.com/questions/16317/geometry-system-of-populous-the-beginning[/url] if anyone has any information or mind helping me out it would be very much appreciated :)
Also, when creating a flat plane out of indexed vertices. How do you do UV mapping? Because if you have a 5x5 plane so 25 vertices the UV for a given vertice would need to be different deppending on what triangle it was part of. IE: [IMG]http://i.imgur.com/eiC5mNr.png[/IMG] Im not sure if this is a silly question, but my brain hasnt been doing so well latelly (damn cold)
[QUOTE=Richy19;43425976]Also, when creating a flat plane out of indexed vertices. How do you do UV mapping? Because if you have a 5x5 plane so 25 vertices the UV for a given vertice would need to be different deppending on what triangle it was part of. IE: [IMG]http://i.imgur.com/eiC5mNr.png[/IMG] Im not sure if this is a silly question, but my brain hasnt been doing so well latelly (damn cold)[/QUOTE] The UV doesn't need to be different, based on what triangle its part off in a flat plane.
Sorry, you need to Log In to post a reply to this thread.