Android Day – 9 marzo 2013 a Udine
Volete partecipare al primo Android Day di Udine? Allora iscrivetevi a: http://androiddayudine.eventbrite.it
L’evento è gestito da GDG Udine.
Volete partecipare al primo Android Day di Udine? Allora iscrivetevi a: http://androiddayudine.eventbrite.it
L’evento è gestito da GDG Udine.
Ricordatevi di cambiare le impostazioni delle variabili sorgente e destinazione.
echo off @echo VARIABILI DI SISTEMA: set source=F:\Users\Pippo\Pictures set destination=C:\Users\Pippo\Pictures cls echo ######################### echo #### SCRIPT DI COPIA #### echo ######################### echo DA %source% echo A %destination% pause cls @echo inizio copy xcopy %source% %destination% /S /Z /F echo ################################## echo FINE echo off timeout /t 10
Dovete programmare in C/C++ oppure Php, Java, Pascal, PHP, Python, Ruby e HTML sotto linux e non vi accontentate del solito GEDIT? Beh allora potete utilizzare GEANY, ottimo editor di codice che permette la compilazione e l’esecuzione immediata del codice senza dover utilizzare il terminale e noiose digitazioni di comandi.
Potete scaricare il software da quì oppure potete lanciare da terminale questo comando:
sudo apt-get install geany
(define diffs
(lambda (txt)
(if (null? (cdr txt)
'()
(cons (- (cadr txt) (car txt)) (diffs (cdr txt)))
)
))
Valori Procedurali di una funzione g(x)= f(x-s)
(define shift
(lambda (fs t)
(lambda (m)
(fs (- m t))
)))
(define h (shift (lambda (x) (* x x )) 3))
(h 0)
Scheme:
(define ht
(lambda (d)
(lambda (k)
(if (= k 0)
(if (> d 0) 0 1)
(+ (* 2 ((ht d) (- k 1)))
((ht (remainder (+ d 3) 4)) (- k 1))
((ht (remainder (+ d 1) 4)) (- k 1)))
))))
(let ((f (ht 1))) (f 2))
Java:
public class tile {
public static int tiles (int d, int k){
if (k == 0)
if (d > 0)
return 0;
else
return 1;
else
return (2* (tile.tiles (d, (k-1)))) + (tiles (((d + 3) %4), (k -1))) + (tiles (((d + 1) % 4), (k - 1)));
}
}
Questo script prevede l’installazione di blat.
@echo. @echo. @echo Versione 1.1 del 30/04/2010 Guion Matteo @echo Procedura di Salvataggio del Server @echo ------------------------------------------- rsm refresh /lf"Hewlett Packard DAT72 drive" sleep 30 C:\WINDOWS\system32\ntbackup.exe backup "@C:\Documents and Settings\pinco_pallino\Impostazioni locali\Dati applicazioni\Microsoft\Windows NT\NTBackup\data\backup_notturno.bks" /j "Backup" /v:yes /r:no /l:s /m normal /rs:no /hc:on /p "4mm DDS" /UM @echo off :::::::::::::: Inizializzazione variabili :::::::::::::::: set email=email@email.it set server=-serverSMTP 192.xxx.xxx.xxx set subject1=-s "BACKUP Server 2003" set subject2=-s "Sono accorsi alcuni errori sul server 2003" set tof=-to %email% -f %email% set attach=-attach "C:\Documents and Settings\pinco_pallino\Impostazioni locali\Dati applicazioni\Microsoft\Windows NT\NTBackup\data\*.log" set msg1=-body "Vedere allegato per dettagli backup" set msg2=-body "ATTENZIONE ##### Non e' stato torvato il file di log . Il backup potrebbe essere fallito!!!!!" ::::::::::::::::: Esecuzione di Blat! ::::::::::::::::::: IF EXIST "C:\Documents and Settings\pinco_pallino\Impostazioni locali\Dati applicazioni\Microsoft\Windows NT\NTBackup\data\*.log" (blat %msg1% %tof% %subject1% %server% %attach%) ELSE (blat %msg2% %tof% %subject2% %server% %attach% ) :::::::::: Copia files di log in un unico file ::::::::::: set mese=%DATE:~3,2% set giorno=%DATE:~0,2% set anno=%DATE:~-4% echo %giorno% echo %mese% echo %anno% copy "C:\Documents and Settings\pinco_pallino\Impostazioni locali\Dati applicazioni\Microsoft\Windows NT\NTBackup\data\*.log" "E:\backup\log\backup.log" ::::::::::::::::: Cancellazione file di Log :::::::::::::: IF EXIST "E:\backup\log\backup.log" (del "C:\Documents and Settings\pinco_pallino\Impostazioni locali\Dati applicazioni\Microsoft\Windows NT\NTBackup\data\*.log") ren "E:\backup\log\backup.log" backup_%giorno%_%mese%_%anno%.log
Definisci in Scheme un programma su una procedura ricorsiva di coda, più eventuali procedure non ricorsive, per trovare minimo e massimo da una lista.
(define mix
(lambda (m n)
(if (< m n)
m
n)
))
(define man
(lambda (m n)
(if (> m n)
m
n)
))
(define f
(lambda (txt)
(f-tr txt (car txt) (car txt))
))
(define f-tr
(lambda (t m n)
(if (null? (cdr t)) (list m n)
(f-tr (cdr t) (mix m (mix (car t) (cadr t))) (man n (man (car t) (cadr t))))
)))
(f '(2 3 4 1 5 4 3 7 9 10))
Altra soluzione assai più esigua che utilizza molto l’ingegno
(define min-max
(lambda (nums)
(min-max-tr (car nums) (car nums) (cdr nums))
))
(define min-max-tr
(lambda (min max nums)
(if (null? nums)
(list min max)
(min-max-tr
(if (< (car nums) min) (car nums) min)
(if (> (car nums) max) (car nums) max)
(cdr nums))
)))
Definiamo in Scheme una procedura a valori procedurali cycle-funzione che data una lista restituisce una funzione periodica e restituisce il valore alla posizione indicata della lista:
(define cycle-fun (lambda (n) (lambda (count) (if (= count 0) (car n) (if (> count 7) ((cycle-fun n) (- count 8)) (list-ref n count) ) ) ))) (define f (cycle-fun '(0 -1 -2 -1 0 1 2 1))) ;esempi di lancio della procedura ; f di 2 -> -2 ; f di 11 -> -1 (f 2) (f 11)
Soluzione “matematica” alternativa più complessa (secondo il mio punto di vista)
(define cycle-fun
(lambda (p)
(lambda (x) ; x >= 0
(list-ref p (remainder x (length p)))
)))
(define shared (lambda (g h) (shared_com g h null ) )) (define shared_com (lambda (u v t) (cond ((=(length u) 0) t) ((=(length v) 0) t) ((= (car u) (car v)) (append t (list(car u)) (shared_com (cdr u) (cdr v) t))) ((> (car u) (car v)) (shared_com u (cdr v) t)) ((< (car u) (car v)) (shared_com (cdr u) v t)) ) )) (shared '(1 3 5 6 7 8 9 10) '(0 1 2 3 4 5 7 9))
Soluzione proposta a lezione
(define shared
(lambda (u v)
(cond ((or (null? u) (null? v)) null)
((< (car u) (car v)) (shared (cdr u) v))
((> (car u) (car v)) (shared u (cdr v)))
(else (cons (car u) (shared (cdr u) (cdr v))))
)))
</pre>
(define tab-fun ; valore: procedura (lambda (args vals) ; args, vals: liste di uguale lunghezza (lambda (n) (if (= n (car args)) (car vals) ((tab-fun (cdr args) (cdr vals)) n) )) )) (define f (tab-fun '(0 1 2 3 4 5) '(2 3 5 7 11 13))) (f 2)
Vedi un esempio dell’albero di Steinhaus con Scheme (lisp Language):
(define nxt (lambda (sq op) (let ((n (string-length sq))) (if (= n 1) "" (string-append (if (op (string-ref sq 0) (string-ref sq 1)) (string-append (string #\0) (nxt (substring sq 1) op)) (string-append (string #\1) (nxt (substring sq 1) op)) ) ) )))) (define tri (lambda (sq op) (if (= (string-length sq) 1) (list sq) (cons sq (tri (nxt sq op) op)) ))) (tri "1101" char=? )
Altra soluzione potrebbe essere questa, più complessa da capire, ma più semplice da implementare!
(define nxt (lambda (sq op) (let ((n (string-length sq))) (if (= n 1) "" (string-append (op (string-ref sq 0) (string-ref sq 1)) (nxt (substring sq 1) op)) )))) (define tri (lambda (sq op) (if (= (string-length sq) 1) (list sq) (cons sq (tri (nxt sq op) op)) ))) (tri "1101" (lambda (u v) (if (char=? u v) "0" "1")))