Binpress components 2012-07-24T08:50:35+00:00 Zend_Feed_Writer http://www.binpress.com Binpress contact@binpress.com http://www.binpress.com <![CDATA[nginx socketlog module - C/C++ | Performance]]> 2012-07-24T08:50:35+00:00 2012-07-24T08:50:35+00:00 http://www.binpress.com/app/nginx-socketlog-module/1030 Valery Kholodkov noreply@binpress.com http://www.binpress.comdev/profile/461 An nginx module for logging http requests via TCP into syslog servers.This is a high-performance nginx module for logging http requests via TCP into syslog. Ever wanted to centralize your log files on one machine or organize your logfiles better? This module is for you! Smooth integration of this module with nginx server gives the best performance possible. This module links together a fast web server with a well-know and verified logging server. Main advantages of this module: you can define multiple log destinations (syslog servers) restarting nginx in order to rotate logs is not required anymore! The module keeps persistent connections to syslog servers and reconnecting if necessary. Once the connection is dropped, the module accumulates log messages in a queue. Once the connection goes up again, the modules flushed accumulated data into the servers. This means that you can restart logging server, without worrying about nginx! The module keeps persistant connections to BSD syslog servers, reconnecting if necessary. Developed and tested with nginx version 1.3.x, might work with earlier as well. <![CDATA[GTK+ Widget State Manager - C/C++ | System & Frameworks]]> 2012-07-15T09:09:55+00:00 2012-07-15T09:09:55+00:00 http://www.binpress.com/app/gtk-widget-state-manager/1008 Richard Ivor noreply@binpress.com http://www.binpress.comdev/profile/12612 A GTK+ Widget State Manager (WSM) that elegantly handles all Management of Widget States (Visible, Editable, or Sensitive) based on the User Interface state of a GTK+ GUI application.The Problem Graphical User Interfaces are notoriously tricky and difficult to program: so much information to keep track of, events that must be handled, anticipating user actions, keeping all widgets properly updated, etc. One aspect of good UI design is maintaining an accurate and consistent relationship between the User Interface state (at any given moment) and how all widgets should be presented when any given UI state is "active". However, keeping this relationship well-behaved, consistent, and always accurate is a non-trivial exercise in programming GUI applications. And, worse still, when the total number of states and total number of widgets that must be managed is large, the problem increases dramatically in scale and complexity. But why must this be so? Isn't there an easy way to handle this situation without all the work and pulling-of-hair that normally comes with it? The Solution With the GTK+ Widget State Manager (WSM) maintaining this relationship is made easy, logical and obvious. Now, instead of having to keep track of what you need to do to every widget at every UI state change, simply call the WSM routine to invoke the new UI state and all widgets are updated automatically, guaranteeing consistency and accuracy 100% of the time. Functionality You do this by registering each widget needing to be managed (at widget creation) with the WSM library, defining exactly how the widget should appear for each defined UI state. As delivered the WSM allows control of the following widget state settings: Visible - wsm_assign_visible() Editable - wsm_assign_editable() Sensitive - wsm_assign_sensitive() Features Any widget having the concept of visibility, editibility, and/or sensitivity is handled UI states are defined per application at design time, i.e., they are fully descriptive for proper implementation of widget details during the coding phase. Ease-of-Use: Widgets are registered once at creation, and may also be de-registered, if this is needed No need to keep track of the previous state Adding new widgets in the future as the application evolves is simply a matter of registering the widget, as per UI state specifications require, and you're done. Changing a UI state is done by simply calling: wsm_set_UIState( WSM_UISTATE_**APP-STATE** ) Advantages Logical and Easy to Implement Implementing into pre-existing code is straight-forward What was once a head-ache is now simple and easy You will gain a deeper understanding of your application, its behaviours and how these relate to end-user interactions. Extensibility: Widget settings other than the three provided can be added to the library quite easily. This extends, then, any other widget-related behaviour(s) having a relationship to a GUI's display state. Code Base is very small, thus, quite easy to adapt. Either by adding language bindings for GTK+, or even adapting to other toolkits, e.g., Qt. Deliverables: Source Code, Header Files, and makefile to create the wsm.a library archive Registration functions to handle widget visibility, editibility, and sensitivity Complete Documentation describing all aspects of how to use the library, detailed instructions to create new registration functions, etc. A GUI example implementation demonstrating 4 different UI states, how to register widgets and how to set the UI states. Target Users: All GTK+ developers interested in having precise control over widget states and their relationship to UI states. Technical Requirements: Up-to-date C compiler GTK+-2 installed. Gtk+-2 is standard on all *NIX platforms and should not be an issue. Installation: Library is provided as a single file source code (plus header files) for compilation. Makefile is provided to create an archive named wsm.a, to be used when linking the final program. <![CDATA[U-Streams - C/C++]]> 2012-07-10T13:32:23+00:00 2012-07-10T13:32:23+00:00 http://www.binpress.com/app/ustreams/1000 Richard Ivor noreply@binpress.com http://www.binpress.comdev/profile/12612 A C library to intercept and redirect UNIX stdin, stdout & stderr streams to multiple destinations. An unlimited number of user-defined write streams may also be created for multiple destination output and onward processing.U-Streams Library The Problem UNIX and its variants provide only stdout and stderr as standard write streams available to fprintf(). When wanting to direct messages elsewhere, it is necessary to make other arrangements for output; either via a command-line redirect, through internal management within a program itself, or some other (most-likely) non-trivial method (think pipes and sockets). Modern systems, however, are very often required to send messages to multiple destinations, e.g., a disk-file, a database logger, alert and monitoring systems, auto-updating web-sites, UI displays, e-mail and twitter accounts, other programs, and the list goes on. When multiple destinations are necessary for the same message, this message needs to be duplicated for each destination, making coding annyoing, repetitive, and increasingly difficult to manage. But what if there were a way to write a message just once in your program, while elsewhere it can be handled and forwarded to any number or kind of destinations without headache? And wouldn't it be even nicer to be able to use newly named write streams that allow message type deliniation through more than just the two standard streams provided? For example, why not extend the standard stream concept to include stdInfo, stdWarn, and stdDbug? The Solution With this C source code library, a programmer can now: Redirect stdin, forwarding all incoming messages to your registered callback handler. Redirect stdout and stderr to multiple destinations, without having to rewrite any of your fprintf() statements. Create new streams that behave identically to stdout and stderr, using the new stream name directly, just like the standard streams. Define and register your own call-back routines, per stream, for program-specific handling of every message. Features: Unlimited number of new streams may be created Unlimited number of callbacks may be registered per stream (and de-registered) Registration and De-Registration of callbacks can be made at any point in your program; that is, they may be turned on and off throughout the course of a program's execution. Caller can define and set the message delimiter, per stream Works with background programs or GUI programs equally well stdout and stderr streams originating from other libraries included in your program are also intercepted. For example, all MySQL error messages are sent through stderr and so could be intercepted by this library. This provides the opportunity for the programmer to act on these messages directly and immediately. For example, when receiving a crashed table message, your program could parse this message and automatically issue a repair table command, alleviating the user from having to do this themselves. Works especially well when forking a program. Since all file descriptors are inherited by the child, all messages written by the child will be processed by the same callback routine, guaranteeing single concurrancy of message processing, i.e., no collisions regardless the number of children demanding attention. It Is Extensible: In general, new streams can be created to be used as a channel to transmit anything to go anywhere and/or do anything. Example 1: Streams may also be created and used for other purposes. For example, counting an occurance of something, where this occurance happens in multiple locations of your code. In this situation, the callback maintains the system-wide counter, and can then carry out any necessary actions when the counter reaches a certain value. For example, a server program listening for client connections where connection management of all clients is a concern. Example 2: A new stream can be created that is responsible for executing one of many known tasks, essentially becoming a channel of "work". That is, anywhere in the program where a separate task must be performed, simply send a message through the stream and let the callback be reponsible for all logic and subsequent task execution. Example 3: And turning the concept around, it's possible to create streams not by message type, but by destination type. So, a stream may be designated to send information through the channel directly to a Database, a web-site, a twitter account, a UI display screen, a disk file, another program, a work queue, etc. Creating a new stream is as simple as: Define the new stream name, in ustreams.c Add the extern declaration to ustreams.h file Add an equivalent USTREAMS_STREAM enum anywhere in the current list of known streams, in ustreams.h Add one line to the initialisation routine creating the stream itself, in ustreams.c Re-Compile the library Write the callbacks to handle the new stream's output New stream is now available for use everywhere in your program Advantages: Retrieve and process all stdin messages as a simple callback Never have to deal with having to manage FILE* pointers, pipes, sockets, etc. directly in your app code ever again As new output requirements come to exist, no need to re-write existing code, just write a new callback handler. fprintf() now becomes a powerful tool of information transmission and routing; no longer just a statement to print a string All logic associated with data of a stream is now centrally located and fully de-coupled from your program at-large Using the stdDbug stream now simplifies necessary debugging statements. Write all your debug statements, and when you don't need the output, simply don't register a callback. And, since dynamic registration and de-registration of callbacks per stream is possible, it is trivial to isolate only those sections of the code requiring debug output for any given execution. Ideal for large systems employing many libraries and/or having a large code base. Because it's so easy to use/implement: If used during the Design Phase, new algorithms and solutions are now available, and trivial to implement. Deliverables: Source Code, Header Files, and makefile to create the ustreams.a library archive New streams stdInfo, stdWarn, and stdDbug provided for Complete Documentation describing all aspects of how to use the library, detailed instructions to create new streams, examples of extensibility, A completed example implementation (skinny version below) demonstrating how to forward messages to: Multiple Disk Files A Database Email Addresses or Twitter Accounts Target Users: All UNIX/C developers interested in having precise control over program messages, their destinations, and any possible follow-on actions. Any programmer wishing to extend the concept of a write stream beyond using it simply for string messages; the possibilities are limitless. Technical Requirements: Up-to-date C compiler GTK+-2 installed on computer (though programming in GTK+-2 is not a requirement, everything is internalized). Gtk+-2 is standard on all *NIX platforms and should not be an issue. Installation: Library is provided as a single file source code, a header file, and externs header file for compilation. Makefile is provided to create an archive named ustreams.a, to be used when linking the final program. <![CDATA[nginx redislog module - C/C++ | Performance]]> 2012-07-07T11:15:41+00:00 2012-07-07T11:15:41+00:00 http://www.binpress.com/app/nginx-redislog-module/998 Valery Kholodkov noreply@binpress.com http://www.binpress.comdev/profile/461 An nginx module for logging http requests into Redis database.This is a high-performance nginx module for logging http requests into Redis database. Turn your Redis database into log file storage using this module! Ever wanted to centralize your log files on one machine or organize your logfiles better? This module is for you! Redis is a simple yet fast database server that perfectly fits for storing log files. This module links together a fast web server with a fast database server: you can define multiple log destinations (redis servers) you can configure the module to keep daily, hourly, as well as monthly and yearly log files any nginx variable can be used as log file name (e.g. domain, subdomain, location, etc) restarting nginx in order to rotate logs is not required anymore! The module keeps persistant connections to Redis database servers, reconnecting if necessary. Developed and tested with nginx version 1.3.x, might work with earlier as well. <![CDATA[Dynamic Mesh - C/C++]]> 2012-06-19T14:46:09+00:00 2012-06-19T14:46:09+00:00 http://www.binpress.com/app/dynamic-mesh/976 Dale Thomas noreply@binpress.com http://www.binpress.comdev/profile/10360 A highly optimised dynamic mesh classA mesh is made up of vertices, edges and faces. If the mesh is static and not going to change, we can get away with just storing the vertices and a list of faces, which index into the vertex array. This does away with edges all together and is well suited to rendering on graphics hardware. However, if we desire to perform operations on the mesh that will change the connectivity and structure, then we need to store the information in a data structure that will allow us to quickly traverse points, edges or faces. The halfedge structure is one such structure (among many) that will give us the versatility we need. Thsi dynamic mesh class uses a half edge data structure for fast mesh operations such as split, collapse and rotate edges. It comes with a very useful 3D vector class and also has functions for loading and saving in obj format. It is an ideal starting point for applications such as: Virtual clay modelling tool like mudbox/sculptris Fluid simulation surface tracking Artificial morphogenesis simulation Surface extraction (point sets, implicit surfaces, MRI data, etc) Retargeting meshes 3D morphing Creating meshes for FEM/BEM analysis View dependent level of detail: eg realtime terrains for games, flightsims, etc The package comes with a demo project, which is a fully functional 3D virtual clay sculpting tool, like MudBox or Sculptris. <![CDATA[Sky Sphere / Cube / Dome Render - C/C++ | Games & Entertainment]]> 2012-06-14T13:12:31+00:00 2012-06-14T13:12:31+00:00 http://www.binpress.com/app/sky-sphere-cube-dome-render/970 Dale Thomas noreply@binpress.com http://www.binpress.comdev/profile/10360 Three blisteringly fast classes for rendering sky textures in 3D games: sphere, cube and domeA very large percentage of games use textures to fake 'stuff' on or over the horizon. Distant mountains, buildings, clouds, hills, stars, nebula, sun, moon, etc, can all be painted into textures rather than rendered with actual geometry. However, there are several geometries and mapping methods that can be used, each with their own advantages and disadvantages. This application showcases 3 types of environment geometry: sphere, cube and dome. Which one you choose depends on your requirements and how it will be used: SkySphere: Advantages: 1 texture, 1 draw call, only 1 seam, full 360 degree coverage Disadvantages: texture singularity at poles Example usage: racing game (no looking directly up) SkyCube: Advantages: minimal texture distortion, full 360 degree coverage, only 12 triangles Disadvantages: 6 textures, 6 draw calls, more seams Example usage: space battle game (full rotation) SkyDome: Advantages: 1 texture, 1 draw call, 0 seams, minimal texture distortion Disadvantages: 50% coverage Example usage: first-person shooter with fairly flat terrain They all use vertex buffer objects and triangle strips for greatest speed. The code is clear, concise and optimized. TIP: It is SOMETIMES a good idea to render your sky last. This is because the other geometry will have written to the depth buffer, and a large portion of the sky pixels will fail the z test and never be drawn. If you render the sky first, they will be drawn unnecessarily. Of course, this only works if you have no transparency in the scene. Note: The example program uses freeglut for window creation but the Sky Geometry components themselves do not, so they are very portable. <![CDATA[iOS Rubber Image - C/C++ | Audio / Video / Images]]> 2012-05-21T00:29:42+00:00 2012-05-21T00:29:42+00:00 http://www.binpress.com/app/ios-rubber-image/928 Dale Thomas noreply@binpress.com http://www.binpress.comdev/profile/10360 An OpenGLES1 rubber image manipulation component in C++ with Objective-C example for iOS. This rubber image component provides a fullscreen textured mesh, similar to what is found in apps like FaceGoo and FatBooth. It sets up a regular grid of physical points, and maps a texture onto it. Each point has a position, velocity and a rest position. User interaction modifies the velocities of the points, and elastic forces try to pull the point back to its rest position. There are no forces between adjacent points so it is extremely fast. For this iOS example, the setup code and texture loading are written in Objective C, but the pertinent code is C++, so it is very portable and can be compiled for almost any system. In addition, it uses OpenGLES 1, making it compatible with all devices. <![CDATA[String converter - C/C++ | Games & Entertainment]]> 2011-08-06T10:19:05+00:00 2011-08-06T10:19:05+00:00 http://www.binpress.com/app/string-converter/541 vincenzo panella noreply@binpress.com http://www.binpress.comdev/profile/1305 This library converts various formats into strings and vice versa This library is written for converting numeric formats into string and for doing the opposite. The library is of a static type, everything is included in a single header file and is very easy to include in any project - the only requirements are the inclusion of the stl libraries. Every function is templated to work with every kind of numeric formats. Some examples: string a=CStringConverter::NumToString( num, std::fixed, 10 ); Converts a number expressed in fixed form with a precision of 10 digits. float a=CStringConverter::NumToString( numstring, std::fixed, 10 ); Similar to the above with different type. Quick conversion functions: double a=CStringConveter::StringToDouble( numstring ); float a=CStringConveter::StringToDouble( numstring ); string a =CStringConverter::DecToBinStr( n ); Converts a decimal number into a binary string. string a =CStringConverter::DecToHexStr( n ); Converts a decimal number into an hexadecimal string. int a =CStringConverter::HexToDecStr( numstr ); Reverse of the above. string a = CStringConverter::DateToStr(); Converts the current date into a string. RGB rgb=CStringConverter::HexStrToRGB( numstring ); Converts an hexadecimal color value into an RGB triple, the RGB data structure is included in the library. string a=CStringConverter::RgbToHex( r,g,b ); Reverse of the above function. int a=CStringConverter::OctToDec( num ); Converts an octal number into decimal. int a=CStringConverter::DecToOct( num ); Reverse of the above function. The library has been updated to include different classes most of them are documented well enough to put inside any existing code without much problems the classes are : string validator class , which tests if s given string is a numeric format , included there is also a function for computing the similarity of two strings. string formatter class which eliminates whites, trailing spaces and other string normalizing functions split path class, given a full path , separates directories, filenames and extensions I have also include the message error handling class which was missing in the previous version <![CDATA[Domain name class - C/C++ | Performance]]> 2011-07-31T13:43:09+00:00 2011-07-31T13:43:09+00:00 http://www.binpress.com/app/domain-name-class/535 Valery Kholodkov noreply@binpress.com http://www.binpress.comdev/profile/461 A domain name encapsulation class for servers, resolver implementations and other domain-name handling applications.This class provides many common domain name string manipulations: Manipulate individual labels in the domain name Serialization and deserialization to and from character and byte strings Subtraction and pruning Domain name compressions as specified in RFC 1035 And more. This class is useful for: Servers Resolver implementations Any software that deals with domain names and their components A comprehensive test suite is attached. Example of usage: dname d1(std::string("abc.def.xyz")); // Create dname d2(d1); // Copy dname d3(d2, 1); // Copy and strip 1 label d2 = d1; // Assign d3 = d3; d3.to_string(); // Convert to a string "def.xyz" d3.to_fqdn(); // Convert to FQDN "def.xyz." d2.is_subdomain(d3); // Check if d3 is a subdomain of d2 d2.label_count(); // Get number of labels (3) d1.swap(d2); // Swap 2 domains // Subtraction dname d0(std::string(".")); dname d1(std::string("abc.def.xyz")); dname d2(std::string("123.abc.def.xyz")); dname d3(std::string("456.123.abc.def.xyz")); d0.subtract(d0); // Returns "" d1.subtract(d1); // Returns "" d2.subtract(d1); // Returns "123" d3.subtract(d2); // Returns "456" d3.subtract(d1); // Returns "456.123" d3.subtract(d0); // Returns "456.123.abc.def.xyz" d1.subtract(d2); // Returns "-123" d2.subtract(d3); // Returns "-456" d1.subtract(d3); // Returns "-456.123" d0.subtract(d3); // Returns "-456.123.abc.def.xyz" // Prune dname d0(std::string(".")); dname d1(std::string("abc.def.xyz")); dname d2(std::string("123.abc.def.xyz")); dname d3(std::string("456.123.abc.def.xyz")); d2.prune(4); // Returns "123" d3.prune(5); // Returns "456" d3.prune(4); // Returns "456.123" d3.prune(0); // Returns "456.123.abc.def.xyz" d3.prune(d2.label_count()); // Returns "456" // Serialize into a stream dname d1(std::string("abc.def.xyz")); std::ostringstream o; o << d1; // Read from a stream dname d; i >> d; <![CDATA[Artificial Neural Network Framework - C/C++ | Statistics]]> 2011-07-25T20:10:01+00:00 2011-07-25T20:10:01+00:00 http://www.binpress.com/app/artificial-neural-network-framework/531 Samuel Hiard noreply@binpress.com http://www.binpress.comdev/profile/1697 An ANSI C framework for ANNThis framework is designed for artificial neural network creation and use. The used structure is multi-layer perceptrons (MLP) where each neuron computes either a sigmoid function or the hyperbolic tangent. Each layer contains a bias neuron which always outputs the value "1" The weight update is performed with the gradient descent backpropagation algorithm <![CDATA[Arbitrary-precision Decimal Class with Arithmetic Methods - C/C++]]> 2011-07-22T10:59:52+00:00 2011-07-22T10:59:52+00:00 http://www.binpress.com/app/arbitraryprecision-decimal-class-with-arithmetic-methods/528 Samuel Hiard noreply@binpress.com http://www.binpress.comdev/profile/1697 A C++ class for arithmetic operations on arbitrary-precision valuesHave you ever noticed that double precision is not sufficient? Have you ever wanted your software to be able to compute 10^10 + 10^-10 ? If the answer is yes, then this component is definetely for you. Based on a string representation, this class allows you to work with numbers without any limitations whatsoever on the number of digits being used. You can perform simple arithmetics (+, -, *, /), to even more complex computations (power, sqrt) This component is really easy to include in your project, compared to other solutions. So, why would you waste your time installing a whole package (like GMP) when you only want to be able to perform some operations on huge and/or tiny numbers? <![CDATA[Anubis CPPCards - C/C++ | Games & Entertainment]]> 2011-07-14T16:28:03+00:00 2011-07-14T16:28:03+00:00 http://www.binpress.com/app/anubis-cppcards/525 Weston Networks noreply@binpress.com http://www.binpress.comdev/profile/1229 A card deck and card class framework to make your card game easier to developWhen developing a new card game, blackjack, poker, anything that involves cards, wouldn't it just be easier to already have the deck built? That is exactly what this component does. This component creates a shoe of however many decks of cards you want, as long as that number is 1 or greater! #include "AnubisCards.cpp" int main() { Deck *example = new Deck(1); example->demo(); } This will list the stats of each card in the deck in the following format: Suit: 4 Visible: false Suit Letter: C Suit Name: Club Letter: K Name: King Value: 10 ******************************************************