View trajectory_utils.py
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 numpy as np | |
from kitti_eval.pose_evaluation_utils import pose_vec_to_mat | |
def convert_and_change_coordinate_system(poses, new_coord_index=0): | |
coord_pose = pose_vec_to_mat(poses[new_coord_index]) | |
out = [] | |
for pose_vec in poses: | |
pose = pose_vec_to_mat(pose_vec) |
View dasda
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
function signalFiltered = highPassFilter(signal, fc, fs) | |
signalFrecDomain = fft(signal); | |
frecs = 0 : ((fs/2)/length(signalFrecDomain)) : (fs/2); | |
minLength = min(length(signalFrecDomain), length(frecs)); | |
signalFrecDomain = signalFrecDomain(1 : minLength); | |
frecs = frecs(1:minLength); | |
for ind = 1 : length(frecs) |
View CreateUser.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
INSERT INTO users (id, name, created_at_utc) VALUES (1, 'John Smith', '1970-1-1 00:00:00.000') |
View DbAssistSolution.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
ConditionsBuilder conditionsBuilder = new ConditionsBuilder(); | |
Condition cond = conditionsBuilder.equal("createdAt", utcDate); | |
conditionsBuilder.apply(cond); | |
List<User> results = uRepo.find(conditionsBuilder); |
View SpecificationSolution.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
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); | |
CriteriaQuery<User> criteriaQuery = criteriaBuilder.createQuery(User.class); | |
Root<User> userRoot = criteriaQuery.from(User.class); | |
//Specification<User> specs = (root, query, cb) -> | |
// cb.equal(root.get("createdAt"), utcDate); | |
String paramName = "pn"; | |
Specification<User> specs = (root, query, cb) -> | |
cb.equal(root.get("createdAt"), cb.parameter(Date.class, paramName)); |
View package-info.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
@TypeDef(name = "UtcDateType", defaultForType = Date.class, typeClass = UtcDateType.class), | |
package com.montrosesoftware.dbassist.types; |
View User.hbm.xml
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
... | |
<property name="createdAt" type="com.montrosesoftware.dbassist.types.UtcDateType" column="created_at"/> | |
... |
View UtcDateType.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 org.hibernate.type.DateType; | |
public class UtcDateType extends DateType { | |
private static final TimeZone UTC = TimeZone.getTimeZone("UTC"); | |
@Override | |
public Object get(ResultSet rs, String name) throws SQLException { | |
return rs.getDate(name, Calendar.getInstance(UTC)); | |
} |
View HibernateSaveTest.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
Configuration configuration = new Configuration().configure(); | |
SessionFactory factory = configuration.buildSessionFactory(); | |
Session session = factory.openSession(); | |
Transaction transaction = session.beginTransaction(); | |
//prepare date | |
String createdAtUtcStr = "2016-04-24 9:54:23"; | |
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
format.setTimeZone(TimeZone.getTimeZone("UTC")); | |
Date date = format.parse(createdAtUtcStr); |
View HibernateReadTest.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
Configuration configuration = new Configuration().configure(); | |
SessionFactory factory = configuration.buildSessionFactory(); | |
Session session = factory.getCurrentSession(); | |
Transaction transaction = session.getTransaction(); | |
transaction.begin(); | |
//insert one user | |
String sql = "INSERT INTO users (id, name, created_at_utc)" | |
+ "VALUES (1, 'Adam Spring', '2016-06-12 14:54:15')"; | |
Query query = session.createSQLQuery(sql); |
NewerOlder