This document summarizes a presentation about Rogue, a Scala DSL for MongoDB. Some key points:
- Rogue allows type-safe querying of MongoDB with features like filters, pagination, and awareness of indexes.
- It uses phantom types to prevent issues like multiple selects or limits.
- Queries can be logged and validated.
- Future goals include iteratees for cursors, compile-time checking, and generating JavaScript for map-reduce.
CS442 - Rogue: A Scala DSL for MongoDBjorgeortiz85
?
Talk at Stanford's CS442 (High Productivity and Performance with Domain Specific Languages in Scala http://www.stanford.edu/class/cs442/), on Rogue. 5/24/2011
Solr provides concise summaries of key points from the document:
1. Solr discusses its search architecture including the use of Thrift for service encapsulation and reduced network traffic. Only IDs are returned from searches to reduce index size and enable easy scaling of primary key lookups.
2. Load balancing is discussed, including an algorithm that hashes the query and number of servers to provide server affinity while distributing load evenly.
3. Replication of the index is covered, including challenges with multicast and an implementation using BitTorrent to efficiently replicate files.
Solr & Lucene at Etsy provides concise summaries of Gregg Donovan's experience using Solr and Lucene at Etsy and TheLadders, including optimizations made to maximize performance out of the box, techniques for low-level hacking, and when each approach is best applied. Key points covered are maximizing Solr functionality, continuous deployment, cheap performance wins, and tools for low-level hacking.
The Ring programming language version 1.4.1 book - Part 13 of 31Mahmoud Samir Fayed
?
This document provides documentation on Ring's web library API for generating HTML pages and elements. It describes classes and methods for creating pages, adding content and attributes, handling forms, and more. The Page class allows adding various HTML elements to the page content through methods like text(), html(), h1(), etc. The Application class contains methods for encoding, cookies, and page structure. WebLib enables generating complete HTML pages in Ring code.
Presented by Gregg Donovan, Senior Software Engineer, Etsy.com, Inc.
Understanding the impact of garbage collection, both at a single node and a cluster level, is key to developing high-performance, high-availability Solr and Lucene applications. After a brief overview of garbage collection theory, we will review the design and use of the various collectors in the JVM.
At a single-node level, we will explore GC monitoring -- how to understand GC logs, how to monitor what % of your Solr request time is spend on GC, how to use VisualGC, YourKit, and other tools, and what to log and monitor. We will review GC tuning and how to measure success.
At a cluster-level, we will review how to design for partial availability -- how to avoid sending requests to a GCing node and how to be resilient to mid-request GC pauses.For application development, we will review common memory leak scenarios in custom Solr and Lucene application code and how to detect them.
The document provides an overview of the Ruby programming language with sections on installation, data types, operators, control structures, methods, classes and modules. It discusses key aspects of Ruby like its object oriented nature, dynamic typing, syntax and cross-platform capabilities. The document serves as a quick tour of the Ruby language covering its basic concepts, structures and features.
The Ring programming language version 1.9 book - Part 53 of 210Mahmoud Samir Fayed
?
This document provides code examples and documentation for Ring's web application framework. It includes code for user authentication using a database, classes for database access and web controllers, and descriptions of the main classes and methods in the WebLib API for generating HTML pages and handling requests. The document covers key concepts like generating pages dynamically based on request parameters, working with databases using Model classes, and common tasks like cookies, file uploads, and URL encoding.
As a result of an engine rewrite with focus on more efficient data structures, PHP 7 offers much improved performance and memory usage. This session describes important aspects of the new implementation and how it compares to PHP 5. A particular focus will be on the representation of values, arrays and objects.
PHP 7 ¨C What changed internally? (Forum PHP 2015)Nikita Popov
?
One of the main selling points of PHP 7 is greatly improved performance, with many real-world applications now running twice as fast¡ But where do these improvements come from?
At the core of PHP 7 lies an engine rewrite with focus on improving memory usage and performance. This talk provides an overview of the most significant changes, briefly covering everything from data structure changes, over enhancements in the executor, to the new compiler implementation.
Patterns for slick database applicationsSkills Matter
?
Slick is Typesafe's open source database access library for Scala. It features a collection-style API, compact syntax, type-safe, compositional queries and explicit execution control. Community feedback helped us to identify common problems developers are facing when writing Slick applications. This talk suggests particular solutions to these problems. We will be looking at reducing boiler-plate, re-using code between queries, efficiently modeling object references and more.
The Ring programming language version 1.10 book - Part 47 of 212Mahmoud Samir Fayed
?
This document summarizes the methods available in various Ring classes for data types, conversions, databases, security, and internet functions. It provides examples of using each class and the output. The DataType class allows checking value types and properties. The Conversion class converts between data types. Database classes like ODBC, MySQL, SQLite and PostgreSQL provide methods for connecting to databases and executing queries. The Security class implements hashing and encryption algorithms. The Internet class allows downloading files and sending emails.
The Ring programming language version 1.2 book - Part 19 of 84Mahmoud Samir Fayed
?
The document describes object-oriented programming concepts in Ring, including defining classes with attributes and methods, creating objects, accessing object data and methods using dot notation and braces, initializing objects, inheritance, private members, and other OOP features. Key classes like Point are defined and used to demonstrate how to set attributes, call methods, pass objects to functions, and more.
The document summarizes ActiveRecord query methods in Ruby on Rails. It discusses finder methods like where, select, group, order, limit, and offset for retrieving single or multiple records. It also covers retrieving objects in batches, conditions like string, array, and hash conditions, ordering, selecting specific attributes, limiting, grouping, having, and overriding conditions.
The document contains technical information about software vulnerabilities and security exploits. It discusses memory corruption issues like buffer overflows, use-after-free vulnerabilities, and heap overflow attacks. It also covers injection attacks, deserialization of untrusted data, container escapes, and other common software vulnerabilities. The document emphasizes the importance of secure coding practices, threat modeling, code reviews, and security testing to identify and address vulnerabilities.
Scala is a multi-paradigm programming language that combines object-oriented and functional programming. It runs on the Java Virtual Machine and interoperates with Java. Scala source code is compiled to Java bytecode, so Scala programs can access full Java libraries. Scala supports features like immutable data structures, pattern matching, actor-based concurrency and more. The document provides examples of Scala code and discusses some of its core features.
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...Databricks
?
Mastering complex software stacks, such as Spark or Hadoop, is a challenging process. Incompatible dependencies, new programming paradigms, runtime errors, outdated documentation, scaling, tuning - this is just a short list of skills we must acquire. How do we make sure that we are not wasting time and making progress learning? How do we share our knowledge efficiently? This talk walks you through a journey of scaling Salesforce Einstein AI platform to serve 3B+ predictions per day and provides you with a scale to measure learning progress.
Speaker: Matthew Tovbin
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...Matthew Tovbin
?
Spark + AI Summit, 2019 - Mastering complex software stacks, such as Spark or Hadoop, is a challenging process. Incompatible dependencies, new programming paradigms, runtime errors, outdated documentation, scaling, tuning - this is just a short list of skills we must acquire. How do we make sure that we are not wasting time and making progress learning? How do we share our knowledge efficiently? This talk walks you through a journey of scaling Salesforce Einstein AI platform to serve 6B+ predictions per day and provides you with a scale to measure learning progress.
This document provides an introduction to jQuery, an open source JavaScript library. It discusses what jQuery is, how it works, selector basics, and many jQuery commands. Key points include:
- jQuery is an open source JavaScript library that makes DOM manipulation and event handling easier. It works across browsers.
- jQuery selectors allow selecting elements using CSS syntax. Common selectors return a jQuery object containing matching elements.
- jQuery methods can be chained together for concise DOM manipulation. Chaining avoids unnecessary re-selection of elements.
- Common jQuery methods covered include manipulating attributes, CSS classes, HTML content, and traversing/filtering the DOM tree. Event handling and custom events are also discussed.
PHP 7 ¨C What changed internally? (PHP Barcelona 2015)Nikita Popov
?
The document discusses optimizations made in PHP 7 to improve performance. Some key points:
- PHP 7 optimized how values and objects are stored in memory by removing unnecessary overhead like reference counting. This reduces memory usage and indirection.
- Arrays were optimized to reduce the number of allocations, size, and lookup indirections compared to PHP 5.
- Objects saw reduced allocations, size and indirection for property values in PHP 7.
- Other optimizations included using 64-bit integers, improving immutable array performance, and enhancing the virtual machine to better manage function call stacks.
This document discusses ActiveRecord and various querying methods in Rails such as finding single and multiple records, adding conditions to queries, joining tables, and more. It provides code examples for methods like find, where, select, joins, and others. It also covers topics like readonly records, locking, overriding conditions, and joining with associations.
The Ring programming language version 1.8 book - Part 50 of 202Mahmoud Samir Fayed
?
The Page class contains methods for generating HTML elements and adding content to web pages. It includes methods for common elements like headings, paragraphs, links, forms, tables, and more. Each method accepts a parameter that allows setting attributes of the element through a list. This allows generating HTML elements with customized attributes in a simple way.
1) This document provides examples of how to use Spark DataFrames and SQL to load and analyze Iris flower data. It shows how to load data from files and Kafka, define schemas, select, filter, sort, group, and join dataframes.
2) Methods like spark.read, dataframe.select(), dataframe.filter(), and dataframe.groupBy() are used to load and query the data. StructType and case classes define the schema. SQL statements can also be used via the sqlContext.
3) User defined functions (UDFs) are demonstrated to handle custom data types like maps. The examples provide an overview of basic Spark DataFrame and SQL functionality.
Swift - ????? ?????????? ???????? ???????????? ????? ?????????Suyeol Jeon
?
The document contains code snippets demonstrating various Swift programming concepts including variables, constants, types, optionals, functions, classes, structs, enums, and more. Key concepts demonstrated include variable and constant declaration with types, optional binding, functions with parameters and return values, classes and structs with properties and methods, tuples, and enums with associated values and raw values.
This C++ program implements a student record management system using binary search trees and file handling. The program defines a Student class with fields like registration number, name, address etc. and methods to insert, search, delete and display student records from binary search indexed text files. The main function provides a menu to call these class methods to manage the student records stored in files.
Foursquare uses MongoDB to power their location-based social network. They have over 9 million users generating around 3 million check-ins per day across over 15 million venues. Foursquare chose MongoDB because it is fast, supports rich queries, sharding, replication, and geo-indexes. Foursquare runs 8 MongoDB clusters across around 40 machines storing over 2.3 billion records and handling around 15,000 queries per second. They developed Rogue, a Scala DSL for MongoDB, to make queries type-safe and add features like pagination, logging, and index awareness.
This document discusses refactoring Java code to Clojure using macros. It provides examples of refactoring Java code that uses method chaining to equivalent Clojure code using the threading macros (->> and -<>). It also discusses other Clojure features like type hints, the doto macro, and polyglot projects using Leiningen.
PHP 7 ¨C What changed internally? (Forum PHP 2015)Nikita Popov
?
One of the main selling points of PHP 7 is greatly improved performance, with many real-world applications now running twice as fast¡ But where do these improvements come from?
At the core of PHP 7 lies an engine rewrite with focus on improving memory usage and performance. This talk provides an overview of the most significant changes, briefly covering everything from data structure changes, over enhancements in the executor, to the new compiler implementation.
Patterns for slick database applicationsSkills Matter
?
Slick is Typesafe's open source database access library for Scala. It features a collection-style API, compact syntax, type-safe, compositional queries and explicit execution control. Community feedback helped us to identify common problems developers are facing when writing Slick applications. This talk suggests particular solutions to these problems. We will be looking at reducing boiler-plate, re-using code between queries, efficiently modeling object references and more.
The Ring programming language version 1.10 book - Part 47 of 212Mahmoud Samir Fayed
?
This document summarizes the methods available in various Ring classes for data types, conversions, databases, security, and internet functions. It provides examples of using each class and the output. The DataType class allows checking value types and properties. The Conversion class converts between data types. Database classes like ODBC, MySQL, SQLite and PostgreSQL provide methods for connecting to databases and executing queries. The Security class implements hashing and encryption algorithms. The Internet class allows downloading files and sending emails.
The Ring programming language version 1.2 book - Part 19 of 84Mahmoud Samir Fayed
?
The document describes object-oriented programming concepts in Ring, including defining classes with attributes and methods, creating objects, accessing object data and methods using dot notation and braces, initializing objects, inheritance, private members, and other OOP features. Key classes like Point are defined and used to demonstrate how to set attributes, call methods, pass objects to functions, and more.
The document summarizes ActiveRecord query methods in Ruby on Rails. It discusses finder methods like where, select, group, order, limit, and offset for retrieving single or multiple records. It also covers retrieving objects in batches, conditions like string, array, and hash conditions, ordering, selecting specific attributes, limiting, grouping, having, and overriding conditions.
The document contains technical information about software vulnerabilities and security exploits. It discusses memory corruption issues like buffer overflows, use-after-free vulnerabilities, and heap overflow attacks. It also covers injection attacks, deserialization of untrusted data, container escapes, and other common software vulnerabilities. The document emphasizes the importance of secure coding practices, threat modeling, code reviews, and security testing to identify and address vulnerabilities.
Scala is a multi-paradigm programming language that combines object-oriented and functional programming. It runs on the Java Virtual Machine and interoperates with Java. Scala source code is compiled to Java bytecode, so Scala programs can access full Java libraries. Scala supports features like immutable data structures, pattern matching, actor-based concurrency and more. The document provides examples of Scala code and discusses some of its core features.
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...Databricks
?
Mastering complex software stacks, such as Spark or Hadoop, is a challenging process. Incompatible dependencies, new programming paradigms, runtime errors, outdated documentation, scaling, tuning - this is just a short list of skills we must acquire. How do we make sure that we are not wasting time and making progress learning? How do we share our knowledge efficiently? This talk walks you through a journey of scaling Salesforce Einstein AI platform to serve 3B+ predictions per day and provides you with a scale to measure learning progress.
Speaker: Matthew Tovbin
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...Matthew Tovbin
?
Spark + AI Summit, 2019 - Mastering complex software stacks, such as Spark or Hadoop, is a challenging process. Incompatible dependencies, new programming paradigms, runtime errors, outdated documentation, scaling, tuning - this is just a short list of skills we must acquire. How do we make sure that we are not wasting time and making progress learning? How do we share our knowledge efficiently? This talk walks you through a journey of scaling Salesforce Einstein AI platform to serve 6B+ predictions per day and provides you with a scale to measure learning progress.
This document provides an introduction to jQuery, an open source JavaScript library. It discusses what jQuery is, how it works, selector basics, and many jQuery commands. Key points include:
- jQuery is an open source JavaScript library that makes DOM manipulation and event handling easier. It works across browsers.
- jQuery selectors allow selecting elements using CSS syntax. Common selectors return a jQuery object containing matching elements.
- jQuery methods can be chained together for concise DOM manipulation. Chaining avoids unnecessary re-selection of elements.
- Common jQuery methods covered include manipulating attributes, CSS classes, HTML content, and traversing/filtering the DOM tree. Event handling and custom events are also discussed.
PHP 7 ¨C What changed internally? (PHP Barcelona 2015)Nikita Popov
?
The document discusses optimizations made in PHP 7 to improve performance. Some key points:
- PHP 7 optimized how values and objects are stored in memory by removing unnecessary overhead like reference counting. This reduces memory usage and indirection.
- Arrays were optimized to reduce the number of allocations, size, and lookup indirections compared to PHP 5.
- Objects saw reduced allocations, size and indirection for property values in PHP 7.
- Other optimizations included using 64-bit integers, improving immutable array performance, and enhancing the virtual machine to better manage function call stacks.
This document discusses ActiveRecord and various querying methods in Rails such as finding single and multiple records, adding conditions to queries, joining tables, and more. It provides code examples for methods like find, where, select, joins, and others. It also covers topics like readonly records, locking, overriding conditions, and joining with associations.
The Ring programming language version 1.8 book - Part 50 of 202Mahmoud Samir Fayed
?
The Page class contains methods for generating HTML elements and adding content to web pages. It includes methods for common elements like headings, paragraphs, links, forms, tables, and more. Each method accepts a parameter that allows setting attributes of the element through a list. This allows generating HTML elements with customized attributes in a simple way.
1) This document provides examples of how to use Spark DataFrames and SQL to load and analyze Iris flower data. It shows how to load data from files and Kafka, define schemas, select, filter, sort, group, and join dataframes.
2) Methods like spark.read, dataframe.select(), dataframe.filter(), and dataframe.groupBy() are used to load and query the data. StructType and case classes define the schema. SQL statements can also be used via the sqlContext.
3) User defined functions (UDFs) are demonstrated to handle custom data types like maps. The examples provide an overview of basic Spark DataFrame and SQL functionality.
Swift - ????? ?????????? ???????? ???????????? ????? ?????????Suyeol Jeon
?
The document contains code snippets demonstrating various Swift programming concepts including variables, constants, types, optionals, functions, classes, structs, enums, and more. Key concepts demonstrated include variable and constant declaration with types, optional binding, functions with parameters and return values, classes and structs with properties and methods, tuples, and enums with associated values and raw values.
This C++ program implements a student record management system using binary search trees and file handling. The program defines a Student class with fields like registration number, name, address etc. and methods to insert, search, delete and display student records from binary search indexed text files. The main function provides a menu to call these class methods to manage the student records stored in files.
Foursquare uses MongoDB to power their location-based social network. They have over 9 million users generating around 3 million check-ins per day across over 15 million venues. Foursquare chose MongoDB because it is fast, supports rich queries, sharding, replication, and geo-indexes. Foursquare runs 8 MongoDB clusters across around 40 machines storing over 2.3 billion records and handling around 15,000 queries per second. They developed Rogue, a Scala DSL for MongoDB, to make queries type-safe and add features like pagination, logging, and index awareness.
This document discusses refactoring Java code to Clojure using macros. It provides examples of refactoring Java code that uses method chaining to equivalent Clojure code using the threading macros (->> and -<>). It also discusses other Clojure features like type hints, the doto macro, and polyglot projects using Leiningen.
Apache Spark for Library Developers with William Benton and Erik ErlandsonDatabricks
?
As a developer, data engineer, or data scientist, you¡¯ve seen how Apache Spark is expressive enough to let you solve problems elegantly and efficient enough to let you scale out to handle more data. However, if you¡¯re solving the same problems again and again, you probably want to capture and distribute your solutions so that you can focus on new problems and so other people can reuse and remix them: you want to develop a library that extends Spark.
You faced a learning curve when you first started using Spark, and you¡¯ll face a different learning curve as you start to develop reusable abstractions atop Spark. In this talk, two experienced Spark library developers will give you the background and context you¡¯ll need to turn your code into a library that you can share with the world. We¡¯ll cover: Issues to consider when developing parallel algorithms with Spark, Designing generic, robust functions that operate on data frames and datasets, Extending data frames with user-defined functions (UDFs) and user-defined aggregates (UDAFs), Best practices around caching and broadcasting, and why these are especially important for library developers, Integrating with ML pipelines, Exposing key functionality in both Python and Scala, and How to test, build, and publish your library for the community.
We¡¯ll back up our advice with concrete examples from real packages built atop Spark. You¡¯ll leave this talk informed and inspired to take your Spark proficiency to the next level and develop and publish an awesome library of your own.
This document summarizes a talk given about Nokia's migration to Scala for its Places API. The key points are:
1) Nokia migrated its Places API codebase to Scala to take advantage of Scala's features like its powerful type system, immutable data structures, and functional programming capabilities.
2) The migration was done gradually over time while continuing to develop new features. They discovered many benefits of Scala along the way like improved test readability and JSON parsing capabilities.
3) Nokia uses Scala features like case classes, options, and functions to model data and add type safety to its codebase. This uncovered bugs that would have been hard to find in Java.
Functional programming avoids changing-state and mutable data. Referential transparency means expressions can be replaced without affecting observable behavior. Pure functions only depend on argument values and have no other effects. Case classes provide functionality like equals, hashCode and pattern matching out of the box. Futures allow running blocking operations asynchronously and chaining results with map, flatMap and for comprehensions. Implicits allow type conversions and providing parameters implicitly. Sealed classes allow exhaustive pattern matching of a type hierarchy.
This document introduces higher order functions (HOFs) in Scala. It provides examples of how HOFs such as map and filter can transform collections in more idiomatic and functional ways compared to imperative approaches using loops. Key benefits of HOFs include producing immutable and thread-safe results without needing to manually manage intermediate data structures. The document also briefly outlines some other powerful HOFs like reduce, partition, min, max and parallel collections.
This document provides an introduction to functional programming and the Scala programming language. It discusses core concepts of functional programming like immutable data, pure functions, expressions over instructions, and first-class functions. It provides examples comparing imperative Java code to equivalent functional Scala code. The document also outlines benefits of functional programming like simpler concurrency, optimizations, easier debugging, and cleaner code. It concludes by providing additional resources for learning Scala and functional programming.
This document provides an overview of the Scala programming language. Some key points:
- Scala runs on the Java Virtual Machine and was created by Martin Odersky at EPFL.
- It has been around since 2003 and the current stable release is 2.7.7. Release 2.8 beta 1 is due out soon.
- Scala combines object-oriented and functional programming. It has features like pattern matching, actors, XML literals, and more that differ from Java. Everything in Scala is an object.
Some languages, like SML, Haskell, and Scala, have built-in support for pattern matching, which is a generic way of branching based on the structure of data.
While not without its drawbacks, pattern matching can help eliminate a lot of boilerplate, and it's often cited as a reason why functional programming languages are so concise.
In this talk, John A. De Goes talks about the differences between built-in patterns, and so-called first-class patterns (which are "do-it-yourself" patterns implemented using other language features).
Unlike built-in patterns, first-class patterns aren't magical, so you can store them in variables and combine them in lots of interesting ways that aren't always possible with built-in patterns. In addition, almost every programming language can support first-class patterns (albeit with differing levels of effort and type-safety).
During the talk, you'll watch as a mini-pattern matching library is developed, and have the opportunity to follow along and build your own pattern matching library in the language of your choice.
The document discusses Java and the benefits of Groovy compared to Java. It covers boilerplate code and ceremony in Java that can be reduced using Groovy. Examples are provided demonstrating Groovy's syntax for primitives, collections like lists and maps, closures, IO operations, XML processing, and a DSL. The document recommends Groovy for its duck typing, operators, and safe navigation operator to avoid null pointer exceptions.
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
?
The document appears to be notes from a MongoDB training session that discusses various MongoDB features like MapReduce, geospatial indexes, and GridFS. It also covers topics like database commands, indexing, and querying documents with embedded documents and arrays. Examples are provided for how to implement many of these MongoDB features and functions.
The document describes MOBL, a programming language for building mobile web applications. MOBL aims to provide a small core language with large and extensible libraries. It includes built-in types, controls, and abstraction mechanisms like screens and functions. The language exposes low-level primitives while providing a native interface to external APIs. MOBL code can be deployed by concatenating, eliminating dead code, and minifying for client-side execution on mobile browsers. The language has been publicly released since January 2011 and sees over 1,000 visitors per day, with ongoing development focused on error handling, data evolution, documentation and libraries.
This document discusses how different Ruby implementations like MRI, Rubinius, and JRuby handle method dispatch and execution. It explains how MRI searches for and executes methods, and how Rubinius and JRuby optimize this using techniques like inline caches, just-in-time compilation, and invokedynamic. It provides code examples and compares the bytecode generated by each implementation.
Scala can be used to build web applications in several ways:
1. Lift and Scalatra allow building web applications by embedding Scala code and XML directly in the code.
2. Libraries like Ajax.scala, Scalate, and Unfiltered provide APIs for building web functionality and handling HTTP requests and responses programmatically in Scala.
3. Frameworks like Play allow building traditional MVC web apps in Scala with automatic JSON and XML conversion between case classes and HTTP requests/responses.
This document provides an agenda and overview for a Spark workshop covering Spark basics and streaming. The agenda includes sections on Scala, Spark, Spark SQL, and Spark Streaming. It discusses Scala concepts like vals, vars, defs, classes, objects, and pattern matching. It also covers Spark RDDs, transformations, actions, sources, and the spark-shell. Finally, it briefly introduces Spark concepts like broadcast variables, accumulators, and spark-submit.
The document provides an overview of MongoDB including key concepts like collections, documents, queries, indexes, aggregation, and more. It compares MongoDB to a traditional SQL database and shows examples of common operations like insert, update, find in MongoDB shell and Node.js driver. It also briefly covers more advanced topics like geospatial queries, optimization, replication and sharding.
The document discusses using Rust and Emscripten to compile Rust code to JavaScript and WebAssembly. It covers how to export Rust functions, call JavaScript from Rust, and handle types through Embind to integrate Rust and JavaScript. Embind uses C++ templates to register Rust classes and implement bindings, allowing Rust code to interoperate with JavaScript through Emscripten.
The document summarizes differences between MySQL and MongoDB data types and operations. MongoDB uses BSON for data types rather than separate numeric, text and blob types. It supports embedded documents and arrays. Unlike MySQL, MongoDB does not have tables or rows, but collections and documents. Operations like insert, update, find, sort and index are discussed as alternatives to SQL equivalents.
Scala Days 2011 - Rogue: A Type-Safe DSL for MongoDB
1. rogue:
a scala dsl for mongodb
ScalaDays 2011 - 6/2/2011
Jason Liszka (@jliszka)
Jorge Ortiz (@jorgeortiz85)
2. what is foursquare?
location-based social network - ¡°check-in¡± to bars,
restaurants, museums, parks, etc
friend-finder (where are my friends right now?)
virtual game (badges, points, mayorships)
city guide (local, personalized recommendations)
location diary + stats engine (where was I a year ago?)
specials (get rewards at your favorite restaurant)
4. foursquare: the tech
Nginx, HAProxy
Scala, Lift
MongoDB, PostgreSQL (legacy)
(Kestrel, Munin, Ganglia, Python, Memcache, ...)
All on EC2
5. what is mongodb?
fast, schema-less document store
indexes & rich queries on any field
sharding, auto-balancing
replication
geo-indexes
6. mongodb: our numbers
8 clusters
some sharded, some not
some master/slave, some replica set
~40 machines (68.4GB, m2.4xl on EC2)
2.3 billion records
~15k QPS
10. mongodb: query example
val query =
(BasicDBOBjectBuilder
.start
.push(¡°mayorid¡±)
.add(¡°$lte¡±, 100)
.pop
.add(¡°veneuname¡±, ¡°Starbucks¡±)
...
.get)
11. rogue: a scala dsl for mongo
type-safe
all mongo query features
logging & validation hooks
pagination
index-aware
cursors
http://github.com/foursquare/rogue
13. rogue: code example
val vs: List[Venue] =
(Venue where (_.mayorid <= 100)
and (_.venuename eqs ¡°Starbucks¡±)
and (_.tags contains ¡°wifi¡±)
and (_.latlng near
(39.0, -74.0, Degrees(0.2))
orderDesc (_._id)
fetch (5))
21. rogue: more limit problems
(Venue where (_.venuename eqs ¡°Starbucks¡±)
orderAsc (_.total_checkins)
limit (5)
bulkDelete_!!)
// How many Venues got deleted?
22. rogue: phantom types
Sel =:= Selected, Unselected
Ord =:= Ordered, Unordered
Lim =:= Limited, Unlimited
Sk =:= Skipped, Unskipped
http://james-iry.blogspot.com/2010/10/phantom-types-in-haskell-and-scala.html
23. rogue: phantom types
abstract sealed class Ordered
abstract sealed class Unordered
abstract sealed class Selected
abstract sealed class Unselected
abstract sealed class Limited
abstract sealed class Unlimited
abstract sealed class Skipped
abstract sealed class Unskipped
24. rogue: initializing phantoms
class BaseQuery[M <: MongoRecord[M], R,
Ord, Sel, Lim, Sk](...) {
...
}
def dfltQuery[M <: MongoRecord[M]](rec: M) =
new BaseQuery[M, M,
Unordered,
Unselected,
Unlimited,
Unskipped](...)