Skip to main content

ASP CODE ; Aggiunge rimuove un elemento dalla sessione ASP

--------------------------------------------
<%
Option Explicit
response.buffer = True
%>

ADD REMOVE ITEM FROM SESSION ARRAY DATA




<%
' Recupero parametri

Dim txtAction
Dim txtCognome
Dim txtNome
Dim txtLuogo
Dim txtData
Dim txtPaternita
Dim txtSesso
Dim strFilePath
Dim txtFull
Dim txtIndex


If IsArray(Session("arrayCasellario")) Then

arrayCasellario = Session("arrayCasellario")
arrayCasellarioIndex = Session("arrayCasellarioIndex")

Else

Dim arrayCasellario( ) ' <<<< notice no size!
ReDim arrayCasellario(100) ' an arbitrary initial size
Dim arrayCasellarioIndex
arrayCasellarioIndex = -1 ' no elements used yet...

End if




Randomize()
strFilePath = "./casellario.txt"


txtAction = Trim(Request("txtAction"))

if txtAction = "AGGIUNGI" Then

txtCognome = Ucase(Trim(Request("txtCognome")))
txtNome = Ucase(Trim(Request("txtNome")))
txtLuogo = Ucase(Trim(Request("txtLuogo")))
txtData = Trim(Request("txtData"))
txtPaternita = Ucase(Trim(Request("txtPaternita")))
txtSesso = Ucase(Trim(Request("txtSesso")))

txtCognome = txtCognome & Space(35 - len(txtCognome))
txtNome = txtNome & Space(35 - len(txtNome))
txtLuogo = txtLuogo & Space(35 - len(txtLuogo))
txtPaternita = txtPaternita& Space(24 - len(txtPaternita))

txtFull = txtCognome & txtNome & txtLuogo & txtData & txtPaternita & txtSesso

arrayCasellarioIndex = arrayCasellarioIndex + 1
arrayCasellario(arrayCasellarioIndex) = txtFull

Session("arrayCasellario") = arrayCasellario
Session("arrayCasellarioIndex") = arrayCasellarioIndex

Dim i
Response.write ""
For i = 0 To arrayCasellarioIndex
Response.write ""
Response.write " <%
Response.write ""
Next
Response.write "
" & arrayCasellario(i) & ""%> < a href="" txtaction="ELIMINA&txtIndex="<%response.write(i)">">[Elimina]
"
End if


if txtAction = "GENERA" Then


dim objFSO, objFile
strFilePath = Server.MapPath(strFilePath)

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

' Getting error on this line....
Set objFile=objFSO.CreateTextFile(strFilePath,true)

For i = 0 To arrayCasellarioIndex
objFile.WriteLine(arrayCasellario(i))
Next



objFile.Close
Set objFile = nothing
Set objFSO = nothing

if err then response.Write(err.Description)

'response.write(Rnd())

%>

File builded ">QUI



<%


End if

'-----------------------------------------------------------------------------------------------------

if txtAction = "ELIMINA" Then

txtIndex = Trim(Request("txtIndex"))

Dim j
For j = txtIndex To arrayCasellarioIndex - 1
arrayCasellario(j) = arrayCasellario(j + 1)
Next

arrayCasellarioIndex = arrayCasellarioIndex - 1

' store
Session("arrayCasellario") = arrayCasellario
Session("arrayCasellarioIndex") = arrayCasellarioIndex


Response.write ""
For i = 0 To arrayCasellarioIndex
Response.write ""
Response.write " <%
Response.write ""
Next
Response.write "
" & arrayCasellario(i) & ""%> < a href="" txtaction="ELIMINA&txtIndex="<%response.write(i)">">[Elimina]
"




End if


if txtAction = "RESET" Then

Session("arrayCasellario") = ""
Session("arrayCasellarioIndex") = "-1"

End if


%>





























Cognome
Nome
Luogo di Nascita
Data di nascita (es. AAAA-MM-GG)
Paternità (opzionale)
Sesso (opzionale o M/F)







< a href="" txtaction="GENERA&<%response.write(Rnd())">">[Genera il file]

< a href="" txtaction="RESET&<%response.write(Rnd())">">[Ricomincia - ripulisci i dati]

Comments

Popular posts from this blog

Word2vec - Sentiment Analysis

Word2vec è un modello (evoluzione Doc2vec) https://sourcedexter.com/tensorflow-text-classification/ https://github.com/tflearn/tflearn Vector space models   (VSMs) represent (embed) words in a continuous vector space where semantically similar words are mapped to nearby points ('are embedded nearby each other') Word2vec is a particularly computationally-efficient predictive model for learning word embeddings from raw text. It comes in two flavors, the Continuous Bag-of-Words model (CBOW) and the Skip-Gram model (Section 3.1 and 3.2 in   Mikolov et al. ) Skip Gram Model http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/ Bag-Of-Words Model https://ongspxm.github.io/blog/2014/12/bag-of-words-natural-language-processing/ Il modello è semplice perchè usa un trucco del auto-encoder l'output layer fa deve ritornare la stessa cosa dell'input (apprendimento supervisionato anche se non si hanno le label) poi si rimuove il livello di output e si ottengono i p...