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
| # Original data | |
| # (Creditor, Debtor, Amount) | |
| (James, Mary, 1300) | |
| (Mary, Robert, 2500) | |
| (Mary, Michael, 500) | |
| (Barbara, Linda, 1200) | |
| (Linda, Robert, 300) | |
| # Mapped to two individual records | |
| # (Person, Amount) |
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 void run(String planFileOnHdfs) throws IOException, InterruptedException { | |
| SparkLauncher sparkLauncher = new SparkLauncher(); | |
| SparkAppHandle handle = sparkLauncher | |
| .setAppResource("cif.hadoop.boot.jar") | |
| .setMainClass("com.ataccama.dqc.hadoop.launcher.HadoopClusterLauncher") | |
| .setMaster("yarn-cluster") | |
| .addAppArgs(planFileOnHdfs) | |
| .startApplication(); | |
| CountDownLatch countDownLatch = new CountDownLatch(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 CDA { | |
| String creditor; | |
| String debtor; | |
| int amount; | |
| } | |
| public List<Tuple2<Integer, Integer>> createHistogram(JavaRDD<CDA> inputRDD) { | |
| return inputRDD | |
| .flatMapToPair(cda -> Arrays.asList( | |
| new Tuple2<>(cda.creditor, cda.amount), |
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
| <?php | |
| class Excerpt { | |
| # transformation rules for characters common in Central Europe | |
| # at the end there are all [:space:] characters transforrmed to a single space | |
| private static $transformation = [ | |
| 'ä'=>'a', | |
| 'Ä'=>'A', | |
| 'á'=>'a', | |
| 'Á'=>'A', |
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 void test() throws TheDoctorException { | |
| long currentTimeMillis = System.currentTimeMillis(); | |
| long lastTimeInMillis = getLastKnownTimestamp(currentTimeMillis); | |
| long tamperedTimeInMillis = getTamperedTimestamp(currentTimeMillis); | |
| // logger.debug("Last time: " + lastTimeInMillis + "; tampered time: " + tamperedTimeInMillis); | |
| if (currentTimeMillis < lastTimeInMillis - TIME_OFFSET | |
| || tamperedTimeInMillis < lastTimeInMillis - TIME_OFFSET) { | |
| block(tamperedTimeInMillis, lastTimeInMillis); |
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
| <?php | |
| function buildIndex($header) { | |
| $index = array(); | |
| $i = 0; | |
| foreach ($header as $field) { | |
| $index[strtolower(trim($field))] = $i; | |
| $i++; | |
| } | |
| return $index; |
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
| from pylab import * | |
| from numpy import random | |
| from itertools import * | |
| def matrixCreate(rows, cols, mi=-1, ma=1): | |
| ''' | |
| Generates a matrix of size a x b filled with random numbers with uniform distribution in specified range. | |
| ''' | |
| return rand(rows, cols) * (ma - mi) + mi |
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
| Result of: sed 's/^[^ ]* \(...............\).*/\1/' channels | sort | uniq -c | sort -n | |
| 10 Eurosport360HD | |
| 13 DECODEUR:12402: | |
| 13 Sky Bundesliga | |
| 19 MEDIA BROADCAST | |
| 58 .;BetaDigital:1 | |
| 98 CT sport HD pre | |
| 98 HBO Comedy_PREL | |
| 98 HBO HD_PRELADTE |
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
| // the propagated constraint is: | |
| // Z = if B then X else Y endif | |
| // propagator for Z: | |
| if (lb(B) < ub(B)) { // B is not fixed | |
| setlb(Z, min(lb(X), lb(Y)); | |
| setub(Z, max(ub(X), ub(Y)); | |
| } else if (lb(B) == 1) { // B is fixed and B = 1 | |
| setlb(Z, lb(X)); | |
| setub(Z, ub(X)); |
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
| // Include standard headers | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| // Include GLEW | |
| #include <GL/glew.h> | |
| // Include GLFW | |
| #include <GLFW/glfw3.h> | |
| GLFWwindow* window; |