473,608 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: What am I doing wrong?

On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@com cast.netsaid:
Do you agree that ..

member,first,mi ,last,dob,eff_d ate,exp_date
1,John,,Doe,07/04/1776,01/01/1800,
2,Mack,T,Knife, 11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?
Err, no not really as that has nothing to do with stock market prices :).
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire

Jul 6 '08 #1
25 2684
Cromulent wrote:
On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@com cast.netsaid:
>Do you agree that ..

member,first,m i,last,dob,eff_ date,exp_date
1,John,,Doe, 07/04/1776,01/01/1800,
2,Mack,T,Knife ,11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?

Err, no not really as that has nothing to do with stock market prices :).
Of course. I was talking about the format of the file. In the case of
Microsoft Excel, Visual FoxPro and perhaps Access, CSV files are text
representations of tables. The first row (line) of the CSV file are the
names of the columns and subsequent lines are the values of the columns.

Is this the kind of CSV file you are talking about or do you have some
other idea?
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Jul 6 '08 #2
On 2008-07-06 22:11:48 +0100, Joe Wright <jo********@com cast.netsaid:
Cromulent wrote:
>On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@com cast.netsaid:
>>Do you agree that ..

member,first, mi,last,dob,eff _date,exp_date
1,John,,Doe,0 7/04/1776,01/01/1800,
2,Mack,T,Knif e,11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?

Err, no not really as that has nothing to do with stock market prices :).

Of course. I was talking about the format of the file. In the case of
Microsoft Excel, Visual FoxPro and perhaps Access, CSV files are text
representations of tables. The first row (line) of the CSV file are the
names of the columns and subsequent lines are the values of the columns.

Is this the kind of CSV file you are talking about or do you have some
other idea?
Ah, I see. Yes that is exactly the type of data I will be using. Here
is an example:

Date,Open,High, Low,Close,Volum e
3-Jul-08,0.80,1.09,0. 80,1.09,77800
2-Jul-08,1.08,1.09,0. 56,0.94,19600
1-Jul-08,1.09,1.09,0. 95,1.08,29700
30-Jun-08,0.80,1.09,0. 75,1.09,11500
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire

Jul 6 '08 #3
Cromulent wrote:
On 2008-07-06 22:11:48 +0100, Joe Wright <jo********@com cast.netsaid:
>Cromulent wrote:
>>On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@com cast.netsaid:
Do you agree that ..

member,first ,mi,last,dob,ef f_date,exp_date
1,John,,Doe, 07/04/1776,01/01/1800,
2,Mack,T,Kni fe,11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?

Err, no not really as that has nothing to do with stock market prices
:).

Of course. I was talking about the format of the file. In the case of
Microsoft Excel, Visual FoxPro and perhaps Access, CSV files are text
representation s of tables. The first row (line) of the CSV file are
the names of the columns and subsequent lines are the values of the
columns.

Is this the kind of CSV file you are talking about or do you have some
other idea?

Ah, I see. Yes that is exactly the type of data I will be using. Here is
an example:

Date,Open,High, Low,Close,Volum e
3-Jul-08,0.80,1.09,0. 80,1.09,77800
2-Jul-08,1.08,1.09,0. 56,0.94,19600
1-Jul-08,1.09,1.09,0. 95,1.08,29700
30-Jun-08,0.80,1.09,0. 75,1.09,11500
Ok, thanks. I deal with these .csv files every day at my job. I haven't
used strtok() in twenty years, since I figured out how it works.

Given your example file, what do you want to do with the data?

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Jul 6 '08 #4
On 2008-07-07 00:06:09 +0100, Joe Wright <jo********@com cast.netsaid:
>
>>
Ah, I see. Yes that is exactly the type of data I will be using. Here
is an example:

Date,Open,High ,Low,Close,Volu me
3-Jul-08,0.80,1.09,0. 80,1.09,77800
2-Jul-08,1.08,1.09,0. 56,0.94,19600
1-Jul-08,1.09,1.09,0. 95,1.08,29700
30-Jun-08,0.80,1.09,0. 75,1.09,11500

Ok, thanks. I deal with these .csv files every day at my job. I haven't
used strtok() in twenty years, since I figured out how it works.

Given your example file, what do you want to do with the data?
Basically I want to split the component parts up. I want to keep the
date and convert it to a useable form and then take each of the other
components (open, high, low etc) and put them in the appropriate
variable type. Then once I have all of them I want to be able to do
certain mathmatically functions. To give a very simple example I want
to be able to work out the moving average with the given data.
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire

Jul 7 '08 #5
Cromulent wrote:
Joe Wright <jo********@com cast.netsaid:
>>Ah, I see. Yes that is exactly the type of data I will be using.
Here is an example:

Date,Open,Hig h,Low,Close,Vol ume
3-Jul-08,0.80,1.09,0. 80,1.09,77800
2-Jul-08,1.08,1.09,0. 56,0.94,19600
1-Jul-08,1.09,1.09,0. 95,1.08,29700
30-Jun-08,0.80,1.09,0. 75,1.09,11500

Ok, thanks. I deal with these .csv files every day at my job. I
haven't used strtok() in twenty years, since I figured out how
it works.

Given your example file, what do you want to do with the data?

Basically I want to split the component parts up. I want to keep
the date and convert it to a useable form and then take each of
the other components (open, high, low etc) and put them in the
appropriate variable type. Then once I have all of them I want to
be able to do certain mathmatically functions. To give a very
simple example I want to be able to work out the moving average
with the given data.
Please do not strip attribution lines for material you quote.
Those are the initial lines of the form "Joe wrote:", and give
credit to the authors.

Try this:

/* ------- file tknsplit.c ----------*/
#include "tknsplit.h "

/* copy over the next tkn from an input string, after
skipping leading blanks (or other whitespace?). The
tkn is terminated by the first appearance of tknchar,
or by the end of the source string.

The caller must supply sufficient space in tkn to
receive any tkn, Otherwise tkns will be truncated.

Returns: a pointer past the terminating tknchar.

This will happily return an infinity of empty tkns if
called with src pointing to the end of a string. Tokens
will never include a copy of tknchar.

A better name would be "strtkn", except that is reserved
for the system namespace. Change to that at your risk.

released to Public Domain, by C.B. Falconer.
Published 2006-02-20. Attribution appreciated.
Revised 2006-06-13 2007-05-26 (name)
*/

const char *tknsplit(const char *src, /* Source of tkns */
char tknchar, /* tkn delimiting char */
char *tkn, /* receiver of parsed tkn */
size_t lgh) /* length tkn can receive */
/* not including final '\0' */
{
if (src) {
while (' ' == *src) src++;

while (*src && (tknchar != *src)) {
if (lgh) {
*tkn++ = *src;
--lgh;
}
src++;
}
if (*src && (tknchar == *src)) src++;
}
*tkn = '\0';
return src;
} /* tknsplit */

#ifdef TESTING
#include <stdio.h>

#define ABRsize 6 /* length of acceptable tkn abbreviations */

/* ---------------- */

static void showtkn(int i, char *tok)
{
putchar(i + '1'); putchar(':');
puts(tok);
} /* showtkn */

/* ---------------- */

int main(void)
{
char teststring[] = "This is a test, ,, abbrev, more";

const char *t, *s = teststring;
int i;
char tkn[ABRsize + 1];

puts(teststring );
t = s;
for (i = 0; i < 4; i++) {
t = tknsplit(t, ',', tkn, ABRsize);
showtkn(i, tkn);
}

puts("\nHow to detect 'no more tkns' while truncating");
t = s; i = 0;
while (*t) {
t = tknsplit(t, ',', tkn, 3);
showtkn(i, tkn);
i++;
}

puts("\nUsing blanks as tkn delimiters");
t = s; i = 0;
while (*t) {
t = tknsplit(t, ' ', tkn, ABRsize);
showtkn(i, tkn);
i++;
}
return 0;
} /* main */

#endif
/* ------- end file tknsplit.c ----------*/

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.

Jul 7 '08 #6
Cromulent <cr*******@just extrememetal.co mwrites:
On 2008-07-07 00:06:09 +0100, Joe Wright <jo********@com cast.netsaid:
>>
>>>
Ah, I see. Yes that is exactly the type of data I will be
using. Here is an example:

Date,Open,Hig h,Low,Close,Vol ume
3-Jul-08,0.80,1.09,0. 80,1.09,77800
2-Jul-08,1.08,1.09,0. 56,0.94,19600
1-Jul-08,1.09,1.09,0. 95,1.08,29700
30-Jun-08,0.80,1.09,0. 75,1.09,11500

Ok, thanks. I deal with these .csv files every day at my job. I
haven't used strtok() in twenty years, since I figured out how it
works.

Given your example file, what do you want to do with the data?

Basically I want to split the component parts up.
You could do a lot worse than simply using fscanf. If you make the
format quite strict and test the return you will be alerted to most
input errors:

char month[4], nl;
double open, hi, lo, close;
unsigned day, year, vol;
...
if (fscanf("%2u-%3s-%2u,%lf,%lf,%lf ,%lf,%u%c",
&day, month, &year, &open, &hi, &lo, &close, &vol, &nl) == 9
&& nl == '\n')

--
Ben.
Jul 7 '08 #7
Bill Reid said:
>
Bill Reid <ho********@hap pyhealthy.netwr ote in message
news:97******** ************@bg tnsc05-news.ops.worldn et.att.net...

DAMN!!! I hate it when that happens!!!
It would happen less if you listened more.

There are plenty of bright people in here.

You can always tell the bright ones, because they are the ones who learn
from other people's crits.

And then there are those who, like Bill, take criticism as insult and
respond to it with invective.

Not so bright.

Okay, Bill, flame away. Shouting is what you're good at, so you get on with
your shouting and let the poor newbie get on with learning C from people
who know it.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 8 '08 #8
Richard Heathfield wrote:
Bill Reid said:
>Bill Reid <ho********@hap pyhealthy.netwr ote in message
news:97******* *************@b gtnsc05-news.ops.worldn et.att.net...

DAMN!!! I hate it when that happens!!!

It would happen less if you listened more.

There are plenty of bright people in here.

You can always tell the bright ones, because they are the ones who learn
from other people's crits.

And then there are those who, like Bill, take criticism as insult and
respond to it with invective.

Not so bright.

Okay, Bill, flame away. Shouting is what you're good at, so you get on with
your shouting and let the poor newbie get on with learning C from people
who know it.
Yes, for instance mr heathfield that can't figure out that pointers
aren't always 32 bits...

See "C unleashed"

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jul 8 '08 #9
On Tue, 08 Jul 2008 09:36:46 +0200, jacob navia posted:
Richard Heathfield wrote:
>Bill Reid said:
>>Bill Reid <ho********@hap pyhealthy.netwr ote in message
news:97****** **************@ bgtnsc05-news.ops.worldn et.att.net...

DAMN!!! I hate it when that happens!!!

It would happen less if you listened more.

There are plenty of bright people in here.

You can always tell the bright ones, because they are the ones who learn
from other people's crits.

And then there are those who, like Bill, take criticism as insult and
respond to it with invective.

Not so bright.

Okay, Bill, flame away. Shouting is what you're good at, so you get on with
your shouting and let the poor newbie get on with learning C from people
who know it.

Yes, for instance mr heathfield that can't figure out that pointers
aren't always 32 bits...

See "C unleashed"
I couldn't find the guarantee of 32-bit pointers. I don't think it's any
big secret that there were a lot of errors. My favorite of the whoppers is
Jack Klein's visualization of an error-correcting Hamming code announced as
(12,4) instead of (12,8), which completely reverses the role of the parity
and data bits.
--
I hate all sports as rabidly as a person who likes sports hates common
sense.
H. L. Mencken
Jul 8 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1448
by: Graham Mattingley | last post by:
I am trying to count the records in a database, and make an array from the answer this is the code strQuery = "SELECT count(*) FROM resort where island_id= '"&island_drop&"' ;" Set rsIslandinfo = adoConn.Execute(strQuery) i = rsIslandinfo("count(*)").Value ** this bit above here works find I have done a response.write to check I have a number in i
4
5600
by: Simom Thorpe | last post by:
Hi, I'm trying to insert a line into a MS access DB using ASP on IIS 5. This is the line: con.execute "INSERT INTO newProds(title,desc,catcode) VALUES ('Champagne Muff Scarf','','AC304B')" But it throws up this error:
1
2460
by: coolsti | last post by:
I am trying to let the user drag a rectangle over an image, which will then let the user zoom in on the dragged area. However, I am doing something wrong in implementing the onmousedown and onmouseup events. Everything is very simple so far. I just defined an onMouseDown event to record the event's x and y locations as the starting point, and an onMouseUp event to record the x and y of the end point, and this function gives me the...
2
2703
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update button, seems simple. I am using ALL visual controls (supposedly to simplify things. If I was not using the visual controls and calling an ExecuteNonQuery no prob. Please look at my code and tell me what I am doing wrong. Also, what are the advatages...
5
2906
by: Simon Brooke | last post by:
This is supposed to be a very simple XSL stylesheet to strip styling information out of HTML documents - it could not be more basic. And yet, it doesn't work. I'm obviously getting something very basic wrong and for the life of me I can't see it. Please, somebody, cast your eyes over this and tell me what's wrong! First, the XSL stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"
8
2061
by: watkinsdev | last post by:
Hi, I have created a mesh class in visual studio 6.0 c++. I can create a device, render objects and can edit the objects by for instancnce selecting a cluster of vertices and processing the vertices and can do this multiple times on a sinlge vertex cluster. The problem I have been encoutering is that, if I select a second vertex cluster and try to edit that , the program crashes.
0
1319
by: shapper | last post by:
Hello, I am creating a class with a control. I compiled the class and used it on an Asp.Net 2.0 web site page. I can see the begin and end tags of my control (<oland </ol>) but somehow the child controls (just a literal for testing) of my control is not being added to the page. Could someone tell me what am I doing wrong?
16
1902
by: SirG | last post by:
I'm looking for an explanation of why one piece of code works and another does not. I have to warn you that this is the first piece of Javascript I've ever written, so if there is a better way or a simpler answer, by all means show me the light! What I'm trying to do is refresh the page at a timed interval ( actually redirect the page... ) and I have a simple piece of code I got from the net that works, but I need to modify it a little...
10
1789
by: DavidSeck.com | last post by:
Hi, I am working with the Facebook API right now, an I have kind of a problem, but I don't know what I am doing wrong. So I have a few arrays, f.ex.: User albums: array(2) {
34
1758
by: raphfrk | last post by:
This program should copy one file onto the other. It works if I compile it with gcc to a cygwin program. However, if I compile it with the -mno-cygwin option, it doesn't work (this targets native windows). Anyway, I just want to check that the program is valid before I see if I can find a way around a compiler bug. It might be something simple that I am doing wrong.
0
8475
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8148
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8338
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3962
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4024
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1329
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.