Skip to content

Instantly share code, notes, and snippets.

// DB-Kram einbinden
$tunings = $db->get_results("SELECT * FROM tunings");
$by_component = array();
foreach($tunings AS $tuning) {
$by_component[$tuning['component']] = $tuning;
}
function ip2country($ipv4) {
$sock = fsockopen("whois.ripe.net", 43);
fwrite($sock, $ipv4."\n");
$info = '';
while (!feof($sock)) {
$info .= fgetc($sock);
}
fclose($sock);
preg_match("/country:[ ]+([A-Z]{2})\n/", $info, $match);
if(isset($match[1]))
class Baby {
String name;
double gewicht;
double groesse;
double lautstaerke;
double stillfrequenz;
String haarfarbe;
char geschlecht;
public Person[] getPersons() {
Person[] persons = new Person[this.getSize()];
int length = 0;
for(int i = 0; i < profiles.length; i++) {
if(profiles[i] != null) {
persons[length] = profiles[i].getOwner();
length++;
}
}
public Person findMostSimilarTo(Person p) {
Person bestMatch = null;
Profile ownProfile = this.getProfile(p);
int bestScore = 0;
for(int i = 0; i < this.profiles.length; i++) {
// don't compare the person with itself
if(p.equals(this.profiles[i].getOwner())) {
continue;
}
driver.get(baseUrl + "/app_dev.php/firma/sascha-weyers-internet-solutions-7");
driver.findElement(By.cssSelector("span > span > span")).click();
driver.findElement(By.cssSelector("#googleMapsToggle > span > span > span")).click();
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (isElementPresent(By.cssSelector("div[title=\"Satellitenbilder anzeigen\"]"))) break; } catch (Exception e) {}
Thread.sleep(1000);
}
driver.findElement(By.cssSelector("div[title=\"Satellitenbilder anzeigen\"]")).click();
/**
*
* @author Patrick Bisenius
*/
public class MathUtil {
public static double scalarProduct(double[] v1, double[] v2) {
double scalarProduct = 0;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
/**
* calculates the shortest path between two persons in the social graph
* @param p1 person
* @param p2 person
* @return shortest path between two persons
*/
public Person[] shortestPath(Person p1, Person p2) {
if (p1 == null || p2 == null) {
throw new IllegalArgumentException();
/**
* checks whether two persons are connected in the social graph
* @param p1 person
* @param p2 person
* @return true if the two persons are connected
*/
public boolean areConnected(Person p1, Person p2) {
if (p1 == null || p2 == null) {
throw new IllegalArgumentException();
}