This file contains hidden or 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
-- 17. Get the names of people, who live at the same address | |
SELECT fname, sname, address | |
FROM Member | |
WHERE address = (SELECT address | |
FROM Member | |
GROUP BY address HAVING COUNT(address) > 1); |
This file contains hidden or 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 java.net.*; | |
import java.io.*; | |
public class DateClient3 { | |
private static String server = "127.0.0.1"; | |
private static int PORT = 8765; | |
public static void main(String[] args) throws IOException{ | |
//Create the socket, a reader and a writer | |
Socket socket = new Socket(server,PORT); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); | |
/* Note that the writer helps the server |
This file contains hidden or 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 java.io.*; | |
import java.net.*; | |
import java.util.Date; | |
public class DateServer3 { | |
private static int PORT = 8765; | |
private static ServerSocket listener; | |
public static void main(String[] args) { | |
try { | |
listener = new ServerSocket(PORT); | |
while(true) { |
This file contains hidden or 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 class Server { | |
private static int PORT = 9000; | |
public static void main(String[] args){ | |
ServerSocket listener = new ServerSocket(PORT); | |
Socket client = listener.accept(); | |
PrintWriter out = new PrintWriter(client.getOutputStream(), true); |
This file contains hidden or 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
// MyElement only implements the accept method and this just called the visit method of MyVisitor | |
public interface MyElement { | |
public void accept(MyVisitor visitor); | |
} | |
import java.util.Calendar; | |
public class Human implements MyElement { | |
public Calendar dOB; | |
public Human(Calendar d) { | |
dOB = d; |
This file contains hidden or 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
// the first step is to define an abstract | |
// class that both BasicCar and our decorators will extend | |
public abstract class Car { | |
public abstract double getPrice(); | |
public abstract String getDescription(); | |
} | |
public class BasicCar extends Car{ | |
public double getPrice() { |
This file contains hidden or 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 java.io.BufferedWriter; | |
import java.util.InputMismatchException; | |
import java.util.NoSuchElementException; | |
import java.math.BigInteger; | |
import java.io.OutputStream; | |
import java.io.PrintWriter; | |
import java.io.Writer; | |
import java.io.IOException; | |
import java.io.FileInputStream; | |
import java.util.Arrays; |
This file contains hidden or 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
archey About this Mac in terminal form | |
brew-cask homebrew-style CLI workflow for the administration of Mac applications distributed as binaries. | |
cmatrix Matrix animation in your terminal (oldie but goodie) | |
gawk makes it possible to handle simple data-reformatting jobs with just a few lines of code | |
gibo | |
git Apple's git is outdated, this allows you to have the news git | |
git-flow A set of git extensions to provide high-level repository operations | |
gmp | |
go Go is a tool for managing Go source code. | |
htop-osx |
This file contains hidden or 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
Lab exam for calculating the number of files and folders in a file system | |
http://sourcemaking.com/design_patterns/Composite/java/1 | |
interface FileComponent | |
+ calculateTotal(); | |
FileComposite | |
+ calculateTotal() | |
for item in composite | |
total += leaf.calculateTotal(); |
This file contains hidden or 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
# Aliases | |
# -------- | |
# Projects | |
alias ipy="python -i $1" | |
alias prof="subl ~/.profile" | |
alias spy="cd ~/Documents/scripts/" | |
alias itech="cd ~/Documents/itech-team-pamm && workon itech-team-pamm" | |
alias tp="cd ~/Documents/workspace/AE4 && git pull" | |
alias socs="ssh [email protected] -L 8080:webapps.dcs.gla.ac.uk:443" |