Skip to content

Instantly share code, notes, and snippets.

View mariannave's full-sized avatar

Marianna Veríssimo mariannave

  • Konduto
  • London
  • 21:44 (UTC)
View GitHub Profile
@mariannave
mariannave / CriacaoInsercao.sql
Created February 20, 2016 02:13
Projeto de Banco de Dados - BDII
-- Cidade
CREATE TABLE cidade(
codigo NUMBER PRIMARY KEY NOT NULL,
nome VARCHAR2(45) NOT NULL,
estado VARCHAR2(2) NOT NULL
);
--Aluno
CREATE TABLE aluno(
matricula NUMBER PRIMARY KEY NOT NULL,
cpf VARCHAR2(11) NOT NULL,
@mariannave
mariannave / Consumer.java
Last active May 23, 2017 17:25
Sincronização - Thread
public class Consumer extends Thread {
private CubbyHole cubbyhole;
private int number;
public Consumer(CubbyHole c, int number) {
cubbyhole = c;
this.number = number;
}
public void run() {
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
public class Cliente {
public static void main(String[] args) {
try{
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
public class Cliente {
public static void main(String[] args) {
try{
class Course < ApplicationRecord
has_many :books
end
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
course = Course.create({
"id": 11,
# GET /courses
def index
@courses = Course.all
render json: @courses
end
api :GET/ '/courses', 'Lista todas as disciplinas'
def index
@courses = Course.all
render json: @courses
end
class CoursesController < ApplicationController
before_action :set_course, only: [:show, :update, :destroy]
# GET /courses
api :GET, '/courses', 'Lista todas as disciplinas'
def index
@courses = Course.all
render json: @courses
end
class BooksController < ApplicationController
before_action :set_book, only: [:show, :update, :destroy]
# GET /books
api :GET, '/books', 'Lista todos os livros'
def index
@books = Book.all
render json: @books
end