Skip to content

Instantly share code, notes, and snippets.

/**
*
* @author Patrick Bisenius
*/
public class MathUtil {
public static double scalarProduct(double[] v1, double[] v2) {
double scalarProduct = 0;
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();
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;
}
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++;
}
}
class Baby {
String name;
double gewicht;
double groesse;
double lautstaerke;
double stillfrequenz;
String haarfarbe;
char geschlecht;
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]))
// DB-Kram einbinden
$tunings = $db->get_results("SELECT * FROM tunings");
$by_component = array();
foreach($tunings AS $tuning) {
$by_component[$tuning['component']] = $tuning;
}