473,769 Members | 7,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing Data, Storing into an array, Infinite Backslashes

I am using this function to parse data I have stored in an array.

This is what the array looks like:

[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0',
'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory', '0',
'ConfigurationT ype', '2'], ['Memory', '1', 'Summary', '0'], ['Memory',
'1', 'Speed', 'PC3200U-30330'], ['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '1', 'Size', '512'], ['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationT ype', '2'], ['Memory', '2', 'Summary',
'0'], ['Memory', '2', 'Speed', 'PC3200U-30330'], ['Memory', '2',
'Type', 'DDR SDRAM'], ['Memory', '2', 'Size', '512'], ['Memory', '2',
'Slot', 'DIMM2/J13'], ['Memory', '2', 'ConfigurationT ype', '2'],
['Memory', '3', 'Summary', '0'], ['Memory', '3', 'Speed',
'PC3200U-30330'], ['Memory', '3', 'Type', 'DDR SDRAM'], ['Memory', '3',
'Size', '512'], ['Memory', '3', 'Slot', 'DIMM3/J14'], ['Memory', '3',
'ConfigurationT ype', '2']]

This is the code to parse the array:

count=0
place=0
query=[]
while 1:
try:
i=fetch.next()
except StopIteration:
break
if i[1] != count:
++count
query.append(co unt)
qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

print qval,"\n"

When it runs I get an output similar to this.

\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\'Type=DDR
SDRAM,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ 'Size=512,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\'Slot=DI MM2/J13,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\'Configurati onType=2,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \'Summary=0,
\\\\\\\\\\\\\\\ 'Speed=PC3200U-30330, \\\\\\\'Type=DD R SDRAM,
\\\'Size=512, \'Slot=DIMM3/J14, '

When it's supposed to print just the plain text with the numbers etc.

I have changed these lines:

qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

To this:

query[count]=query[count]+i[2]+"="+i[3]+", "

I get this error:

Traceback (most recent call last): File "infnode.py ", line 60, in ?
query[count]=query[count]+i[2]+"="+i[3]+", "TypeError: unsupported
operand type(s) for +: 'int' and 'str'

So I try and fix it by doing this:

query[count]=`query[count]`+i[2]+"="+i[3]+", "

Can someone please point me in the right direction I am sure that the
`query[count]` is causing the backslashes.

Thanks in advance.

Jul 21 '05 #1
6 2048
Your code is needlessly complicated.

Instead of this business
while 1:
try:
i = fetch.next()
except stopIteration:
break
simply write:
for i in fetch:
(if there's an explicit 'fetch = iter(somethinge lse)' in code you did
not show, then get rid of that and just loop 'for i in somethingelse')

i[1] will never compare equal to count, because i[1] is always a string
and count is always an integer. Integers and strings are never equal to
each other.

Wring code like
x = "a string " + 3
does not work in Python. You can either convert to a string and then
use the + operator to concatenate:
x = "a string " + str(3)
or you can use %-formatting:
x = "a string %s" % 3
("%s" accepts any sort of object, not just strings)

Using repr(...) (`...` is just a shorthand for this) is what is really
introducing the backslashes. When it outputs a string, it quotes the
string using backslashes. But you pass the old part of the prepared
string through it each time, which leads to doubling backslashes.

Below is a program I wrote to process the data in your message. It prints
out
Memory 2 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM2/J13, ConfigurationTy pe=2
Memory 3 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM3/J14, ConfigurationTy pe=2
Memory 0 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM0/J11, ConfigurationTy pe=2
Memory 1 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM1/J12, ConfigurationTy pe=2
the result is out of order because the result of calling .items() on a
dict is in an arbitrary order.

Jeff

s = [['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0',
'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory', '0',
'ConfigurationT ype', '2'], ['Memory', '1', 'Summary', '0'], ['Memory',
'1', 'Speed', 'PC3200U-30330'], ['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '1', 'Size', '512'], ['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationT ype', '2'], ['Memory', '2', 'Summary',
'0'], ['Memory', '2', 'Speed', 'PC3200U-30330'], ['Memory', '2',
'Type', 'DDR SDRAM'], ['Memory', '2', 'Size', '512'], ['Memory', '2',
'Slot', 'DIMM2/J13'], ['Memory', '2', 'ConfigurationT ype', '2'],
['Memory', '3', 'Summary', '0'], ['Memory', '3', 'Speed',
'PC3200U-30330'], ['Memory', '3', 'Type', 'DDR SDRAM'], ['Memory', '3',
'Size', '512'], ['Memory', '3', 'Slot', 'DIMM3/J14'], ['Memory', '3',
'ConfigurationT ype', '2']]

query = {}

for a, b, c, d in s:
if not query.has_key(( a,b)): query[(a,b)] = []
query[(a,b)].append("%s=%s" % (c, d))

for (a,b), v in query.items():
print a, b, ", ".join(v)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFC0uMvJd0 1MZaTXX0RAm5dAK CsFownutZiB2pc2 xf9PTGb2hRyUgCf T7ti
E3RKhgPPE1u9/D5MKa1F/Ho=
=HtOG
-----END PGP SIGNATURE-----

Jul 21 '05 #2
On Mon, 11 Jul 2005 13:47:22 -0700, su***********@g mail.com wrote:
I am using this function to parse data I have stored in an array.

This is what the array looks like:

[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ... ]
[snip more of the array]
This is the code to parse the array:

count=0
place=0
place is not used in your function. Remove it.
query=[]
while 1:
try:
i=fetch.next()
What is fetch and what does fetch.next() do?

It is considered bad programming practice to use a variable i for anything
except for i in range(). i for "index", not i for "next record".
except StopIteration:
break
if i[1] != count:
What is i? A list? A tuple? A dict? What is stored in it?
++count
query.append(co unt)
Why are you appending the numeric value of count to the list query? Since
count starts at zero, and increases by one, your list is just [1, 2, 3, ...]
qval=`query[count]`
It looks like you are setting the variable qval to the string
representation of a number. Backticks are being depreciated, you should
write this as qval = str(query[count]).

But if I have understood your program logic correctly, query[count] up
to this point is just count. So a much simpler way is to just use qval =
str(count).
query[count]=qval+i[2]+"="+i[3]+", "
Impossible to know what this does since we don't know what i is. Hint: it
is easier to read and parse expressions by adding a small amount of
whitespace:

query[count] = qval + i[2] + "=" + i[3] + ", "
print qval,"\n"

When it runs I get an output similar to this.

\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\'Type=DDR
SDRAM,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ 'Size=512,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\'Slot=DI MM2/J13,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \\\'Configurati onType=2,
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \'Summary=0,
\\\\\\\\\\\\\\\ 'Speed=PC3200U-30330, \\\\\\\'Type=DD R SDRAM,
\\\'Size=512, \'Slot=DIMM3/J14, '

When it's supposed to print just the plain text with the numbers etc.

See below for some further hints.

I have changed these lines:

qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

To this:

query[count]=query[count]+i[2]+"="+i[3]+", "

I get this error:

Traceback (most recent call last): File "infnode.py ", line 60, in ?
query[count]=query[count]+i[2]+"="+i[3]+", "TypeError: unsupported
operand type(s) for +: 'int' and 'str'
Yes. query[count] is an integer equal to count. i[2] is who-knows-what.
"=" is a string. You can't add strings to ints.
So I try and fix it by doing this:

query[count]=`query[count]`+i[2]+"="+i[3]+", "
That is functionally equivalent to your first version.
Can someone please point me in the right direction I am sure that the
`query[count]` is causing the backslashes.


I doubt it very much. But you can test it by adding some print lines in
your code: change this:

qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

to this:

print "Count is: ", count
print "query[count] is: ", query[count]
qval=`query[count]`
print "qval is: ", qval
query[count]=qval+i[2]+"="+i[3]+", "
print "query[count] changed.\nNew value is: ", query[count]

--
Steven.
Jul 21 '05 #3
On 11 Jul 2005 13:47:22 -0700, "su***********@ gmail.com"
<su***********@ gmail.com> declaimed the following in comp.lang.pytho n:
count=0
place=0
query=[]
while 1:
try:
i=fetch.next()
Where is the fetch object defined? And what is it supposed to be
returning?
except StopIteration:
break
if i[1] != count:
++count
query.append(co unt)
qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

print qval,"\n"
When it's supposed to print just the plain text with the numbers etc.
Which numbers? The "memory" number IN the data, or some
incremental counter you are hoping will match?

Watch out for text wrapping in the browser...

-=-=-=-=-=-=-=-=-=-

# I've deliberately re-ordered some of the items
inData = [ ['Memory', '0', 'Summary', '0'],
['Memory', '0', 'Speed', 'PC3200U-30330'],
['Memory', '0', 'Type', 'DDR SDRAM'],
['Memory', '0', 'Size', '512'],
['Memory', '0', 'Slot', 'DIMM0/J11'],
['Memory', '0', 'ConfigurationT ype', '2'],
['Memory', '1', 'Size', '512'],
['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationT ype', '2'],
['Memory', '2', 'Summary', '0'],
['Memory', '2', 'Speed', 'PC3200U-30330'],
['Memory', '2', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Size', '512'],
['Memory', '1', 'Summary', '0'],
['Memory', '1', 'Speed', 'PC3200U-30330'],
['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Slot', 'DIMM2/J13'],
['Memory', '2', 'ConfigurationT ype', '2'],
['Memory', '3', 'Summary', '0'],
['Memory', '3', 'Speed', 'PC3200U-30330'],
['Memory', '3', 'Type', 'DDR SDRAM'],
['Memory', '3', 'Size', '512'],
['Memory', '3', 'Slot', 'DIMM3/J14'],
['Memory', '3', 'ConfigurationT ype', '2'] ]

# Since I scrambled the order, lets build a dictionary to recollect
stuff
tDict = {}

for ln in inData:
if ln[0] != "Memory":
print "Bad data entry"
print ln
else:
# add a dictionary entry for memory ln[1], with key ln[2] and
value ln[3]
tDict.setdefaul t(ln[1], {})[ln[2]] = ln[3]

# input data has been reformatted, process each subdictionary for
output
for k, v in tDict.items():
for sk, sv in v.items():
print "%5s:\t%s=% s" % (k, sk, sv)
print
-=-=-=-=-=-=-=-=-=-=-=-
E:\UserData\Den nis Lee Bieber\My Documents>scrip t1.py
1: Slot=DIMM1/J12
1: Speed=PC3200U-30330
1: Summary=0
1: ConfigurationTy pe=2
1: Type=DDR SDRAM
1: Size=512

0: Slot=DIMM0/J11
0: Speed=PC3200U-30330
0: Summary=0
0: ConfigurationTy pe=2
0: Type=DDR SDRAM
0: Size=512

3: Slot=DIMM3/J14
3: Speed=PC3200U-30330
3: Summary=0
3: ConfigurationTy pe=2
3: Type=DDR SDRAM
3: Size=512

2: Slot=DIMM2/J13
2: Speed=PC3200U-30330
2: Summary=0
2: ConfigurationTy pe=2
2: Type=DDR SDRAM
2: Size=512
E:\UserData\Den nis Lee Bieber\My Documents>

You'll note that using the intermediate dictionary allows me
collect mixed order data -- but without using a separate sort operation,
the retrieval is in whatever order Python gives it.

-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.com/> <

Jul 21 '05 #4
Thanks for all the help, I'm not sure what approach I'm going to try
but I think I'll try all of your suggestions and see which one fits
best.

The variable "i" held the following array:

[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0',
'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory', '0',
'ConfigurationT ype', '2'], ['Memory', '1', 'Summary', '0'], ['Memory',
'1', 'Speed', 'PC3200U-30330'], ['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '1', 'Size', '512'], ['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationT ype', '2'], ['Memory', '2', 'Summary',
'0'], ['Memory', '2', 'Speed', 'PC3200U-30330'], ['Memory', '2',
'Type', 'DDR SDRAM'], ['Memory', '2', 'Size', '512'], ['Memory', '2',
'Slot', 'DIMM2/J13'],
Where is the fetch object defined? And what is it supposed to be
returning?
Fetch is declared a few lines up in the program with this
fetch=iter(ed) it just goes through the array and returns the next part
of it.
query[count]=qval+i[2]+"="+i[3]+", "

Impossible to know what this does since we don't know what i is. Hint: it
is easier to read and parse expressions by adding a small amount of
whitespace:


I am trying to assign each new memory slot to a new part in the array.
So when memory is either 0,1,2,3 it will assign it to query[0],
query[1], query[2], query[3]

Jul 21 '05 #5
On 12 Jul 2005 06:21:11 -0700, "su***********@ gmail.com"
<su***********@ gmail.com> declaimed the following in comp.lang.pytho n:
Thanks for all the help, I'm not sure what approach I'm going to try
but I think I'll try all of your suggestions and see which one fits
best.

The variable "i" held the following array:
Did it? Since later on you are using "i" to contain one element
from the data array.
[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0', <snip> 'Slot', 'DIMM2/J13'],
Fetch is declared a few lines up in the program with this
fetch=iter(ed) it just goes through the array and returns the next part
of it.
Which is a native capability of lists and tuple already.
query[count]=qval+i[2]+"="+i[3]+", "

Impossible to know what this does since we don't know what i is. Hint: it
is easier to read and parse expressions by adding a small amount of
whitespace:


I am trying to assign each new memory slot to a new part in the array.
So when memory is either 0,1,2,3 it will assign it to query[0],
query[1], query[2], query[3]


Unfortunately there are two concerns, to start with...

One, Python lists are dynamic sized -- one can not assign/append to q[3]
without having created [0]..[2]. This is one reason so many of the
attempted solutions are using dictionaries; they are unordered.

Two, the code won't behave properly if the input data is in mixed order.
You are using count to keep track of an incrementing index, but you are
(attempting) to increment it every time the data "memory" number changes
with no test for the number being a match to the next in sequence,
rather than just using the "memory" number itself for the index.

Here's a version using lists in place of the dictionary (though
I haven't fully tested it, it does handle my simple reordered data, but
I don't have a skipped number in that):

-=-=-=-=-=-=-=-=-
# I've deliberately re-ordered some of the items
inData = [ ['Memory', '0', 'Summary', '0'],
['Memory', '0', 'Speed', 'PC3200U-30330'],
['Memory', '0', 'Type', 'DDR SDRAM'],
['Memory', '0', 'Size', '512'],
['Memory', '0', 'Slot', 'DIMM0/J11'],
['Memory', '0', 'ConfigurationT ype', '2'],
['Memory', '1', 'Size', '512'],
['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationT ype', '2'],
['Memory', '2', 'Summary', '0'],
['Memory', '2', 'Speed', 'PC3200U-30330'],
['Memory', '2', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Size', '512'],
['Memory', '1', 'Summary', '0'],
['Memory', '1', 'Speed', 'PC3200U-30330'],
['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Slot', 'DIMM2/J13'],
['Memory', '2', 'ConfigurationT ype', '2'],
['Memory', '3', 'Summary', '0'],
['Memory', '3', 'Speed', 'PC3200U-30330'],
['Memory', '3', 'Type', 'DDR SDRAM'],
['Memory', '3', 'Size', '512'],
['Memory', '3', 'Slot', 'DIMM3/J14'],
['Memory', '3', 'ConfigurationT ype', '2'] ]

### Since I scrambled the order, lets build a dictionary to recollect
stuff
##tDict = {}
##
##for ln in inData:
## if ln[0] != "Memory":
## print "Bad data entry"
## print ln
## else:
## # add a dictionary entry for memory ln[1], with key ln[2]
and value ln[3]
## tDict.setdefaul t(ln[1], {})[ln[2]] = ln[3]
##
### input data has been reformatted, process each subdictionary for
output
##for k, v in tDict.items():
## for sk, sv in v.items():
## print "%5s:\t%s=% s" % (k, sk, sv)
## print

# This time, lets try to manage a list of concatenated strings
tList = []
for ln in inData:
if ln[0] != "Memory":
print "Bad data entry"
print ln
else:
ID = int(ln[1]) # convert string number to integer
item = "%s=%s" % (ln[2], ln[3])

if ID < len(tList):
# list element already allocated, but could be empty
if tList[ID]:
tList[ID] = tList[ID] + ", " + item
else:
tList[ID] = item

elif ID == len(tList):
# ID is next element to be added to list
tList.append(it em)

else:
# ID skips some unallocated elements, so create them
tList = tList + ([None] * (ID - len(tList)))
tList.append(it em)
# output the reformatted list
for i in range(len(tList )):
print "Memory %5s:\t%s" % (i, tList[i])

-=-=-=-=-=-=-=-=-=-

Since I put everything into a concatenated string, the lines are
too long and are wrapped by my client here...

E:\UserData\Den nis Lee Bieber\My Documents>scrip t1.py
Memory 0: Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM,
Size=512, Slot=DIMM0/J11, ConfigurationTy pe=2
Memory 1: Size=512, Slot=DIMM1/J12, ConfigurationTy pe=2,
Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM
Memory 2: Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM,
Size=512, Slot=DIMM2/J13, ConfigurationTy pe=2
Memory 3: Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM,
Size=512, Slot=DIMM3/J14, ConfigurationTy pe=2

E:\UserData\Den nis Lee Bieber\My Documents>
-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.com/> <

Jul 21 '05 #6
I ended up using this code to solve my problem.
for a, b, c, d in s:
if not query.has_key(( a,b)): query[(a,b)] = []
query[(a,b)].append("%s=%s" % (c, d)) for (a,b), v in query.items():
print a, b, ", ".join(v)


I'm relatively new to python/programming in general. I usually write
in php and have produced this website and application
http://my-pbs.sf.net One of the things that makes php easy to program
in is the documentation provided at php.net. It is extremely easy to
find the correct functions to use. Are there any sites you could
recommend that discusses structures of loops and strings? I have an
OReilly book called, "Programmin g Python" and it focuses to much on
showing examples rather than structure and methods.

Thanks for the help.

Jul 21 '05 #7

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

Similar topics

7
332
by: Daniel Lidström | last post by:
Hi, I'm currently using this method to extract doubles from a string: System::String* sp = S" "; System::String* tokens = s->Trim()->Split(sp->ToCharArray()); m_Northing = System::Double::Parse(tokens, nfi); m_Easting = System::Double::Parse(tokens, nfi); m_Elevation = System::Double::Parse(tokens, nfi);
4
2659
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. <txtNameUSState>CALIFORNIA</txtNameUSState>
6
3184
by: Kyle Teague | last post by:
What would give better performance, serializing a multidimensional array and storing it in a single entry in a table or storing each element of the array in a separate table and associating the entries with the entry in the other table? Having a separate table would result in two queries instead of one, but you wouldn't have to deal with the overhead of serializing and unserializing data. -- Kyle
9
4062
by: ankitdesai | last post by:
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics" portions of Babe Ruth page (http://www.baseballprospectus.com/dt/ruthba01.shtml) and store that info in a CSV file. Also, I would like to do this for numerous players whose IDs I have stored in a text file (e.g.: cobbty01, ruthba01, speaktr01, etc.)....
3
4386
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in the file) with the location. And for a particular section I parse only that section. The file is something like, .... DATAS
9
1990
by: Paulers | last post by:
Hello, I have a log file that contains many multi-line messages. What is the best approach to take for extracting data out of each message and populating object properties to be stored in an ArrayList? I have tried looping through the logfile using regex, if statements and flags to find the start and end of each message but I do not see a good time in this process to create a new instance of my Message object. While messing around with...
2
4885
by: RG | last post by:
I am having trouble parsing the data I need from a Serial Port Buffer. I am sending info to a microcontroller that is being echoed back that I need to remove before I start the actual important data reading. For instance this is my buffer string: 012301234FFFFFFxFFFFFFxFFFFFFx Where the FFFFFF is my Hex data I need to read. I am using the "x" as a separater as I was having problems using the VbCrLf. But I think
11
1623
by: a | last post by:
To solve the 100k * 100k data, I finally adopt the file read method and use malloc. The system somehow knows to use virtual memory. Now I first test 1k * 1k data but something uninterpretable happens again. The data file starts with: 42.106983132 85.931514337 98.155213938 23.685776453 76.827067592 ....
35
1972
by: Stef Mientki | last post by:
hello, I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I can think of something like: - use a relative path if drive is identical to the application (I'm still a Windows guy) - use some kind of OS-dependent translation table if on another drive - use ? if on a network drive
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10049
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
9997
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
9865
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...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
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
6675
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();...
1
3965
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
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.