Skip to content

Instantly share code, notes, and snippets.

View zaharidichev's full-sized avatar

Zahari Dichev zaharidichev

View GitHub Profile
var mongoose = require('mongoose');
var schema = require('./schema');
mongoose.connect('mongodb://localhost:27017/test');
// Parameters are: model name, schema, collection name
var User = mongoose.model('User', schema, 'users');
var user = new User({
name: 'John Smith',
@zaharidichev
zaharidichev / TripDTO
Created March 20, 2016 09:51
This is a trip result with an id indicating the unique trip
{
"city": "Copenhagen",
"price": 81,
"fromAirportCode": "LTN",
"toAirportCode": "CPH",
"currency": "GBP",
"imageUrl": "http://airconomist.com/city_images/CPH.jpg",
"tripId": "239940274|275106041",
"outbound": [
{
package com.airconomist.searchservice;
import com.airconomist.searchservice.connector.skypicker.dto.SearchResult;
import org.springframework.web.client.RestTemplate;
/**
* @author Zahari Dichev <zaharidichev@gmail.com>.
*/
public class TestMe {
@zaharidichev
zaharidichev / rabbitLockThreadDump.txt
Created August 18, 2016 11:05
This is an example of a channel lock caused when RabbitMq puts a High memory watermark warning
2016-08-17 13:21:56
Full thread dump OpenJDK 64-Bit Server VM (25.91-b14 mixed mode):
"RMI TCP Connection(51)-127.0.0.1" - Thread t@338815
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
{
"durations": [
{
"filterId": "Two",
"filterCategory": "Duration",
"filterName": "2 Days",
"iconUrl": "http://airconomist.com/imgs/__PLATFORM__/filter_icons/Two.png"
},
{
"filterId": "Three",
[
{
"preferenceCategoryName": "Activities",
"preferences": [
{
"id": "LTE1MTI2Mjc5MDg=",
"preferenceCategory": "Activities",
"preferenceName": "Beaches",
"iconUrl": "http://airconomist.com/imgs/__PLATFORM__/pref_icons/Beaches.png"
},
2016-09-27 13:52:33:128 ERROR NotificationTransformer - Get user accounts failed
java.util.concurrent.ExecutionException: org.springframework.web.client.HttpClientErrorException: 414 Request-URI Too Large
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) ~[?:1.8.0_101]
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) ~[?:1.8.0_101]
at com.airconomist.web.transformer.notification.NotificationTransformer.transformNotificationDTOToWeb(NotificationTransformer.java:82) ~[classes/:?]
at com.airconomist.web.transformer.notification.NotificationTransformer.lambda$null$60(NotificationTransformer.java:46) ~[classes/:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) [?:1.8.0_101]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101]
Caused by: org.springframework.web.client.HttpClientErrorException: 414 Request-URI Too Large
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseError
Caused by: java.lang.IllegalArgumentException: Parameter value [7625] did not match expected type [java.lang.String (n/a)]
at org.hibernate.jpa.spi.BaseQueryImpl.validateBinding(BaseQueryImpl.java:897) ~[hibernate-entitymanager-5.0.7.Final.jar:5.0.7.Final]
at org.hibernate.jpa.internal.QueryImpl.access$000(QueryImpl.java:61) ~[hibernate-entitymanager-5.0.7.Final.jar:5.0.7.Final]
at org.hibernate.jpa.internal.QueryImpl$ParameterRegistrationImpl.bindValue(QueryImpl.java:235) ~[hibernate-entitymanager-5.0.7.Final.jar:5.0.7.Final]
at org.hibernate.jpa.spi.BaseQueryImpl.setParameter(BaseQueryImpl.java:638) ~[hibernate-entitymanager-5.0.7.Final.jar:5.0.7.Final]
at org.hibernate.jpa.spi.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:163) ~[hibernate-entitymanager-5.0.7.Final.jar:5.0.7.Final]
at org.hibernate.jpa.criteria.compile.CriteriaQueryTypeQueryAdapter.setParameter(CriteriaQueryTypeQueryAdapter.java:150) ~[hibernate-entitymanager-5.0.7.Final.jar:5.0.7.Final]
at org.hibernate.jpa.criteria.compile
.....Result From SkyPicker.....
{
"mapIdfrom": "london",
"duration": {
"return": null,
"departure": 1347
},
"flyTo": "EWR",
"conversion": {
Hibernate: select useraccess0_.id as id1_9_, useraccess0_.is_valid as is_valid2_9_, useraccess0_.issued_at as issued_a3_9_, useraccess0_.uuid as uuid4_9_, useraccess0_.account_id as account_6_9_, useraccess0_.expiration as expirati5_9_ from user_access_token useraccess0_
2017-01-02 20:00:49.733 WARN 1 --- [ool-43-thread-1] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08006
2017-01-02 20:00:49.734 ERROR 1 --- [ool-43-thread-1] o.h.engine.jdbc.spi.SqlExceptionHelper : An I/O error occurred while sending to the backend.
2017-01-02 20:00:49.749 ERROR 1 --- [ool-43-thread-1] o.s.t.i.TransactionInterceptor : Application exception overridden by rollback exception
org.springframework.dao.DataAccessResourceFailureException: could not extract ResultSet; nested exception is org.hibernate.exception.JDBCConnectionException: could not extract ResultSet
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:238) ~[spring-orm-4.2