View SVGBenchmark.java
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 com.google.common.collect.ImmutableSet; | |
import com.google.common.math.StatsAccumulator; | |
import java.awt.Graphics2D; | |
import java.awt.Image; | |
import java.awt.image.BufferedImage; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.URL; | |
import java.util.Set; | |
import javax.imageio.ImageIO; |
View PrintGC.java
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 com.eirikbakke.upstream.popup; | |
import java.awt.GraphicsConfiguration; | |
import java.awt.GraphicsDevice; | |
import java.awt.GraphicsEnvironment; | |
public class PrintGC { | |
public static final void main(String args[]) { | |
System.out.println(System.getProperty("java.version")); | |
for (GraphicsDevice graphicsDevice : |
View FontLayoutPerfTest.java
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 java.awt.Font; | |
import java.awt.font.FontRenderContext; | |
import java.awt.font.LineBreakMeasurer; | |
import java.awt.font.TextLayout; | |
import java.awt.geom.AffineTransform; | |
import java.text.AttributedCharacterIterator; | |
import java.text.AttributedString; | |
/** | |
* Measure the performance on both LineBreakMeasurer and Font.layoutGlyphVector for short strings. |
View panama.sql
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
-- PostgreSQL import script for panamapapers CSV files available from https://panamapapers.icij.org/blog/20160509-offshore-database-release.html | |
-- First convert CSV files from MacRoman to UTF-8 encoding: | |
-- iconv -f MACROMAN -t UTF-8 Entities.csv > Entities-utf8.csv | |
-- iconv -f MACROMAN -t UTF-8 Addresses.csv > Addresses-utf8.csv | |
-- iconv -f MACROMAN -t UTF-8 Intermediaries.csv > Intermediaries-utf8.csv | |
-- iconv -f MACROMAN -t UTF-8 Officers.csv > Officers-utf8.csv | |
-- iconv -f MACROMAN -t UTF-8 all_edges.csv > all_edges-utf8.csv | |
drop table if exists addresses cascade; |
View ScrollpaneTrackpadJitterBugExhibit.java
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 com.sieuferd.uiutil; | |
import java.awt.Dimension; | |
import java.awt.Font; | |
import java.awt.Rectangle; | |
import javax.swing.*; | |
public final class ScrollpaneTrackpadJitterBugExhibit extends JFrame { | |
private static final class ViewportPanel extends JPanel implements Scrollable { | |
public ViewportPanel() { |
View LexerInputCharStream.java
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
/* | |
The MIT License (MIT) | |
Copyright (c) 2015 Eirik Bakke | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
View LexerInputCharStream.java
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
/* | |
The MIT License (MIT) | |
Copyright (c) 2015 Eirik Bakke | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
View FlavorMapBugExhibit.java
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 com.sieuferd.harness; | |
import java.awt.Toolkit; | |
import java.awt.datatransfer.Clipboard; | |
import java.awt.datatransfer.DataFlavor; | |
import java.awt.datatransfer.SystemFlavorMap; | |
import java.awt.datatransfer.Transferable; | |
import java.io.InputStream; | |
public final class FlavorMapBugExhibit { |
View JackcessDateConvert2.java
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
private static final ZoneId UTC_ZONEID = ZoneId.of("UTC"); | |
public double toDateDouble(Object value) { | |
long time = toDateLong(value); | |
time += getToLocalTimeZoneOffset(time); | |
final LocalDateTime ldt = | |
LocalDateTime.ofInstant(Instant.ofEpochMilli(time), UTC_ZONEID); | |
final long datePart = ldt.toLocalDate().toEpochDay() * (long) MILLISECONDS_PER_DAY + | |
MILLIS_BETWEEN_EPOCH_AND_1900; | |
final long timePart = ldt.toLocalTime().toNanoOfDay() / 1000000L; |
View JackcessNegDate.java
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
private double adjustNegativeDatesFromAccess(double value) { | |
double fractionalPart = value % 1.0; // Negative if value is negative. | |
double wholePart = value - fractionalPart; | |
return wholePart + Math.abs(fractionalPart); | |
} | |
// Simplified equivalent implementation (avoids touching positive dates). | |
private double adjustNegativeDatesFromAccess2(double value) { | |
return value >= 0.0 ? value : (value - 2.0 * (value % 1.0)); | |
} |
NewerOlder