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
| mongodump -h [server]:[port] -u [user] -p [password] -d [db] | |
| export d=$(date +'%Y-%m-%d') | |
| tar -czf $d.tgz dump | |
| rm dump |
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
| public static void main(String[] args) throws DatabaseException, | |
| UnsupportedEncodingException { | |
| DatabaseEntry key = new DatabaseEntry(); | |
| DatabaseEntry data = new DatabaseEntry(); | |
| EnvironmentConfig config = new EnvironmentConfig(); | |
| config.setAllowCreate(true); | |
| config.setTransactional(true); | |
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
| package models; | |
| import java.io.File; | |
| import java.io.UnsupportedEncodingException; | |
| import com.sleepycat.je.Database; | |
| import com.sleepycat.je.DatabaseConfig; | |
| import com.sleepycat.je.DatabaseEntry; | |
| import com.sleepycat.je.DatabaseException; | |
| import com.sleepycat.je.Environment; | |
| import com.sleepycat.je.EnvironmentConfig; |
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
| class Citizen { | |
| private String name; | |
| private Date registrationDate; | |
| private Date birthDate; | |
| private Double income; | |
| } |
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
| import java.lang.annotation.ElementType; | |
| import java.lang.annotation.Retention; | |
| import java.lang.annotation.RetentionPolicy; | |
| import java.lang.annotation.Target; | |
| @Retention(RetentionPolicy.RUNTIME) | |
| @Target({ElementType.FIELD, ElementType.PARAMETER}) | |
| public @interface Calculated { | |
| String name(); | |
| } |
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
| class Citizen { | |
| private String name; | |
| @Calculated(name="Registration date") | |
| private Date registrationDate; | |
| private Date birthDate; | |
| @Calculated(name="Income") | |
| private Double income; |
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
| Field [] allFields = Citizen.class.getFields(); | |
| List<Field> calculatedFields = new ArrayList<Field>(); | |
| for (Field field : allFields) { | |
| if (field.isAnnotationPresent(Calculated.class)) { | |
| calculatedFields.add(field); | |
| } | |
| } |
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
| import java.io.File; | |
| import java.util.Collection; | |
| import org.apache.commons.io.FileUtils; | |
| import org.apache.commons.io.filefilter.DirectoryFileFilter; | |
| import org.apache.commons.io.filefilter.RegexFileFilter; | |
| import org.apache.commons.io.filefilter.TrueFileFilter; | |
| import net.sf.jasperreports.engine.JRException; | |
| import net.sf.jasperreports.engine.JasperCompileManager; |
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
| import java.awt.print.*; | |
| import java.io.*; | |
| import java.net.MalformedURLException; | |
| import java.net.URL; | |
| import java.net.URLConnection; | |
| import java.text.MessageFormat; | |
| import java.util.logging.Level; | |
| import java.util.logging.Logger; | |
| import javax.swing.JEditorPane; |
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
| import java.io.File; | |
| import java.util.Collection; | |
| import net.sf.jasperreports.engine.JRException; | |
| import net.sf.jasperreports.engine.JasperCompileManager; | |
| import org.apache.commons.io.FileUtils; | |
| import org.apache.commons.io.filefilter.RegexFileFilter; | |
| import org.apache.commons.io.filefilter.TrueFileFilter; |
OlderNewer