Latest Posts in Software Development

Re: in Computer Science
 
0
 

I am familiar with mfc. Would that mean I would to reload the image every let say 25 times a sec to avoid flickering because i wanna plot real time data. Now i am getting the idea.

Many thanks

Re: in Computer Science
 
0
 

OK, let's extend our GnuPlot skills a little. I'm going to pull from memory here that GnuPlot outputs PNG. And yes it does. Then you only need to get that PNG into your app. There are too many ways to do that like http://stackoverflow.com/questions/15710153/read-gnuplot-output-into-image-in-c-sharp or just set the image to use that file.

Hope that helps.

Re: in Computer Science
 
0
 

Thanks for the reply rproffitt. It worth knowing about such library. It seems the library allows plotting into external window but it does not allow to draw into the main window. I want to draw couple graphs in the same window in different locations of the window. Also I want make a look like window like a control panel where you observe different processes and you have controls to control such processes. There is a way of achieving by using cvi labview libraries but they are not free.

Re: in C
 
0
 

Firstly, please see the comments about clearing up your code, at your other post.

https://www.daniweb.com/software-development/c/threads/499170/program-which-compute-number-of-days-between-two-dates

You also have not followed the spec's you were assigned.

  • You are to repeat the task (could use calling a function in a loop) until the precision is (at least) 3 places of decimals.

  • You are to take the area of a trapezium (not a rectangle as you have done) and the area of a trapezium is: ((height1 + height2) / 2.0) * base

Re: in Software Development
 
0
 

Why not use what you know? Since browsers can use local files with .html you could use what you know today. As to the clicker, I'm going to share I own a Satechi ST-BTRM1 which you could use or something else then your code does the usual on event to cut to your menu for the next html file.

However, many just forget the clicker idea and get a big touchscreen.

Re: in C
 
0
 

Without you stating the particular problem with which you wish to have help ...

here are several ways to begin to clear up your code and make it easier to see if logic and code ok:

  • Indent blocks of code.

  • Use descriptive variable names.

  • Use functions (a function for each task.)

  • Use comments and blank lines to document what is happening in each section of your code ... as you go.

  • Take in only valid input ... and do not let program crash if input was invalid.

Re: in C++
 
0
 

Without seeing all the code you are using ... we can only guess at the problem(s), according to our own experience.

Inspect the good (working ok) 1st file ... by loading it into a text editor, like notepad, and see if there is one and only one newline char at the end of the last line of data there ... or if instead, that last line ends with EOF ? (i.e. NO newline char there.)

Then, make sure, (using a text editor), that the 2nd file ends like the first.

This will resolve the problem if the issue is (only) related to how you program reads lines of data and in particular the last line.

Another possible issue is the possibility of unrecognized char's being embedded in the 2nd data file chunk ... and then, the program may be halting with an exception thrown there ... but check out first idea above .. firstly ... as that 'data file (corruption and/or ending) problem' is suggested by the original two data .txt files you presented.

Re: in C
 
0
 

Yes, you did allocate a space of 90. So maybe you should have passed the value 90 as the size parameter. Instead, you passed the value 8.

Then what is that for ?

What is what for?

Re: in C
 
0
 

But in buffer , i have allocated size 90 using malloc , isn't it.Then what is that for ?

Re: in C++
 
0
 

I attached a new 5 min file i tried with, but no luck. I made this one to be only a few days long with no extraneous lines in it. But still aborting at runtime, frustrating.

Attachments 09five.txt (15.79 KB)
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
NQ05MIR	5	12/10/2009	930	1794.25	1803.25	1794	1802	5024	1800.75
NQ05MIR	5	12/10/2009	935	1802	1806.75	1801.25	1804	4666	1802.75
NQ05MIR	5	12/10/2009	940	1804	1806.25	1803.75	1805	3633	1803.75
NQ05MIR	5	12/10/2009	945	1805	1805.75	1803.75	1804	2915	1802.75
NQ05MIR	5	12/10/2009	950	1804	1804	1799	1799.75	2433	1798.5
NQ05MIR	5	12/10/2009	955	1800	1802.25	1799.5	1799.75	1421	1798.5
NQ05MIR	5	12/10/2009	1000	1800	1800.75	1797.5	1799	1558	1797.75
NQ05MIR	5	12/10/2009	1005	1799	1801.25	1797.5	1800.25	2683	1799
NQ05MIR	5	12/10/2009	1010	1800.5	1801.5	1798.25	1800.25	1913	1799
NQ05MIR	5	12/10/2009	1015	1800.25	1802.25	1799.5	1799.75	2553	1798.5
NQ05MIR	5	12/10/2009	1020	1799.75	1802.25	1799.25	1802.25	2468	1801
NQ05MIR	5	12/10/2009	1025	1802	1804.75	1801	1803.25	2594	1802
NQ05MIR	5	12/10/2009	1030	1803.25	1804.5	1802	1802.5	2852	1801.25
NQ05MIR	5	12/10/2009	1035	1802.5	1802.75	1800.5	1802	1403	1800.75
NQ05MIR	5	12/10/2009	1040	1802	1803.75	1801	1801.25	1599	1800
NQ05MIR	5	12/10/2009	1045	1801.25	1802.5	1800.25	1801.25	1055	1800
NQ05MIR	5	12/10/2009	1050	1801.5	1802.25	1800.75	1801.25	1045	1800
NQ05MIR	5	12/10/2009	1055	1801	1803	1800.5	1802.25	1345	1801
NQ05MIR	5	12/10/2009	1100	1802.25	1803.25	1801.25	1803.25	707	1802
NQ05MIR	5	12/10/2009	1105	1803.5	1803.75	1802	1802.75	1196	1801.5
NQ05MIR	5	12/10/2009	1110	1802.75	1803.75	1801.5	1802.75	2092	1801.5
NQ05MIR	5	12/10/2009	1115	1802.75	1805.25	1802.75	1804.25	1847	1803
NQ05MIR	5	12/10/2009	1120	1804.25	1804.5	1803	1803.5	1572	1802.25
NQ05MIR	5	12/10/2009	1125	1803.5	1804.75	1802.25	1803.25	1957	1802
NQ05MIR	5	12/10/2009	1130	1803.25	1805.25	1802.75	1803.5	1745	1802.25
NQ05MIR	5	12/10/2009	1135	1803.5	1804.25	1802.75	1803.5	1695	1802.25
NQ05MIR	5	12/10/2009	1140	1803.75	1803.75	1802.25	1802.25	1260	1801
NQ05MIR	5	12/10/2009	1145	1802.25	1803.5	1801.75	1803.5	968	1802.25
NQ05MIR	5	12/10/2009	1150	1803.25	1803.25	1801.25	1802.5	1036	1801.25
NQ05MIR	5	12/10/2009	1155	1802.25	1803	1801.75	1801.75	824	1800.5
NQ05MIR	5	12/10/2009	1200	1801.75	1803	1801.5	1803	853	1801.75
NQ05MIR	5	12/10/2009	1205	1803	1804.25	1801.75	1802.75	2528	1801.5
NQ05MIR	5	12/10/2009	1210	1802.75	1803	1801.25	1801.25	1918	1800
NQ05MIR	5	12/10/2009	1215	1801	1802.75	1800.75	1802.75	1546	1801.5
NQ05MIR	5	12/10/2009	1220	1802.5	1802.5	1801.25	1801.75	836	1800.5
NQ05MIR	5	12/10/2009	1225	1801.75	1802.25	1801.25	1801.75	555	1800.5
NQ05MIR	5	12/10/2009	1230	1801.5	1802	1800.75	1801.75	1060	1800.5
NQ05MIR	5	12/10/2009	1235	1801.75	1801.75	1800.75	1801.25	1137	1800
NQ05MIR	5	12/10/2009	1240	1801.25	1802.5	1801	1802.25	1277	1801
NQ05MIR	5	12/10/2009	1245	1802.25	1804.25	1802.25	1804	1011	1802.75
NQ05MIR	5	12/10/2009	1250	1803.75	1804.5	1803.75	1804	533	1802.75
NQ05MIR	5	12/10/2009	1255	1804	1804.75	1803.75	1804.75	380	1803.5
NQ05MIR	5	12/10/2009	1300	1804.5	1804.75	1801.5	1802.25	1683	1801
NQ05MIR	5	12/10/2009	1305	1802.25	1803.5	1799.5	1799.75	1324	1798.5
NQ05MIR	5	12/10/2009	1310	1799.75	1800.25	1797	1797.5	2001	1796.25
NQ05MIR	5	12/10/2009	1315	1797.5	1799	1797	1797.5	1476	1796.25
NQ05MIR	5	12/10/2009	1320	1797.5	1799.25	1797	1798.5	1354	1797.25
NQ05MIR	5	12/10/2009	1325	1798.5	1799.5	1798.5	1799.25	795	1798
NQ05MIR	5	12/10/2009	1330	1799.25	1800.5	1799.25	1800	801	1798.75
NQ05MIR	5	12/10/2009	1335	1799.75	1801.5	1799.25	1801.5	863	1800.25
NQ05MIR	5	12/10/2009	1340	1801.5	1802	1800	1801.5	768	1800.25
NQ05MIR	5	12/10/2009	1345	1801.5	1801.5	1799.75	1801	299	1799.75
NQ05MIR	5	12/10/2009	1350	1801	1801.25	1799.75	1799.75	352	1798.5
NQ05MIR	5	12/10/2009	1355	1799.75	1801.5	1799.5	1801.25	474	1800
NQ05MIR	5	12/10/2009	1400	1801.25	1801.25	1800	1801.25	515	1800
NQ05MIR	5	12/10/2009	1405	1801.25	1802.5	1801.25	1801.75	900	1800.5
NQ05MIR	5	12/10/2009	1410	1801.75	1801.75	1800.75	1801.75	829	1800.5
NQ05MIR	5	12/10/2009	1415	1802	1803.25	1801.75	1803.25	808	1802
NQ05MIR	5	12/10/2009	1420	1803.25	1803.5	1802.25	1802.25	949	1801
NQ05MIR	5	12/10/2009	1425	1802.25	1803.25	1802.25	1802.75	975	1801.5
NQ05MIR	5	12/10/2009	1430	1802.75	1803.75	1802.75	1803.25	372	1802
NQ05MIR	5	12/10/2009	1435	1803.25	1803.25	1802	1802.5	449	1801.25
NQ05MIR	5	12/10/2009	1440	1802.5	1802.5	1800.25	1801	1235	1799.75
NQ05MIR	5	12/10/2009	1445	1801	1802.75	1801	1801.75	1030	1800.5
NQ05MIR	5	12/10/2009	1450	1802	1802	1801	1802	862	1800.75
NQ05MIR	5	12/10/2009	1455	1802	1802	1801.25	1801.75	372	1800.5
NQ05MIR	5	12/10/2009	1500	1801.75	1802	1800.25	1800.25	895	1799
NQ05MIR	5	12/10/2009	1505	1800.25	1801.75	1799.75	1800.5	1322	1799.25
NQ05MIR	5	12/10/2009	1510	1800.25	1803	1800.25	1801.5	867	1800.25
NQ05MIR	5	12/10/2009	1515	1801.5	1802.25	1800.75	1801	463	1799.75
NQ05MIR	5	12/10/2009	1520	1800.75	1800.75	1798.75	1798.75	815	1797.5
NQ05MIR	5	12/10/2009	1525	1798.75	1799.25	1796	1796.5	1739	1795.25
NQ05MIR	5	12/10/2009	1530	1796.5	1797.25	1795	1796	1545	1794.75
NQ05MIR	5	12/10/2009	1535	1796	1797.75	1795.75	1797.5	1059	1796.25
NQ05MIR	5	12/10/2009	1540	1797.5	1798	1796.5	1797.75	1026	1796.5
NQ05MIR	5	12/10/2009	1545	1797.75	1799.5	1797.25	1799.25	1015	1798
NQ05MIR	5	12/10/2009	1550	1799.25	1799.5	1796.75	1797.75	1868	1796.5
NQ05MIR	5	12/10/2009	1555	1797.75	1798.25	1796.25	1796.25	5325	1795
NQ05MIR	5	12/10/2009	1600	1796.5	1798.5	1796	1797.75	2151	1796.5
NQ05MIR	5	12/10/2009	1605	1798	1798.5	1797.75	1798.5	886	1797.25
NQ05MIR	5	12/10/2009	1610	1798.25	1798.75	1796.75	1798.25	2073	1797
NQ05MIR	5	12/11/2009	930	1805.75	1808.75	1803	1803	4448	1801.75
NQ05MIR	5	12/11/2009	935	1803	1805	1802.25	1804	4006	1802.75
NQ05MIR	5	12/11/2009	940	1803.75	1806	1803.25	1803.25	3357	1802
NQ05MIR	5	12/11/2009	945	1803.5	1805	1800.5	1800.75	3566	1799.5
NQ05MIR	5	12/11/2009	950	1800.75	1804.5	1797.75	1803.75	6303	1802.5
NQ05MIR	5	12/11/2009	955	1804	1807.75	1799.75	1804.75	7899	1803.5
NQ05MIR	5	12/11/2009	1000	1805.25	1805.75	1801.5	1801.5	3078	1800.25
NQ05MIR	5	12/11/2009	1005	1801.75	1802.5	1799.25	1800.25	3482	1799
NQ05MIR	5	12/11/2009	1010	1800.25	1802	1799.25	1800.5	4871	1799.25
NQ05MIR	5	12/11/2009	1015	1800.25	1800.25	1796.5	1799.5	3541	1798.25
NQ05MIR	5	12/11/2009	1020	1799.5	1799.75	1796.25	1797.25	4677	1796
NQ05MIR	5	12/11/2009	1025	1797.25	1799.5	1797	1799.25	1750	1798
NQ05MIR	5	12/11/2009	1030	1799	1801.5	1798.25	1800.25	3359	1799
NQ05MIR	5	12/11/2009	1035	1800	1801.5	1799	1800.25	2890	1799
NQ05MIR	5	12/11/2009	1040	1800.25	1800.25	1798.25	1799.5	998	1798.25
NQ05MIR	5	12/11/2009	1045	1799.25	1800.25	1798.75	1799	1204	1797.75
NQ05MIR	5	12/11/2009	1050	1799.25	1800.75	1798.75	1800.25	1334	1799
NQ05MIR	5	12/11/2009	1055	1800.5	1802.25	1799.5	1799.5	2097	1798.25
NQ05MIR	5	12/11/2009	1100	1799.5	1799.75	1796.75	1797	2222	1795.75
NQ05MIR	5	12/11/2009	1105	1797	1797.5	1795	1795.25	2549	1794
NQ05MIR	5	12/11/2009	1110	1795	1795.5	1794.25	1794.5	2125	1793.25
NQ05MIR	5	12/11/2009	1115	1794.5	1796.5	1794.25	1794.5	2762	1793.25
NQ05MIR	5	12/11/2009	1120	1794.25	1794.25	1787.25	1787.5	7489	1786.25
NQ05MIR	5	12/11/2009	1125	1787.75	1788.75	1785.5	1787.25	7740	1786
NQ05MIR	5	12/11/2009	1130	1787.25	1787.5	1785	1787.25	5214	1786
NQ05MIR	5	12/11/2009	1135	1787	1788	1785.5	1787.5	3377	1786.25
NQ05MIR	5	12/11/2009	1140	1787.5	1787.5	1785	1786	3201	1784.75
NQ05MIR	5	12/11/2009	1145	1786	1786	1782.5	1783.75	7228	1782.5
NQ05MIR	5	12/11/2009	1150	1783.75	1785.25	1783	1785	2676	1783.75
NQ05MIR	5	12/11/2009	1155	1785	1785.5	1783.25	1785.25	2574	1784
NQ05MIR	5	12/11/2009	1200	1785	1786.5	1785	1785.25	1453	1784
NQ05MIR	5	12/11/2009	1205	1785.5	1787	1785.25	1786.75	1534	1785.5
NQ05MIR	5	12/11/2009	1210	1786.75	1788	1786.5	1787	1904	1785.75
NQ05MIR	5	12/11/2009	1215	1786.75	1788	1786.75	1787	725	1785.75
NQ05MIR	5	12/11/2009	1220	1787.25	1787.75	1786.25	1786.25	2027	1785
NQ05MIR	5	12/11/2009	1225	1786.25	1787	1786	1786.75	1330	1785.5
NQ05MIR	5	12/11/2009	1230	1786.5	1787.5	1786	1787	2299	1785.75
NQ05MIR	5	12/11/2009	1235	1787.25	1788	1786.5	1787.75	725	1786.5
NQ05MIR	5	12/11/2009	1240	1787.75	1787.75	1787	1787.25	683	1786
NQ05MIR	5	12/11/2009	1245	1787.5	1787.5	1786.25	1786.75	2899	1785.5
NQ05MIR	5	12/11/2009	1250	1786.5	1790.5	1786.5	1790.25	2310	1789
NQ05MIR	5	12/11/2009	1255	1790.5	1791.75	1790	1791.25	1971	1790
NQ05MIR	5	12/11/2009	1300	1791.5	1792.5	1791.25	1791.25	1015	1790
NQ05MIR	5	12/11/2009	1305	1791	1791.25	1790.5	1790.75	800	1789.5
NQ05MIR	5	12/11/2009	1310	1790.75	1791.25	1790.25	1790.5	596	1789.25
NQ05MIR	5	12/11/2009	1315	1790.25	1791	1789.75	1790.25	774	1789
NQ05MIR	5	12/11/2009	1320	1790.25	1790.75	1790	1790.25	574	1789
NQ05MIR	5	12/11/2009	1325	1790	1790.25	1789	1789.5	728	1788.25
NQ05MIR	5	12/11/2009	1330	1789.75	1790.25	1789	1789.5	602	1788.25
NQ05MIR	5	12/11/2009	1335	1789.5	1790.75	1789.25	1790.75	691	1789.5
NQ05MIR	5	12/11/2009	1340	1790.75	1791	1790	1790	936	1788.75
NQ05MIR	5	12/11/2009	1345	1790	1790.25	1789.25	1789.5	737	1788.25
NQ05MIR	5	12/11/2009	1350	1789.25	1790	1788.75	1789	765	1787.75
NQ05MIR	5	12/11/2009	1355	1789	1790.5	1788.75	1790	860	1788.75
NQ05MIR	5	12/11/2009	1400	1790	1791.25	1789.25	1790	2121	1788.75
NQ05MIR	5	12/11/2009	1405	1789.75	1792.5	1789.75	1792	1949	1790.75
NQ05MIR	5	12/11/2009	1410	1791.75	1792.5	1791.5	1791.75	1130	1790.5
NQ05MIR	5	12/11/2009	1415	1791.75	1791.75	1791	1791	521	1789.75
NQ05MIR	5	12/11/2009	1420	1791	1792	1790.75	1791.25	1115	1790
NQ05MIR	5	12/11/2009	1425	1791	1791.5	1790.5	1791	933	1789.75
NQ05MIR	5	12/11/2009	1430	1791	1791.5	1790	1790	1180	1788.75
NQ05MIR	5	12/11/2009	1435	1790	1790	1788.5	1789	849	1787.75
NQ05MIR	5	12/11/2009	1440	1789	1790	1788	1789.25	1923	1788
NQ05MIR	5	12/11/2009	1445	1789.25	1791	1789.25	1789.75	1078	1788.5
NQ05MIR	5	12/11/2009	1450	1789.5	1790.75	1789.5	1789.75	1168	1788.5
NQ05MIR	5	12/11/2009	1455	1789.75	1790.75	1789	1789.25	1639	1788
NQ05MIR	5	12/11/2009	1500	1789	1790	1788.5	1790	1012	1788.75
NQ05MIR	5	12/11/2009	1505	1790	1790.25	1789.5	1789.5	574	1788.25
NQ05MIR	5	12/11/2009	1510	1789.75	1791.25	1789.25	1791	1284	1789.75
NQ05MIR	5	12/11/2009	1515	1791	1791	1789.75	1790	756	1788.75
NQ05MIR	5	12/11/2009	1520	1789.75	1791.25	1789	1790.5	1323	1789.25
NQ05MIR	5	12/11/2009	1525	1790.75	1793.25	1790.75	1793	2501	1791.75
NQ05MIR	5	12/11/2009	1530	1793	1794	1792.25	1793	2677	1791.75
in Computer Science
 
0
 

Hi there,

I hope I could find help about plotting graphs. My problem is I have a device which alows me collect some data and transfer it throught USB. Then I will interpret that data using c or c++. I would like to plot such data on a window on windows enviroment or linux. The library would allow to pick a convient graph such as scatter plot or bar. Would you able to recommend any library which would be just for the problem?

Thanks to good people in advance!

Re: in C++
 
0
 

David and Nullptr,

Thanks. Nullptr, sorry for the silly question, how did you get to 'see' those bytes? And what can I do to fix the file? I basically have the data in a much larger excel file that spans 3 months. So if I only want to use a few days of it say, is copy/paste not the right method? Should I instead try deleting all unwanted data first in the excel file and then saving as a txt file?

Re: in C
 
1
 

buffer is a char pointer, so sizeof(buffer) is the size of a char*, which is typically 4 or 8.

If you passed in the number 8, then we would expect to see eight bytes written. One char takes up one byte, so we'd expect to see eight characters. How many did we see?

Item : A is exactly eight bytes.

It output eight characters because when you called snprintf, you told it to write no more than eight characters into buffer.

in C
 
0
 
#include <stdio.h>
#include <stdlib.h>

char* format(char* buffer,size_t size,
        const char* name,int quantity,int weight){
    snprintf(buffer,size,"Item: %s Quantity: %d Weight: %d",name,quantity,weight);
    return buffer;
}

int main()
{
    char *buffer = (char*)malloc(90);

    printf("%s\n",format(buffer,sizeof(buffer),"Axle",25,45));

    return 0;

}

When i run the above program, i expect the output

 Item: Axle Quantity: 25 Weight: 45

But the output i got is

 Item : A

Can someone help me.

Software Development Tag Cloud