This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# we use mailcatcher here | |
config.action_mailer.delivery_method = :smtp | |
#config.action_mailer.delivery_method = :letter_opener | |
config.action_mailer.smtp_settings = { | |
:address => "localhost", | |
:port => 25, | |
:domain => "saberespoder.com", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Libraries */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <signal.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <fcntl.h> | |
#include <time.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Realizzate un programma multi processo in C, completo di commento, che svolga quanto segue: | |
un processo P genera due processi figli P1 e P2. | |
Il figlio P1 esegue un ciclo indeterminato durante il quale genera casualmente una sequenza | |
di numeri interi compresi tra 0 e 1023. | |
Quando il numero generato assume un valore superiore a 512 P1 comunica tale valore a P2. | |
P2, ricevuto il dato da P1 lo visualizza sullo schermo e lo scrive in un file con diritti di accesso rw- rw- ---. | |
Durante l’esecuzione, il processo P1 deve gestire il segnale SIGINT in modo tale che se lo riceve stampi sullo schermo | |
il messaggio: “interruzione disabilitata”. | |
Il programma termina quando il valore estratto da P1 assume il valore 1000. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s --> simple_s. | |
s --> simple_s, det, simple_s. | |
simple_s --> np, vp. | |
np --> det, sogg. | |
onp --> det, ogg. | |
vp --> v, onp. | |
det --> [il]. | |
det --> [mentre]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iterateExamples([]). | |
iterateExamples([H1|T1]) :- assert(H1), iterateExamples(T1). | |
getRightOperator(Albero, L) :- arg(2, Albero, L). | |
getLeftOperator(Albero, R) :- arg(1, Albero, R). | |
findSubTree([FirstSub|List], Key, FirstSub) :- | |
arg(1, FirstSub, Key). | |
findSubTree([H|T], Key, Result) :- findSubTree(T, Key, Result). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package thikingjava; | |
import java.util.*; | |
class Student { | |
String firstName; | |
String lastName; | |
long matricola; | |
Student(String firstName, String lastName, long matricola) { | |
this.firstName = firstName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package javaapplication1; | |
import java.util.*; | |
class Author { | |
String name; | |
String email; | |
char gender; | |
public Author(String name, String email, char gender) { | |
this.name = name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
as :user do | |
get 'login' => 'devise/sessions#new', :as => :new_user_session | |
post 'login' => 'devise/sessions#create', :as => :user_session | |
delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session | |
end | |
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json = ActiveSupport::JSON.decode(File.read('db/cards.json')) | |
json.each do |card| | |
Card.create!(game_id: card['id'], | |
name: card['name'], | |
cost: card['cost'], | |
set: card['set'], | |
card_text: card['text'], | |
health: card['health'], | |
attack: card['attack'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Binary Search | |
# O(n logn) | |
def binarySearch(alist, item): | |
first = 0 | |
last = len(alist)-1 | |
found = False | |
while first<=last and not found: | |
midpoint = (first + last)//2 | |
if alist[midpoint] == item: |