try(Connection con = getConnection()) {
try (PreparedStatement prep = con.prepareConnection("Update ...")) {
//prep.doSomething();
//...
//etc
con.commit();
} catch (SQLException e) {
//any other actions necessary on failure
con.rollback();
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
#!/bin/bash | |
############ | |
# whereami # | |
############ | |
# Req. -> screen | |
# Convenience function for checking if you're in a screen and outputting the id of it if so. | |
function whereami { | |
if [[ $(echo $STY) ]]; then | |
echo "You're in the screen: $STY" |
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
#!/bin/sh | |
# ensure we have the unzip on the CLI | |
sudo apt-get install unzip | |
# what version of terraform do we want? | |
VER=0.11.7 | |
# download $VER of terraform | |
wget https://releases.hashicorp.com/terraform/$VER/terraform_$VER_linux_amd64.zip |
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.sql.SQLException; | |
import java.sql.Connection; | |
public class AutoRollback implements AutoCloseable { | |
private Connection conn; | |
private boolean committed; | |
public AutoRollback(Connection conn) throws SQLException { | |
this.conn = conn; |
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 <your_package>; | |
import org.apache.commons.lang3.Validate; | |
import java.util.Optional; | |
import javax.annotation.Nullable; | |
/** Immutable object containing the credentials for a database. */ | |
public final class Credentials { | |
/** Host of this login */ |
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
++++++++ Set Cell #0 to 8 | |
[ | |
>++++ Add 4 to Cell #1; this will always set Cell #1 to 4 | |
[ as the cell will be cleared by the loop | |
>++ Add 2 to Cell #2 | |
>+++ Add 3 to Cell #3 | |
>+++ Add 3 to Cell #4 | |
>+ Add 1 to Cell #5 | |
<<<<- Decrement the loop counter in Cell #1 | |
] Loop till Cell #1 is zero; number of iterations is 4 |
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
try (Connection conn = source.getConnection()) { | |
conn.setAutoCommit(false); | |
SQLException savedException = null; | |
try { | |
// Do things with connection in transaction here... | |
conn.commit(); | |
} catch (SQLException ex) { | |
savedException = ex; | |
conn.rollback(); | |
} finally { |
down vote I contend that images (files) are NOT usually stored in a database base64 encoded. Instead, they are stored in their raw binary form in a binary (blob) column (or file).
Base64 is only used as a transport mechanism, not for storage. For example, you can embed a base64 encoded image into an XML document or an email message.
Base64 is also stream friendly. You can encode and decode on the fly (without knowing the total size of the data).
While base64 is fine for transport, do not store your images base64 encoded.
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
sudo docker logs 79494 | |
Preparing to run Artifactory in Docker | |
===================================== | |
2017-06-20 21:31:26 [42 entrypoint-artifactory.sh] Checking open files and processes limits | |
2017-06-20 21:31:26 [45 entrypoint-artifactory.sh] Current max open files is 1048576 | |
2017-06-20 21:31:26 [57 entrypoint-artifactory.sh] Current max open processes is unlimited | |
2017-06-20 21:31:26 [67 entrypoint-artifactory.sh] Checking if /var/opt/jfrog/artifactory is mounted | |
2017-06-20 21:31:26 [72 entrypoint-artifactory.sh] /var/opt/jfrog/artifactory is mounted | |
2017-06-20 21:31:26 [78 entrypoint-artifactory.sh] Setting up data directories if missing |
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
Here are some guidelines for people who want to contribute their code | |
to this software. | |
(0) Decide what to base your work on. | |
In general, always base your work on the oldest branch that your | |
change is relevant to. | |
- A bugfix should be based on 'maint' in general. If the bug is not | |
present in 'maint', base it on 'master'. For a bug that's not yet |
NewerOlder