Embedding Python in C++

Adding python scripting capabilities to your code is an interesting thing to do, it can help you enhance an application without as much hard work. This is just an example on how to use code from memory as part of your program.


// Embedded Py.cpp
//

#include "stdafx.h"
#include
#undef _DEBUG /* Link with python24.lib and not python24_d.lib */
#include

using namespace std;

Tags:

Playing with templates

Dumb strokes of C++ templates while bored generated this templated queue.


#define QueueSize 5

template
class Queue
{

public:
Queue() : head(NULL), tail(-1) { for (int i=0; i < QueueSize; queue[i++]=NULL); }
void insert(T in);
bool isEmpty() { return ( queue[head] == NULL ) ? true : false; }
bool isFull() { return (head == tail && queue[head] != NULL) ? true : false; }
T remove();
void showContents();

private:
T queue[QueueSize];
int head, tail;

Tags:

Updates

Did a minor update on the book code since Amazon moved their webservices from ECS 3.0 to 4.0 and it broke all my code, now it is fixed.

Amazon Web Services

Been very busy lately, going back to school to finally get my bachelors.

Lately I have been playing with Amazon Web Services so I decided to add a list of my programming and personal books to the personal menu using the AWS platform.

I am only touching the tip of it obviously. Too much Web 2.0 hype lately, bring back the telnet days please.

Some code I just found. Simple matching algorithms. I love going nuts with pointers in C

uncommon.c

#include

int main( int argc , char ** argv , char ** env )
{
if (argc != 3)
{
fprintf(stdout, "Usage: %s \n\r", argv[0]);
return -1;
}

/* find out the size for the registry */
char * registry = NULL;
registry = (char*)malloc( strlen(argv[1]) * sizeof(char) + 1);
memset(registry, 0, sizeof(registry) + 1);

char * wordX = argv[1], *wordY = argv[2], *startY = wordY;

Tags:

mapleman's Java Proxy

Lately I been messing with Medved QuoteTracker's API.
It is an XML through TCP protocol. Medved only allows you to interact with its API from localhost.
Unfortunately the PC that hosts the executable is not, well, mine. So I decided to rewrite my
Java Proxy and make it extremely easy for anyone (the ones that use that particular PC) to run
it without a hitch.

Tags:

Pages

Subscribe to mapleman's Code & Stuff RSS