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