text:
% This file was created with JabRef 2.7.
% Encoding: Cp1252

@ARTICLE{AspremontArbitrageBounds,
  author = {Alexandre d'Aspremont and Lourent El Ghaoui},
  title = {Static arbitrage bounds on basket option prices},
  journal = {Mathematical Programming},
  year = {2006.},
  volume = {Series A 106(3)},
  pages = {467-489}
}

@ARTICLE{PenaArbitrageBounds,
  author = {Javier Pe\~na and Juan C. Vera and Luis F. Zuluaga},
  title = {Static-arbitrage bounds on the prices of basket options via linear
	programming}
}

@BOOK{abramowitz+stegun,
  title = {Handbook of mathematical functions with formulas, graphs, and mathematical
	tables},
  publisher = {Dover},
  year = {1964},
  author = {Milton Abramowitz and Irene A. Stegun},
  address = {New York},
  edition = {ninth Dover printing, tenth GPO printing}
}

@ARTICLE{AliliGeneralizedBridge,
  author = {Larbi Alili},
  title = {Canonical decompositions of certain generalized {B}rownian bridges},
  journal = {Electronic communications in probability},
  year = {2002},
  volume = {7},
  pages = {27-35}
}

@ARTICLE{AndersenRatcliffe,
  author = {Leif B. Andersen and Rupert Brotherton-Ratcliffe},
  title = {Extended {LIBOR} market models with stochastic volatility},
  journal = {Journal of Computational Finance},
  year = {2005},
  volume = {9(1)},
  pages = {1-40},
  language = {English},
  type = {Working Paper Series}
}

@BOOK{lapack,
  title = {{LAPACK} User's Guide},
  publisher = {Society for Industrial and Applied Mathematics},
  year = {1999},
  author = {Edward Anderson and Zhaojun Bai and Christian H. Bischof and Laura
	Susan Blackford and James W. Demmel and Jack J. Dongarra and Jeremy
	J. DuCroz and Anne Greenbaum and Sven Hammarling and Alan McKenney
	and Danny C. Sorensen}
}

@INPROCEEDINGS{AnkirchnerDereichImkeller,
  author = {Stefan Ankirchner and Steffen Dereich and Peter Imkeller},
  title = {Enlargement of filtrations and continuous {G}irsanov-type embeddings},
  booktitle = {Séminaire de Probabilité XV},
  year = {2007}
}

@INPROCEEDINGS{AryaMountFastVectorQuantization,
  author = {Sunil Arya and David M. Mount},
  title = {Algorithms for fast vector quantization},
  booktitle = {Proc. of DCC '93: Data Compression Conference},
  year = {1993},
  pages = {381-390},
  publisher = {IEEE Press}
}

@BOOK{AtkinsonMonograph,
  title = {The numerical solution of integral equations of the second kind},
  publisher = {Cambridge Monographs on Applied and Computational Mathematics},
  year = {1999},
  author = {Kendall E. Atkinson}
}

@MISC{Arprec,
  author = {David H. Bailey and Yozo Hida and Xiaoye S. Li and Brandon Thompson
	and Karthik Jeyabalan and Alex Kaiser},
  title = {The {ARPREC} libraries},
  year = {2010}
}

@ARTICLE{BaileyJeyabalanLi,
  author = {David H. Bailey and Karthik Jeyabalan and Xiaoye S. Li},
  title = {A Comparison of Three High-Precision Quadrature Schemes},
  journal = {Experimental Mathematics},
  year = {2005},
  volume = {14(3)},
  pages = {317-329}
}

@BOOK{BakerIntegral,
  title = {The numerical treatment of integral equations},
  author = {Baker}
}

@INPROCEEDINGS{BallyPagesOptimalStopping,
  author = {Vlad Bally and Gilles Pagès},
  title = {A quantization algorithm for solving multidimensional optimal stopping
	problems},
  booktitle = {University de Paris VI},
  year = {2001},
  pages = {1003-1049}
}

@ARTICLE{BallyPagesPrintemsAmerican1,
  author = {Vlad Bally and Gilles Pagès and Jacques Printems},
  title = {A quantization tree method for pricing and hedging multidimensional
	{A}merican options},
  journal = {Mathematical Finance},
  year = {2005},
  volume = {15},
  pages = {119-168},
  number = {1}
}

@ARTICLE{BardouBouthemyPagesSwing1,
  author = {Olivier Bardou and Sandrine Bouthemy and Gilles Pagès},
  title = {Optimal quantization for the pricing of swing options},
  journal = {Applied Mathematical Finance},
  year = {2009},
  volume = {16(2)},
  pages = {183-217}
}

@MISC{BardouBouthemyPagesSwing2,
  author = {Olivier Bardou and Sandrine Bouthemy and Gilles Pagès},
  title = {When are Swing options bang-bang and how to use it},
  month = may # {~03},
  year = {2007}
}

@ARTICLE{BentleyKdTree1,
  author = {Jon Louis Bentley},
  title = {Multidimensional binary search trees used for associative searching},
  journal = {Commun. ACM},
  year = {1975},
  volume = {18},
  pages = {509-517},
  number = {9},
  publisher = {ACM}
}

@ARTICLE{KrishnamoorthyChiSquare,
  author = {Denise Benton and Kalimuthu Krishnamoorthy},
  title = {Computing discrete mixtures of continuous distributions: noncentral
	chisquare, noncentral t and the distribution of the square of the
	sample multiple correlation coefficient},
  journal = {Computational statistics \& data analysis},
  year = {2003},
  volume = {43(2)},
  pages = {249-267}
}

@ARTICLE{SmileDynamics4,
  author = {Lorenzo Bergomi},
  title = {Smile Dynamics {IV}},
  journal = {Risk},
  year = {2009}
}

@ARTICLE{SmileDynamics3,
  author = {Lorenzo Bergomi},
  title = {Smile Dynamics {III}},
  journal = {Risk},
  year = {2007}
}

@ARTICLE{SmileDynamics2,
  author = {Lorenzo Bergomi},
  title = {Smile Dynamics {II}},
  journal = {Risk},
  year = {2005}
}

@ARTICLE{SmileDynamics1,
  author = {Lorenzo Bergomi},
  title = {Smile Dynamics {I}},
  journal = {Risk},
  year = {2004}
}

@BOOK{OksendalFractional,
  title = {Stochastic calculus for fractional {B}rownian motion and applications},
  year = {2008},
  author = {Francesca Biagini and Yaozhong Hu and Bernt Øksendal and Tusheng
	Zhang}
}

@ARTICLE{OksendalWhiteNoise,
  author = {Francesca Biagini and Bernt Øksendal and Agnès Sulem and Naomi Wallner},
  title = {An introduction to white-noise theory and {M}alliavin calculus for
	fractional {B}rownian motion},
  journal = {Proceedings: Mathematical, Physical and Engineering Sciences},
  year = {2004},
  volume = {460(2041)},
  pages = {347-372}
}

@ARTICLE{Brent73algorithmsfor,
  author = {Richard P. Brent},
  title = {Algorithms for Minimization without Derivatives},
  journal = {(Englewood Cliffs, NJ: Prentice-Hall); reprinted 2002 (New York:
	Dover), Chapters 3, 4.[1]},
  year = {1973}
}

@ARTICLE{MercurioMixed,
  author = {Damiano Brigo and Gianvittorio Maurittorio Mauri and Fabio Mercurio},
  title = {Lognormal-mixture dynamics and calibration to volatility smiles and
	skews},
  journal = {International Journal of Theoretical \& Applied Finance},
  year = {2002},
  volume = {5(4)},
  pages = {427-446}
}

@ARTICLE{GlassContinuousCorrection,
  author = {Mark Broadie and Paul Glasserman and Steven Kou},
  title = {A Continuity Correction For Discrete Barrier Options},
  journal = {Mathematical Finance},
  year = {1997},
  volume = {7},
  pages = {325-349}
}

@ARTICLE{BuckleyWise,
  author = {James A. Bucklew and Gary L. Wise},
  title = {Multidimensional asymptotic quantization theory with $r$th power
	distortion measures},
  journal = {IEEE Transactions On Information Theory},
  year = {1982},
  volume = {IT-28(2 pt 1)},
  pages = {239-247}
}

@ARTICLE{BeyondGaussianCopula,
  author = {Xavier Burtschell and Jon Gregory and Jean-Paul Laurent},
  title = {Beyond the {G}aussian copula: stochastic and local correlation},
  journal = {Journal of Credit Risk},
  year = {2007},
  volume = {3(1)},
  pages = {31-62}
}

@ARTICLE{BohmBerchtoldKeimDataBase1,
  author = {Böhm, Christian and Berchtold, Stefan and Keim, Daniel A.},
  title = {Searching in high-dimensional spaces: Index structures for improving
	the performance of multimedia databases},
  journal = {ACM Comput. Surv.},
  year = {2001},
  volume = {33},
  pages = {322-373},
  number = {3},
  month = {September},
  priority = {2},
  publisher = {ACM Press}
}

@ARTICLE{YongShengPatternRecogn,
  author = {Yong-Sheng Chen and Yi-Ping Hung and Ting-Fang Yen and Chiou-Shann
	Fuh},
  title = {Fast and versatile algorithm for nearest neighbor search based on
	a lower bound tree},
  journal = {Pattern Recogn.},
  year = {2007},
  volume = {40},
  pages = {360-375},
  number = {2},
  address = {New York, NY, USA},
  publisher = {Elsevier Science Inc.}
}

@ARTICLE{ChiarellaReichel,
  author = {Carl Chiarella and Alex Reichel},
  title = {On the evaluation of integrals related to the error function},
  journal = {Mathematics of Computation},
  year = {1968},
  volume = {22},
  pages = {137-143}
}

@ARTICLE{ClarksonClosestPoint,
  author = {Kenneth L. Clarkson},
  title = {A randomized algorithm for closest-point queries},
  journal = {SIAM J. Comput.},
  year = {1988},
  volume = {17},
  pages = {830-847},
  number = {4},
  address = {Philadelphia, PA, USA},
  publisher = {Society for Industrial and Applied Mathematics}
}

@ARTICLE{DualQuantKnotSelection,
  author = {Sylvain Corlay},
  title = {Dual quantization and automatic knot selection for piecewise linear
	regression},
  journal = {Preprint},
  year = {2012}
}

@ARTICLE{CorlayFNNS,
  author = {Sylvain Corlay},
  title = {A fast nearest neighbor search algorithm based on vector quantization},
  journal = {Preprint},
  year = {2011}
}

@ARTICLE{CorlayPartialQuantization,
  author = {Sylvain Corlay},
  title = {Partial functional quantization and generalized bridges},
  journal = {Preprint},
  year = {2011}
}

@ARTICLE{CorlayNystrom,
  author = {Sylvain Corlay},
  title = {The {N}yström method for functional quantization with an application
	to the fractional {B}rownian motion},
  journal = {Preprint},
  year = {2010}
}

@ARTICLE{CorlayPagesStratification,
  author = {Sylvain Corlay and Gilles Pagès},
  title = {Functional quantization-based stratified sampling methods},
  journal = {Preprint},
  year = {2010}
}

@ARTICLE{CorlessKnuthLambert,
  author = {Robert M. Corless and Gaston H. Gonnet and David E. G. Hare and David
	H. Jeffrey and Donald E. Knuth},
  title = {On the {L}ambert {W} function},
  journal = {Adv. Computational Maths},
  year = {1996},
  volume = {5(1)},
  pages = {329-359}
}

@ARTICLE{DhaesVanDyckRodetNNS,
  author = {Wim D'Haes and Dirk van Dyck and Xavier Rodet},
  title = {An efficient branch and bound seach algorithm for computing K nearest
	neighbors in a multidimensional vector space},
  journal = {IEEE Advanced Concepts for Intelligent Vision Systems (ACIVS)},
  year = {2002}
}

@ARTICLE{DeheuvelsMartynov,
  author = {Paul Deheuvels and Guennadi V. Martynov},
  title = {A {K}arhunen-{L}oève decomposition of a {G}aussian process generated
	by independent pairs of exponential random variables},
  journal = {Journal of Functional Analysis},
  year = {2008},
  volume = {255(9)},
  pages = {2363-2394}
}

@BOOK{DelvesMohamedIntegral,
  title = {Computational methods for integral equations},
  publisher = {Cambridge University Press},
  year = {1985},
  author = {Leonard Michael Delves and Julie L. Mohamed}
}

@ARTICLE{DereichDiffusionCoding,
  author = {Steffen Dereich},
  title = {The coding complexity of diffusion processes under Lp[0, 1]-norm
	distortion},
  journal = {Stochastic Processes and their Applications},
  year = {2008},
  volume = {118(6)},
  pages = {938-951},
  month = {June}
}

@ARTICLE{TriangulationWalking,
  author = {Olivier Devillers and Sylvain Pion and Monique Teillaud},
  title = {Walking in a Triangulation},
  journal = {Internat. J. Found. Comput. Sci.},
  year = {2002},
  volume = {13},
  pages = {181-199}
}

@ARTICLE{DietrichSimulationFractional,
  author = {Claude R. Dietrich and Garry N. Newsam},
  title = {Fast and exact simulation of stationary {G}aussian processes through
	circulant embedding of the covariance matrix},
  journal = {SIAM Journal Sci. Comput.},
  year = {1997},
  volume = {18},
  pages = {1088-1107}
}

@ARTICLE{DingChi,
  author = {Cherng G. Ding},
  title = {Computing the non-central $\chi^2$ distribution function.},
  journal = {Applied Statistics},
  year = {1992}
}

@INPROCEEDINGS{Doss2,
  author = {Halim Doss},
  title = {Connections between stochastic and ordinary integral equations},
  booktitle = {Biological Growth and Spread},
  year = {1979},
  editor = {Willi Jäger and Hermann Rost and Petre Tautu},
  volume = {38},
  pages = {443-448},
  publisher = {Springer, Berlin}
}

@ARTICLE{Doss1,
  author = {Halim Doss},
  title = {Liens entre équations différentielles stochastiques et ordinaires},
  journal = {Ann. I.H.P.},
  year = {1977},
  volume = {13(2)},
  pages = {99-125}
}

@ARTICLE{LloydConvergence,
  author = {Qiang Du and Maria Emelianenko and Lili Ju},
  title = {Convergence of the {L}loyd algorithm for computing centroidal {V}oronoi
	tessellations},
  journal = {SIAM J. Numer. Anal.},
  year = {2006},
  volume = {44},
  pages = {102-119},
  number = {1},
  address = {Philadelphia, PA, USA},
  publisher = {Society for Industrial and Applied Mathematics}
}

@ARTICLE{DuGunzburgerGridGeneration,
  author = {Qiang Du and Max Gunzburger},
  title = {Grid generation and optimization based on centroidal {V}oronoi tessellations},
  journal = {Applied Mathematics and Computation},
  year = {2002},
  volume = {133},
  pages = {591-607}
}

@ARTICLE{DupireUTV,
  author = {Bruno Dupire},
  title = {A unified theory of volatility},
  journal = {Paribas working paper},
  year = {1996}
}

@ARTICLE{DzhaparidzevanZanten2,
  author = {Kacha Dzhaparidze and Harry van Zanten},
  title = {Optimality of an explicit series expansion of the fractional {B}rownian
	sheet},
  journal = {Statistics and probability letters},
  year = {2005},
  volume = {71},
  pages = {295-301}
}

@ARTICLE{DzhaparidzevanZanten1,
  author = {Kacha Dzhaparidze and Harry van Zanten},
  title = {A series expansion of fractional {B}rownian motion},
  journal = {Probability theory and related fields},
  year = {2004},
  volume = {130},
  pages = {39-55}
}

@BOOK{EdelsbrunnerComputationalGeometry1,
  title = {Algorithms in combinatorial geometry},
  publisher = {Springer-Verlag New York, Inc.},
  year = {1987},
  author = {Herbert Edelsbrunner},
  address = {New York, NY, USA}
}

@ARTICLE{HeliotHoekFractional,
  author = {Robert J. Elliott and John van der Hoek},
  title = {A General Fractional White Noise Theory And Applications To Finance},
  journal = {Mathematical Finance},
  year = {2003},
  volume = {13(2)},
  pages = {301-330}
}

@ARTICLE{MacBethCEV,
  author = {David C. Emanuel and James D. MacBeth},
  title = {Further results on the {C}onstant {E}lasticity of {V}ariance call
	option pricing model},
  journal = {Journal of Financial and Quantitative Analysis},
  year = {1982},
  volume = {17},
  pages = {533-54}
}

@BOOK{EthierKurtzMarkovProcessses,
  title = {Markov processes, characterization and convergence},
  publisher = {Wiley Series in Probability and Statistics},
  year = {2005},
  author = {Stewart N. Ethier and Thomas G. Kurtz}
}

@ARTICLE{Forgy1965,
  author = {Edward W. Forgy},
  title = {Cluster analysis of multivariate data: efficiency \textit{vs.} interpretability
	of classifications},
  journal = {Biometrics},
  year = {1965},
  volume = {21},
  pages = {768 769}
}

@INPROCEEDINGS{FortuneVoronoiDelaunay,
  author = {Steven Fortune},
  title = {{V}oronoi diagrams and {D}elaunay triangulations},
  booktitle = {Computing in Euclidean Geometry},
  year = {1992},
  editor = {Ding-Zhu Du and Frank Hwang},
  pages = {193-233},
  publisher = {World Scientific}
}

@ARTICLE{FrantiSpaceDecomposition,
  author = {Pasi Fränti and Timo Kaukoranta and Olli Nevalainen},
  title = {On the splitting method for VQ codebook generation},
  journal = {Optical Engineering},
  year = {1997}
}

@ARTICLE{FollmerImkeller,
  author = {Hans Föllmer and Peter Imkeller},
  title = {Anticipation cancelled by a {G}irsanov transformation: a paradox
	on {W}iener space},
  journal = {Annales de l'institut Henri Poincaré (B) Probabilités et Statistiques},
  year = {1993},
  volume = {29(4)},
  pages = {569-586}
}

@ARTICLE{GaedeGuntherMultidimensionalaccess,
  author = {Volker Gaede and Oliver Gunther and Name Volker Gaede and Name Oliver
	Gunther},
  title = {Multidimensional Access Methods},
  journal = {ACM Computing Surveys},
  year = {1998},
  volume = {30},
  pages = {170-231}
}

@BOOK{GatheralVolatilityBook,
  title = {The volatility surface},
  publisher = {Wiley Finance},
  year = {2010},
  author = {Jim Gatheral}
}

@ARTICLE{GatheralAsymptotic,
  author = {Jim Gatheral and Elton P. Hsu and Peter Laurence and Cheng Ouyang
	and Tai-Ho Wang},
  title = {Asymptotics of implied volatility in local volatility models},
  journal = {Preprint},
  year = {2009}
}

@ARTICLE{GatheralJacquierGlobalSVI,
  author = {Jim Gatheral and Antoine Jacquier},
  title = {Arbitrage-free {S.V.I.} volatility surfaces},
  journal = {Preprint},
  year = {2012}
}

@ARTICLE{GauntRichardson,
  author = {John Arthur Gaunt and Lewis Fry Richardson},
  title = {The deferred approach to the limit},
  journal = {Philosophical Transactions of the Royal Society of London},
  year = {1927},
  volume = {A 226},
  pages = {299-349}
}

@BOOK{GershoGrayVectorQuantization,
  title = {Vector quantization and signal compression},
  publisher = {Kluwer Academic Publishers},
  year = {1991},
  author = {Allen Gersho and Robert M. Gray}
}

@BOOK{GlassermanMonteCarlo,
  title = {Monte Carlo Methods in Financial Engineering},
  publisher = {Springer-Verlag New York, Inc.},
  year = {2004},
  author = {Paul Glasserman}
}

@ARTICLE{GoldysMaslowskiOUBridge,
  author = {Beniamin Goldys and Bohdan Maslowski},
  title = {The {O}rnstein-{U}hlenbeck bridge and applications to {M}arkov semigroups},
  journal = {Stochastic processes and their applications},
  year = {2008},
  volume = {118(10)},
  pages = {1738-1767}
}

@BOOK{GrafLushgyMonograf,
  title = {Foundations of Quantization for Probability Distributions},
  publisher = {Springer-Verlag Berlin and Heidelberg GmbH \& Co. K},
  year = {2000},
  author = {Siegfried Graf and Harald Luschgy}
}

@ARTICLE{GrafLuschgyPagesMismatch,
  author = {Siegried Graf and Harald Luschgy and Gilles Pagès},
  title = {Distortion mismatch in the quantization of probability measures},
  journal = {ESAIM: PS},
  year = {2008},
  volume = {12},
  pages = {127-153}
}

@ARTICLE{GLPApprox,
  author = {Siegfried Graf and Harald Luschgy and Gilles Pagès},
  title = {Optimal quantizers for {R}adon random vectors in a {B}anach space},
  journal = {J. Approx. Theory},
  year = {2007},
  volume = {144},
  pages = {27-53},
  number = {1},
  address = {Orlando, FL, USA},
  publisher = {Academic Press, Inc.}
}

@ARTICLE{GuoqiangExtrapolation,
  author = {Han Guoqiang},
  title = {Asymptotic error expansion for the {N}yström method for a nonlinear
	{V}olterra-{F}redholm integral equation},
  journal = {Journal of Computational and Applied Mathematics},
  year = {1995},
  volume = {59},
  pages = {49-59},
  number = {1}
}

@ARTICLE{GurrieriSVI,
  author = {Sébastien Gurrieri},
  title = {A class of term structures for {S.V.I.} implied volatility},
  journal = {Preprint},
  year = {2010}
}

@ARTICLE{GyongyMarkovian,
  author = {István Gyöngy},
  title = {Mimicking the one-dimensional marginal distributions of processes
	having an {I}tô differential},
  journal = {Probability theory and related fields},
  year = {1986},
  volume = {71},
  pages = {501-516}
}

@ARTICLE{SABRSmallMaturity,
  author = {Patrick S. Hagan and Deep Kumar and Andrew S. Lesniewski and Diana
	E. Woodward},
  title = {Managing smile Risk},
  journal = {Wilmott magazine},
  year = {2002}
}

@BOOK{HairerNorsettWanner,
  title = {Solving ordinary differential equations I: nonstiff problems},
  publisher = {Springer-Verlag New York, Inc.},
  year = {1996},
  author = {Ernst Hairer and Syvert Paul Nørsett and Gerhard Wanner}
}

@ARTICLE{BuscaFlorent,
  author = {Henri. Berestycki, Jerome Busca and Igor Florent},
  title = {Asymptotics and calibration of local volatility models},
  journal = {Quantitative Finance},
  year = {2002},
  volume = {2},
  pages = {61-69}
}

@BOOK{BookLabordere,
  title = {Analysis, geometry and modelling in finance},
  publisher = {Chapman \& Hall / CRC, Financial Mathematics Series},
  year = {2008},
  author = {Pierre Henry-Labordère}
}

@ARTICLE{LabordereLambdaSABR,
  author = {Pierre Henry-Labordère},
  title = {A general asymptotic implied volatility for stochastic volatility
	models},
  journal = {Preprint},
  year = {2005},
  keywords = {Heat kernel expansion, hyperbolic geometry, asymptotic smile, SABR
	with a mean-reversion term},
  language = {English}
}

@BOOK{HighamFloatingPoint,
  title = {Accuracy and stability of numerical algorithms},
  publisher = {SIAM},
  year = {2002},
  author = {Nicholas J. Higham}
}

@BOOK{HirschLacombe,
  title = {Elements d'analyse fonctionnelle ; Cours et exercices avec réponses},
  publisher = {Dunod},
  year = {2009},
  author = {Francis Hirsch and Gilles Lacombe}
}

@ARTICLE{Hsu200860,
  author = {Ying-Lin Hsu and Tsung-I Lin and Cheng-Few Lee},
  title = {{C}onstant {E}lasticity of {V}ariance ({CEV}) option pricing model:
	Integration and detailed derivation},
  journal = {Mathematics and Computers in Simulation},
  year = {2008},
  volume = {79},
  pages = {60 - 71},
  number = {1}
}

@ARTICLE{IstasKLSphericalFBM,
  author = {Jacques Istas},
  title = {{K}arhunen-{L}oève expansion of spherical fractional {B}rownian motions},
  journal = {Statistics \& Probability Letters},
  year = {2006},
  volume = {76(14)},
  pages = {1578-1583}
}

@ARTICLE{JacodEnlargement,
  author = {Jean Jacod},
  title = {Grossissements de filtrations : exemples et applications},
  journal = {Lecture Notes in Mathematics},
  year = {1985},
  volume = {1118},
  pages = {15-35}
}

@ARTICLE{TransformedProcesses,
  author = {Ramón Gutiérrez Jaimez and Mariano J. Valderrama Bonnet},
  title = {On the {K}arhunen-{L}oève expansion for transformed processes},
  journal = {Trabajos De Estadistica},
  year = {1987},
  volume = {2(2)},
  pages = {81-90}
}

@BOOK{JansonGaussianHilbertSpaces,
  title = {Gaussian Hilbert spaces},
  publisher = {Cambridge university press},
  year = {1997},
  author = {Svante Janson}
}

@ARTICLE{JeulinFiniteVariation,
  author = {Thierry Jeulin},
  title = {Processus Gaussiens à variation finie},
  journal = {Annales de l'I.H.P. Probabilités et statistiques},
  year = {1983}
}

@ARTICLE{JeulinEnlargement,
  author = {Thierry Jeulin},
  title = {Semi-martingales et grossissement d'une filtration},
  journal = {Lecture Notes in Mathematics},
  year = {1980},
  volume = {833}
}

@ARTICLE{JostVolterra,
  author = {Céline Jost},
  title = {Measure-preserving transformations of {V}olterra {G}aussian processes
	and related bridges},
  journal = {Preprint},
  year = {2007}
}

@ARTICLE{JourdainConvenientStratDir,
  author = {Benjamin Jourdain and Bernard Lapeyre and Piergiacomo Sabino},
  title = {Convenient multiple directions of stratification},
  journal = {International Journal of Theoretical and Applied Finance},
  year = {2011}
}

@ARTICLE{JourdainSbaiScheme,
  author = {Benjamin Jourdain and Mohamed Sbai},
  title = {High order discretization schemes for stochastic volatility models},
  year = {2011}
}

@ARTICLE{JunglenLuschgyConstructive,
  author = {Stefan Junglen and Harald Luschgy},
  title = {A constructive sharp approach to functional quantization of stochastic
	processes},
  journal = {Journal of Applied Mathematics},
  year = {2010}
}

@ARTICLE{KiefferLogConcave,
  author = {John C. Kieffer},
  title = {Uniqueness of locally optimal quantizer for vector quantizer design},
  journal = {IEEE Trans. Comm.},
  year = {1983},
  volume = {29},
  pages = {42-47}
}

@BOOK{KnuthArt3,
  title = {Art of Computer Programming, Volume 3: Sorting and Searching (2nd
	Edition)},
  publisher = {{Addison-Wesley Professional}},
  year = {1998},
  author = {Knuth, Donald E. },
  month = {April}
}

@BOOK{KnuthArt1,
  title = {Art of Computer Programming, Volume 1: Fundamental Algorithms (3rd
	Edition)},
  publisher = {{Addison-Wesley Professional}},
  year = {1997},
  author = {Knuth, Donald E.},
  month = {July}
}

@BOOK{KnuthArt2,
  title = {Art of Computer Programming, Volume 2: Seminumerical Algorithms (3rd
	Edition)},
  publisher = {{Addison-Wesley Professional}},
  year = {1997},
  author = {Knuth, Donald E. },
  month = {November},
  howpublished = {Hardcover},
  keywords = {algorithms, computer, seminumerical}
}

@ARTICLE{KreinMilman,
  author = {Mark Krein and David Milman},
  title = {On the extreme points of regularly convex sets},
  journal = {Studia Mathematica},
  year = {1940},
  volume = {9},
  pages = {133-138}
}

@ARTICLE{KusuokaStrook,
  author = {Shigeo Kusuoka and Daniel W. Stroock},
  title = {Applications of the {M}alliavin calculus, part {II}},
  journal = {J. Fac. Sci. Univ. Tokyo 32},
  year = {1985},
  pages = {1-76}
}

@ARTICLE{LangnauLocalCorrel,
  author = {Alex Langnau},
  title = {Introduction into Local Correlation Modelling},
  journal = {Preprint},
  year = {2009}
}

@ARTICLE{LebovitsLevyVehelCalSto,
  author = {Joachim Lebovits and Jacques Lévy-Véhel},
  title = {White noise-based stochastic calculus with respect to multi-fractional
	{B}rownian motion},
  journal = {Preprint},
  year = {2011}
}

@ARTICLE{LejayReutenauerControl,
  author = {Antoine Lejay and Victor Reutenauer},
  title = {{A} variance reduction technique using a quantized {B}rownian motion
	as a control variate},
  journal = {J. Comput. Finance},
  year = {2008}
}

@ARTICLE{LemairePagesSampling,
  author = {Vincent Lemaire and Gilles Pagès},
  title = {Unconstrained recursive importance sampling},
  journal = {Ann. Appl. Probab.},
  year = {2010},
  volume = {20(3)},
  pages = {1029-1067}
}

@ARTICLE{LevenbergLeastSquares,
  author = {Kenneth Levenberg},
  title = {A Method for the Solution of Certain Non-Linear Problems in Least
	Squares},
  journal = {The Quarterly of Applied Mathematics},
  year = {1944},
  volume = {2},
  pages = {164-168}
}

@ARTICLE{MemoVisualImprovement,
  author = {Minqiang Li},
  title = {Memo on local vol surface visual improvements},
  journal = {Bloomberg internal documentation},
  year = {2011}
}

@ARTICLE{LloydInformationTheory,
  author = {Stuart P. Lloyd},
  title = {Least squares quantization in PCM},
  journal = {Information Theory, IEEE Transactions on},
  year = {1982},
  volume = {28},
  pages = {129-137},
  number = {2},
  booktitle = {Information Theory, IEEE Transactions on}
}

@ARTICLE{CEVTimedependent,
  author = {Chi Fai Lo and Pui Ho Yuen and Cho-Hoi Hui},
  title = {Constant Elasticity of Variance option pricing model with time-dependent
	parameters},
  journal = {International Journal of Theoretical and Applied Finance},
  year = {2000},
  volume = {3(4)},
  pages = {661-674}
}

@ARTICLE{FunctionalQuantizationLevy,
  author = {Harald Luschgy and Gilles Pagès},
  title = {Functional quantization rate and mean regularity of processes with
	an application to {L}évy processes},
  journal = {Ann. Appl. Probab.},
  year = {2008},
  volume = {18(2)},
  pages = {427-469}
}

@ARTICLE{ProductQuantLuschyPages,
  author = {Harald Luschgy and Gilles Pagès},
  title = {High-resolution product quantization for {G}aussian processes under
	sup-norm distortion},
  journal = {Bernoulli},
  year = {2007},
  volume = {13},
  pages = {653-671},
  number = {3}
}

@ARTICLE{LuschgyPagesFunctional5,
  author = {Harald Luschgy and Gilles Pagès},
  title = {Functional quantization of a class of {B}rownian diffusions: A constructive
	approach},
  journal = {Stochastic Processes and their Applications},
  year = {2006},
  volume = {116},
  pages = {310-336},
  number = {2}
}

@ARTICLE{LuschgyPagesFunctional2,
  author = {Harald Luschgy and Gilles Pagès},
  title = {Sharp asymptotics of the functional quantization problem for {G}aussian
	processes},
  journal = {Annals of Probability},
  year = {2004},
  volume = {32},
  pages = {1574-1599},
  number = {2}
}

@ARTICLE{LuschgyPagesFunctional3,
  author = {Harald Luschgy and Gilles Pagès},
  title = {Functional quantization of {G}aussian processes},
  journal = {Journal of Functional Analysis},
  year = {2002},
  volume = {196},
  pages = {486-531},
  number = {2}
}

@ARTICLE{LuschgyPagesWilberzFunctionalSchemes,
  author = {Harald Luschgy and Gilles Pagès and Benedikt Wilbertz},
  title = {Asymptotically optimal quantization schemes for {G}aussian processes},
  journal = {ESAIM: PS},
  year = {2010},
  volume = {14},
  pages = {93-116}
}

@MISC{BoostLibraries,
  author = {John Maddock and Paul Bristow},
  title = {The {B}oost {C}++ libraries, statistical distributions and functions},
  howpublished = {\texttt{http://www.boost.org}},
  month = {March},
  year = {2008}
}

@BOOK{YorMansuy,
  title = {Random times and enlargements of filtrations in a Brownian setting},
  publisher = {Springer-Verlag New York, Inc.},
  year = {2006},
  author = {Roger Mansuy and Marc Yor},
  journal = {(avec Marc Yor) Lecture Notes in Math., vol. 1873, 2006, Springer-Verlag}
}

@ARTICLE{MarquardtLeastSquares,
  author = {Donald W. Marquardt},
  title = {An Algorithm for Least-Squares Estimation of Nonlinear Parameters},
  journal = {SIAM Journal on Applied Mathematics},
  year = {1963},
  volume = {11},
  pages = {431-441}
}

@ARTICLE{McNamesPAT,
  author = {James McNames},
  title = {A Fast Nearest-Neighbor Algorithm Based on a Principal Axis Search
	Tree},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2001},
  volume = {23},
  pages = {964-976},
  number = {9},
  address = {Washington, DC, USA},
  publisher = {IEEE Computer Society}
}

@ARTICLE{MeiserPointLocation,
  author = {Stefan Meiser},
  title = {Point location in arrangements of hyperplanes},
  journal = {Inf. Comput.},
  year = {1993},
  volume = {106},
  pages = {286-303},
  number = {2},
  address = {Duluth, MN, USA},
  publisher = {Academic Press, Inc.}
}

@ARTICLE{MeyerEnlargement,
  author = {Paul André Meyer},
  title = {Les resultats de jeulin sur le grossissement des tribus},
  journal = {Lecture Notes in Mathematics},
  year = {1980},
  volume = {784},
  pages = {173-188}
}

@ARTICLE{MradHamidaGenetic,
  author = {Moez Mrad and Sana Ben Hamida},
  title = {Optimal quantization: evolutionary algorithm \textit{vs.} stochastic
	gradient},
  journal = {Proceedings of the 9th Joint Conference on Information Sciences},
  year = {2006}
}

@ARTICLE{NeculaPricing,
  author = {Ciprian Necula},
  title = {Option pricing in a fractional {B}rownian motion environment}
}

@ARTICLE{NeculaBarrier,
  author = {Ciprian Necula},
  title = {Pricing {E}uropean and barrier options in the fractional {B}lack-{S}choles
	market},
  year = {2007}
}

@ARTICLE{OravPedasVainikko,
  author = {Kerli Orav-Puurand and Arvet Pedas and Gennadi Vainikko},
  title = {Nyström type methods for Fredholm integral equations with weak singularities},
  journal = {Journal of Computational and Applied Mathematics},
  year = {2010}
}

@BOOK{OvertonFloatingPoint,
  title = {Numerical computing with {IEEE} floating point arithmetic},
  publisher = {SIAM},
  year = {2001},
  author = {Michael L. Overton}
}

@INPROCEEDINGS{PagesVoronoiTesselations,
  author = {Gilles Pagès},
  title = {Voronoi tesselation, space quantization algorithms and numerical
	integration},
  booktitle = {Proc. ESANN'93, European Symp. on Artificial NeuralNetworks},
  year = {1993},
  editor = {Micle Verleysen},
  pages = {221-228},
  address = {Brussels, Belgium},
  publisher = {D facto conference services}
}

@BOOK{PagesNumericalBook,
  title = {Introduction to numerical probability in finance},
  year = {2011},
  author = {Gilles Pagès}
}

@MISC{PagesFunctional1,
  author = {Gilles Pagès},
  title = {Quadratic optimal functional quantization of stochastic processes
	and numerical applications},
  year = {2007}
}

@ARTICLE{PagesIntegVectorQuant,
  author = {Gilles Pagès},
  title = {A space quantization method for numerical integration},
  journal = {J. Comput. Appl. Math.},
  year = {1998},
  volume = {89},
  pages = {1-38}
}

@ARTICLE{LuschyPagesParseval,
  author = {Gilles Pagès and Harald Luschgy},
  title = {Expansions for {G}aussian processes and {P}arseval frames},
  journal = {Electronic Journal of Probability},
  year = {2010},
  volume = {14, Paper no. 42},
  pages = {1198-1221}
}

@INPROCEEDINGS{PagesReview,
  author = {Gilles Pagès and Huyên Pham and Jacques Printems},
  title = {Optimal quantization methods and applications to numerical problems
	in finance},
  booktitle = {Handbook on numerical methods in finance},
  year = {2004},
  editor = {Svetlozar T. Rachev and George A. Anastassiou},
  pages = {253-297},
  publisher = {Birkhäuser, Boston, MA},
  journal = {Handbook of Computational and Numerical Methods in Finance}
}

@ARTICLE{PagesPrintemsFunctional4,
  author = {Gilles Pagès and Jacques Printems},
  title = {Functional quantization for numerics with an application to option
	pricing},
  journal = {Monte Carlo Methods and Appl.},
  year = {2005},
  volume = {11},
  pages = {407-446},
  number = {11}
}

@MISC{WebSiteGaussian,
  author = {Gilles Pagès and Jacques Printems},
  title = {\texttt{http://www.quantize.maths-fi.com}},
  year = {2005},
  note = {``Web site devoted to optimal quantization''}
}

@ARTICLE{PagesGaussianQuantization,
  author = {Gilles Pagès and Jacques Printems},
  title = {Optimal quadratic quantization for numerics: the {G}aussian case},
  journal = {Monte Carlo Methods and Applications},
  year = {2003},
  volume = {9},
  pages = {135-166}
}

@ARTICLE{PagesSagnaRadius1,
  author = {Gilles Pagès and Abass Sagna},
  title = {Asymptotics of the maximal radius of an ${L}^r$-optimal sequence
	of quantizers},
  journal = {Bernoulli},
  year = {2008}
}

@INPROCEEDINGS{PagesSellamiSDE,
  author = {Gilles Pagès and Afef Sellami},
  title = {{C}onvergence of multi-dimensional quantized ${SDE}$'s},
  booktitle = {Séminaire de Probabilités XLIII},
  year = {2010},
  editor = {Catherine Donati-Martin and Antoine Lejay and Alain Rouault},
  pages = {269-308},
  publisher = {Springer, Berlin}
}

@ARTICLE{DualQuantizationPagesWilbertz1,
  author = {Gilles Pagès and Benedikt Wilbertz},
  title = {Intrinsic stationarity for vector quantization: Foundation of dual
	quantization},
  journal = {Preprint},
  year = {2010}
}

@ARTICLE{DualQuantizationPagesWilbertz2,
  author = {Gilles Pagès and Benedikt Wilbertz},
  title = {Sharp rate for the dual quantization problem},
  journal = {Preprint},
  year = {2010}
}

@ARTICLE{PedasVainikkoRegularity,
  author = {Arvet Pedas and Gennadi Vainikko},
  title = {On the regularity of solutions to integral equations with nonsmooth
	kernels on a union of open intervals},
  journal = {Journal of Computational and Applied Mathematics},
  year = {2009},
  volume = {229(2)}
}

@BOOK{NumericalRecipes,
  title = {Numerical recipes in C++: The art of scientific computing},
  publisher = {Cambridge University Press},
  year = {2002},
  author = {William H. Press and Saul A. Teukolsky and William T. Vetterling
	and Brian P. Flannery},
  month = {February}
}

@ARTICLE{PyckeKLGreenLaplacian,
  author = {Jean-Renaud Pycke},
  title = {Explicit {K}arhunen-{L}oève expansions related to the {G}reen function
	of the {L}aplacian},
  journal = {Banach Center Publ.},
  year = {2006},
  volume = {72},
  pages = {263-270}
}

@BOOK{KressIntegral,
  title = {Linear Integral Equations},
  year = {1989},
  author = {Kress R.}
}

@PROCEEDINGS{RajanOptimalityDelaunay,
  title = {Optimality of the Delaunay triangulation in $\R^d$},
  year = {1991},
  author = {V. T. Rajan},
  journal = {Proceedings of the seventh annual symposium on Computational geometry},
  pages = {357-363}
}

@ARTICLE{ReghaiLocalCorrel,
  author = {Adil Reghai},
  title = {Using local correlation models to improve option hedging},
  journal = {Risk},
  year = {2009}
}

@BOOK{RevuzYor,
  title = {Continuous martingales and Brownian motion},
  publisher = {Springer, 3rd edition},
  year = {2005},
  author = {Daniel Revuz and Marc Yor}
}

@ARTICLE{RussoVallois,
  author = {Francesco Russo and Pierre Vallois},
  title = {Stochastic calculus with respect to continuous finite quadratic variation
	processes},
  journal = {Stochastics An International Journal of Probability and Stochastic
	Processes},
  year = {2000},
  volume = {Volume 70, Issue 1 \& 2},
  pages = {1-40}
}

@ARTICLE{SagnaLsLrRateOptimality,
  author = {Abass Sagna},
  title = {Universal ${L}^s$-rate-optimality of ${L}^r$-optimal quantizers by
	dilatation and contraction},
  journal = {Preprint},
  year = {2009}
}

@ARTICLE{SchroderCEV,
  author = {Mark Schroder},
  title = {Computing the {C}onstant {E}lasticity of {V}ariance option pricing
	formula},
  journal = {The Journal of Finance},
  year = {1989}
}

@ARTICLE{SchwartzCommo97,
  author = {Eduardo S. Schwartz},
  title = {The Stochastic Behavior of Commodity Prices: Implications for Valuation
	and Hedging},
  journal = {Journal of Finance},
  year = {1997},
  volume = {52},
  pages = {923-73},
  number = {3},
  month = {July}
}

@ARTICLE{Sussman,
  author = {Hector J. Sussman},
  title = {On the gap between deterministic and stochastic ordinary differential
	equations},
  journal = {Ann. Probab},
  year = {1978},
  volume = {6(1)},
  pages = {19-41}
}

@ARTICLE{Tarpey_PCA_principal_points,
  author = {Thaddeus Tarpey and Luning Li and Flury, Bernard D.},
  title = {Principal points and self-consistent points of elliptical distributions.},
  journal = {Ann. Stat.},
  year = {1995},
  volume = {23},
  pages = {103-112},
  number = {1}
}

@ARTICLE{ReviewTsaparas,
  author = {Panayotis Tsaparas},
  title = {Nearest-Neighbor Search in Multidimensional Spaces},
  journal = {Qualifying Depth Oral Report 319-02, Dept. of Computer Science, University
	of Toronto, 1999. 2},
  year = {1999}
}

@ARTICLE{WangDuMeshOptimization,
  author = {Desheng Wang and Qiang Du},
  title = {Mesh optimization based on the centroidal {V}oronoi tesselation},
  journal = {International Journal of Numerical Analysis and modeling},
  year = {2005},
  volume = {2},
  pages = {100-113}
}

@PHDTHESIS{WilbertzPHD,
  author = {Benedikt Wilbertz},
  title = {Construction of optimal quantizers for {G}aussian measures on {B}anach
	spaces},
  school = {Universität Trier},
  year = {2008}
}

@ARTICLE{WilbertzDiplomaThesis,
  author = {Benedikt Wilbertz},
  title = {Computational aspects of functional quantization for {G}aussian measures
	and applications},
  journal = {Diploma thesis, Univ. Trier (Germany)},
  year = {2005}
}

@ARTICLE{WongZakai2,
  author = {Eugene Wong and Moshe Zakai},
  title = {On the relation between ordinary and stochastic differential equations},
  journal = {International Journal of Engineering Science},
  year = {1965},
  volume = {3(2)},
  pages = {213-229}
}

@ARTICLE{WoodChanSimulationMultifractional,
  author = {Andrew T. A. Wood and Grace Chan},
  title = {Simulation of multifractional {B}rownian motion},
  journal = {Proc. Comput. Statist},
  year = {1998},
  pages = {233-238}
}

@ARTICLE{WoodChanSimulationStationary,
  author = {Andrew T. A. Wood and Grace Chan},
  title = {Simulation of stationary {G}aussian processes in $[0,1]^d$},
  journal = {Journal of Comp. and Graphical Statistics},
  year = {1994},
  volume = {3},
  pages = {409-432}
}

@ARTICLE{YorEnlargement,
  author = {Marc Yor},
  title = {Grossissement d'une filtration et semi-martingales : Théoremes généraux},
  journal = {Lecture Notes in Mathematics},
  year = {1978},
  volume = {649}
}

@ARTICLE{ZadorAsymptoticError,
  author = {Paul L. Zador},
  title = {Asymptotic quantization error of continuous signals and the quantization
	dimension},
  journal = {IEEE Trans. Inform. Theory},
  year = {1982},
  volume = {IT-28},
  pages = {139 -149},
  number = {2},
  month = {March}
}

@ARTICLE{ZhangMixedLognormal,
  author = {Kaiyuan Zhang},
  title = {Construction of equity volatility surface using mixed lognormal distribution},
  journal = {Internal Bloomberg documentation},
  year = {2011}
}

@ARTICLE{JourdainAdaptiveStrat,
  author = {Pierre Étoré and Gersende Fort and Benjamin Jourdain and Éric Moulines},
  title = {On adaptive stratification},
  journal = {Ann. Oper. Res.},
  year = {2011}
}

@ARTICLE{JourdainStratification1,
  author = {Pierre Étoré and Benjamin Jourdain},
  title = {Adaptive optimal allocation in stratified sampling methods},
  journal = {Methodology and Computing in Applied Probability},
  year = {2008}
}


text:
package app

import (
	"github.com/crazy-max/firefox-history-merger/internal/db/places"
	"github.com/crazy-max/firefox-history-merger/internal/utl"
	"github.com/jinzhu/gorm"
	"github.com/rs/zerolog/log"
	"github.com/vcraescu/go-paginator"
	"github.com/vcraescu/go-paginator/adapter"
)

type mergeClient struct {
	pCli         *places.Client
	pTx          *gorm.DB
	ptmCli       *places.Client
	mpLeft       int
	countCreated int
	countUpdated int
	countErrors  int
}

// Merge a working places databases with other ones
func (fhm *FirefoxHistoryMerger) Merge() {
	var err error

	log.Debug().Msgf("Opening working places database: %s...", fhm.fl.PlacesFile)
	pCli, err := places.New(fhm.fl.PlacesFile, true)
	if err != nil {
		log.Fatal().Err(err).Msgf("Cannot open database %s", fhm.fl.PlacesFile)
	}
	fhm.dbs = append(fhm.dbs, pCli.Db)
	defer pCli.Db.Close()
	if err := pCli.Db.Backup(); err != nil {
		log.Warn().Err(err).Msgf("Cannot backup database %s", pCli.Db.Filename)
	}

	log.Debug().Msgf("Opening places database to merge: %s...", fhm.fl.PlacesToMergeFile)
	ptmCli, err := places.New(fhm.fl.PlacesToMergeFile, true)
	if err != nil {
		log.Fatal().Err(err).Msgf("Cannot open database %s", fhm.fl.PlacesToMergeFile)
	}
	fhm.dbs = append(fhm.dbs, ptmCli.Db)
	defer ptmCli.Db.Close()

	// Create merge client
	mc := &mergeClient{
		pCli:   pCli,
		ptmCli: ptmCli,
	}

	// Paginate result
	var ptmPlacesList []places.MozPlaces
	ptmPlacesPage := paginator.New(adapter.NewGORMAdapter(ptmCli.Db.Model(places.MozPlaces{})), fhm.fl.MaxPerTx)
	if err = ptmPlacesPage.Results(&ptmPlacesList); err != nil {
		log.Fatal().Err(err).Msg("Cannot get pagination places")
	}

	// Count places to merge
	mc.mpLeft = ptmPlacesPage.Nums()
	log.Info().Msgf("%d places will be merged", ptmPlacesPage.Nums())

	// Iterate
	for {
		tx := mc.pCli.Db.Begin()
		log.Info().Msgf("Merging %d places (%d/%d)...", len(ptmPlacesList), ptmPlacesPage.Page(), ptmPlacesPage.PageNums())
		for _, ptmPlaces := range ptmPlacesList {
			pPlaces := mc.mergePlaces(ptmPlaces, tx)
			if pPlaces.ID == 0 {
				continue
			}
			mc.mergeHistoryvisits(pPlaces, ptmPlaces, tx)
		}
		tx.Commit()
		log.Debug().Msg("Transaction committed")

		if !ptmPlacesPage.HasNext() {
			break
		}
		nextPage, err := ptmPlacesPage.NextPage()
		if err != nil {
			log.Fatal().Err(err).Msg("Cannot reached places next page")
		}
		ptmPlacesPage.SetPage(nextPage)
		if err := ptmPlacesPage.Results(&ptmPlacesList); err != nil {
			log.Fatal().Err(err).Msg("Cannot get pagination places")
		}
	}

	log.Info().Msg("Optimizing database...")
	if err := mc.pCli.Db.Vacuum(); err != nil {
		log.Warn().Err(err).Msg("Cannot optimize database")
	}

	log.Info().
		Int("total", ptmPlacesPage.Nums()).
		Int("created", mc.countCreated).
		Int("updated", mc.countUpdated).
		Int("errors", mc.countErrors).
		Msg("Finished")
}

func (mc *mergeClient) mergePlaces(ptmPlaces places.MozPlaces, pTx *gorm.DB) places.MozPlaces {
	defer func() {
		mc.mpLeft--
	}()

	var pPlaces places.MozPlaces
	pTx.Where("url = ?", ptmPlaces.Url).Find(&pPlaces)

	// New entry
	if pPlaces.ID == 0 {
		pPlaces = ptmPlaces
		pPlaces.ID = 0
		pPlaces.Guid = placesNewGUID(pTx)
		pPlaces.OriginId = 0
		pTx.NewRecord(pPlaces)
		if err := pTx.Create(&pPlaces).Error; err != nil {
			mc.countErrors++
			log.Error().Err(err).Int("places_id", pPlaces.ID).
				Int("mplaces_id", ptmPlaces.ID).
				Int("left", mc.mpLeft).
				Str("url", ptmPlaces.Url).Msg("Creating moz_places row")
			return places.MozPlaces{}
		}

		mc.countCreated++
		log.Debug().Int("places_id", pPlaces.ID).
			Int("mplaces_id", ptmPlaces.ID).
			Int("left", mc.mpLeft).
			Str("url", ptmPlaces.Url).Msg("Creating moz_places row")
		return pPlaces
	}

	// Update entry
	pPlaces.VisitCount += ptmPlaces.VisitCount
	pPlaces.LastVisitDate = utl.MaxInt64(pPlaces.LastVisitDate, ptmPlaces.LastVisitDate)
	pPlaces.Frecency = (pPlaces.Frecency + ptmPlaces.Frecency) / 2
	if err := pTx.Save(&pPlaces).Error; err != nil {
		mc.countErrors++
		log.Error().Err(err).Int("places_id", pPlaces.ID).
			Int("mplaces_id", ptmPlaces.ID).
			Int("left", mc.mpLeft).
			Str("url", ptmPlaces.Url).Msg("Updating moz_places row")
		return places.MozPlaces{}
	}

	mc.countUpdated++
	log.Debug().Int("places_id", pPlaces.ID).
		Int("mplaces_id", ptmPlaces.ID).
		Int("left", mc.mpLeft).
		Str("url", ptmPlaces.Url).Msg("Updating moz_places row")
	return pPlaces
}

func placesNewGUID(pTx *gorm.DB) string {
	var found int
	var table places.MozPlaces
	guid := utl.GenerateGUID()
	pTx.Model(table).Where("guid = ?", guid).Count(&found)
	if found > 0 {
		guid = placesNewGUID(pTx)
	}
	return guid
}

func (mc *mergeClient) mergeHistoryvisits(pPlaces places.MozPlaces, ptmPlaces places.MozPlaces, pTx *gorm.DB) {
	var ptmHistoryvisitsList []places.MozHistoryvisits

	mc.ptmCli.Db.Where("place_id = ?", ptmPlaces.ID).Find(&ptmHistoryvisitsList)
	for _, ptmHistoryvisits := range ptmHistoryvisitsList {
		// Find if already exists
		var pHistoryvisitsList places.MozHistoryvisits
		pTx.Where("from_visit = ? AND place_id = ? AND visit_date = ?",
			ptmHistoryvisits.FromVisit,
			pPlaces.ID,
			ptmHistoryvisits.VisitDate,
		).First(&pHistoryvisitsList)

		// Leave if found
		if pHistoryvisitsList.ID > 0 {
			continue
		}

		ptmHistoryvisits.ID = 0
		ptmHistoryvisits.PlaceId = pPlaces.ID
		ptmHistoryvisits.FromVisit = 0 //TODO: Find a way to retrieve ancestors. Fills from_visit with 0 temporarily.
		pTx.NewRecord(ptmHistoryvisits)
		if err := pTx.Create(&ptmHistoryvisits).Error; err != nil {
			log.Error().Err(err).Int("places_id", pPlaces.ID).
				Int("mplaces_id", ptmPlaces.ID).
				Int("historyvisits_id", ptmHistoryvisits.ID).
				Msg("Creating moz_places row")
			continue
		}

		log.Debug().Int("places_id", pPlaces.ID).
			Int("mplaces_id", ptmPlaces.ID).
			Int("historyvisits_id", ptmHistoryvisits.ID).
			Msg("Creating moz_historyvisits row")
	}
}

license: MIT

repository: crazy-max/firefox-history-merger

license_type: permissive

repo_name: crazy-max/firefox-history-merger

branch_name: refs/heads/master

gha_license_id: MIT

gha_language: Go

extension: go


text:
SUMMARY = "Pixman: Pixel Manipulation library"

DESCRIPTION = "Pixman provides a library for manipulating pixel regions \
-- a set of Y-X banded rectangles, image compositing using the \
Porter/Duff model and implicit mask generation for geometric primitives \
including trapezoids, triangles, and rectangles."

require xorg-lib-common.inc

LICENSE = "MIT & MIT-style & PD"
LIC_FILES_CHKSUM = "file://COPYING;md5=14096c769ae0cbb5fcb94ec468be11b3 \
                    file://pixman/pixman-matrix.c;endline=25;md5=ba6e8769bfaaee2c41698755af04c4be \
                    file://pixman/pixman-arm-neon-asm.h;endline=24;md5=9a9cc1e51abbf1da58f4d9528ec9d49b \
                   "
DEPENDS += "zlib libpng"
BBCLASSEXTEND = "native nativesdk"

PE = "1"

IWMMXT = "--disable-arm-iwmmxt"
LOONGSON_MMI = "--disable-loongson-mmi"
NEON = " --disable-arm-neon "
NEON_class-nativesdk = " --disable-arm-neon "
NEON_armv7a = " "
NEON_armv7a-vfp-neon = " "

EXTRA_OECONF = "--disable-gtk ${IWMMXT} ${LOONGSON_MMI} ${NEON}"
EXTRA_OECONF_class-native = "--disable-gtk"

SRC_URI += "\
            file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch \
"

SRC_URI[md5sum] = "cdb566504fe9daf6728c7b03cc7ea228"
SRC_URI[sha256sum] = "ae2bd664057e330d41b40336ed296d3512318ce7f2401cc42601f2613d371e4c"

REQUIRED_DISTRO_FEATURES = ""

#
#Meta-debian
#
inherit debian-package
DPR = "0"
DEBIAN_SECTION = "x11"
DEBIAN_PATCH_TYPE = "quilt"

repository: takuya-t/meta-debian

repo_name: takuya-t/meta-debian

branch_name: refs/heads/daisy

extension: bb


text:
// Copyright 2016 Guilherme Nemeth <guilherme.nemeth@gmail.com>

package yo

type LineInfo struct {
	Instr uint32 // the instruction index
	Line  uint16
}

// Contains executable code by the VM and
// static information generated at compilation time.
// All runtime functions reference one of these
type Bytecode struct {
	Source    string
	NumConsts uint32
	NumCode   uint32
	NumLines  uint32
	NumFuncs  uint32
	Consts    []Value
	Code      []uint32
	Lines     []LineInfo
	Funcs     []*Bytecode
}

const (
	bytecodeMaxConsts = 0xffff
)

func newBytecode(source string) *Bytecode {
	return &Bytecode{
		Source: source,
	}
}

repository: glhrmfrts/yo

repo_name: glhrmfrts/yo


text:
@article{neto2018mechanical,
 author = {Neto*, Ary Serpa and Deliberato*, Rodrigo Octavio and Johnson*, Alistair E and Bos, Lieuwe D and Amorim, Pedro and Pereira, Silvio Moreto and Cazati, Denise Carnieli and Cordioli, Ricardo L and Correa, Thiago Domingos and Pollard, Tom J and others},
 author+an = {3=highlight},
 journal = {Intensive care medicine},
 pages = {1--9},
 publisher = {Springer Berlin Heidelberg},
 title = {Mechanical power of ventilation is associated with mortality in critically ill patients: an analysis of patients in two observational cohorts},
 year = {2018}
}

extension: bib


text:
PV = "0.6.2svn${CVSDATE}"
LICENSE = "GPL"
SECTION = "x11/utils"
PR = "r0"
MAINTAINER = "Johan Bilien <jobi@via.ecp.fr>"

DESCRIPTION = "SIP user agent, with focus on security"
DEPENDS = "libglademm libmsip0 libmikey0"
SRC_URI = "svn://svn.minisip.org/var/svn/minisip/trunk;module=minisip"
S = ${WORKDIR}/${PN}

DEFAULT_PREFERENCE=-1

FILES_${PN} += "${datadir}/minisip"

inherit autotools

EXTRA_OECONF = "--enable-ipaq"

# do_configure_prepend() {
#	./bootstrap
#}

do_install_append () {
	install -d ${D}${datadir}/pixmaps
	install -d ${D}${datadir}/applications
	install -m 0644 share/minisip.png ${D}${datadir}/pixmaps/minisip.png
	install -m 0644 share/minisip.desktop ${D}${datadir}/applications/minisip.desktop
}

repository: Terentyev/familiar-linux

repo_name: Terentyev/familiar-linux


text:
package main

import (
	"github.com/douban/gobeansdb/gobeansdb"
)

func main() {
	gobeansdb.Main()
}

repository: douban/gobeansdb

repo_name: douban/gobeansdb


text:
set(FIND_OPENGL_PATHS
        ~/Library/Frameworks)

find_library(OPENGL_LIBRARY
        NAMES OpenGL
        PATH_SUFFIXES lib
        PATHS ${FIND_OPENGL_PATHS})

extension: cmake


text:
package nfs

import (
	"bytes"
	"context"
	"os"

	"github.com/go-git/go-billy/v5"
	"github.com/willscott/go-nfs-client/nfs/xdr"
)

func onRemove(ctx context.Context, w *response, userHandle Handler) error {
	w.errorFmt = wccDataErrorFormatter
	obj := DirOpArg{}
	if err := xdr.Read(w.req.Body, &obj); err != nil {
		return &NFSStatusError{NFSStatusInval, err}
	}
	fs, path, err := userHandle.FromHandle(obj.Handle)
	if err != nil {
		return &NFSStatusError{NFSStatusStale, err}
	}

	if !billy.CapabilityCheck(fs, billy.WriteCapability) {
		return &NFSStatusError{NFSStatusROFS, os.ErrPermission}
	}

	if len(string(obj.Filename)) > PathNameMax {
		return &NFSStatusError{NFSStatusNameTooLong, nil}
	}

	dirInfo, err := fs.Stat(fs.Join(path...))
	if err != nil {
		if os.IsNotExist(err) {
			return &NFSStatusError{NFSStatusNoEnt, err}
		}
		if os.IsPermission(err) {
			return &NFSStatusError{NFSStatusAccess, err}
		}
		return &NFSStatusError{NFSStatusIO, err}
	}
	if !dirInfo.IsDir() {
		return &NFSStatusError{NFSStatusNotDir, nil}
	}
	preCacheData := ToFileAttribute(dirInfo).AsCache()

	toDelete := fs.Join(append(path, string(obj.Filename))...)

	err = fs.Remove(toDelete)
	if err != nil {
		if os.IsNotExist(err) {
			return &NFSStatusError{NFSStatusNoEnt, err}
		}
		if os.IsPermission(err) {
			return &NFSStatusError{NFSStatusAccess, err}
		}
		return &NFSStatusError{NFSStatusIO, err}
	}

	writer := bytes.NewBuffer([]byte{})
	if err := xdr.Write(writer, uint32(NFSStatusOk)); err != nil {
		return &NFSStatusError{NFSStatusServerFault, err}
	}

	if err := WriteWcc(writer, preCacheData, tryStat(fs, path)); err != nil {
		return &NFSStatusError{NFSStatusServerFault, err}
	}

	if err := w.Write(writer.Bytes()); err != nil {
		return &NFSStatusError{NFSStatusServerFault, err}
	}
	return nil
}

repository: willscott/go-nfs

repo_name: willscott/go-nfs


text:
body {
  background-color: white;
}

.posts {
  height: 400px;
  overflow: auto;
  z-index: 100;
}

.right {
  float: right;
}

.display {
  display: flex !important;
}

nav {
  position: fixed;
  z-index: 100;
}

nav .brand-logo {
  margin-left: 0.5em;
  margin-top: 0.5em;
  transition: 300ms;
}

nav .nav-wrapper ul li .dropdown-button{
  /*position: relative;*/
  top: -10px;
}

.iconRow {
  position: relative;
  top: 8vh;
}

.dropdown-content li > a {
  color: #1565c0 !important;
}

.dropdown-content li > a:hover {
  background-color: #bbdefb !important;
}

.side-nav li > a:hover {
  background-color: #bbdefb !important;
}

.side-nav .collapsible-header:hover {
  background-color: #bbdefb !important;
}

.add-new-article {
  margin-left: 5px;
}

.logout {

}

nav div .t1 {
  visibility: visible;
  transition: 300ms;
}

nav div .t2 {
  visibility: hidden;
  transition: 300ms;
}

@media (max-width: 500px) {
  nav div .t1 {
    visibility: hidden;
    transition: 300ms;
  }

  nav div .t2 {
    visibility: visible;
    transition: 300ms;
  }
}

.sliderRow {
  position: relative;
  top: 9em;
  transition: 300ms;
}

/*@media (max-width: 768) {
  .sliderRow {
    top: 18vh;
    transition: 300ms;
  }
}*/

extension: css


text:
file(REMOVE_RECURSE
  "CMakeFiles/tests.dir/glew.c.obj"
  "CMakeFiles/tests.dir/tests.cpp.obj"
  "CMakeFiles/tests.dir/vec2.cpp.obj"
  "CMakeFiles/tests.dir/mat2.cpp.obj"
  "CMakeFiles/tests.dir/rectangle.cpp.obj"
  "CMakeFiles/tests.dir/circle.cpp.obj"
  "CMakeFiles/tests.dir/window.cpp.obj"
  "tests.pdb"
  "tests.exe"
  "tests.exe.manifest"
  "libtests.dll.a"
)

# Per-language clean rules from dependency scanning.
foreach(lang C CXX)
  include(CMakeFiles/tests.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()


text:
@online{site:StackOverflow,
    title   = {StackOverflow},
    url     = {https://stackoverflow.com/}
}
@online{site:Wikipedia,
    title   = {Wikipedia},
    url     = {https://it.wikipedia.org/wiki/Pagina_principale}
}
@online{site:W3School,
    title   = {W3School},
    url     = {https://www.w3schools.com/}
}
@online{site:HTML,
    title   = {html.it},
    url     = {https://www.html.it/}
}
@online{site:DocumentazionePHP,
    title   = {PHP Documentation},
    url     = {http://php.net/docs.php}
}
@online{site:DocumentazioneJS,
    title   = {JavaScript Documentation},
    url     = {https://devdocs.io/javascript/}
}


text:
@article{wang2018copenhagen,
  title={The Copenhagen team participation in the factuality task of the competition of automatic identification and verification of claims in political debates of the CLEF-2018 fact checking lab},
  author={Wang, Dongsheng and Simonsen, Jakob Grue and Larsen, Birger and Lioma, Christina},
  journal={CLEF 2018 Working Notes},
  year={2018}
}


text:
@PhdThesis{darby2011hp,
  author = {Darby, Christopher L},
  title  = {hp--Pseudospectral Method for Solving Continuous-Time Nonlinear Optimal Control Problems},
  school = {University of Florida},
  year   = {2011},
  file   = {:papers/darby_c.pdf:PDF},
}
@PhdThesis{garg2011advances,
  author = {Garg, Divya},
  title  = {Advances in global pseudospectral methods for optimal control},
  school = {University of Florida},
  year   = {2011},
  file   = {:papers/garg_d.pdf:PDF},
}
@Article{garg2010unified,
  author    = {Garg, Divya and Patterson, Michael and Hager, William W and Rao, Anil V and Benson, David A and Huntington, Geoffrey T},
  title     = {A unified framework for the numerical solution of optimal control problems using pseudospectral methods},
  journal   = {Automatica},
  year      = {2010},
  volume    = {46},
  number    = {11},
  pages     = {1843--1851},
  file      = {:papers/unified.pdf:PDF},
  publisher = {Elsevier},
}
@Article{garg2009overview,
  author    = {Garg, Divya and Patterson, Michael A and Hager, William W and Rao, Anil V and Benson, David A and Huntington, Geoffrey T},
  title     = {An overview of three pseudospectral methods for the numerical solution of optimal control problems},
  journal   = {Advances in the Astronautical Sciences},
  year      = {2009},
  volume    = {135},
  number    = {1},
  pages     = {475--487},
  file      = {:papers/unifiedFrameworkAAS.pdf:PDF},
  publisher = {Univelt, Inc.},
}

gha_license_id: NOASSERTION

gha_language: Julia