Use Gradle/Liquibase to apply others' recent database changes: gradlew update
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 com.netflix.hystrix.HystrixCommandGroupKey; | |
import com.netflix.hystrix.HystrixCommandKey; | |
import com.netflix.hystrix.HystrixObservableCommand; | |
import reactor.core.publisher.Mono; | |
import rx.Observable; | |
import rx.RxReactiveStreams; | |
class AsyncCommand extends HystrixObservableCommand<SourceAwareRestResponse> { | |
private final Mono<HttpResponse> adaptee; | |
private final Callable<T> fallbackProvider; |
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
type this in the Console: | |
setTimeout(() => { debugger; }, 5000) | |
Then you've got 5 seconds (or change the value to anything else) to make whatever you want to debug appear. | |
None of the other answers worked for me - the DOM tree kept getting modified (i.e. stuff I care about disappeared) right before the script paused. |
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
# after appcleaner does his magic, do this | |
sudo rm -rf "/Library/Application Support/Paragon Software/" | |
sudo rm /Library/LaunchDaemons/com.paragon-software.installer.plist | |
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist | |
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfsd.plist | |
sudo rm /Library/LaunchAgents/com.paragon-software.ntfs.notification-agent.plist | |
sudo rm -rf /Library/Filesystems/ufsd_NTFS.fs/ | |
sudo rm -rf /Library/PrivilegedHelperTools/com.paragon-software.installer | |
sudo rm -rf /Library/Extensions/ufsd_NTFS.kext/ |
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
Add hive2 to IDEA: | |
/Users/gennadiy.chernyaev/Downloads/curator-framework-2.6.0.jar | |
/Users/gennadiy.chernyaev/Downloads/hive-jdbc-2.0.0-standalone.jar | |
/Users/gennadiy.chernyaev/Downloads/curator-client-4.0.1.jar | |
/Users/gennadiy.chernyaev/Downloads/zookeeper-3.4.11.jar | |
/Users/gennadiy.chernyaev/Downloads/hive-common-2.0.0.jar | |
/Users/gennadiy.chernyaev/Downloads/hive-service-2.0.0.jar | |
/Users/gennadiy.chernyaev/Downloads/hadoop-common-3.1.0.jar |
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
According to Example 50 at Using @Query from spring-data documentation this is possible specifying the query itself and a countQuery, like this: | |
public interface UserRepository extends JpaRepository<User, Long> { | |
@Query(value = "SELECT * FROM USERS WHERE LASTNAME = ?1", | |
countQuery = "SELECT count(*) FROM USERS WHERE LASTNAME = ?1", | |
nativeQuery = true) | |
Page<User> findByLastname(String lastname, Pageable pageable); | |
} | |
solution: |
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
// given - column with type Map<String, String> | |
import static org.apache.spark.sql.functions.callUDF; | |
import static org.apache.spark.sql.functions.lit; | |
import static org.apache.spark.sql.functions.col; | |
// define UDF | |
private UserDefinedFunction keyContains = functions.udf( | |
(scala.collection.Map<String, String> m, String key) -> m.contains(key), |
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
need to perform some actions on entity after it had been commited using spring app events? | |
Use (instead of @EventListener): | |
@TransactionalEventListener(classes = MyEvent.class) | |
(note that inside new transaction is required to perform actions!) | |
https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2 | |
https://dzone.com/articles/transaction-synchronization-and-spring-application |
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
// Select Page with sorts and filters by children entities and distinct parent | |
// 1. Create DTO with sortable fields and id of parent, perform paging, sorting and filtering over this DTO | |
CriteriaQuery<ParentEntityDto> parentEntityQuery = cb.createQuery(ParentEntityDto.class); | |
Root<ParentEntity> parentEntityRoot = query.from(ParentEntity.class); | |
// filter here as usual, no special treatment | |
Predicate predicate = ... | |
parentEntityQuery.where(predicate); | |
parentEntityQuery.distinct(true); | |
// need to prevent duplication in select and order |
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
@Override | |
public Predicate toPredicate(Root<ParentEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) { | |
List<Predicate> predicates = new ArrayList<>(); | |
if (filters.isEmpty()) { | |
return cb.conjunction(); | |
} | |
Subquery<Long> countChildren = query.subquery(Long.class); | |
Root<ChildEntity> countChildrenRoot = countVotes.from(ChildEntity.class); |