8 08UTC Diciembre, 2009
Compara dos tablas delimitadas por tabuladores por un campo numerico ordenado, imprime registros de la tabla 1 coincidentes con la tabla 2 y agrega un campo suplementario. Evalua que las lineas no estén vacías, si no se interrumpe el procesamiento. Requiere val() ya que en la cabecera el rótulo del campo índice es una cadena y la evaluación no daría el resultado esperado.
const sArch1 = "archivo1.txt" ' tabla 1
const sArch2 = "archivo2.txt" ' tabla 2
const nIX = 0 ' campo indice
const nCampo = 2 ' campo suplementario (tabla 2)
const ht = chr(9) : nCount = 0 : nMatch = 0
tload sArch1, aArch1
for i in aArch1
if (len(i) > 0) then
split i, ht, aLinea1()
nIndice1 = val(aLinea1(nIX))
tload sArch2, aArch2
for j in aArch2
if (len(j) > 0) then
split j, ht, aLinea2()
nIndice2 = val(aLinea2(nIX)) : nCount += 1
if ( nIndice1 == nIndice2 ) then
print i, aLinea2(nCampo) : nMatch += 1
goto leave_for_j
elif ( nIndice1 < nIndice2 ) then
goto leave_for_j
fi
fi
next
label leave_for_j:
fi
next
'print "Iterations: " + nCount, "Matches: " + nMatch
Deja un Comentario » |
SmallBasic |
Permalink
Escrito por abelmora
8 08UTC Diciembre, 2009
Similar a la entrada previa, pero disminuye las repeticiones.
const ht = chr(9)
const sArch1="archivo1.txt"
const sArch2="archivo2.txt"
nCount = 0 : nMatch = 0
open sArch1 for input as #1
repeat
linput #1, sLinea1 : split sLinea1, ht, aLinea1
open sArch2 for input as #2
repeat
linput #2, sLinea2 : split sLinea2, ht, aLinea2 : nCount += 1
if ( val(aLinea1(0)) == val(aLinea2(0))) then
print sLinea1, aLinea2(2) : nMatch += 1
goto leave_repeat2
elif ( val(aLinea1(0)) < val(aLinea2(0)) ) then
goto leave_repeat2
fi
until eof(2)==1
label leave_repeat2:
close #2
until eof(1) == 1
close #1
'print "Iterations: " + nCount, "Matches: " + nMatch
Deja un Comentario » |
SmallBasic |
Permalink
Escrito por abelmora
8 08UTC Octubre, 2007
If you manage an important amount of bibliographic references Memento is a very interesting alternative among other online tools. Some of its features are
- Add articles from URLs —Pubmed, Nature, etc— from files —BibTeX, RIS and more— and manually
- Organize your collection by Author and by Keywords
- Write reports linking selected articles
- Make watchlists
- Export to BibTeX and MS Word 2007 XML
- Share, Add to Cart, Add to Reports, Delete and Comment entries
- Sort articles by Title, Year, etc
- Explore graphically articles, tags and authors
- Edit article fields
- Search article in Citeseer, HighWire and more
- Last but not least, a competent and responsive developer supporting it. Thank you Ritesh Agrawal!
For those who do academic work —like me— it does definitively deserve a try. You can know more visiting Memento
Enjoy it!
Deja un Comentario » |
academic | Etiquetado: bibliography, research |
Permalink
Escrito por abelmora