Skip to content

Instantly share code, notes, and snippets.

View franciscocaixeiro's full-sized avatar

Francisco Caixeiro franciscocaixeiro

View GitHub Profile
function loadData(book){
$(".bookDiv").append(html);
$bookHTML = $(".book").eq(-1);
$("h1",$bookHTML).text(book.volumeInfo.title);
$.ajax({
url:" https://www.googleapis.com/books/v1/users/ " + UserID
@franciscocaixeiro
franciscocaixeiro / solved.xquery
Last active February 3, 2017 15:48
3.2 Simple XQuery Expressions
XQuery 3
List all flights to the airport named Rome Fiumicino.
for $airport in doc/Airport
for $flights in doc/Flight
let $airid:=$airport/@airId
where $airport/name='Rome Fiumicino' and $flights/destination=$airid
return $flights
List all flights to Rome (i.e., to the airport containing Rome in its name) sorted by the corresponding departure time.
Return the name for all airports.
//Airport/name
Return the destination of the 3rd flight on the XML document, if one such flight
exists.
//Flight[3]
Return the departure date for all flights having ZRH or PRG as the destination.
//Flight[destination='ZRH' or destination='PRG']/departure
@franciscocaixeiro
franciscocaixeiro / MM4.m
Created January 6, 2017 20:08
MM4 implementation
function MM4(clients)
meanInterarrival=2;
meanService=1;
Time=0;
NumQueueCompleted=0;
ServerStatus = [0 0 0 0];
NumInQueue=0;
AcumDelay=0;
QueueArrivalTime=[];
@franciscocaixeiro
franciscocaixeiro / MMm.m
Created January 6, 2017 20:06
MMm implementation
function MMm(clients, m)
meanInterarrival=2;
meanService=1;
Time=0;
NumQueueCompleted=0;
ServerStatus = zeros(1, m);
NumInQueue=0;
AcumDelay=0;
QueueArrivalTime=[];
@franciscocaixeiro
franciscocaixeiro / MM44queues.m
Created January 6, 2017 19:01
DDRS16/17 - Exercise2 test 1 implementation
function MM44queues(clients)
meanInterarrival=0.25;
meanService=1;
Time=0;
NumQueueCompleted=0;
ServerStatus1=0;
ServerStatus2=0;
ServerStatus3=0;
ServerStatus4=0;
public void switchToCell(String cellNumber){
map.setImageResource(getResources().getIdentifier(drawablesList.get(parseCellName(cellNumber)),"drawable", getPackageName()));
}
public Integer parseCellName(String cellName){
String cellNumber = cellName.replaceAll("\\D+","");
return Integer.parseInt(cellNumber);
}
//Then just add this line