Categories
Articles C++11 Coders Codex GNU C++ Languages Linux Development Programming Science & Technology

Coders Codex::Best Online Compiler for C++11 Programming

INTRODUCTION

This article briefly discusses Coding Ground from Tutorialspoint for which I feel is one of the best online compilers for C++11 Programming. An online text editor and compiler offers good opportunity to try out C++11 without needing to setup a compiler or IDE on your local computer, so this is great for going through tutorials and sharing snippets of code online.

Online C++ Compiler and Editor
C++ Codingground

DISCUSSION

The IDE features a syntax highlighted text editor which I find to be pleasant and clean to look at. I also like the code-collapse tooltips at the side of the window, allowing the close inspection of code which needs attention. Sadly though, it does not have anything like intellisense, code completion or basic debugging tools. I think it would be nice to see in an update some basic code autocomplete and some break points, step-through, step into and continue debugging features.

FINDINGS

The ability to import GitHub projects looks like a nifty feature however I have yet to try this out. The Bash terminal at the bottom of the window in addition to compiling with gcc allows for the use of makefiles and with make and vi to edit. I am sure a few other features are available although these are out of scope for this article. A quick launch sidebar allows the quick reference to C++ Tutorials which open in a separate tab, all good stuff.

LINKS

Below are a few other links and online IDE’s and articles to check out. Happy Coding!

RexTester IDE
Collection of Online Compilers Article
MSVC and C++11 Compatible online compiler
Compile and Execute C++ Code Online on Coding Ground

Categories
API Articles Blog Coders Codex Development JUCE Linux Development Portfolio Programming

Coders Codex::Command Line Arguments Example for JUCE C++

INTRODUCTION

I base this article around the need to pass command line parameters to a running program. Please note this does not seem to work with Windows yet (working in Linux and OSX not tested).

DISCUSSION

The idea is to use a set of command line parameters to execute a set of built in software tests between two or more instances of a given software and then automatically generate unit test reports. The whole thing can be automated via the sequencing of various tests in a bash script or batch file.

//============================================================================
// Name        : Command Line Arguments
// Author      : Divide To Infinity
// Version     : V1.0
// Copyleft    : Divide To Infinity 2015 - GNU GPL v2
// Description : JUCE Command Line Arguments Demo C++11, Ansi-style
//============================================================================

#include "../JuceLibraryCode/JuceHeader.h"

class CommandLineArguments : public JUCEApplication
{
    public:
        CommandLineArguments(){}
        ~CommandLineArguments(){}

        void initialise(const String& commandLine) override
        {
            Logger * log = Logger::getCurrentLogger();
            log->writeToLog(getApplicationName());

            // Now list the command line arguments
            log->writeToLog("See the entered command line parameters below: ");
            log->writeToLog(JUCEApplicationBase::getCommandLineParameters());
        }

        void shutdown() override {}

        const String getApplicationName() override
        {
            return "CommandLineArguments";
        }

        const String getApplicationVersion() override
        {
            return "1.0";
        }

    private:

};

START_JUCE_APPLICATION(CommandLineArguments);

FINDINGS

//============================================================================
// Name        : CommandLineArguments
// Author      : Divide To Infinity
// Version     : V1.0
// Copyleft    : Divide To Infinity 2015 - GNU GPL v2
// Description : JUCE Command Line Arguments Demo C++11, Ansi-style
//============================================================================

#include "../JuceLibraryCode/JuceHeader.h"

using namespace std;

class CommandLineArguments : public JUCEApplication
{
    public:
        CommandLineArguments(){}
        ~CommandLineArguments(){}

        void initialise(const String& commandLine) override
        {
            Logger * log = Logger::getCurrentLogger();
            log->writeToLog(getApplicationName());

            // To get the parameters as an array, you can call JUCEApplication::getCommandLineParameters()

            // Now list the command line arguments
            log->writeToLog("See the entered command line parameters below: ");
            log->writeToLog(JUCEApplicationBase::getCommandLineParameters());
            cout << endl; // Empty line : 0

            // Now lets try and do something with the arguments
            // First use the getCommandLineParameterArray which returns a tokenised array
            // of Command Line args separated by whitespace
            StringArray argTokens = StringArray(JUCEApplicationBase::getCommandLineParameterArray());

            for(int i = 0; i < argTokens.size(); ++i)
            {
                // Print out each arg line by line
                log->writeToLog(argTokens[i]);

                // We can use these args to call methods
                if (argTokens[i] == "-i")
                {
                    cmdTest();
                }
                // Then use args with parameters and error messages
            }

        }

        void cmdTest()
        {
            cout << "cmdTest called" << endl;
        }

        void shutdown() override {}

        const String getApplicationName() override
        {
            return "CommandLineArguments";
        }

        const String getApplicationVersion() override
        {
            return "1.0";
        }

        void unhandledException(const std::exception *, const String &sourceFilename, int lineNumber) override
        {
            // Here we can use this method to catch exceptions and generate reports
        }

    private:

};

START_JUCE_APPLICATION(CommandLineArguments);

LINKS
Command Line Arguments discussion on the JUCE forum
JUCEApplicationBase Class docs

Categories
Articles Blog C++11 Coders Codex Design Patterns Development Featured GNU C++ Languages Linux Development Programming Science & Technology Solution Technology UML

Coders Codex::How to Generate C++ Code from a UML Class Diagram in Linux

INTRODUCTION

UML Class Generated in Dia

DISCUSSION

sudo apt-get install dia dia2code

FINDINGS

LINKS
C++ Code Generation from UML on Stack Overflow

Categories
API Articles Blog C# Coders Codex Creative Computing Development Featured Games Development Graphic Displays IDE Installation Interactive Installation Languages Library London Network OpenGL OpenGL Programming Portfolio Programming Science & Technology Solution Technology Video Visual Studio 2012 Visuals

Coders Codex::Decoding Video Streams to Textures in Unity 3d

INTRODUCTION

Here we will decode an Ogg Theora file streaming from the internet onto a plane surface scripted in Unity 3d.

DISCUSSION

The fastest method to do this as of writing is to look here and then attach this to the camera in a new unity 3d scene.

FINDINGS

The Unity docs do not seem to show a C# source example, so in full Blue Peter (UK) style: Here is one I made earlier.

//============================================================================
// Name        : WWWVideoTexture (Unity 3d)
// Author      : Divide To Infinity
// Version     : V1.0
// Copyright   : GNU GPL v2
// Description : C# Monobehaviour Script for Decoding Video Streams to Texture
//============================================================================

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(GUITexture))]
[RequireComponent(typeof(AudioSource))]
public class WWWVideoTexture : MonoBehaviour
{
    public string url = "http://playground.html5rocks.com/samples/html5_misc/chrome_japan.ogv";
    IEnumerator Start()
    {
        WWW www = new WWW(url);
        MovieTexture movieTexture = www.movie;
        while (!movieTexture.isReadyToPlay)
        {
            yield return null;
        }
        
        GUITexture gt = GetComponent();
        gt.texture = movieTexture;
        transform.localScale = new Vector3(0, 0, 0);
        transform.position = new Vector3(0.1f, 0.25f, 0);

        gt.pixelInset = new Rect(0, 0, movieTexture.width / 2, movieTexture.height / 2);

        AudioSource aud = GetComponent();
        aud.clip = movieTexture.audioClip;
        movieTexture.Play();
        aud.Play();
    }
}

And the screenshot:

WWWVideoTexture.cs in Unity 3d

LINKS

WWW.movie in Unity 3d Scripting API
Video Streaming solutions for Unity3d on Stack Overflow
C# pixelInset problem on UnityAnswers
Streaming Textures in Unity3d
Video Playback Speed Discussion on Unity 3d Forums

Categories
Articles Assembly audio-programming C++11 Coders Codex computer-music Creative Computing Development GNU C++ Languages Mixing Programming

Coders Codex::Reverse Engineering and Binary Auditing Tools

INTRODUCTION

DISCUSSION

This Needs a 64 bit Debugger/Diassembler (Hex Rays IDA Pro)

FINDINGS

LINKS

Binary Auditing Training Material
Detect it Easy Packer Identifier
Cheat Engine Debugger / Disassembler
IDA Pro Disassembler / Debugger 32 and 64 Bit

Categories
Articles Coders Codex GNU C++ Languages Linux Development OpenGL Programming

Coders Codex::Linux GLX Server Side Computation using X Window protocol

441

442

443

Computer Graphics Cover

Contents

ISBN

pg439

pg440

Links

OpenGL programming for X Window