| Fields | Type | Default |
|---|---|---|
| start | long | The querying moment |
| end | long | The querying day end |
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 setPic(src: number[][], color: number, device: neopixel.Strip) { | |
| for (let i = 0; i < 8; i++) { | |
| for (let j = 0; j < 8; j++) { | |
| if (src[i][j] === 1) { | |
| if (color < 0) { | |
| device.setPixelColor(i * 8 + j, getRandomColor()) | |
| } else { | |
| device.setPixelColor(i * 8 + j, color) | |
| } | |
| } else { |
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
| CertificateFactory cf = CertificateFactory.getInstance("X.509"); | |
| InputStream caInput = new BufferedInputStream(new FileInputStream("add certificate file path here")); | |
| Certificate ca; | |
| try { | |
| ca = cf.generateCertificate(caInput); | |
| } finally { | |
| caInput.close(); | |
| } | |
| String keyStoreType = KeyStore.getDefaultType(); |
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
| Connection conn = DatabaseHelper.connect(); | |
| PreparedStatement pstmt; | |
| System.out.println("" + i); | |
| pstmt = conn | |
| .prepareStatement("select `timestamp` from news where newsid = ?"); | |
| pstmt.setInt(1, i); | |
| ResultSet rs = pstmt.executeQuery(); | |
| long timestamp = -1; | |
| if (rs.next()) { |
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
| AmazonS3 s3Client = StorageHelper.getAmazonS3(); | |
| ObjectListing listing = s3Client.listObjects("cp04-final", "news/"); | |
| do { | |
| List<S3ObjectSummary> summaries = listing.getObjectSummaries(); | |
| for (S3ObjectSummary s : summaries) { | |
| if (s.getSize() == 0) { | |
| long newsId = Long.parseLong(s.getKey().substring( | |
| s.getKey().lastIndexOf("/") + 1)); | |
| System.out.println("Reparse news id: " + newsId + " ... "); | |
| News n; |
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
| <build> | |
| <plugins> | |
| <plugin> | |
| <artifactId>maven-compiler-plugin</artifactId> | |
| <version>2.0.2</version> | |
| <configuration> | |
| <source>1.7</source> | |
| <target>1.7</target> | |
| </configuration> | |
| </plugin> |
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
| String time = "Thu, 18 Jun 2015 13:10:00 +0800"; | |
| DateTimeFormatter parser = DateTimeFormat.forPattern("E, d MMM y HH:mm:ss Z"); | |
| long unixTime = parser.parseDateTime(time).withTimeAtStartOfDay().getMillis(); | |
| System.out.println(unixTime); |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | |
| http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> | |
| <display-name>speakup</display-name> | |
| <filter> | |
| <filter-name>jersey</filter-name> | |
| <filter-class>org.glassfish.jersey.servlet.ServletContainer</filter-class> | |
| <init-param> |