Skip to content

Instantly share code, notes, and snippets.

/**
* Returns a random Date in the range [start, end)
*/
public static Date randomDate(Date start, Date end, boolean endInclusive) {
long d1 = start.getTime();
long d2 = end.getTime();
// How can I change the range from [start, end) to [start, end] (inclusive)
// depending on whether endInclusive is set?
NODELIST new;
new = malloc(nodeList.size * sizeof(NODE)); // I could be wrong here
int i;
for (i = 0; i < nodeList.size; i++) {
NODE *n = pop(nodeList);
push(new, n, n->data);
}
booking_in_seats ==> I
================
tname
section
booking_num
booking_for_schedule ==> S
====================
tname
date
@MarkyC
MarkyC / 02.sql
Last active December 15, 2015 08:19
CLUB -> Defines a CLUB
----
club (varchar)
MEMBER -> Holds member information for CLUBs
------
club (varchar refs CLUB)
id (customer id number, refs another table, I don't think this is neccesary to solve the problem)
PURCHASE -> Holds all purchases
WITH #members AS (
SELECT DISTINCT count(*) as num
FROM yrb_club C, yrb_member M
WHERE C.club = M.club
)
SELECT
C.club,
count(M.num)
FROM
yrb_club C,
@MarkyC
MarkyC / 03.sql
Last active December 15, 2015 08:49
Select all cities were no one in the city has purchased a book in French
-- Returns CID's of customers that have never purchased a book in French
-- I need something like
-- SELECT C3.city FROM yrb_customer C WHERE c3.cid = c2.cid
-- (this doesn't work though)
SELECT DISTINCT C2.cid
FROM
yrb_customer C2,
yrb_purchase P,
yrb_book B
@MarkyC
MarkyC / 02.sql
Last active December 15, 2015 11:18
purchase
=======
club
title
year
book
====
title
year
package name.marcocirillo;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.InputStream;
// Fit Facebook Like Feature with page
$().ready(function(){
try {
$('.uiGrid').css("color", "white");
} catch (err) { alert(err); }
});
typedef struct Node Node;
typedef struct FIFOQ FIFOQ;
struct Node {
char data; // the data for this Node
off_t offset; // offset of data byte in the file
Node *next; // next Node in the queue
};
struct FIFOQ {