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
<project name="Cflow" default="cflow-tests" basedir="."> | |
<target name="cflow-tests"> | |
<junit printsummary="yes" haltonfailure="yes"> | |
<classpath> | |
<pathelement location="libs/junit.jar"/> | |
<pathelement location="."/> | |
</classpath> | |
<test name="cflow.tests.TestDFA" haltonfailure="no" outfile="result"> | |
<formatter type="plain"/> |
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
import socket | |
MCAST_GRP = '224.1.1.1' | |
MCAST_PORT = 5007 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) | |
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) | |
sock.sendto("robot", (MCAST_GRP, MCAST_PORT)) |
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
from lexer import Lexer | |
from rdp_parser import Parser | |
tokens={ | |
"INT":"[0-9]+", | |
"ADD":"\+", | |
"SUB":"-", | |
"MUL":"\*", | |
"DIV":"/" | |
} |
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
-- Remove the old score from that costumer in that product | |
DROP TRIGGER IF EXISTS new_score_before ON stores; | |
DROP FUNCTION IF EXISTS new_score_before(); | |
CREATE OR REPLACE FUNCTION new_score_before() RETURNS trigger as $$ | |
BEGIN | |
DELETE FROM products_scores | |
WHERE NEW.user_id = products_scores.user_id AND | |
NEW.product_id = products_scores.product_id; | |
RETURN NEW; | |
END; |
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
public boolean areAdjacent(int oldX, int oldY, int newX,int newY){ | |
int deltaX=newX-oldX; | |
int deltaY=newY-oldY; | |
if(deltaY==0 && deltaX!=0){ | |
for(int i=oldX+deltaX; i<7; i=i+deltaX){ | |
if(board.getAt(newY, i)!=board.INVALID_POSITION){ | |
if(i==newX) | |
return true; | |
else |
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
db.persons.insert({name:"Peter",email:"[email protected]",age:42}) |
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
import sys | |
from PyQt4.QtGui import QApplication | |
from PyQt4.QtDeclarative import QDeclarativeView | |
from PyQt4.QtCore import QUrl | |
app = QApplication(sys.argv) | |
view = QDeclarativeView() | |
view.setSource(QUrl('hello.qml')) | |
view.show() | |
view.setWindowTitle("Hello World") |
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
% Using Maps to have constant time complexity to access data | |
% See more at http://www.mathworks.com/help/matlab/map-containers.html | |
% Example here http://stackoverflow.com/questions/3591942/hash-tables-in-matlab | |
% Let's supose we have the following information: | |
table =[ [1 , 1 , 1 , 0.444 , 0.67 , 0.98]; | |
[1 , 1 , 2 , 0.254 , 0.67 , 0.98] | |
]; | |
% So to store them in an efficient way |
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
""" | |
Teaching a neural network to do the XOR binary operator | |
Artificial Intelligence - FEUP | |
""" | |
from pybrain.tools.shortcuts import buildNetwork | |
from pybrain.datasets import SupervisedDataSet | |
from pybrain.supervised.trainers import BackpropTrainer | |
from pybrain import TanhLayer | |
""" Builds the network """ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Olá mundo</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
Olá mundo | |
</body> | |
</html> |
OlderNewer