Programming :: Possible To Have A Templated C++ Stl Containers In Classes?

Feb 15, 2010

Is it possible to have a templated c++ stl container in another class without specifying the type prior to compile time? I haven't coded in c++ in a while and im at a total loss.

For example - Not real code. Just outlining the problem code...

View 1 Replies


ADVERTISEMENT

Programming :: Creating New List Containers C++?

Oct 15, 2010

I need to create a program where the user creates an account and he/she is entitled to add interests and creating friendships with other users.The main algorithm depends on an object which is the user and its attributes are adding interests, friends, so on.Users are stored in a linked list while their interests are stored in another list.What I want to do is every time a new user is created dynamically create a new list during execution for personal info. storage. Is that possible?

View 12 Replies View Related

Programming :: Reg: C++ Abstract Classes?

Oct 28, 2010

I know the basic answer about how to create a class as ABC.But I don;'t know- - why I have to create a AbstractBaseClass. - In what situations it can be used.an example code base and not like a animal(base) and tiger(derived) relationship example.

View 2 Replies View Related

Programming :: C++Linking Classes/.cpp Files To Run One After Other?

Apr 11, 2010

This is probably a really stupid thing to ask considering the development I'm doing (effectivly creating a virus scanner), but how do I link classes/cpp files?I have 3 applications/sections that I can compile/combine with a makefile, that's fine, but I need them to run 1, 2, 3 once the output from the makefile is done.Currently the only section to actually run is whichever I have "main" in and obviously if I put that into all three, they won't compile as one.I've been looking all over the place at all sorts, header files and such, but there is no mention of how toually do this although I'm sure it must be possible. I'm used to being able to do this in Java and I'm sure I've seen C++ applications do it, but not worked out how.I have 3x .cpp files which are combined into one using a makefile:

Code:
# Virus Scanner
scanner.out : ProgramList.o MD5Hash.o HazardCheck.o

[code]...

View 2 Replies View Related

Programming :: Saving A Certain Variable And Using It In All The Classes?

Feb 4, 2010

facing a problem in declaring variables. i have a few classes like the one below...

Code:
#ifndef _FINANCE_H
#define_FINANCE_H

[code]....

View 1 Replies View Related

Programming :: Child Classes That Extend Each Type Of Pet

Jan 6, 2011

I am fairly new to c++. There must be a better way to do the following?:- Say I have a base class, Pet. I have several child classes that extend from this, like Dog, Cat, Fish etc.

I have the following function, that returns a pointer to a new Pet:-
Code: Pet* addPetToVet()
{ //Do some stuff
return new Pet();
} This will return a pointer an instance of a pet object.

Now, if I want to interpret this pet as a dog or cat I have to do this:-
Code: Dog* dogA = static_cast<Dog*>(addPetToVet());
Cat* catA = static_cast<Cat*>(addPetToVet()); Is there a way around this? Casting seems lame. I cant write a function for each type of pet.

View 5 Replies View Related

Programming :: Java : Use Dynamically Loaded Classes?

May 15, 2010

I'm new to Java.
I'm trying to use some dynamically loaded classes in my application.
The application doesn't know those classes , Just it try to load a class by name that its name came from input.
It doesn't know class (So I can't use casting) but just needs to call some methods of that class (every class should have that methods).
I thought about interfaces but I don't know how.
How can I call those methods?

View 1 Replies View Related

Programming :: [c++] Mixing Abstract Classes And Multiple Inheritance?

Apr 18, 2011

Why are the 'defense' method calls actually using the 'offense' methods.Also, is there a way to remove the commented base classes for 'Player' so that the casting isn't necessary?

Code:
#include <iostream>
class Offense

[code]...

View 1 Replies View Related

Programming :: Equivalence Classes Based On Field Values And Multi-key Hashtable?

May 12, 2010

I've got a set of objects (all of the same type). I'm trying to think of a good way to divide it into equivalence classes, with equivalence of two objects defined as meaning a specified set of attributes are equal for both objects. More concretely, I've got:

- a Java class with around 50 fields
- a bunch of instances of the class

I want:

- to divide the instances into a few sets
- in each set, each instance has field 1 - field 5 equal to fields 1-5 of the other instances in the set.

The method I've come up with is to generate a hashcode for each instance based on the hashcodes of fields 1-5*, and map the hashcode to one of my sets. Ignoring problems with potential hashcode collisions (which I'm expecting to be too rare to worry about for now), does that sound reasonable? It seems simple enough, but I'm wondering if there's a simpler method I haven't thought of.

* I'll generate the hashcode using a method based on Eclipse's generic hashcode method, which looks like this:

Code:

public int hashCode() {
final int prime = 31;
int result = 1;

[code]....

View 5 Replies View Related

Ubuntu :: Convert The Containers Of PHOTO`s And AUDIO`s Files To Minimum Space

Aug 11, 2010

i need a way to convert the containers of PHOTO`s and AUDIO`s files to minimum space as possible

for example .wav to .mp3 and photo to convert to .jpg

prefer to use the command line in order to write a script

View 3 Replies View Related

General :: How To Connect Two Different Ip Classes In Lan In System

Jun 14, 2010

In our LAN connection setup. having 192.168.1.0/24 and 192.168.2.0/24 how do i connected intermediately. server are RHEL5.

View 2 Replies View Related

Ubuntu :: Send .docx For College Classes?

Apr 2, 2011

I started taking CIT 101 (computer classes 101 LOL i know) as I am strict linux, in my house, purchasing office 2007 yes they require 2007 not 2010. Columbus State is tough on that, I need to be able to send documents in 2007 .docx in openoffice 3.3. The only computer that uses windows, is my grandparents and I don't want to buy Office if at all possible. I have like no money after all the text books. Teacher is strict it can not be .doc, odt. or other, needs to be .docx

View 9 Replies View Related

General :: Cups Implicit Classes And Windows

Oct 20, 2010

To foster from the failover concept of Cups I have set up 2 servers with the same printers and settings to enable the implicit classes.

Server A

I added first aprinter defined with the name myprinter (a Ricoh MP5000)

Server B

On Server B i did no printer definition

That is working fine on Cups web interface of Server B i see queuename Server A.myprinter(and vice versa).

Now I add the printer (without samba via ipp) to my windows client with the parameters [url]. I can print that way all ok. The job appears and will be printed on Server A

When I disable myprinter on A. I cannot print. I expected with the implicit classes that it switches to Server B. Is the idea wrong ? Or is Windows limited here ? Or is there another way of defintion I have to do.

My both servers are running on different platforms Suse SLES 10 and Red Hat. CUPS version 1.4.4

View 2 Replies View Related

Server :: Tomcat 7.0.8 Not Finding Packaged Classes?

Mar 11, 2011

I'm trying to set up Apache Tomcat with virtual hosting. I've used Caucho Resin before but not Tomcat...and I've run into what appears to be (from Google at least) a rather common problem with Tomcat in that any properly packaged classes under WEB-INF of the default virtual host or the named host are not found and Tomcat complains of a class that "cannot be resolved to a type". I researched this error on Google and the consensus seems to be that: -

- You need properly packaged classes as classes in the default package are no longer allowed. I have done this.

- You need to either fully declare the packaged class to make an instance of it within the JSP or include the via an import statement at the top of the JSP. I have done this.

- In the web.xml for the Tomcat server instance (under $CATALINA_HOME/conf/web.xml) you need to set the servlet mapping for JSPs fork init-param to "true". I have done this also.

Yet the problem persists and I have found no solution. So I can only assume I'm missing something obvious and fundamental. My configuration is as follows: - I have two virtual hosts - one as the default virtual host and another as a named virtual host.

$CATALINA_HOME/webapps/localhost <--- Default host.
$CATALINA_HOME/webapps/www.easicasino.com <--- Named host. The logic being that the URL IP address of the server will hit the default webapp and the URL hostname with hit the named webapp. This appears to work with just JSPs.

My $CATALINA_HOME/conf/server.xml looks like this: -

Code:

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />

[code]....

View 1 Replies View Related

Networking :: Shape Bandwidth Using HTB Method And Filtering Classes With Destination Mac Address?

Jan 21, 2010

I'm trying to shape bandwidth using HTB method and filtering classes with destination mac address. for this I've found two codes but none of them seem to filter bandwidth as i want (test with iperf)

code 1 Code: tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbit ceil 1000kbit
tc filter add dev eth0 parent 1: protocol ip prio 3 u32 match u16 0x0800 0xFFFF at -2 match u16 0xM4M5 0xFFFF
code....

View 1 Replies View Related

General :: Phpldapadmin Classes Of Objects From XML Doesn't Support By LDAP Server

May 1, 2010

I have installed phpldapadmin 1.2.0.5 Using commands in shell I have added two users and some groups into a base (ldif-file) and I see them in phpldapadmin. But when I try to add users or groups by using graphical interface (phpldapadmin) I can't do this correctly because I can't to select a type of new entry and I see a tip "classes of objects from XML does not support LDAP-server". So I can't to create a new entry by using graphical interface. Here is my slapd.conf

[code]...

View 3 Replies View Related

SUSE / Novell :: "Type Error: Components. Classes[cid]is Undefined"

Oct 2, 2010

When I start Firefox I get the subject error. Suse 11.2. What does it mean, and how can I fix it? It also says "[java script application]" in the task bar when FF launches.

View 2 Replies View Related

Fedora Networking :: Finding The Upcoming Bandwidth And Specify The Bandwidth Rateto Classes

Nov 18, 2010

I created a the class like this for shaping the packets with a specified bandwidth rate.....

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 15
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 750kbit ceil 750kbit
tc class add dev eth0 parent 1:1 classid 1:3 htb rate 600kbit ceil 750kbit prio 0

For Our Requirement:-

I dont want to specify the bandwidth rate strictly like this rate750kbit ceil 750kbit,based on whatever speed is coming which should allocate the bandwidth rate for particular class...I need one application for finding the upcoming bandwidth & Is any other method is there for specify the bandwidth rate in a classes.

View 1 Replies View Related

Programming :: 3D Programming - Difference Between JOGL And C++ OpenGL Programming?

Aug 27, 2010

I am interested in learning 3D programming. The thing is, I would hate to put too much effort to learn something that doesn't have future and is dying. My favorite language at the time is Java. My goal is professional programming.

So I have several questions:
1. Should I learn JOGL or start learning C++ and do C++ openGL programming?
2. Is there a big difference between JOGL and C++ openGL programming?
3. Is it worth to learn openGL? Does it have a future?
4. Is it a big difference between openGL and directX coding?
5. If choosing Java, then JOGL or LWJGL?

Why and what is the main difference between them?

View 4 Replies View Related

Programming :: Groovy Scripting - An Object-oriented Programming Language For The Java Platform ?

Mar 7, 2010

Groovy is an object-oriented programming language for the Java platform. I do not have experience in Java, only perl and shell scripts. Recently I have been asked to maintain a software written in groovy (also to make enhancements). So can I learn groovy without knowing java language. or isit I have to learn java before venturing into groovy.

View 1 Replies View Related

Programming :: Searching For Video Or Screen Cast Which Shows Device Driver Programming?

May 30, 2010

I did searched you tube but my results were not great.I have 2 books on KernelProgramming.I feel I need if some where I can get a video tutorial which can help me to understand how to develop a Linux Device driver that will be great.I had a look at Greg Kroah Hartmans video lecture of developing patches on ......I have been reading books and a lot of stuff.So I wish if I could get a video lecture that would be better

View 1 Replies View Related

Programming :: Timer In Socket Programming - Wait For X Sec After Read() And Then Disconnect The Client Connection

Mar 8, 2011

I have a server listening on incoming client connections. Once the client establishes SSL connection with the server, the server waits on read() from the client. Only Client can disconnect the connection. I want to have a timer in the server program to wait for x secs after read() and then disconnect the Client connection.

View 3 Replies View Related

Programming :: Totem Python Plugin Programming: Any Signal For Video Mouse Click?

Feb 9, 2011

I want that I click with the mouse on the video, it paused.I notice that there is "BaconVideoWidget" which I guess is the video rendering widget but it don't have signal named "clicked":

Code:
vd = totem_object.get_video_widget()
vd.connect("clicked", vd.hide)

[code]....

View 3 Replies View Related

Programming :: Socket And Timer Programming - Server Doesn't Execute Any Msg Which Client Sent

May 16, 2011

i have a server program which accept multiple client connection and am using polling. like every 2 secs it will look to client whether any data is received after it binded. i have used setitimer but there is runtime error i got.. the server accept all client connection but doesn't execute any msg which client sent.

#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netdb.h>
#include<unistd.h>
#include<pthread.h>
#include<string.h>
[Code]....

View 1 Replies View Related

Programming :: Headers From Richard Stevens Network Programming Book Not Installing

Oct 27, 2010

I am learning network programming via a book of Richard Stevens.The sample source codes are given here
http://www.unpbook.com/unpv13e.tar.gz
I downloaded and unzipped the file in /usr/src folder.As per the instructions given in README of downloaded archive I did.

View 5 Replies View Related

Programming :: Unix Programming - Single Thread Server Can Support Exactly 2 Clients At Once

Sep 28, 2010

A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit

View 4 Replies View Related

Programming :: Unable To Find Description Of Alsa's Programming Language

Dec 19, 2008

I am unable to find a description of alsa's programing language, this sort of stuff:

[Code]...

I need to know what, for example, 'ttable' means and what is its syntax. This seems to be a state secret.

View 2 Replies View Related

Programming :: Choice Of Programming Solutions For Collated Document Repository?

Feb 18, 2011

We have documents on multiple workstations and want to collate them into a single repository to provide text search and download. So far we have implemented rsync to copy files from each workstation under a directory for each workstation on a server (incidentally providing a backup) and have set up text search using Xapian with Omega; users access it via a web browser. Still to do is to set up a system to copy files from each workstation's area on the server to the repository.

Many files are duplicated. In these cases we want to preserve the names but keep a single copy of the file;hard links can be used for that.For each file to be copied from a workstation's area into the collated area we need to check whether it is a duplicate (file size and, if same, MD5 sum) and if so, create a hard link to the original rather than create a copy.A system to detect and replace duplicates in the collated area has been written using ruby and postgresql but the developer cannot commit to continuing this work. It does mean we have a postgresql database populated with "fingerprints" of files in the collated area.My first priority is to get the system working; in the longer term whatever is developed must be maintainable; I do not yet know which language skills are available locally.

I am fluent in bash and competent with awk. Ruby looks nice but I have started to learn python and do think it prudent to learn both at the same time. Python's postgresql capabilities are not settled but may be fine for the simple usage required.What to do? A bash solution would run very slowly but could be developed quickly. Language knowledge aside, I have found it difficult to install ruby on the server (CentOS 5.5;installed rvm but "gem" still not installed; seems a very complex system with its own package management).

View 7 Replies View Related

Programming :: Socket Programming While Displaying Received Message In File

May 11, 2011

i have problem in socket programming, while displaying received message in file,i got a problem... i cant able to write it in the file.... this is the code....

Code:
/* tcpserver.c */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
[Code]....

now my problem is run time error i can able to create file but i cant able to write file....log.txt contain nothing.... as here i have give sample code... dont say not initialising function and all.... i have initialised , please only see func1() - my problem is only not able to write msg which i got received from the client..

View 2 Replies View Related

Programming :: C++ Programming With Simple RTAI Functions Outputing Words?

Apr 11, 2011

I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.

1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".

2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.

Quote:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!

[Code]...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved