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
// | |
// This is example code from Chapter 6.7 "Trying the second version" of | |
// "Software - Principles and Practice using C++" by Bjarne Stroustrup | |
// | |
/* | |
>This file is known as calculator02buggy.cpp | |
> | |
>I have inserted 5 errors that should cause this not to compile |
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
package sample; | |
import java.util.ArrayList; | |
import java.util.List; | |
class Card { | |
char suit; | |
String rank; | |
Card() { |
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
import matplotlib.pyplot as plt | |
import math as math | |
def get_exp(n): | |
if n <= 0: | |
return 0 | |
return math.floor(math.log(n, 3)) | |
def conv_to_deci(n): | |
s = str(n) |
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
#!/usr/bin/ruby | |
def is_fourcards (cs) | |
return cs.has_value?(4) | |
end | |
def is_threecards (cs) | |
return cs.has_value?(3) | |
end |
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
import static org.junit.Assert.assertEquals; | |
import java.math.BigInteger; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.junit.Test; | |
/** | |
* Question: http://nabetani.sakura.ne.jp/hena/ord17scheherazade/ |
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
import static org.junit.Assert.assertEquals; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import org.junit.Test; | |
/*** | |
* Question: http://nabetani.sakura.ne.jp/hena/ord16boseg/ -- this answer is a |
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
blockdiag { | |
default_fontsize = 14; | |
allocation [color = "#ff0000"]; | |
generation, heap, iterator, memRegion, resourceArea, space, watermark [color = "#ff9900"]; | |
// include generation | |
generationSpec, compactPermGen, genCollectedHeap, "generation.inline", "genOopClosures.inline", permGen, sharedHeap, tenuredGeneration [color = "#ffff00"]; | |
// include iterator | |
genOopClosures, permGen [color = "#ffff00"]; | |
// include memRegion |
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
blockdiag { | |
default_fontsize = 14; | |
ResourceObj -> AllocatedObj; | |
AllocStats, ReallocMark -> StackObj; | |
Chunk, Arena -> CHeapObj; | |
SharedHeap [color = "#FFFFFF"]; | |
GenClosure -> StackObj; | |
GenCollectedHeap -> SharedHeap -> CollectedHeap -> CHeapObj; |
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
blockdiag { | |
default_fontsize = 14; | |
AllStatic [color = "#FF9999"]; | |
Universe -> AllStatic; | |
oopFactory -> AllStatic; | |
GenMarkSweep -> MarkSweep -> AllStatic; | |
HeapInspection -> AllStatic; | |
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
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertTrue; | |
import java.util.Arrays; | |
import org.junit.Test; | |
enum Rune { | |
U(3, new char[] { '1', '0', '1' }, new char[] { '1', '1', '1' }), N(3, | |
new char[] { '1', '1', '1' }, new char[] { '1', '0', '1' }), S(3, |
NewerOlder