This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sequence | |
import scala.annotation.tailrec | |
import scala.util.Random | |
/** | |
* Created by Owner on 10/21/14. | |
* | |
* Problem: In an array of uniformly distributed digits from 0-9 find two sequences such that | |
* the first sequence and second sequence add to the same sum and that sequence 1 and sequence 2 are |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" indent="yes" encoding="UTF-8" /> | |
<xsl:template match="/data"> | |
<xsl:element name="html"> | |
<head> | |
<title>OCLC matching to CARS files</title> | |
<style type="text/css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library( reticulate) | |
library(ggplot2) | |
library( dplyr ) | |
# As in the call-python.R script the structure remains unchanged | |
# A) load the python file | |
# B) use the function to return a data.frame | |
# i) name is the neighborhood name | |
# ii) restaurants | |
# iii) region_lng and region_at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
import pandas as pd | |
def get_data( neighborhood ): | |
data = {} | |
client = MongoClient('mongodb+srv://restaurantAppUser:restaurantAppPwd@mflix.beal2.mongodb.net/test?authSource=admin&replicaSet=atlas-a7tqy4-shard-0&readPreference=primary&appname=MongoDB%20Compass&ssl=true') | |
restaurants = client['sample_restaurants']['restaurants'] | |
# Sometimes all the work is in getting your data into the format your program requires | |
# In this example there are two queries: a) get the region coordinates for the neighborhood selected, and b) use that set of coordinates to | |
# find the restaurants within that region. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* restaurantsByNeighborhood | |
* @param string neighborhood | |
* @returns object | |
*/ | |
exports = function(neighborhood){ | |
// A simple function to create an average coordinate | |
// for centering the map. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* restaurantsByNeighborhood | |
* @param string neighborhood | |
* @returns object | |
*/ | |
exports = function(neighborhood){ | |
// A simple function to create an average coordinate | |
// for centering the map. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'package:flutter/services.dart' show rootBundle; | |
import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
import 'package:http/http.dart' as http; | |
import 'package:json_annotation/json_annotation.dart'; | |
import 'package:logging/logging.dart'; | |
import 'package:flutter_dotenv/flutter_dotenv.dart'; | |
// RUN THIS COMMAND TO CREATE the g.dart files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Serialize,Deserialize, Debug)] | |
pub struct Restaurant { | |
cuisine: String, | |
borough: String, | |
name: String, | |
address: Address | |
} | |
#[derive(Serialize, Deserialize, Debug)] | |
pub struct Address { | |
building: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
For a web server objects are sent serialized into json, but a client | |
could create an object from the http call response | |
**/ | |
#[derive(Serialize, Deserialize, Debug, Clone)] | |
#[serde(crate = "rocket::serde")] | |
pub struct Restaurant { | |
cuisine: String, | |
borough: String, | |
name: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** This is not compiler ready | |
from cargo.toml: | |
dependencies.mongodb] | |
version = "2.0.0" | |
default-features = false | |
features = ["sync"] | |
**/ | |
use mongodb::{bson::Bson, bson::doc, bson::Document, options::ClientOptions, options::FindOptions, sync::Client, sync::Collection}; | |
use mongodb::options::AggregateOptions; |
OlderNewer