Posts
 
Reputation
Joined
Last Seen
Ranked #592
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
92% Quality Score
Upvotes Received
11
Posts with Upvotes
10
Upvoting Members
8
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
5 Commented Posts
~49.2K People Reached
About Me

:)

Interests
C++,Algorithm
PC Specs
Linux
Favorite Tags

79 Posted Topics

Member Avatar for stereomatching

Just food for thought: Performance of network programming mainly depends on how you are processing your datas. How you are sharing the data among several component of your software? How you are sharing the data among several processes on the machine? (shared memory/pipe/file fifo, mapped memory) How you have distributed …

Member Avatar for stereomatching
0
1K
Member Avatar for stereomatching

Looks like its all about function pointer. But I think your code has little bit definition issue? If I am right it should be like this: [CODE] typedef void ( *set_malloc_handler)( void(*f)() ) ; //Which means set_malloc_handler is a function pointer, which takes another function pointer as argument. [/CODE] Here …

Member Avatar for stereomatching
0
142
Member Avatar for vidit_X
Member Avatar for Rashakil Fol
0
157
Member Avatar for SCass2010

@vijayan121 Cool.. Little optimization if there are millions of keys and million of values per keys. [CODE] template< typename K, typename T, typename C, typename A > typename std::multimap<K,T,C,A>::size_type num_unique_keys( const std::multimap<K,T,C,A>& mmap ) { if( mmap.size() < 2U ) return mmap.size() ; const C& cmp = mmap.key_comp() ; typename …

Member Avatar for vijayan121
0
1K
Member Avatar for dospy

[QUOTE]ps: thx mike, i didn't know auto could be used this way, i thought that keyword is useless [/QUOTE] That is [URL="http://en.wikipedia.org/wiki/C%2B%2B11#Type_inference"]C++11[/URL] Here is the another way to do it in c++11 :) using for_each and lambda [CODE] for_each(v.begin(), v.end(), [](int n) { cout << n << " "; }); …

Member Avatar for dospy
0
181
Member Avatar for moonray

Can you give more information to understand what exactly the project requirements are. Initially I thought you want to know about the tools to find out the performance of a program/server, Rubberman already gave a reply for this. I want to add my 2 cets. Valgrind, one of the top …

Member Avatar for raptr_dflo
0
125
Member Avatar for sneekula

When you read almost every reply of this thread and try to match which one you are..

Member Avatar for Netcode
0
673
Member Avatar for teha_toshio

Hi, Your entire program is almost correct. Only problem is you are resetting your cinemas in display function: [CODE] // This is in your display function. so just before display its resetting your entire array. for( int row = 0; row < 17; ++row ) for( int column = 0; …

Member Avatar for teha_toshio
0
174
Member Avatar for ChaseRLewis

Hi, Inheritance with virtual functions and virtual inheritance are two different things. After reading your initial question, I think you first need to read about normal inheritance with virtual functions. Virtual functions are for implementing polymorphism. If a class is derived from another class and when you create a object …

Member Avatar for mike_2000_17
0
163
Member Avatar for stereomatching

Hi, Narue's example doesn't have polymorphic/virtual methods. If you want to develop any robust C project, you need to use struct in such a way that you can write generic codes. Here is an example using the vector(as we are talking about vector) I wrote it hurriedly and haven't been …

Member Avatar for nezachem
0
1K
Member Avatar for Muralidharan.E

Here is a compile time Polymorphism example for JAVA using the above classes. EDIT: ITS SHOWING C++ CODE, BUT THESE ARE ACTUALLY JAVA CODE. [CODE] package com.generic.myanimal; public interface GenericAnimal { public void makeAnimalCry(); } [/CODE] [CODE] package com.generic.myanimal; public class Dog implements GenericAnimal { @Override public void makeAnimalCry() { …

Member Avatar for Fbody
0
596
Member Avatar for 4everct01

Hi, What do you mean by repeated cards. I just skimmed through the code and looks like it may shuffle same card multiple times, but it shouldn't create any duplicate card. Your shuffling algorithm is based on rand(), and if modular is too small then you might get same index …

Member Avatar for 4everct01
0
462
Member Avatar for alwaysLearning0

Hi, I was thinking of writing this post as a reply of [URL="http://www.daniweb.com/software-development/cpp/threads/375854"]Need small example for compile time polymorphism and runtime polymorphism in c++.[/URL] But later decided to open this new thread as some expert may want to give some expert opinion on this. On the above mentioned thread, mike_2000_17 …

2
202
Member Avatar for afi@alvi

Please try to make some effort to do your OWN homework!!!! Here several programmers can solve it without even blink of an eye, BUT I am pretty sure no one will take this bait to solve your school homework.

Member Avatar for arkoenig
0
107
Member Avatar for marcux

Hi, You need to setup your ethernet card in promiscuous mode, in linux you can use the commands to see every packet. ifconfig eth0 promisc - Put nic into promiscuous mode to sniff traffic. tcpdump -n host not XXX.XXX.XXX.XXX | more - Sniff net but ignore IP which is your …

Member Avatar for marcux
0
380
Member Avatar for bimoweemo

Hi, You havent mentioned what error you are getting. But I am assuming that isFull() is there and you will be able to fix the normal errors like [ICODE]using namespacestd;[/ICODE] should be acutlaly [ICODE]using namespace std; [/ICODE] and [ICODE]top[/ICODE] and [ICODE]elements[/ICODE] need to be declared. Still you gonna face linker …

Member Avatar for alwaysLearning0
0
86
Member Avatar for IndianaRonaldo

Hi, Dont worry about subset. First try to do permutation for a word. If you can generate permutation of a word, then subset is really easy. You can treat each substring as a word and generate permutation for that word, you can use std::set to get rid of duplicates. So, …

Member Avatar for IndianaRonaldo
0
293
Member Avatar for brynjar

Hi, You can not return a local array. returning a local array will create invalid memory access. Your [ICODE]double f_g [2];[/ICODE] is a local array and as soon as you are getting out of the function, your address is invalid. So [CODE] cout << "asd: " << asd[0] << ", …

Member Avatar for lcordero
0
229
Member Avatar for alwaysLearning0

Mike_2000_17 and Narue Just a thought: You should write a beginner's tutorial on C++0x for Daniweb. That will be a great way to promote this site. I can also contribute on some easier topics!!.

Member Avatar for mike_2000_17
1
161
Member Avatar for munitjsr2

[QUOTE]You sure can but they must be initialized thus declared static[/QUOTE] A class can also have non static constant, it has to be initialized at initialization list. [CODE] class A{ const int a; public: A(int a) : a(a){ } }; [/CODE] You can not do [CODE]int &var=NULL;[/CODE] and there is …

Member Avatar for kanuxy
-2
185
Member Avatar for winecoding

You already have it!! If you are using linux and you have development environment setup then you will find it in the : /usr/include/c++ In windows I dont know exact location, but you should still able to browse it from any IDE. Just include the header file and click on …

Member Avatar for alwaysLearning0
0
432
Member Avatar for tikoti

I have just run it on Mac, didn't get any compilation error, what platform you are using? [CODE] #include <iostream> #include <complex> #include <functional> #include <numeric> #include <vector> using namespace std; double accumSq(double sum_so_far, double x) { return sum_so_far + x*x; } void doIt(const std::vector< std::vector<double> > &values ) { …

Member Avatar for tikoti
0
275
Member Avatar for perfectBing

Best way to make a singleton class will be to implement a singleton template which can hold anyclass and can make any class singleton. Here is a very simplified version of it: [CODE] #include <iostream> using namespace std; //A is a simple normal class class A{ int x; public: A(): …

Member Avatar for alwaysLearning0
0
85
Member Avatar for ravenous

Hi, Can you please check sizeof(real) and sizeof(double) is same or not, may be lame check but only invalid memory access is the reason that making your first matrix corrupted. On a first glance, code looks so far fine, only potential invalid memory access in the above code is while …

Member Avatar for ravenous
1
382
Member Avatar for Stefano Mtangoo

Are you asking about a PHP related question? Like how you can make use of PHP to interact between several layers? Or are you asking about a more general MVC related question like how each layer should interact? Sorry I didn't get your question. BTW there should be many light …

Member Avatar for Stefano Mtangoo
0
396
Member Avatar for melfoy

[QUOTE]Thank u for ur advice but it would be better if u elaborate little better as i went through Dijkstra' Algo and got that it is for weighted graph for least weight path rather than least number of path .[/QUOTE] Dijkstra is a least number path problem, it will give …

Member Avatar for alwaysLearning0
0
235
Member Avatar for TheWolverine

[CODE] classB predefinedClassBObject_; // This is local variable, so when you leave the scope this variable doesn't exist anymore, and hence you wont be able to access it. This is definitely causing the crashing/garbage value as you are accessing invalid memory. [/CODE] Second thing is: [CODE] predefinedClassAObject.pointerToClassBBase->testValue; //I am not …

Member Avatar for TheWolverine
0
403
Member Avatar for CPT

you input and output operator takes a CGuser by reference. Do following: [CODE] cout<< *user; [/CODE]

Member Avatar for mike_2000_17
0
176
Member Avatar for Celtrix

Hi, A straight forward error is: [CODE] void lsmain(lua_State* L, SDL_Event event){ //Takes a SDL_Event } //and from main you are passing: lsmain(L, &Event); //address of SDL_Event, this would definitely cause crash and i am kind a surprise why its not giving an compiling error! [/CODE] Now about the thread …

Member Avatar for Celtrix
0
251
Member Avatar for v_janssens

Why you want to declare N objects with name n1, n2, n3..nN? It wont help you any how. There is ways to generate name at compile time but not on runtime but still those are mainly for template programming to generate struct/class type on fly. Can you explain why you …

Member Avatar for alwaysLearning0
0
214
Member Avatar for manaila

fork() creates a copy of a parent process and all the descriptor is opened by the parent process is also shared by forked children. If you use fork() to create children, then parent process or a child process doesn't need to wait for other children or parent to get finished. …

Member Avatar for manaila
0
156
Member Avatar for macla

What do you mean by setting name of the thread? Why you need a name? In Posix you can refer to a thread by it's thread id. pthread_create creates a thread and returns the handler of the thread which you can save and use. [CODE] #include <pthread.h> #include <stdio.h> #define …

Member Avatar for macla
0
683
Member Avatar for riotburn

Hi, Couple of things gone wrong in your program, I am just fixing the Person class and pointing out some issues, see the inline comments: [CODE] //Now it should compile, fix your other class like this class Person { protected: string name; public: Person():name(""){cout << "Default Person Constructor" << endl;} …

Member Avatar for Stefano Mtangoo
0
199
Member Avatar for Fatooma
Member Avatar for digital_ice7

several things have gone wrong here. But my first suggestion is use stl::vector See inline commands below: [CODE] #include <iostream> #include <string> using namespace std; string test() { string a[5] = {"Hello","World","How","Are","You"}; return a; //You are trying to return a local variable, once local variable out of scope, programs frees …

Member Avatar for digital_ice7
0
601
Member Avatar for mirkuh

Hi, Why you want to bind member function type with a static bind method? you wont be able to call it without having proper address of class member function. Anyway, I hope following code helps, let me know if it works? [CODE] #include <iostream> using namespace std; template <typename T> …

Member Avatar for mirkuh
0
439
Member Avatar for airerdem

[URL="http://www.linuxquestions.org/questions/programming-9/c-list-files-in-directory-379323/"]http://www.linuxquestions.org/questions/programming-9/c-list-files-in-directory-379323/[/URL] Copied from above link: [CODE] #include <sys/types.h> #include <dirent.h> #include <errno.h> #include <vector> #include <string> #include <iostream> using namespace std; /*function... might want it in some class?*/ int getdir (string dir, vector<string> &files) { DIR *dp; struct dirent *dirp; if((dp = opendir(dir.c_str())) == NULL) { cout << "Error(" << …

Member Avatar for raptr_dflo
0
256
Member Avatar for massivefermion

Start reading code in open source projects, chose your area of interest, download a project of that interest and start installing,reading,modifying code and see the result. Best way to learn lot of things all together.

Member Avatar for Ancient Dragon
0
439
Member Avatar for ag_17

Looks like this problem can be solved using Breath first search (BFS) with Priority queue. you can use min heap to solve this problem. [URL="http://en.wikipedia.org/wiki/Binary_heap"]http://en.wikipedia.org/wiki/Binary_heap[/URL] Keep it simple example: 2 4 6 7 1 5 3 2 0 [CODE] put Source in the Priority queue while(priority queue is not empty){ …

Member Avatar for alwaysLearning0
0
152
Member Avatar for liora

use sigaction to capture the signal to check what signal is interrupting the gets method. If you handle the signal using sigaction, it should also fix your current issue.

Member Avatar for Ancient Dragon
0
100
Member Avatar for ztdep

every call of cellPair() is creating an object of cellPair, so cellPair(3) and cellPair(2) are two different objects each has one vector in it with 3 and 2 respectively. [CODE] aMap[1]=cellPair(3); // first object of cellPair aMap[1]=cellPair(2); // second object of cellPair, no relation with the first object [/CODE]

Member Avatar for alwaysLearning0
0
128
Member Avatar for akhal

try to explicitly declare template arguments, this usually happens when template argument deduction satisfy multiple template class/functions. [CODE] w = pow<double,int>(e, 2*pi*j/n) //or whatever you want to be your datatype [/CODE] Have a look into the pow functions: [url]http://www.cplusplus.com/reference/std/complex/pow/[/url]

Member Avatar for akhal
0
325
Member Avatar for iamthwee

Sounds interesting.. may be i can do some fun coding instead of my office tasks!! but i left college long time ago.. so may be i will write some brute force!! :)

Member Avatar for pseudorandom21
0
178
Member Avatar for jainpratik2

Hi, It can be done in combination of some linux functions: Here is a code snippet should work on every linux platform, it will take all the keystrokes and when a ctr+c is pressed, it will terminate. [CODE] #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <termios.h> #include <unistd.h> #include <fcntl.h> …

Member Avatar for L7Sqr
0
4K
Member Avatar for rocktea

You can do it so many different ways. Lets do it by array. You need 3 dimensional array; so lets say, node 1 to node 2 has 3 street with somesort of value, ex: 10, 20, 30 matrix[NumberOfNode][NumberOfNode][MaximumNumberOfedege] matrix[1][2][0] = 10; matrix[1][2][1] = 20; matrix[1][2][2] = 30; I hope it …

Member Avatar for alwaysLearning0
0
104
Member Avatar for BimBam

Hi, I think you are not using it properly, It should work, i just copy paste your code and its working for me. I hope it helps: [CODE] #include <iostream> #include <vector> #include <algorithm> using namespace std; class Circle{ private: string ID; // FindIDCircle have to declare as friend of …

Member Avatar for alwaysLearning0
0
219
Member Avatar for tfmontague

btw, i like the Typelist idea, its a great idea to do lot of things. :)

Member Avatar for alwaysLearning0
0
191
Member Avatar for Jaily

Hi, No, it will delete only one Node with a certain value. You can delete binary tree in so many different ways. First try to do traversing, Inorder, preorder, postorder. Once you understand traversing, then you can delete whatever way you like. simplest way to delete will be, delete root, …

Member Avatar for nbaztec
0
2K
Member Avatar for rageplant

Hi, what do you mean by it doesnt update. It has to, as you are passing by reference. And also you are doing a logical mistake, you are using if, else if. you can not do if else if here, all of the check has to be individual if. DSF …

Member Avatar for alwaysLearning0
0
247
Member Avatar for Alec0905

Hi, I assumes matrix has created properly from the input, Two things i notice in the recursion: 1) You are not checking the range of the matrix, -1 can lead you to matrix[-1][0] which is an invalid memory, thats why you are getting segmentation fault. 2) You are not keeping …

Member Avatar for Alec0905
0
167

The End.