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
/* Auch wieder in die user.css packen; komplett ungetestet in allem | |
außer Chrome; dürfte vermutlich im IE < 9 nicht funktionieren. | |
Problem: Die erste Codebox eines Artikels darf nicht zu weit oben | |
im Artikel stehen, ansonsten überlagert die Seitenleiste den Code. | |
Deswegen wird die „Verbreiterung“ sicherheitshalber auch nur auf | |
Code im „Erweiterten Eintrag“ angewendet – aber auch da aufpassen, | |
wenn der „Teaser“ (also der „normale“ Eintrag sehr kurz ist, kann | |
das wahrscheinlich trotzdem überlagern.) */ |
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
BufferedImage tmp = ImageIO.read(new File(currentBestMatch.getFilename())); | |
Image scaled = tmp.getScaledInstance(fragmentSize, fragmentSize, BufferedImage.SCALE_SMOOTH); | |
g.drawImage(scaled, i, k, null); |
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
/** | |
* @ORM\Entity | |
*/ | |
class UserProductAssociation | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="bigint") | |
* @ORM\GeneratedValue(strategy="AUTO") |
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
/** | |
* @ORM\ManyToMany(targetEntity="Product", inversedBy="contactPersons", fetch="EXTRA_LAZY", cascade={"persist"}) | |
* @ORM\JoinTable(name="contactPersons_products") | |
* @ORM\OrderBy({"name"="ASC"}) | |
*/ | |
protected $products; |
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 objSort(&$arr) { | |
usort($arr, function($a, $b) { | |
if($a !== null && $b !== null) { | |
return $a->compareTo($b); | |
} | |
} | |
} |
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
$em = $client->getContainer()->get('doctrine')->getEntityManager(); | |
$company = $em->getRepository('FirmaLogicBundle:User')->findOneBy(array()); | |
$crawler = $client->request('GET', '/firma/' . $company->getSlug()); | |
$this->assertEquals(200, $client->getResponse()->getStatusCode()); | |
// check if heading is correct | |
$this->assertEquals(1, $crawler->filterXPath('/html/body/div/div[2]/div/h2')->count()); | |
$this->assertEquals(1, $crawler->filter('html:contains("' . $company->getName() . '")')->count()); |
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
private void submitSolution(String[] tokens) { | |
if(tokens.length == 4) { | |
if(!isValidNumber(tokens[1])) { | |
System.err.println("Error! Invalid task ID."); | |
return; | |
} | |
if(!isValidMatrNo(tokens[2])) { | |
System.err.println("Error! Invalid matrNo."); |
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(); | |
} |
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
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; | |
/** |