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
public <T> T streamQuery(String sql, Function<Stream<SqlRowSet>, ? extends T> streamer, Object... args) { | |
return jdbcTemplate.query(sql, resultSet -> { | |
final SqlRowSet rowSet = new ResultSetWrappingSqlRowSet(resultSet); | |
final boolean parallel = false; | |
// The ResultSet API has a slight impedance mismatch with Iterators, so this conditional | |
// simply returns an empty iterator if there are no results | |
if (!rowSet.next()) { | |
return streamer.apply(StreamSupport.stream(Spliterators.emptySpliterator(), parallel)); | |
} |
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
var Promise = require('bluebird'); | |
var MongoDB = Promise.promisifyAll(require("mongodb")); | |
var MongoClient = Promise.promisifyAll(MongoDB.MongoClient); | |
var cheerio = require('cheerio'); | |
var http = require('http'); | |
var urls = [ | |
'http://www.magentocommerce.com/certification/directory/index/?q=&country_id=AU®ion_id=®ion=vic&certificate_type=', | |
'http://www.magentocommerce.com/certification/directory/index/?q=&country_id=AU®ion_id=®ion=victoria&certificate_type=' | |
]; |