Monday, September 28, 2009
Lab 1 Diffusion And Osmosis Answers Web Archive
A problem that often occurs when you want to control the number of users online on its website, is to detect if the user has exited the closing the browser directly to our site.
There is no way to detect the event that you have left our site taken to another site, or the user may be directly released by closing the browser.
then I present a solution to this problem, made with ASP and Ajax.
First, I explain the theory, then shows you the code (very simple). If someone wants to skip the explanation, in fondo trovate lo zip con gli script.
Io ho risolto il problema prendendolo al contrario: non sono io che devo vedere se l'utente è online..o se è uscito...o se ha cambiato sito... Ma è l'utente che deve segnalarmi di essere ancora sul mio sito.
Quindi ogni tot minuti, secondi o quello che vorremo, il nostro utente, con una richiesta asincrona fatta con ajax, comunicherà al nostro server, di essere ancora sul sito. E quando segnala la sua presenza, mi salverò il minuto della sua segnalazione....a questo punto, se l'ultima segnalazione di un utente dovesse essere più vecchia del numero di minuti che io imposto, elimino semplicemente l'utente dalla mia variabile che contiene gli utenti reali sul sito.
theoretically the game ends!
course, between saying and doing ...
The first operation is typical to set the variable "application" that will contain information on users online that interest me.
The Application variable (for the uninitiated, is a variable common to all users, and that remains in effect until all users have not come from my site), is typically created in global.asa or (in ' ASP (global.asa is the first file that is read the entry on the site)), or we can decide where and how we want to create it. I in this example, the variable application, which I call "user" when I create a registered user of my site to login. (if you want you can create even more, with the reference to the user his sessionID)
example we will create a generic system that counts all users accessed the site, not just those that have logged , then keep as a reference point the sessionID of the user. The sessionID is a session variable, which is created automatically by the server every time you enter a user is unique and lasts for as long as the user running on our website. This variable're ready to be useful, for example, in ecommerce sites, to fill the temporary shopping cart, without the user has not registered or has logged.
First we create the variable application, se non esiste ancora, oppure accodarci alla variabile già esistente:
Per il codice di questa prima parte, aprire il file "test.asp", all'interno dello Zip.
Il risultato sostanzialmente sarà un array con "SessionID---minuto della segnalazione della propria presenza o della propria entrata"
A questo punto, in ogni pagina del mio sito, avrò un piccolo script, che tramite l'oggetto XMLHttpRequest, che è la base per le richieste asincrone di Ajax, che con un intervallo fissato da noi, segnalerà la nostra presenza, ed andrà ad aggiornare l'orario nella variabile application.
Nella pagina test.asp, trovate il codice Ajax che aggiorna la nostra presence, referring to the page "presenza.asp", and reads the current list of users through the 'user-online.asp.
The table of online users is then inserted, again with an asynchronous request, the test page.
On the "user-online.asp", which is the page that I count the people, and I generate the list, I have the script that checks if the users in the application variable, they reported their presence in recent n minutes, I have set.
If I set two minutes, when the difference between the actual and the minutes of the last report of presence is greater than 2, the user is deleted.
This solution obviously works when the user exits without the typical Logout, because it is no longer on the site, most will not report its presence ... and then it will be removed from the Application variable.
In the zip you will find 4 pages:
- Test.asp: that contains the code to be included in the initial entry page
- presenza.asp: This is the page where its presence is signaled
- online.asp-users: it is page that generates the table with the list of users, which counts users, and eliminates any people left.
- out-Test.asp: the page for the output type Logout.
If you want proof, go to this page actually users online (maybe access with two or three browsers at the same time as the entry of several simulated users)
If you want to download the zip file click here>> really Users online by alessio_1976
The script works with IE from 7 up, Firefox, Google Chrome, Safari. (tested by me)
I hope it will be useful, and if someone has to make improvements and changes, so be it!
Warning!
updated on: 14/01/2010
Added: Many people have asked me how to use the script to display the username of the user. Add a second
Zip, which contains the script changed, so that it is used the session variable that contains Username of the users accessing the site, instead of the variable that contains the Id of the session, the previous script.
in the zip file there are a few more that are used to simulate a login:
- "login.asp" which has the form to get
- "create-session.asp" that creates the session variable called "username", which is then used in the script, to keep track of user presence. Obviously, my advice is always to use the user id, and then with that, get any usernames to be displayed on the site.
I am posting the link to go before the tests: check username really online
I am attaching the zip here ... Milanos: users-real-online
Thursday, September 10, 2009
Where Is The Eterna Forest In Pokemon Indigo
I present now a little script that I made for the classic map that tells you what position you are on the site like:
Home>> Products>> Sony> Playstation 3
Inside the file you just select which page on your server is set as your home page.
As for the home directory of all, usually when you go to a folder directly without putting the name of the final page, the server points to a page set by default ... which might just be default.htm. ... .. or index.htm or index.php or index.asp ... ... etc. .. make sure that each directory abbia la propria home page...altrimenti , cliccando il link alla directory, vi potrebbe dare il messaggio tipico "directory listing denied"
Anche quando un utente accede al nostro sito inserendo solo l'indirizzo, comunque il server punta alla nostra home page.
Lo script in sostanza lavora sulla url visualizzata in quel momento, e non come in genere questi script fanno, direttamente sul server controllando i file all'interno delle cartelle.
Con una serie di split, si rileva così la root principale, tutte le eventuali directory, e la pagina finale nella quale ci si trova.
Lo script sostituisce il simbolo "-" con lo spazio, perché io ho l'abitudine di mettere al posto degli spazi il carattere "-" Which is interpreted by the engine as a space.
I usually also replace the anchor text "home" that brings me back to the home page, with the most appropriate keywords: you can see the example running on this site:
Software
.. and ecommerce sites created with that software.
The script is inside a div that you can include anywhere on your site (in pages of course. Asp)
download the Zip file and try: Milanos: Map of the site in ASP
Tuesday, September 1, 2009
Can I Buy Cole Slaw Dressing
We often happens have to include in our pages that repeat sections of the page to create a sort of omogeneicità site.
For example, a structure may be quite common:
\u0026lt;div id="testa"> \u0026lt;/ div> \u0026lt;div
id="menu"> \u0026lt;/ div> \u0026lt;div
id="corpo"> \u0026lt; ; / div> \u0026lt;div
id="piede"> \u0026lt;/ div>
and within each div the content is pasted with an include. There are two types of
include: include files and include virtual.
The two commands are exactly the same purpose, only that the include file has the limit to include only files that reside in the same directory (unless you sure this enabled the "parent paths" on your server, then you can refer to files in other directories using "../" instead of the folder name)
fact, if you try to insert a slash (/) before the name of the file will return error. The
include virtual however it is much more practical, allowing you to enter absolute preparatory courses (which I prefer to that for), and thus be able to use the include in any page of the site without bothering to change the path.
The syntax of include files and virtual is as follows:
\u0026lt;!--# include file = "tuofile.htm" ->
\u0026lt;!--# include virtual = "/ tuofile.htm" -> There
But sometimes the need to dynamically include files ... that is based on certain factors include a file over another. In the syntax of include
you can not insert variables to change dynamically, for example the name of the linked page.
One solution is to use the command Server.Execute.
The syntax is as usual the ASP, and inside I will be able to enter my variables:
\u0026lt;% Server.Execute "tuofile.htm"%>
obviously I can enter the variable with the usual syntax:
\u0026lt;% Server.Execute "" & & nomefiledinamico. "htm"%>
Sample Of Company Hologram
One of the most interesting languages \u200b\u200bto synchronize data from different sources, for example, used to synchronize data from local to remote, is XML.
The first line of a basic XML file indicates the version and encoding of the file and will be:
"\u0026lt;? Xml version =" 1.0 "encoding =" UTF-8 ""?>"
Then start
XML.
XML is very similar to HTML, is structured in a "tag". All XML tags must be closed, however.
The XML has a root tag, also called root node, which would contain within it all the child nodes.
Example:
\u0026lt;nodoprincipale>
\u0026lt;nodo> Content 1 \u0026lt;/ node>
\u0026lt;nodo> Content 2 \u0026lt;/ node>
\u0026lt;nodo> Content 3 \u0026lt;/ node>
\u0026lt;/ nodoprincipale>
Let's see how to create a file on our server, xml:
to create this file we will use an object "FileSystemObject"
\u0026lt;% Dim
OggFile, source, origin OggTextStream
= Server.MapPath ("/ public / file.xml") Set fso = CreateObject
("Scripting.FileSystemObject")
fso.CreateTextFile (source)
September OggFile fso.GetFile = (source)
Set OggTextStream = OggFile.OpenAsTextStream(2)
OggTextStream.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
OggTextStream.WriteLine "<fotos>"
OggTextStream.WriteLine "<foto photo=''>Immagine 1</foto>"
OggTextStream.WriteLine "<foto photo=''>Immagine 2</foto>"
OggTextStream.WriteLine "<foto photo=''>Immagine 3</foto>"
OggTextStream.WriteLine "<foto photo=''>Immagine 4</foto>"
OggTextStream.WriteLine "\u0026lt;/ Photos>"
OggTextStream.close
response.write "Writing successful. \u0026lt;a Href="/public/file.xml"> View \u0026lt;/ a>"
%>
The proposed link at the end of creation, open the file you created.
Sunbeam Electric Blanket Ff Error
This question has populated thousands of threads in the forum for more Webmaster famous on the net ... and the answer is ... Sure you can '!
Looking good in the "handbook" of Aruba, you can find a great zip download that contains a lot of useful things for those who develop sites hosted on Aruba, programming in ASP or ASP.net.
These scripts were created by Persits and are simple to use and very effective. In
files you find on Aruba ( at this address ) found four components, namely:
- AspEmail, a component that joins CDOSYS, and allows you to send mail with various options. Used in conjunction with AspUpload makes it very easy to send attachments via e-mail via web page
- AspUpload, component to facilitate the sending of files through forms. Many options, opportunity 'to save the file to disk or database.
- AspJpeg, component for manipulating the fly image: size, rotate, crop, resolution, save to database.
- AspPdf, component for creating on the fly PDF files, the source can 'be a file of text, image, web page, form, etc.. etc. Within
found lots of examples.
In this post we're talking about, however, upload files of any size, and then I describe how to do it: First
included in the "CGI-BIN" of your space Aruba, the. Dll called "ASPUPLOADLib.dll" that found in the zip.
Then you will have a form with which you load the file type:
\u0026lt;form enctype="multipart/form-data" method="post" action="Upload.asp">
\u0026lt;input type = " file "name =" file "> \u0026lt;input
value="Carica the file" type="submit">
\u0026lt;/ form>
page upload.asp, sostanzialmente dovrà contenere 2 sole righe:
Set Upload = Server.CreateObject("Persits.Upload")
Upload.Save(Server.MapPath("/public")) 'qui impostate il percorso dove finirà il file
response.write "File caricato con successo!"
e con queste sole due righe, voi potrete caricare sul vostro server file di qualunque dimensione!!
Se poi avete bisogno di ricavare il nome del file, magari per inserirlo nel vostro database, aggiungete queste righe:
Set File = Upload.Files("file") ' qui metterete al posto di "file", il nome della input che avete nella vostra form dove caricate il file
If Not File Is Nothing Then
filename=File.FileName
end if
and behold, the variable "filename" contains the full file name extension.
Finally, if you need to rename the file, you can put these lines:
September Upload.Files = File ("file") 'put here instead of "file", the name of the input you have in your form where to upload the file
If Not File Is Nothing Then filename =
File.FileName
nuovo_filename = "text_" & filename & "" Dim
fsoMyFile
September fsoMyFile = Server.CreateObject ("Scripting.FileSystemObject")
fsoMyFile . MoveFile (Server.MapPath ("/ public /" & filename &"")), (Server.MapPath("/public/"&nuovo_filename&""))
Set fsoMyFile = nothing
end if
ed il gioco è fatto!!
Spero possa esservi utile.
Disney Cruise Line Auditions
One of the most effective Ajax applications, is to populate a select html form, without having to reload the page. Especially when there are several options for each value in the first select, it is very handy this system, compared to typical systems with Javascript, which, without reloading the page, should have already included in the code of the page all the elements of each possible choice.
The other way is to send to the server select the value of choice, and remove the server side the corresponding values \u200b\u200bfrom the database and then reload the page and list them. Although this is sometimes inconvenient, especially in forms that have different fields with different values \u200b\u200bthat should be reported every time you recharge.
solution that provides Ajax, using any server side language, is certainly the most practical.
Basically the concept is: when I choose the first value in the select, send a request to the server for a list of values \u200b\u200bbelonging to the elite group, and insert the new content on the page.
In questo esempio vedremo come popolare le tipiche select Regione >> Provincia >> Comune, considerando di avere tutti i valori in relazione tra loro in un database:
Tabella regioni:
id_regione - regione
Tabella provincie:
id_provincia - provincia - id_regione
Tabella comuni:
id_comune - comune - id_provincia
Inizialmente avremo la nostra select(che potremmo creare dinamicamente con il nostro linguaggio lato server, oppure creando manualmente le 20 option che avranno come valore l'id della regione e come testo il nome della regione) che conterrà le 20 Regioni italiane. Al tag "select", che avrà come name "id_regione" javascript code that will match the event "onchange" of the select, it will send the id of the Region to my script that resides in a normal page. The page called in the zip pull-province.asp, will receive the id of the region and extract all the provinces belonging to that region. The content of this page, which will select the practice that contains all the provinces, will be pasted on my page in the appropriate position, with the JavaScript function called innerHTML. The
select which will be pasted, called id_provincia, will in turn JavaScript code that the event "onchange", send the id of the chosen province to the next page called rip-comuni.asp, which will filter the municipalities of the province sent, and generate the select list with all the municipalities, and its id.
At this point, with innerHTML, even this select paste in my form. I could go on indefinitely.
is the result:
But here are the zip, which contains the Access database updated with the new provinces of Sardinia, in Monza, Fermo and Barletta: Popular dynamically select ajax javascript
Remember move the database directory mdb-database (or if you put it in other directories, update the path ... and make sure that the directory has execute permissions)