Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

~46.5K People Reached
Favorite Tags
Member Avatar for can-mohan

I am parsing below sample file in below code snippet. {"requestType":"INVOCATION", "hostName":"localhost", "serviceName":"bucky", "serviceType":"DISCRETE", "serviceParameters":"sampleData", "servicesList" :[ { "serviceName" : "ABC", "serviceParameters" : {"para1" : "value1", "para2" : "value2", "para3" : "value3"} }, {"serviceName" : "CBA", "serviceParameters" : { "para1" : "value90", "para2" : "value", "para3" : "value"} } ], …

Member Avatar for can-mohan
0
5K
Member Avatar for can-mohan

In below code while compiling i am getting error , Error : main.cpp:8:57: error: expected type-specifier before ‘Staircase’ std::unique_ptr algodiagnostic (new Staircase()); compilation command g++ HardwareDiagnostic.cpp HardwareDiagnostic.h main.cpp -std=c++0x -o res it works fine if compile entire code in single file without creating header file and main.cpp separately. Can anybody …

Member Avatar for Coller
0
7K
Member Avatar for can-mohan

Hi All, I am looking for a design approach to implement TCP socket server which is going to serve requests based on multiple ports. (1) port1 : dedicated for video streaming (2) port 2: dedicated for audio streaming (3) port 3: dedicated for data streaming. In above scenario do i …

Member Avatar for rproffitt
0
552
Member Avatar for can-mohan

In below code i am writing file contents in backup serialize file through boost serialization library, but what i observed that every time i need to store all the data in file then only i would be able to read the entire data. so in case if i perform single …

Member Avatar for can-mohan
0
326
Member Avatar for can-mohan

Hi, Below command will give the cpu and memory usage of process in terms of percentage. can we achieve same usin c/c++ API. ps -C <process name> -o %cpu,%mem | tail -n 2

Member Avatar for can-mohan
0
4K
Member Avatar for can-mohan

I am looking for log archival utility or approach which should be able to help me in based on below policy. (1) whenever log file (system.log) size >30859 or file is 3 day old then it should archive the same with new name system.log1 and again start the feeding the …

Member Avatar for JamesCherrill
0
388
Member Avatar for can-mohan

Hi, i want to truncate the log file which is already in use ( log is getting appended) . After that i want to make sure log is still getting appeneded after performing truncate. I have been using below command for the same but don't see it is happening. truncate …

Member Avatar for tinstaafl
0
245
Member Avatar for can-mohan

Hi All, In below code i am getting ouput of process (based on name) memory and cpu utilization % using command "ps -C gnome-terminal -o %cpu,%mem | tail -n +2" .Here gnome-terminal is name of process for that i am printing these values. Now i want to implement the same …

0
148
Member Avatar for can-mohan

Hi All, I have to implement string class and write a program to perform string manipulation in Mystring class. input: "he is going to school" output Case 1: (n=1) He school to going is Case 2: (n=2) He is school to going Case 3:(n=5) No changes Case 4 n<=0 school …

Member Avatar for JamesCherrill
0
475
Member Avatar for can-mohan

Hi All, i am curious to know how to set the value (value=10) through B's constructor in below programme. below is example of multiple inheritance. As construction always happens from right to left so it always call the 'C' class's constructor and set the value 20 but as per my …

Member Avatar for can-mohan
0
471
Member Avatar for can-mohan

Hi, I would linke to know what is the best way to synchronise the shared memory segment. is threads usage are also advisible whie synhcronising the shared memory segement. in what circumstances we should use threads or semaphore to synchronize the memory segment.

Member Avatar for rproffitt
0
454
Member Avatar for can-mohan

In below code snippet , I am trying to add the intefeger and float values in Array template but was surprised to see below output for float value as 5.1 was expected there but getting 0 . Can anybody let me know what can be wrong here. output value=5 value=15 …

Member Avatar for can-mohan
0
359
Member Avatar for can-mohan

Hi All, I below code snippet I have been using diff-2 structure with same variable due to having different -2 default values for the variable (var) in current implementation for both the structure a and b. This way i need to create 17 structure with same variable (var) but different …

Member Avatar for AssertNull
0
463
Member Avatar for can-mohan

Hi All, in sqlite SMALLINT datatype is used to store 2 bytes integer but i didn't see any Unsigned SMALLINT type to support the range(0-65535). Can anybody let me know how to achieve the same.

Member Avatar for cereal
0
159
Member Avatar for can-mohan

Hi, I need to make sure my integer variable doesn't store more than 2 bytes. Usually i am writing programme on Linux machine where integer size is 4 byte. Each byte can take the values 0 through 255 (=2^8-1). So, two bytes can take the values 255*255=65535, so would it …

Member Avatar for AssertNull
0
390
Member Avatar for can-mohan

Hi All, In below code when class a object is assigned to class b by returning object through factory method i observed assignment is not happening properly and after assignment still class b's object points to NULL object only. *cobj=rhs;//it gives NULL object However below statement works perfectly when b …

Member Avatar for can-mohan
0
313
Member Avatar for can-mohan

Hi All, After compiling below code , I am getting below error. error: cannot convert a* to b* in assignment. it seems to be assignment doesn't work with pointers . Can anybody throw some light on this? i tried to use unique_ptr by transfering the ownership from a to b …

Member Avatar for can-mohan
0
335
Member Avatar for can-mohan

Hi All, Below is the code of implementation of aggregation in c++. In this code class bar object will be contained in class a but class a won't act as a owner of class bar and due to this bar object is deleted after class a's life time ends. Now …

Member Avatar for StuXYZ
0
211
Member Avatar for can-mohan

Hi All, In below code i am surprised to see destructor for rectangle class is not being called though base class destructor for IShape is virtual. below is the output of below programme: draw the rectangle draw the circle draw destructor deleting circle **deleting the Rectangle** is missing from output …

Member Avatar for can-mohan
0
266
Member Avatar for can-mohan

Hi All, In below design i would like to know the appraoch of deletion of base class pointer .It is pritty clear that deletion of base class object obj won't take place inside Draw destructor. Apart from this same code i have tested using unique_ptr and as expected it is …

Member Avatar for rubberman
0
248
Member Avatar for can-mohan

Hi All, In below code i am performing search in map through key value but not able to get the desire results though common elements (intersection) is present in both lists. #include <iostream> #include <stdio.h> #include <stdlib.h> #include <map> using namespace std; struct node { int data; struct node* next; …

Member Avatar for jayashreemarg
0
211
Member Avatar for can-mohan

Hi All, In below code snippet multithreading is used to take care of multiple requests from client. I beileve creating and detaching thread will eat lots of CPU cycle and it won't improve the CPU utilization as well. Can anybody let me know if thread pool can be used here …

Member Avatar for can-mohan
0
212
Member Avatar for can-mohan

Hi All , In below code i am getting error while assigning one object with other and result is clear as both objects are different types. it is expected that RHS object should belong to same class. How to resolve this issue. error: no match for operator= in obj1 = …

Member Avatar for can-mohan
0
307
Member Avatar for can-mohan

Hi All, I wanted to know in below code snippet what will be impact if m_singleObject is declared as a weak_ptr. Usaually we peform lock on weak_ptr and convert the same in to the shared pointer and then return the same to GetInstance() function. static std::shared_ptr<singleType> shareObject = m_singleObject.lock why …

Member Avatar for can-mohan
0
962
Member Avatar for can-mohan

Hi All, I just want to know whether use of shared_ptr is justified in below code here or do i need to use unique_ptr instead of shared_ptr? #include <iostream> #include <memory> using namespace std; class a { int a1 ,b; public: a(int x=0,int y=0):a1(x),b(y){} void fun1() {cout<<a1;cout<<b;} }; class b …

Member Avatar for madhav sai
0
184
Member Avatar for can-mohan

Hi, Guys i just wanted to know whether set store elements in specific order or it contains unordered elements only. As per c++ specification http://www.cplusplus.com/reference/set/set/?kw=set Sets are containers that store unique elements following a specific order. As per my knowledge they are not ordered in the sense that you can't …

Member Avatar for JamesCherrill
0
298
Member Avatar for can-mohan

Hi, In below design a big problem is whenever DoSomething() signature is changed to introduce new functionality caller class (return m.DoSomething()) also needs to be changed which might not be aware of this change. kindly suggest good design to get rid of this flaw. class MyOtherClass { int m; public: …

Member Avatar for can-mohan
0
223
Member Avatar for can-mohan

Hi, In below function i am not able to figure out why predicate function cmp_str can't be used with for_each algoritham while using this algoritham with map. #include <iostream> #include <map> #include <utility> using namespace std; struct cmp_str { bool operator()(string a, string b) { return a.compare(b)<0; } }; int …

Member Avatar for can-mohan
0
3K
Member Avatar for can-mohan

Hi All, I am new to thread programing. In below code snippet inside producer thread if return NULL statement is removed i observed programme is hanging. Usually after execution of pthread_cond_signal(&cond); i believe i am out of this thread and consumer thread already have taken proper exit after execution of …

0
128
Member Avatar for can-mohan

Hi , Below is the code of template smart point implementation. in below code snippet we are not allocating any memory in smart pointer constructer for ptr but still delete is called in destructor for ptr. Is it right way to implement the same ? can we delete the pointer …

Member Avatar for can-mohan
0
151