• What Do You Need Help With? V6
    7,544 replies, posted
I'm trying to install the ZMQ::LibZMQ3 module for Perl, but where every other module I'll installed on Windows has gone smoothly, this one is throwing up the same errors whether I try to go through cpanm or the downloaded tarball. It's not strictly a programming problem, but I can't find what Windows wants installed to get around this to save my life. I'd just do it on a Linux box and be done with it if I had half a chance, but what I want to write with this would be something I'd largely be using on Windows machines anyway. I've attached the build error; this is after installed MinGW, which I had hoped would help. [CODE]cpanm (App::cpanminus) 1.5007 on perl 5.014002 built for MSWin32-x86-multi-thread Work directory is /.cpanm/work/1370964188.4120 You have make C:\Perl\c\bin\dmake.exe You have LWP 6.03 Falling back to Archive::Tar 1.80 --> Working on C:\Users\Jack\Downloads\ZMQ-LibZMQ3-1.12.tar.gz Fetching file://C:/Users/Jack/Downloads/ZMQ-LibZMQ3-1.12.tar.gz -> OK Unpacking ZMQ-LibZMQ3-1.12.tar.gz Entering ZMQ-LibZMQ3-1.12 Checking configure dependencies from META.yml Checking if you have Devel::CheckLib 0.4 ... Yes (0.99) Checking if you have ExtUtils::ParseXS 2.21 ... Yes (3.05) Checking if you have ExtUtils::MakeMaker 6.36 ... Yes (6.62) Checking if you have Devel::PPPort 3.19 ... Yes (3.20) Configuring ZMQ-LibZMQ3-1.12 Running Makefile.PL Cannot determine perl version info from lib/ZMQ/LibZMQ3.pm Probing environment variables: Probing libzmq via pkg-config ... 'pkg-config' is not recognized as an internal or external command, operable program or batch file. - No libzmq found... Probing zeromq3 via pkg-config ... 'pkg-config' is not recognized as an internal or external command, operable program or batch file. - No zeromq3 found... Detected the following ZMQ settings: + ZMQ_HOME = (null) + ZMQ_H = (null) + ZMQ_INCLUDES = (null) + ZMQ_LIBS = (null) + ZMQ_TRACE = (null) Can't link/include C library 'zmq.h', 'zmq', aborting. -> N/A -> FAIL Configure failed for ZMQ-LibZMQ3-1.12. See \.cpanm\build.log for details. [/CODE]
[code] - No zeromq3 found... Detected the following ZMQ settings: + ZMQ_HOME = (null) + ZMQ_H = (null) + ZMQ_INCLUDES = (null) + ZMQ_LIBS = (null) + ZMQ_TRACE = (null) Can't link/include C library 'zmq.h', 'zmq', aborting.[/code] You need to install zeromq (the C version). [editline]11th June 2013[/editline] [QUOTE=esalaka;40980044]If I know the semi-major axis, eccentricity, inclination, longitude of ascending node, argument of periapsis and the current true anomaly of a body orbiting another body on an inclined elliptical Kepler orbit how the fuck do I calculate its (X, Y, Z) position relative to the body it's orbiting? [editline]11th June 2013[/editline] To clarify, the body being orbited could be considered an "immobile" star (at the origin of the coordinate system) and the body orbiting it a planet. I want to know where the planet is in space if I know the parameters of its orbit and its current position along it.[/QUOTE] [url]http://downloads.rene-schwarz.com/download/M001-Keplerian_Orbit_Elements_to_Cartesian_State_Vectors.pdf[/url] Sounds like fun. [editline]11th June 2013[/editline] [url=http://smallsats.org/2013/01/17/state-vectors-r-v-from-orbital-elements/]This[/url] seems to be some Matlab code for the conversion.
So the node system works fine and all, it's very elegant. However, soon you'd be able to zoom in and out of nodes, and it would load the childed nodes. Zooming in isn't the problem, but how would I elegantly be able to handle zooming out? Preferably without having to also keep a reference to the parent node in each child node.
Note, when zooming in I simply draw all the child nodes of the point on which I've zoomed. When I zoom out of that node again, I need to draw the nodes that were previously there. Should I simply keep the previous nodes referenced, or is there a nicer way?
Yes, either keep the parent-node stored or keep a stack where you can push the nodes you're zooming into and then can simply pop to go to the previous one.
I created a graphic to help explain the problem I am having with opengl. For some reason all data except the position just refuses to be passed into the shader. Anyone have any idea? The graphic shows that my byte offsets and strides have to be correct. [IMG]http://i.imgur.com/1cxBnDH.png[/IMG] [CODE] /** * Set the vertices of this mesh. */ public void setVertices(Vertex[] vertices){ FloatBuffer vertBuff = BufferUtils.createFloatBuffer(vertices.length * 9); for(int i = 0; i < vertices.length; i++) { vertBuff.put(vertices[i].getElements()); } vertBuff.flip(); vertexCount = vertices.length; vertexSize = vertices[0].getElements().length * 4; vaoID = glGenVertexArrays(); glBindVertexArray(vaoID); vboID = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, vboID); glBufferData(GL_ARRAY_BUFFER, vertBuff, GL_STATIC_DRAW); System.out.println("VAO " + vaoID + " created. VBO " + vboID + " created and filled with " + vertBuff.capacity() + " elements."); glVertexAttribPointer(0, 3, GL_FLOAT, false, vertexSize, 0); // position glVertexAttribPointer(1, 4, GL_FLOAT, false, vertexSize, 12); // color glVertexAttribPointer(2, 2, GL_FLOAT, false, vertexSize, 28); // uv coordinates glEnableVertexAttribArray(0); // Disable our Vertex Array Object glBindVertexArray(0); // Disable our Vertex Buffer Object } [/CODE] EDIT: Figured it out, I wasn't enabling the vertex attributes before setting them. I heard somewhere this wasn't required anymore but I guess I heard wrong. [CODE] glEnableVertexAttribArray(0); // Enable the position attribute glEnableVertexAttribArray(1); // Enable the color attribute glEnableVertexAttribArray(2); // Enable the uv coord attribute glVertexAttribPointer(0, 3, GL_FLOAT, false, vertexSize, 0); // position glVertexAttribPointer(1, 4, GL_FLOAT, false, vertexSize, 12); // color glVertexAttribPointer(2, 2, GL_FLOAT, false, vertexSize, 28); // uv coordinates [/CODE]
How can we recognize O(n log n) or O(log n) complexity in code, I've got an exam later on today and I have trouble comprehending log times. A simple for loop would do with a bit of an explanation perhaps? Thanks. [editline]12th June 2013[/editline] Or just the condition that suffices O(log n)
You have logarithmic time complexity if your search space decreases to a fraction of its previous size with each step. In code, it often means that you're descending or ascending a tree (though this alone is not sufficient; the tree also has to be balanced). Binary search is a common logarithmic algorithm.
Thanks, now I get it.
I'm trying to do a 3D audio visualizer. What I need help with is finding out the easiest way to play music, get its samples, process them and display the result simultaneously. Have anyone here done that before?
Just today switched from windows to linux for the first time and now I even have trouble setting up code blocks (Comming from visual studio) could anyone help me out tonight a bit through steam/skype to set some things up ? Timezone gmt+1 so tonight will mean in about 5/6 hours.
[QUOTE=ArgvCompany;41018210]I'm trying to do a 3D audio visualizer. What I need help with is finding out the easiest way to play music, get its samples, process them and display the result simultaneously. Have anyone here done that before?[/QUOTE] Perhaps you can look at [url=http://projectm.sourceforge.net/]projectM[/url], an open-source audio visualizer.
I'm trying to write a noexcept version of the [URL="http://en.cppreference.com/w/cpp/algorithm/move"]std::move[/URL] algorithm like std::move_if_noexcept that would call either std::move or std::copy depending on whether it is safe to do so or not but i'm having trouble covering all the corner cases as depending on the output iterator used it may result in move construction or move assignment and I can't make assumptions about whether or not a type has both or not. This is the current function which is only safe if the output iterator results in move construction: [code]#include <algorithm> template <typename input_iterator, typename output_iterator, typename std::enable_if< std::is_nothrow_move_constructible< typename std::iterator_traits<input_iterator>::value_type >::value, int>::type = 0> output_iterator move_if_noexcept(input_iterator First, input_iterator Last, output_iterator Output) { return std::move(First, Last, Output); } template <typename input_iterator, typename output_iterator, typename std::enable_if< !std::is_nothrow_move_constructible< typename std::iterator_traits<input_iterator>::value_type >::value, int>::type = 0> output_iterator move_if_noexcept(input_iterator First, input_iterator Last, output_iterator Output) { return std::copy(First, Last, Output); }[/code] Actually I don't even think that this function is possible which is probably why it doesn't already exist. There's the output iterator tag but there's no guarantee on what it actually does. I can make do with a more specific function for what I actually need but I thought that i'd try the more general solution anyway.
The algorithm contains an assignment that I don't think can be optimized into a direct constructor call.
It depends on what the output iterator does. For example an std::back_insert_iterator will push_back and that will almost certainly be a move construction. Also I thought that maybe if you were crazy you could reimplement the whole function instead of relying on the std optimizations and just use std::move_if_noexcept but it seems like this isn't a solved problem at a larger scope either because move_if_noexcept only checks if move construction is noexcept so if you use it for assignment you can run in to an exception. You can only check for both if you're certain that the type will have both but it's not a particularly satisfactory general solution. Basically the problem is that you can't tell what is going to happen to an rvalue so you can't get compile time verification that it will be noexcept. Another thing i've noticed which seems quite obvious now is that move_if_noexcept will still give you a throwing move constructor if there is no copy constructor. If you actually require a non throwing move constructor to guarantee strong exception safety then you need to be more careful. C++ man... fuck.
I am having some depth buffer issues with cubemap FBO's in OpenGL and I am not quite sure what is causing them. Here is a torus, as it should look: [t]http://i.imgur.com/32TfIrk.jpg[/t] However, if you look closely in the cubemap reflection of the torus, it seems that depth testing is somewhat broken (faces of the other side of the torus appear in front of the torus): [t]http://i.imgur.com/yvhpsHJ.png[/t] [editline]15th June 2013[/editline] Nvm, figured it out. Needed to attach depth textures. How stupid of me, lol.
Been spending the afternoon trying to find a managed DirectX overlay library for GUI/drawing functionality, but can't for the life of me find any. Anything obvious I might have missed?
I need help motivating myself to program again, and especially get back into C++ and OGRE for my dissertation...which I haven't used for 2 years. :( Any suggestions appreciated, I just feel exhausted everyday and like I can't get started on anything.
Try another language.
How can I launch a thread with a method with template? (Using SFML) Here's my code [code] // "Draw" the blocks (vector) std::vector<Block> blocks; int row = 4; int colums = 15; float spacement = 2.5f; for (float i = 0; i < colums; i++) { Block block(sf::Vector2f(window.getSize().x / colums, 25), sf::Vector2f(i * window.getSize().x / colums + spacement, 100.f), sf::Color::Blue); spacement += 2.5f; blocks.push_back(block); // Collision threads sf::Thread thread(&<sf::CircleShape>Block::Collision, &ball); thread.launch(); } [/code] The compiler says: "error: expected primary-expression before '<' token" "error: expected primary-expression before '>' token"
[QUOTE=Jookia;41050566]Try another language.[/QUOTE] I need to focus around C++, gotta get in shape. :/ and last time I did that I ended up making a roguelike in Python *shudder*
[QUOTE=Cesar Augusto;41052565]How can I launch a thread with a method with template? (Using SFML) Here's my code [code] // "Draw" the blocks (vector) std::vector<Block> blocks; int row = 4; int colums = 15; float spacement = 2.5f; for (float i = 0; i < colums; i++) { Block block(sf::Vector2f(window.getSize().x / colums, 25), sf::Vector2f(i * window.getSize().x / colums + spacement, 100.f), sf::Color::Blue); spacement += 2.5f; blocks.push_back(block); // Collision threads sf::Thread thread(&<sf::CircleShape>Block::Collision, &ball); thread.launch(); } [/code] The compiler says: "error: expected primary-expression before '<' token" "error: expected primary-expression before '>' token"[/QUOTE] [cpp]&Block::Collision<sf::CircleShape>[/cpp] [editline]16th June 2013[/editline] It sounds kinda expensive to launch a thread per block to do collision checking.
[QUOTE=Philly c;41033939]It depends on what the output iterator does. For example an std:: will push_back and that will almost certainly be a move construction. Also I thought that maybe if you were crazy you could reimplement the whole function instead of relying on the std optimizations and just use std::move_if_noexcept but it seems like this isn't a solved problem at a larger scope either because move_if_noexcept only checks if move construction is noexcept so if you use it for assignment you can run in to an exception. You can only check for both if you're certain that the type will have both but it's not a particularly satisfactory general solution. Basically the problem is that you can't tell what is going to happen to an rvalue so you can't get compile time verification that it will be noexcept. Another thing i've noticed which seems quite obvious now is that move_if_noexcept will still give you a throwing move constructor if there is no copy constructor. If you actually require a non throwing move constructor to guarantee strong exception safety then you need to be more careful. C++ man... fuck.[/QUOTE] Just found out about the [url=http://en.cppreference.com/w/cpp/language/noexcept]noexcept operator[/url]. That should help you.
[QUOTE=ZeekyHBomb;41054449][cpp]&Block::Collision<sf::CircleShape>[/cpp] [editline]16th June 2013[/editline] It sounds kinda expensive to launch a thread per block to do collision checking.[/QUOTE] There's another way? I can't think in another way... :-/ However then how I launch a thread with a template for methods. Just for knowledge
[QUOTE=Cesar Augusto;41057712]There's another way? I can't think in another way... :-/ However then how I launch a thread with a template for methods. Just for knowledge[/QUOTE] I think what he means is that you should do them all in one thread or something like that.
[QUOTE=Cesar Augusto;41057712]There's another way? I can't think in another way... :-/ However then how I launch a thread with a template for methods. Just for knowledge[/QUOTE] You have some sort of logic tick, right? Just do it there. And the syntax I provided should work. If it does not, I'm going to need more information about the Block type (declaration) and the Collision function (signature).
[QUOTE=ZeekyHBomb;41055769]Just found out about the [URL="http://en.cppreference.com/w/cpp/language/noexcept"]noexcept operator[/URL]. That should help you.[/QUOTE] Thanks for that. I didn't know it existed but unfortunately I don't see how it applies to this problem. I ended up creating these functions: [code]#include <algorithm> #include <type_traits> #include <utility> template <typename type> inline constexpr typename std::conditional<std::is_nothrow_move_constructible<type>::value and std::is_nothrow_move_assignable<type>::value, type &&, const type &>::type move_only_if_noexcept(type &Type) noexcept { return std::move(Type); } template <typename type> inline constexpr typename std::conditional<std::is_nothrow_move_constructible<type>::value, type &&, const type &>::type move_construct_only_if_noexcept(type &Type) noexcept { return std::move(Type); } template <typename type> inline constexpr typename std::conditional<std::is_nothrow_move_assignable<type>::value, type &&, const type &>::type move_assign_only_if_noexcept(type &Type) noexcept { return std::move(Type); } template <bool Move> struct _move_only_if_noexcept; template <> struct _move_only_if_noexcept<true> { template <typename input_iterator, typename output_iterator> static output_iterator move(input_iterator First, input_iterator Last, output_iterator Output) { return std::move(First, Last, Output); } }; template <> struct _move_only_if_noexcept<false> { template <typename input_iterator, typename output_iterator> static output_iterator move(input_iterator First, input_iterator Last, output_iterator Output) { return std::copy(First, Last, Output); } }; template <typename input_iterator, typename output_iterator> output_iterator move_only_if_noexcept( input_iterator First, input_iterator Last, output_iterator Output) { typedef typename std::iterator_traits<input_iterator>::value_type type; return _move_only_if_noexcept<std::is_nothrow_move_constructible<type>::value and std::is_nothrow_move_assignable<type>::value>::move(First, Last, Output); } template <typename input_iterator, typename output_iterator> output_iterator move_construct_only_if_noexcept( input_iterator First, input_iterator Last, output_iterator Output) { typedef typename std::iterator_traits<input_iterator>::value_type type; return _move_only_if_noexcept<std::is_nothrow_move_constructible<type>::value>::move( First, Last, Output); } template <typename input_iterator, typename output_iterator> output_iterator move_assign_only_if_noexcept( input_iterator First, input_iterator Last, output_iterator Output) { typedef typename std::iterator_traits<input_iterator>::value_type type; return _move_only_if_noexcept<std::is_nothrow_move_assignable<type>::value>::move( First, Last, Output); }[/code] As far as I am aware they are properly functioning. I have my own tests but they aren't thorough. The first 3 are sort of like std::move_if_noexcept but they will only return an rvalue if it's noexcept and if there is no copy constructor to fall back to it's a compile time error, and of course they are varied on what kind of functionality you need out of it. The other 3 functions are the same idea applied to the move and copy algorithms. I'm not sure exactly what use the variants that check both construction and assignment are but i've included them anyway. Of course the root of the problem is that the compiler is not going to tell you if you're using these functions wrong. While it's slightly more obvious if you're using the first 3 wrong you need to be careful what your output_iterator is doing for the algorithms. The whole thing is pretty academic anyway. The chances of coming across a move constructor that can throw and does throw is pretty low, but since it is technically possibly if you want a robust solution you have to take it in to account. It's also a lot simpler to handle in a non generic situation.
Anyone know some good training programs to make in Visual Basic? Just to gather practice and better understand coding.
guys, bash script makes my head spin why is this while loop wrong [code]i=0 test="" while [ $i -lt $TGTCOL ]; do test+="a" i+=1 done[/code] $TGTCOL is 229, but it's only appending four "a"s to the string
[QUOTE=Ehmmett;41065257]i'm feeling really dumb right now but why isn't this working? [code]function love.load() res = 10 field = {} for x=1,res do for y=1,res do print(y,x) field[y][x] = math.floor(math.random(0,1)) end end end[/code] i'm making a 2d table called field, and i want to size it based on the variable "res", and populate it with random shit for now.[/QUOTE] You're treating field as a table of tables, but you never create those tables. (tables are not two-dimensional) Expanded your code reads something like this, note how we have never put a table into field[y] but we still try and use it as one. [code] local fields = {} local row = field[y] row[x] = blah [/code] You could create the table for each row in your outer loop, or you could index manually, something like... [code] for x = 1, 10 do for y = 1, 10 do field[x * 10 + y] = blah end end [/code] [editline]17 June 2013[/editline] Why the hell do comments disappear in code blocks?
Sorry, you need to Log In to post a reply to this thread.