This file contains 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
12-29 20:59:54.972 22641-22641/chat.tox.antox E/MediaPlayer: Should have subtitle controller already set | |
12-29 20:59:54.973 22641-22641/chat.tox.antox E/MediaPlayer: Should have subtitle controller already set | |
12-29 20:59:54.973 22641-22641/chat.tox.antox E/MediaPlayer: Should have subtitle controller already set | |
12-29 20:59:56.579 22641-27735/chat.tox.antox E/AudioEffect: set(): AudioFlinger could not create effect, status: -22 | |
12-29 20:59:56.579 22641-27735/chat.tox.antox E/AudioEffects-JNI: AudioEffect initCheck failed -4 | |
12-29 20:59:56.579 22641-27735/chat.tox.antox E/AudioEffect-JAVA: Error code -4 when initializing AudioEffect. | |
12-29 20:59:56.583 22641-27735/chat.tox.antox W/AutomaticGainControl: not implemented on this device null | |
12-29 20:59:56.583 22641-27735/chat.tox.antox E/AudioEffect: set(): AudioFlinger could not create effect, status: -22 | |
12-29 20:59:56.583 22641-27735/chat.tox.antox E/AudioEffects-JNI: AudioEffect initCheck failed -4 | |
12-29 20:59:56.584 22641-27735/chat.tox.antox E/AudioEffect- |
This file contains 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
uchar4 __attribute__((kernel)) yuvToRgb(uint32_t pixel, uint32_t x, uint32_t y) { | |
uchar yx = (pixel >> 24); | |
uchar ux = (pixel >> 16); | |
uchar vx = (pixel >> 8); | |
int4 rgb; | |
rgb.r = YUV2R(yx, ux, vx); | |
rgb.g = YUV2G(yx, ux, vx); | |
rgb.b = YUV2B(yx, ux, vx); |
This file contains 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
uchar4 __attribute__((kernel)) yuvToRgb(uchar4 pixel, uint32_t x, uint32_t y) { | |
int4 rgb; | |
rgb.r = YUV2R(pixel.r, pixel.g, pixel.b); | |
rgb.g = YUV2G(pixel.r, pixel.g, pixel.b); | |
rgb.b = YUV2B(pixel.r, pixel.g, pixel.b); | |
rgb.a = 255; | |
uchar4 out = convert_uchar4(rgb); |
This file contains 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
.map(missedCallMap => missedCallMap.map(tuple => { | |
val contactKey = tuple._1 | |
val missedCallEvents = tuple._2 | |
def isRelevant(message: Message): Boolean = { | |
val latestOutgoingTime = db.getMessageList(Some(contactKey)).filter(_.`type` == CallEventKind.Outgoing).map(_.timestamp).max | |
message.timestamp.after(latestOutgoingTime) | |
} | |
val relevantMissedCallEvents = missedCallEvents.filter(isRelevant) | |
This file contains 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
if (whatever) { | |
blah | |
} | |
else { | |
blah | |
} |
This file contains 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
def minMismatches(original: String, encrypted: String): Int = { | |
(0 until 26).map(encrypt(original, _)).map(mismatches(_, encrypted)).min | |
} | |
def encrypt(string: String, shift: Int): String = { | |
string.map(char => (((char.toInt - 97 + shift) % 26) + 97).toChar) | |
} | |
def mismatches(s1: String, s2: String): Int = { | |
s1.zip(s2).foldLeft(0) { case (sum, t) => |
This file contains 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
val cost = 5 | |
val bills = List(1, 2, 5, 10, 20, 50) | |
val bounds: Map[Int, Int] = bills.map(bill => bill -> Math.floor(cost / bill).toInt).toMap | |
lazy val betterBounds = bounds.map { case (bill, bound) => | |
bill -> (0 to bound).map(currBound => List.fill(currBound)(bill)).toList | |
} | |
println((0 to cost).map(n => betterBounds.values.toList.flatten.flatten.combinations(n)).toList.flatten.count(_.sum == cost)) |
This file contains 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
val cost = 3 | |
val bills = List(1, 2, 5, 10, 20, 50) | |
val bounds: Map[Int, Int] = bills.map(bill => bill -> Math.floor(cost / bill).toInt).toMap | |
val allPossibilities = | |
for (range1 <- 0 to bounds(1); range2 <- 0 to bounds(2); range5 <- 0 to bounds(5)) yield { | |
val result = List.fill(range1)(1) ++ List.fill(range2)(2) ++ List.fill(range5)(5) | |
println(result) | |
result |
This file contains 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
09-05 18:57:01.171 22395-22412/chat.tox.antox A/art﹕ art/runtime/mem_map.cc:473] Check failed: found MemMap not found | |
09-05 18:57:02.399 22395-22412/chat.tox.antox A/art﹕ art/runtime/runtime.cc:314] Runtime aborting... | |
09-05 18:57:02.399 22395-22412/chat.tox.antox A/art﹕ art/runtime/runtime.cc:314] Aborting thread: | |
09-05 18:57:02.399 22395-22412/chat.tox.antox A/art﹕ art/runtime/runtime.cc:314] "GCDaemon" prio=5 tid=11 WaitingPerformingGc | |
09-05 18:57:02.399 22395-22412/chat.tox.antox A/art﹕ art/runtime/runtime.cc:314] | group="" sCount=0 dsCount=0 obj=0x12c08220 self=0xb7595be0 | |
09-05 18:57:02.399 22395-22412/chat.tox.antox A/art﹕ art/runtime/runtime.cc:314] | sysTid=22412 nice=0 cgrp=apps sched=0/0 handle=0xb75961f8 | |
09-05 18:57:02.399 22395-22412/chat.tox.antox A/art﹕ art/runtime/runtime.cc:314] | state=R schedstat=( 0 0 0 ) utm=3404 stm=178 core=2 HZ=100 | |
09-05 18:57:02.399 22395-22412/chat.tox.antox A/art﹕ art/runtime/runtime.cc:314] | stack=0xa6b67000-0xa6b69000 stackSize=1036KB | |
09-05 18:57: |
This file contains 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
Protocol extensions | |
Requirements | |
Protocol extensions are based on message-passing primitives, including message rejection with a protocol-provided reason (feature not supported, syntax error, …). This high-level mechanism must support arbitrary-size “high level” messages, based on Toxcore's peer discover, cryptography and low-level message transport primitives. | |
The protocol extensions must be described using a language- and platform-independent syntax specification, from which efficient parsing and serialization code can easily be generated. We chose protobuf (more precisely, its proto2 version) because Protocol Buffers are already in use within Tox4j, and proto3 is still in alpha, and is not yet supported by the tooling we use. | |
For forward-compatibility with proto3, proto2 is employed with the following restrictions: | |
Fields MUST NOT be required in the format specification. | |
Extensions may mandate protocol-specific message validation instead. | |
Each field MUST have a default value compatible with proto3. | |
Proto2 |
NewerOlder