Hi,
I'm using C++ to develop the server side of a game which multiple servers need to communicate with each other using Publisher/Subscriber pattern. Each server subscribes to some events on different servers. All servers are located on the same network so latency and packet-loss should be very low. The inter-server communication should...
I'm currently doing a lot of things on exception safety. (Herb Sutter's Exceptional C++, C++ FAQ Lite, etc)
In particular, I wanted to write and understand the reference counting example of C++ FAQ Lite, but I'm currently stuck on this part of the code:
class Smart_Ptr;
class Foo
{
private:
friend class Smart_Ptr;
unsigned in...
I am using GNU autotools for my project. The configure.ac script has the following snippet.
AC_ARG_WITH(chkhere,
AC_HELP_STRING([--without-chkhere], [do not compile]),
[ac_cv_chkhere=$withval], [ac_cv_chkhere=yes])
# Check if chkhere is available
if test "x$ac_cv_chkhere" = "xyes"
then
AC_DEFINE(HAVE_CHECKED)
echo "chkhere: enabled...
this->setWindowTitle(tr("数据转移程序"));
edt_ftp_server = new QLineEdit;
edt_ftp_port = new QLineEdit;
edt_ftp_account = new QLineEdit;
edt_ftp_pwd = new QLineEdit;
edt_ftp_pwd->setEchoMode( QLineEdit::Password );
lbl_ftp_server = new QLabel;
lbl_ftp_server->setText(tr("FTP服务器地址:"));
lbl_ftp_server->setBuddy( edt_ftp_server );
lbl...
I'm learning to use normal maps (per pixel lighting?) in 2D graphics with OpenGL.
New to normal mapping, I managed to wrap my head around the Sobel operator and the generation of normal maps (mostly thanks to this), that is creating a (2D) array of normals from a (2D) array of pixel data.
(Most of the tutorials and forum threads that I...
Here is simple program to find the element which occurs most often in an array:
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[]) {
int a[] = {1,2,3,4,4,4,5};
int n = sizeof(a) / sizeof(int);
int max = 0;
int result = 0;
int *b = new int[n];
for (int ...
I am trying to implement the Sieve of Eratosthenes problem by data parallel method using pthreads, but I am not able to figure out how does thread-1 on finding "2" is a prime number broadcast that to all the other threads and when all the other threads mark multiples of 2 they should wait again for the next prime. How will the multiple w...
Consider:
struct A {
A (int);
A (const A &);
};
struct B {
A foo [2];
B (const A & x, const A & y)
: foo {x, y} /* HERE IS THE PROBLEM */
{}
};
I was expecting this to work since I'm using C++0x support in GCC4.3, which allegedly supports initialiser lists. No joy.
I have a class A which has no default constructor. This is...
Hi there,
I have the following toy code, intended to remove duplicates from a vector:
void overlap_removal(vector<int> &vec1, vector<int> &vec2) {
for (vector<int>::iterator it1 = vec1.begin(); it1 != vec1.end(); ++it1) {
for (vector<int>::iterator it2 = vec2.begin(); it2 != vec2.end(); ++it2) {
if ((*it1)*(*it2) < 10) {
...
i found some examples how to apply texture on 2d object but nothing on 3d. if you know any tutorial or you can give me an example that would be greate.
...
My configure.in file has LT_VERSION="1.1". I am using the latest version of autoconf and libtool. While using autoconf or autoreconf, I am getting the following error message:
configure.ac:41: error: possibly undefined macro: LT_VERSION
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentat...
hi all,
i'm trying to take a screenshot on osx with c/c++
so far this is what i got:
#import <ApplicationServices/ApplicationServices.h>
int main( int argc, char** argv) {
CGImageRef screenShot = CGWindowListCreateImage( CGRectInfinite,
kCGWindowListOptionOnScreenOnly, kCGNullWindowID, kCGWindowImageDefault);
CFStringRef fi...
Help me Stackoverflow!
So, I feel that I have set up my environment correctly but I cannot build my program!
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
using namespace std;
/*
* simple gtk application
* author jan bodnar
* date february 17, 2008
*/
int main(int argc, char** argv) {
GtkWidget *win...
Developing for WM 6, I call CreateWindow with hWndParent set to the window I want to be the owner. I do not set the WS_CHILD style, but the window created becomes a child window nevertheless. What is the proper way of doing this?
The MSDN article for CreateWindow mentions this behavior for WinCE 1.0:
Windows CE 1.0 does not support ...
My code is something like this:
// ... code
template <int i>
int modifyparameter()
{
i = i++;
return i;
}
// ... some more code
int main()
{
int answer = modifyparameter<5>();
cout << answer; //expecting 6
}
But I am getting errors. What have I done wrong?
...
I want to test the vulnerability of the server I just wrote against man in the middle attacks.
How (on Mac OS X) do I analyze packets. (I'll be checking where they are going, pulling information from if they are heading to my server, and seeing what all is available) Then I'll figure out a way to encrypt everything... but first things...
Hello!
Do I have any way to simplify the following statements? (probably, using boost::enable_if).
I have a simple class structure - Base base class, Derived1, Derived2 inherit from Base.
I have the following code:
template <typename Y> struct translator_between<Base, Y> {
typedef some_translator<Base, Y> type;
};
template <typen...
my code works perfectly in visual studio yet i encounter a problem running it in eclipse.
in the function:
City* Gps::FindCity(const char* city)
{
if(city != NULL)
{
City *tmp = NULL;
if (! m_gpsCities.empty())
{
for (list<City*>::iterator iter = m_gpsCities.begin(); iter != m_gpsCities.end();...
hello,
i would like to know how can i check if i have write permissions to folder.
i'm writing a c++ project and i should print some data to a result.txt file.
and i need to know if i have permissions or not.
is the check deferent between linux and windows ? because my project finally should run on linux and currently i'm working on vi...
I was wondering if there is some standardised way of getting type sizes in memory at the pre-processor stage - so in macro form, sizeof() does not cut it.
If their isn't a standardised method are their conventional methods that most IDE's use anyway?
Are there any other methods that anyone can think of to get such data?
I suppose I co...