• What Do You Need Help With? V6
    7,544 replies, posted
How to write mathematical symbols and greek letters like alpha,beta,gamma.. in fast way, inside Visual studio that is? I know that I can copy/paste characters from character map but that is sloooow. Does anything like that exists for instant input or something? Thanks :)
[QUOTE=HeatPipe;44767599]How to write mathematical symbols and greek letters like alpha,beta,gamma.. in fast way, inside Visual studio that is? I know that I can copy/paste characters from character map but that is sloooow. Does anything like that exists for instant input or something? Thanks :)[/QUOTE] You could write a simple Macro for that. Means if "/alpha" is detected, delete it and make "α" Pretty simple to implement: Global Keyhook, check keys, SendKeys Or you use an existing Application
I have to pull from SQL and put that into my GUI view in Java My prof recommended using a JTextArea since we don't have a lot of time left, but I'm curious how much harder it would be to use a JTable. I'd like to use a JTable but I'm not really sure how I'd set it up so it not only displays the SQL table but also lets you add/remove stuff from the SQL table and reflect that
[QUOTE=HeatPipe;44767599]How to write mathematical symbols and greek letters like alpha,beta,gamma.. in fast way, inside Visual studio that is? I know that I can copy/paste characters from character map but that is sloooow. Does anything like that exists for instant input or something? Thanks :)[/QUOTE] I remember there was a guy in waywo who made an app to replace +STUFF text with custom character sequences, i think it was called MathChars. I'll tell if i find it again.
[QUOTE=Tamschi;44753499]I think the "smart" == stuff in JS is just for primitive types.[/QUOTE] It checks if its the same objects, not if the object is the same. Its like comparing an object in C you're comparing the pointer and not the content.
I'm trying to get started with GLFW following the tutorial at open.gl but I can't get past making the initial context without it resulting in the console outputting "Segmentation fault: 11". So far I have the following code: [code]#include <GLFW/glfw3.h> int main() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", NULL, NULL); // Windowed //GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", glfwGetPrimaryMonitor(), nullptr); // Fullscreen glfwMakeContextCurrent(window); while(!glfwWindowShouldClose(window)) { glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; }[/code] I've been trying to work on the project through the Xamarin Studio IDE because I've been using it for learning C# and have become familiar with the interface, but that shouldn't affect much. Any ideas? [editline]11th May 2014[/editline] It does work if I don't include: [code] glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);[/code] But I feel like that will just cause problems down the line
You need this, I think: glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
[QUOTE=HiddenMyst;44779107] [code] glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);[/code][/QUOTE] [code] glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); [/code] this should be it. Somehow my graphicscard/chip in my notebook is fried... now i have to stick with HD4000 only on GL 3.3 instead of 4.x :( I am not even sure how i could fry it ...
Does C# have a way to hide a variable from view in the editor/intellisense if that variable is null? Essentially I want to have: [code] public class base{ Foo foo; Bahh bahh; public base(){ foo = new Foo(); } } [/code] Then [code] public class child : base{ void something(){ //foo is suggested to the user but bahh isnt } } [/code]
[QUOTE=ECrownofFire;44779870]You need this, I think: glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);[/QUOTE] [QUOTE=Pappschachtel;44780050][code] glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); [/code] this should be it.[/QUOTE] That did the job, thanks guys!
[QUOTE=Richy19;44780060]Does C# have a way to hide a variable from view in the editor/intellisense if that variable is null? Essentially I want to have: [code] public class base{ Foo foo; Bahh bahh; public base(){ foo = new Foo(); } } [/code] Then [code] public class child : base{ void something(){ //foo is suggested to the user but bahh isnt } } [/code][/QUOTE] How would the editor know if the variable is null? It has no way of knowing when that function will be called, so it can't know the state of variables outside of it.
Playing around in Flash AS3, trying to get persistence. I have a "complex" class, Abstract_Inventory, I am trying to save. I've looked around and found the registerClassAlias and how it's supposed to fix everything, but it doesn't work for me. The class being loaded is either null, or can't be cast back to its class. The class: [code]package { public class Abstract_Inventory { public static var allItems = new Array(); public var testValue = 7; public var items = new Array(); public function Abstract_Inventory() { // Constructor } public static function registerItem(inName:String, dispName:String, value:int, callback:Function) { allItems[inName] = [dispName, value, callback]; } public function addItem(inName:String, count:int=1):void { if (allItems[inName] == undefined) return; if (items[inName] == undefined) { // Create an instance of this object. var item = new Abstract_InventoryItem(inName,allItems[inName][0],allItems[inName][1],allItems[inName][2]); items[inName] = item; } (items[inName] as Abstract_InventoryItem).addCount(count); } public function removeItem(inName:String, count:int=1):void { if (items[inName] == undefined) return; (items[inName] as Abstract_InventoryItem).remove(count); if ((items[inName] as Abstract_InventoryItem).stack <= 0) { delete items[inName]; } } public function consumeItem(inName:String):void { if (items[inName] == undefined) return; (items[inName] as Abstract_InventoryItem).consume(); if ((items[inName] as Abstract_InventoryItem).stack <= 0) { delete items[inName]; } } } }[/code] And then the relevant loading code. This is all initiated on the first frame of the timeline, rather than in any class: [code] // Initialize all variables // First, the save/load var saveLoad = SharedObject.getLocal("test"); // Next, the class aliases registerClassAlias("Abstract_Inventory",Abstract_Inventory); registerClassAlias("Abstract_InventoryItem",Abstract_InventoryItem); // Persistent variables //var inventory = (saveLoad.data.inventory == undefined) ? new Abstract_Inventory() : Abstract_Inventory(saveLoad.data.inventory); var inventory = (saveLoad.data.inventory == undefined) ? new Abstract_Inventory() : (saveLoad.data.inventory as Abstract_Inventory); //var inventory = new Abstract_Inventory(); trace(inventory); if (inventory != null) { trace(inventory.testValue); } // Functions function saveGame():void { saveLoad.data.inventory = inventory; saveLoad.flush(); notify("Game saved."); trace("saved data size: "+saveLoad.size+" bytes."); } function resetGame():void { inventory = new Abstract_Inventory(); notify("Game reset."); }[/code] What I'm doing to test this is, I first launch the game, Reset to make sure I have a valid Inventory object, and then Save it. When I first launch, the traces tell me it is null. After resetting and saving, I close the game and launch again, but the traces tell me it is still null! Anyone have any ideas why this isn't working, and how to make it work? Everywhere I've looked on the Internet says this is all you need to do, but obviously, I'm missing something. Also note I have other unrelated variables that I am saving and loading with this same saveLoad object that works fine, using the same ternary operator scheme, so I don't think it is a matter of the saveLoad object itself, or the timing of calling all of this.
-snip- Turns out NetBeans wasn't building anything for some reason even when I used clean and build. Restarting fixed it
[QUOTE=Richy19;44780060]Does C# have a way to hide a variable from view in the editor/intellisense if that variable is null? Essentially I want to have: [code] public class base{ Foo foo; Bahh bahh; public base(){ foo = new Foo(); } } [/code] Then [code] public class child : base{ void something(){ //foo is suggested to the user but bahh isnt } } [/code][/QUOTE] You can't hide it conditionally, but you can use a property instead and hide that unconditionally with the [URL="http://msdn.microsoft.com/en-us/library/system.componentmodel.editorbrowsableattribute%28v=vs.110%29.aspx"]EditorBrowsable attribute[/URL].
Anyone tried to access the full music library and playing songs from it? Can't find any real, conclusive answer for it :f
[QUOTE=Arxae;44784107]Anyone tried to access the full music library and playing songs from it? Can't find any real, conclusive answer for it :f[/QUOTE] Full music library of what?
THIS IS BUGGING THE SHIT OUT OF ME. I HATE THIS. [code] for (vector<string>::iterator it = lines.begin(); it != lines.end(); it++) { for (int column = 0; column < lines[0].size(); column++) if(strcmp((*it).at(column), " "); // delete space where space is }[/code] lines is a vector of a grid. I'm trying to remove the spaces from anywhere in the grid. I can't use strcmp becuase it says argument of type 'char' is incompatible with parameter type 'const char*' why does this happen why can't i use strcmp on two fucking strings
The first argument you're passing is a single character, not a string. strcmp is for comparing strings (you should be using == for that anyway), not chars and strings. Try if(it->at(column) == ' ')
Thanks, that works. [editline]11th May 2014[/editline] Now I don't know how to erase that element from the vector. I've been doing this shit for years and I can't do this. I hate getting bogged down trying to do simple stuff. :|
[QUOTE=NixNax123;44785088]Now I don't know how to erase that element from the vector. I've been doing this shit for years and I can't do this. I hate getting bogged down trying to do simple stuff. :|[/QUOTE] Maybe try another language? I don't know. Doesn't std::vector provide an erase method? Although you can't use it since it invalidates the iterators you're using, unless you change to an std::list.
I just need a resource with lots of small challenges that build my experience in c++ that I can do every day. Does anyone have a suggestion for me?
[QUOTE=NixNax123;44786571]I just need a resource with lots of small challenges that build my experience in c++ that I can do every day. Does anyone have a suggestion for me?[/QUOTE] The Book C++ Early Objects [url]http://eembdersler.files.wordpress.com/2011/07/c_early.pdf[/url] The programming challenges are at the end of every chapter
[QUOTE=NixNax123;44785064]THIS IS BUGGING THE SHIT OUT OF ME. I HATE THIS. [code] for (vector<string>::iterator it = lines.begin(); it != lines.end(); it++) { for (int column = 0; column < lines[0].size(); column++) if(strcmp((*it).at(column), " "); // delete space where space is }[/code] lines is a vector of a grid. I'm trying to remove the spaces from anywhere in the grid. I can't use strcmp becuase it says argument of type 'char' is incompatible with parameter type 'const char*' why does this happen why can't i use strcmp on two fucking strings[/QUOTE] Behold, the magic of C++11 and <algorithm>! [cpp] for(auto& str : lines) { str.erase(std::remove_if(str.begin(), str.end(), ::isspace), str.end()); } [/cpp] Basically remove_if takes in the string and the C function isspace(). It goes through the string, calling isspace() on each of them, and if it returns true, it moves them to the end of the string, and returns an iterator to where the end "should" be. Then, str.erase() simply removes the spaces that are now at the end of the string. I think you could replace ::isspace with [](ch) { return ch == ' '; }
[QUOTE=Tamschi;44784727]Full music library of what?[/QUOTE] Taught i mentioned that, looks like i didn't :suicide: Windows Phone 8.1 (don't judge :P)
Ok, so I've gotten a bit further through [url]http://open.gl/drawing[/url] but now I'm getting the following compile error: [quote]Undefined symbols for architecture x86_64: "_glDrawArrays", referenced from: _main in main.o[/quote]
[QUOTE=HiddenMyst;44788353]Ok, so I've gotten a bit further through [url]http://open.gl/drawing[/url] but now I'm getting the following compile error:[/QUOTE] I'm just making a uneducated guess but are you using 64-bit GLEW?
[QUOTE=Asgard;44788741]I'm just making a uneducated guess but are you using 64-bit GLEW?[/QUOTE] To be honest, I don't know. I just grabbed whatever was available from the brew repository.
Judging by the underscores I'd guess it's a linker error caused by linking against a 32-bit library as well. Underscores aren't used in 64-bit x86 ABIs. This is not useful knowledge, but it's knowledge anyways.
Ok I tried running the linker with -v for a little more info and I still don't see what's directly causing the problem: [quote]g++ -o "/Users/Milo/Projects/OpenGLTest/OpenGLTest/bin/Debug/OpenGLTest" "/Users/Milo/Projects/OpenGLTest/OpenGLTest/bin/Debug/main.o" -L/usr/local/Cellar/glew/1.10.0/lib -L/usr/local/Cellar/glfw3/3.0.4/lib -lGLEW -lglfw3 -v Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o /Users/Milo/Projects/OpenGLTest/OpenGLTest/bin/Debug/OpenGLTest -L/usr/local/Cellar/glew/1.10.0/lib -L/usr/local/Cellar/glfw3/3.0.4/lib /Users/Milo/Projects/OpenGLTest/OpenGLTest/bin/Debug/main.o -lGLEW -lglfw3 -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a Undefined symbols for architecture x86_64: "_glDrawArrays", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)[/quote]
Anyone have some experience in creating Android apps? So far I've set up eclipse with the android SDK, created an AVD which I can start. Yet when ever I run the Project as Android Application nothing happens. Anyone got an idea?
Sorry, you need to Log In to post a reply to this thread.