From e250b0f1759f3fd385262ba47b0c28fe26d6675e Mon Sep 17 00:00:00 2001
From: Brian Smith
Date: Sun, 9 Mar 2014 14:44:06 -0400
Subject: [PATCH 1/5] do not send band session join notification to band
members
---
ruby/lib/jam_ruby/models/notification.rb | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ruby/lib/jam_ruby/models/notification.rb b/ruby/lib/jam_ruby/models/notification.rb
index b9f21f4f3..1bf2fa03a 100644
--- a/ruby/lib/jam_ruby/models/notification.rb
+++ b/ruby/lib/jam_ruby/models/notification.rb
@@ -539,8 +539,13 @@ module JamRuby
notifications, online_followers, offline_followers = [], [], []
notification_msg = format_msg(NotificationTypes::BAND_SESSION_JOIN, nil, band)
- band.followers.each do |bf|
- follower = bf.user
+ followers = band.followers.map { |bf| bf.user }
+
+ # do not send band session notifications to band members
+ followers = followers - band.users
+
+ followers.each do |f|
+ follower = f
notification = Notification.new
notification.band_id = band.id
notification.description = NotificationTypes::BAND_SESSION_JOIN
From af748cba75595430677f573393a9aad9f7940b14 Mon Sep 17 00:00:00 2001
From: Scott Comer
Date: Sun, 9 Mar 2014 17:35:12 -0500
Subject: [PATCH 2/5] rake tasks for importing geoip data
---
db/geodata/supplement.sql | 14 +-
ruby/lib/jam_ruby/models/geo_ip_blocks.rb | 92 ++++++++++++-
ruby/lib/jam_ruby/models/geo_ip_locations.rb | 134 ++++++++++++++++++-
ruby/lib/jam_ruby/models/jam_isp.rb | 116 +++++++++++++++-
web/lib/tasks/import_max_mind.rake | 9 ++
5 files changed, 352 insertions(+), 13 deletions(-)
diff --git a/db/geodata/supplement.sql b/db/geodata/supplement.sql
index d14107d23..5e06299be 100644
--- a/db/geodata/supplement.sql
+++ b/db/geodata/supplement.sql
@@ -16,6 +16,7 @@ CREATE INDEX geoiplocations_geog_gix ON geoiplocations USING GIST (geog);
ALTER TABLE geoipblocks DROP COLUMN geom;
ALTER TABLE geoipblocks ADD COLUMN geom geometry(polygon);
+-- DROP INDEX geoipblocks_geom_gix;
UPDATE geoipblocks SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);
CREATE INDEX geoipblocks_geom_gix ON geoipblocks USING GIST (geom);
@@ -24,13 +25,12 @@ ALTER TABLE jamisp ADD COLUMN geom geometry(polygon);
UPDATE jamisp SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);
CREATE INDEX jamisp_geom_gix ON jamisp USING GIST (geom);
-delete from cities;
-insert into cities (city, region, countrycode) select distinct city, region, countrycode from geoiplocations where length(city) > 0 and length(countrycode) > 0;
+DELETE FROM cities;
+INSERT INTO cities (city, region, countrycode) SELECT DISTINCT city, region, countrycode FROM geoiplocations WHERE length(city) > 0 AND length(countrycode) > 0;
+DELETE FROM regions;
+INSERT INTO regions (region, countrycode) SELECT DISTINCT region, countrycode FROM cities;
+DELETE FROM countries;
+INSERT INTO countries (countrycode) SELECT DISTINCT countrycode FROM regions;
-delete from regions;
-insert into regions (region, countrycode) select distinct region, countrycode from cities;
-
-delete from countries;
-insert into countries (countrycode) select distinct countrycode from regions;
VACUUM ANALYSE;
diff --git a/ruby/lib/jam_ruby/models/geo_ip_blocks.rb b/ruby/lib/jam_ruby/models/geo_ip_blocks.rb
index a0ffdacd9..b303eaa3e 100644
--- a/ruby/lib/jam_ruby/models/geo_ip_blocks.rb
+++ b/ruby/lib/jam_ruby/models/geo_ip_blocks.rb
@@ -15,7 +15,97 @@ module JamRuby
end
def self.import_from_max_mind(file)
- # todo implement import_from_max_mind
+
+ # File Geo-134
+ # Format:
+ # startIpNum,endIpNum,locId
+
+ GeoIpBlocks.transaction do
+ GeoIpBlocks.delete_all
+ File.open(file, 'r:ISO-8859-1') do |io|
+ s = io.gets.strip # eat the copyright line. gah, why do they have that in their file??
+ unless s.eql? 'Copyright (c) 2011 MaxMind Inc. All Rights Reserved.'
+ puts s
+ puts 'Copyright (c) 2011 MaxMind Inc. All Rights Reserved.'
+ raise 'file does not start with expected copyright (line 1): Copyright (c) 2011 MaxMind Inc. All Rights Reserved.'
+ end
+
+ s = io.gets.strip # eat the headers line
+ unless s.eql? 'startIpNum,endIpNum,locId'
+ puts s
+ puts 'startIpNum,endIpNum,locId'
+ raise 'file does not start with expected header (line 2): startIpNum,endIpNum,locId'
+ end
+
+ saved_level = ActiveRecord::Base.logger ? ActiveRecord::Base.logger.level : 0
+ count = 0
+
+ stmt = "insert into #{GeoIpBlocks.table_name} (beginip, endip, locid) values"
+
+ vals = ''
+ sep = ''
+ i = 0
+ n = 20
+
+ csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false})
+ csv.each do |row|
+ raise "file does not have expected number of columns (3): #{row.length}" unless row.length == 3
+
+ beginip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[0]))
+ endip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[1]))
+ locid = row[2]
+
+ vals = vals+sep+"(#{beginip}, #{endip}, #{locid})"
+ sep = ','
+ i += 1
+
+ if count == 0 or i >= n then
+ GeoIpBlocks.connection.execute stmt+vals
+ count += i
+ vals = ''
+ sep = ''
+ i = 0
+
+ if ActiveRecord::Base.logger and ActiveRecord::Base.logger.level > 1 then
+ ActiveRecord::Base.logger.debug "... logging inserts into #{GeoIpBlocks.table_name} suspended ..."
+ ActiveRecord::Base.logger.level = 1
+ end
+
+ if ActiveRecord::Base.logger and count%10000 < n then
+ ActiveRecord::Base.logger.level = saved_level
+ ActiveRecord::Base.logger.debug "... inserted #{count} into #{GeoIpBlocks.table_name} ..."
+ ActiveRecord::Base.logger.level = 1
+ end
+ end
+ end
+
+ if i > 0 then
+ GeoIpBlocks.connection.execute stmt+vals
+ count += i
+ end
+
+ if ActiveRecord::Base.logger then
+ ActiveRecord::Base.logger.level = saved_level
+ ActiveRecord::Base.logger.debug "loaded #{count} records into #{GeoIpBlocks.table_name}"
+ end
+
+ sts = GeoIpBlocks.connection.execute 'ALTER TABLE geoipblocks DROP COLUMN geom;'
+ ActiveRecord::Base.logger.debug "DROP COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ # sts.check [we don't care]
+
+ sts = GeoIpBlocks.connection.execute 'ALTER TABLE geoipblocks ADD COLUMN geom geometry(polygon);'
+ ActiveRecord::Base.logger.debug "ADD COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpBlocks.connection.execute 'UPDATE geoipblocks SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);'
+ ActiveRecord::Base.logger.debug "SET geom returned sts #{sts.cmd_tuples}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpBlocks.connection.execute 'CREATE INDEX geoipblocks_geom_gix ON geoipblocks USING GIST (geom);'
+ ActiveRecord::Base.logger.debug "CREATE INDEX geoipblocks_geom_gix returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+ end
+ end
end
end
end
diff --git a/ruby/lib/jam_ruby/models/geo_ip_locations.rb b/ruby/lib/jam_ruby/models/geo_ip_locations.rb
index 118c4a9ff..0201ff679 100644
--- a/ruby/lib/jam_ruby/models/geo_ip_locations.rb
+++ b/ruby/lib/jam_ruby/models/geo_ip_locations.rb
@@ -2,21 +2,149 @@ module JamRuby
class GeoIpLocations < ActiveRecord::Base
self.table_name = 'geoiplocations'
+ CITIES_TABLE = 'cities'
+ REGIONS_TABLE = 'regions'
+ COUNTRIES_TABLE = 'countries'
def self.lookup(locid)
- GeoIpLocations.where(locid: locid)
+ self.where(locid: locid)
.limit(1)
.first
end
def self.createx(locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode)
c = connection.raw_connection
- c.exec_params('insert into geoiplocations (locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode, geog) values($1, $2, $3, $4, $5, $6, $7, $8, $9, ST_SetSRID(ST_MakePoint($7, $6), 4326)::geography)',
+ c.exec_params("insert into #{self.table_name} (locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode, geog) values($1, $2, $3, $4, $5, $6, $7, $8, $9, ST_SetSRID(ST_MakePoint($7, $6), 4326)::geography)",
[locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode])
end
+ def self.i(s)
+ return 'NULL' if s.nil? or s.blank?
+ return s.to_i
+ end
+
def self.import_from_max_mind(file)
- # todo implement import_from_max_mind
+
+ # File Geo-134
+ # Format:
+ # locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode
+
+ self.transaction do
+ self.delete_all
+ File.open(file, 'r:ISO-8859-1') do |io|
+ s = io.gets.strip # eat the copyright line. gah, why do they have that in their file??
+ unless s.eql? 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.'
+ puts s
+ puts 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.'
+ raise 'file does not start with expected copyright (line 1): Copyright (c) 2012 MaxMind LLC. All Rights Reserved.'
+ end
+
+ s = io.gets.strip # eat the headers line
+ unless s.eql? 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode'
+ puts s
+ puts 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode'
+ raise 'file does not start with expected header (line 2): locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode'
+ end
+
+ saved_level = ActiveRecord::Base.logger ? ActiveRecord::Base.logger.level : 0
+ count = 0
+
+ stmt = "INSERT INTO #{self.table_name} (locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode) VALUES"
+
+ vals = ''
+ sep = ''
+ i = 0
+ n = 20
+
+ csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false})
+ csv.each do |row|
+ raise "file does not have expected number of columns (9): #{row.length}" unless row.length == 9
+
+ locid = row[0]
+ countrycode = row[1]
+ region = row[2]
+ city = row[3]
+ postalcode = row[4]
+ latitude = row[5]
+ longitude = row[6]
+ metrocode = row[7]
+ areacode = row[8]
+
+ vals = vals+sep+"(#{locid}, '#{countrycode}', '#{region}', #{MaxMindIsp.quote_value(city)}, '#{postalcode}', #{latitude}, #{longitude}, #{i(metrocode)}, '#{areacode}')"
+ sep = ','
+ i += 1
+
+ if count == 0 or i >= n then
+ self.connection.execute stmt+vals
+ count += i
+ vals = ''
+ sep = ''
+ i = 0
+
+ if ActiveRecord::Base.logger and ActiveRecord::Base.logger.level > 1 then
+ ActiveRecord::Base.logger.debug "... logging inserts into #{self.table_name} suspended ..."
+ ActiveRecord::Base.logger.level = 1
+ end
+
+ if ActiveRecord::Base.logger and count%10000 < n then
+ ActiveRecord::Base.logger.level = saved_level
+ ActiveRecord::Base.logger.debug "... inserted #{count} into #{self.table_name} ..."
+ ActiveRecord::Base.logger.level = 1
+ end
+ end
+ end
+
+ if i > 0 then
+ self.connection.execute stmt+vals
+ count += i
+ end
+
+ if ActiveRecord::Base.logger then
+ ActiveRecord::Base.logger.level = saved_level
+ ActiveRecord::Base.logger.debug "loaded #{count} records into #{self.table_name}"
+ end
+
+ sts = self.connection.execute "ALTER TABLE #{self.table_name} DROP COLUMN geog;"
+ ActiveRecord::Base.logger.debug "DROP COLUMN geog returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ # sts.check [we don't care]
+
+ sts = self.connection.execute "ALTER TABLE #{self.table_name} ADD COLUMN geog geography(point, 4326);"
+ ActiveRecord::Base.logger.debug "ADD COLUMN geog returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "UPDATE #{self.table_name} SET geog = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326)::geography;"
+ ActiveRecord::Base.logger.debug "SET geog returned sts #{sts.cmd_tuples}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "CREATE INDEX #{self.table_name}_geog_gix ON #{self.table_name} USING GIST (geog);"
+ ActiveRecord::Base.logger.debug "CREATE INDEX #{self.table_name}_geog_gix returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "DELETE FROM #{CITIES_TABLE};"
+ ActiveRecord::Base.logger.debug "DELETE FROM #{CITIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "INSERT INTO #{CITIES_TABLE} (city, region, countrycode) SELECT DISTINCT city, region, countrycode FROM #{self.table_name} WHERE length(city) > 0 AND length(countrycode) > 0;"
+ ActiveRecord::Base.logger.debug "INSERT INTO #{CITIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "DELETE FROM #{REGIONS_TABLE};"
+ ActiveRecord::Base.logger.debug "DELETE FROM #{REGIONS_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "INSERT INTO #{REGIONS_TABLE} (region, countrycode) SELECT DISTINCT region, countrycode FROM #{CITIES_TABLE};"
+ ActiveRecord::Base.logger.debug "INSERT INTO #{REGIONS_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "DELETE FROM #{COUNTRIES_TABLE};"
+ ActiveRecord::Base.logger.debug "DELETE FROM #{COUNTRIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = self.connection.execute "INSERT INTO #{COUNTRIES_TABLE} (countrycode) SELECT DISTINCT countrycode FROM #{REGIONS_TABLE};"
+ ActiveRecord::Base.logger.debug "INSERT INTO #{COUNTRIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+ end
+ end
end
end
end
diff --git a/ruby/lib/jam_ruby/models/jam_isp.rb b/ruby/lib/jam_ruby/models/jam_isp.rb
index 5d640012b..86b56d9ba 100644
--- a/ruby/lib/jam_ruby/models/jam_isp.rb
+++ b/ruby/lib/jam_ruby/models/jam_isp.rb
@@ -4,6 +4,8 @@ module JamRuby
class JamIsp < ActiveRecord::Base
self.table_name = 'jamisp'
+ COMPANY_TABLE = 'jamcompany'
+ GEOIPISP_TABLE = 'geoipisp'
def self.ip_to_num(ip_addr)
begin
@@ -24,7 +26,7 @@ module JamRuby
def self.createx(beginip, endip, coid)
c = connection.raw_connection
- c.exec_params('insert into jamisp (beginip, endip, coid, geom) values($1::bigint, $2::bigint, $3, ST_MakeEnvelope($1::bigint, -1, $2::bigint, 1))',
+ c.exec_params("insert into #{self.table_name} (beginip, endip, coid, geom) values($1::bigint, $2::bigint, $3, ST_MakeEnvelope($1::bigint, -1, $2::bigint, 1))",
[beginip, endip, coid])
end
@@ -37,7 +39,117 @@ module JamRuby
end
def self.import_from_max_mind(file)
- # todo implement import_from_max_mind
+
+ # File Geo-124
+ # Format:
+ # startIpNum,endIpNum,isp
+
+ GeoIpLocations.transaction do
+ GeoIpLocations.delete_all
+ File.open(file, 'r:ISO-8859-1') do |io|
+ #s = io.gets.strip # eat the copyright line. gah, why do they have that in their file??
+ #unless s.eql? 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.'
+ # puts s
+ # puts 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.'
+ # raise 'file does not start with expected copyright (line 1): Copyright (c) 2012 MaxMind LLC. All Rights Reserved.'
+ #end
+
+ #s = io.gets.strip # eat the headers line
+ #unless s.eql? 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode'
+ # puts s
+ # puts 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode'
+ # raise 'file does not start with expected header (line 2): locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode'
+ #end
+
+ saved_level = ActiveRecord::Base.logger ? ActiveRecord::Base.logger.level : 0
+ count = 0
+
+ stmt = "insert into #{GEOIPISP_TABLE} (beginip, endip, company) values"
+
+ vals = ''
+ sep = ''
+ i = 0
+ n = 20
+
+ csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false})
+ csv.each do |row|
+ raise "file does not have expected number of columns (3): #{row.length}" unless row.length == 3
+
+ beginip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[0]))
+ endip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[1]))
+ company = row[2]
+
+ vals = vals+sep+"(#{beginip}, #{endip}, #{MaxMindIsp.quote_value(company)})"
+ sep = ','
+ i += 1
+
+ if count == 0 or i >= n then
+ GeoIpLocations.connection.execute stmt+vals
+ count += i
+ vals = ''
+ sep = ''
+ i = 0
+
+ if ActiveRecord::Base.logger and ActiveRecord::Base.logger.level > 1 then
+ ActiveRecord::Base.logger.debug "... logging inserts into #{GEOIPISP_TABLE} suspended ..."
+ ActiveRecord::Base.logger.level = 1
+ end
+
+ if ActiveRecord::Base.logger and count%10000 < n then
+ ActiveRecord::Base.logger.level = saved_level
+ ActiveRecord::Base.logger.debug "... inserted #{count} into #{GEOIPISP_TABLE} ..."
+ ActiveRecord::Base.logger.level = 1
+ end
+ end
+ end
+
+ if i > 0 then
+ GeoIpLocations.connection.execute stmt+vals
+ count += i
+ end
+
+ if ActiveRecord::Base.logger then
+ ActiveRecord::Base.logger.level = saved_level
+ ActiveRecord::Base.logger.debug "loaded #{count} records into #{GEOIPISP_TABLE}"
+ end
+
+ sts = GeoIpLocations.connection.execute "DELETE FROM #{COMPANY_TABLE};"
+ ActiveRecord::Base.logger.debug "DELETE FROM #{COMPANY_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpLocations.connection.execute "ALTER SEQUENCE #{COMPANY_TABLE}_coid_seq RESTART WITH 1;"
+ ActiveRecord::Base.logger.debug "ALTER SEQUENCE #{COMPANY_TABLE}_coid_seq returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpLocations.connection.execute "INSERT INTO #{COMPANY_TABLE} (company) SELECT DISTINCT company FROM #{GEOIPISP_TABLE} ORDER BY company;"
+ ActiveRecord::Base.logger.debug "INSERT INTO #{COMPANY_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpLocations.connection.execute "DELETE FROM #{self.table_name};"
+ ActiveRecord::Base.logger.debug "DELETE FROM #{self.table_name} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpLocations.connection.execute "INSERT INTO #{self.table_name} (beginip, endip, coid) SELECT x.beginip, x.endip, y.coid FROM #{GEOIPISP_TABLE} x, #{COMPANY_TABLE} y WHERE x.company = y.company;"
+ ActiveRecord::Base.logger.debug "INSERT INTO #{self.table_name} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpLocations.connection.execute "ALTER TABLE #{self.table_name} DROP COLUMN geom;"
+ ActiveRecord::Base.logger.debug "DROP COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ #sts.check [we don't care]
+
+ sts = GeoIpLocations.connection.execute "ALTER TABLE #{self.table_name} ADD COLUMN geom geometry(polygon);"
+ ActiveRecord::Base.logger.debug "ADD COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpLocations.connection.execute "UPDATE #{self.table_name} SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);"
+ ActiveRecord::Base.logger.debug "SET geom returned sts #{sts.cmd_tuples}" if ActiveRecord::Base.logger
+ sts.check
+
+ sts = GeoIpLocations.connection.execute "CREATE INDEX #{self.table_name}_geom_gix ON #{self.table_name} USING GIST (geom);"
+ ActiveRecord::Base.logger.debug "CREATE INDEX #{self.table_name}_geom_gix returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger
+ sts.check
+ end
+ end
end
end
end
diff --git a/web/lib/tasks/import_max_mind.rake b/web/lib/tasks/import_max_mind.rake
index 4e0549394..d07b92248 100644
--- a/web/lib/tasks/import_max_mind.rake
+++ b/web/lib/tasks/import_max_mind.rake
@@ -24,6 +24,15 @@ namespace :db do
JamIsp.import_from_max_mind ENV['file']
end
+ desc "Help"
+ task help: :environment do
+ puts "bundle exec rake db:import_maxmind_isp file=/path/to/GeoIPISP-142.csv"
+ puts "bundle exec rake db:import_maxmind_geo file=/path/to/GeoIPCity.csv"
+ puts "bundle exec rake db:import_geoip_blocks file=/path/to/GeoIPCity-134-Blocks.csv"
+ puts "bundle exec rake db:import_geoip_locations file=/path/to/GeoIPCity-134-Location.csv"
+ puts "bundle exec rake db:import_jam_isp file=/path/to/GeoIPISP.csv"
+ end
+
desc "Create a fake set of maxmind data"
task phony_maxmind: :environment do
MaxMindManager.active_record_transaction do |manager|
From dbed2edee802399e16535240896db3f26bd68e60 Mon Sep 17 00:00:00 2001
From: Brian Smith
Date: Sun, 9 Mar 2014 18:56:08 -0400
Subject: [PATCH 3/5] VRFS-1397 ensure instruments are always synced in
music_sessions_user_history table
---
ruby/lib/jam_ruby/models/track.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/ruby/lib/jam_ruby/models/track.rb b/ruby/lib/jam_ruby/models/track.rb
index 554807ea3..6ad15159a 100644
--- a/ruby/lib/jam_ruby/models/track.rb
+++ b/ruby/lib/jam_ruby/models/track.rb
@@ -75,8 +75,13 @@ module JamRuby
to_delete = Set.new(connection_tracks)
to_add = Array.new(tracks)
+ tracks.each do |track|
+ instruments << track[:instrument_id]
+ end
+
connection_tracks.each do |connection_track|
tracks.each do |track|
+
if track[:id] == connection_track.id || track[:client_track_id] == connection_track.client_track_id
to_delete.delete(connection_track)
to_add.delete(track)
@@ -85,8 +90,6 @@ module JamRuby
connection_track.sound = track[:sound]
connection_track.client_track_id = track[:client_track_id]
- instruments << track[:instrument_id]
-
result.push(connection_track)
if connection_track.save
From a0fab2b584aa58505c770bdf5ec86bd949ed69e1 Mon Sep 17 00:00:00 2001
From: Scott Comer
Date: Mon, 10 Mar 2014 00:17:34 -0500
Subject: [PATCH 4/5] mod the get_work stored procedure to exclude all
connections but those which are from clients.
---
db/manifest | 1 +
db/up/update_get_work_for_client_type.sql | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
create mode 100644 db/up/update_get_work_for_client_type.sql
diff --git a/db/manifest b/db/manifest
index 92caba43c..f04a8c89d 100755
--- a/db/manifest
+++ b/db/manifest
@@ -131,3 +131,4 @@ connection_client_type.sql
add_countries_regions_and_cities.sql
plays_refactor.sql
fix_max_mind_isp_and_geo.sql
+update_get_work_for_client_type.sql
diff --git a/db/up/update_get_work_for_client_type.sql b/db/up/update_get_work_for_client_type.sql
new file mode 100644
index 000000000..cd356eef7
--- /dev/null
+++ b/db/up/update_get_work_for_client_type.sql
@@ -0,0 +1,16 @@
+DROP FUNCTION get_work (mylocidispid BIGINT);
+CREATE FUNCTION get_work (mylocidispid BIGINT) RETURNS TABLE (client_id VARCHAR(64)) ROWS 5 VOLATILE AS $$
+BEGIN
+ CREATE TEMPORARY TABLE foo (locidispid BIGINT, locid INT);
+ INSERT INTO foo SELECT DISTINCT locidispid, locidispid/1000000 FROM connections where client_type = 'client';
+ DELETE FROM foo WHERE locidispid IN (SELECT DISTINCT blocidispid FROM current_scores WHERE alocidispid = mylocidispid AND (current_timestamp - score_dt) < interval '24 hours');
+ DELETE FROM foo WHERE locid NOT IN (SELECT locid FROM geoiplocations WHERE geog && st_buffer((SELECT geog from geoiplocations WHERE locid = mylocidispid/1000000), 806000));
+ CREATE TEMPORARY TABLE bar (client_id VARCHAR(64), locidispid BIGINT, r DOUBLE PRECISION);
+ INSERT INTO bar SELECT l.client_id, l.locidispid, random() FROM connections l, foo f WHERE l.locidispid = f.locidispid and l.client_type = 'client';
+ DROP TABLE foo;
+ DELETE FROM bar b WHERE r != (SELECT max(r) FROM bar b0 WHERE b0.locidispid = b.locidispid);
+ RETURN QUERY SELECT b.client_id FROM bar b ORDER BY r LIMIT 5;
+ DROP TABLE bar;
+ RETURN;
+END;
+$$ LANGUAGE plpgsql;
From b13dcef4f1419dc31928619a077bb09c89cd9222 Mon Sep 17 00:00:00 2001
From: Brian Smith
Date: Mon, 10 Mar 2014 01:41:06 -0400
Subject: [PATCH 5/5] VRFS-1399 media center content
---
.../stylesheets/corp/corporate.css.scss.erb | 22 ++++-
web/app/controllers/corps_controller.rb | 45 ++++++++--
web/app/views/corps/audio.html.erb | 37 +++++++++
web/app/views/corps/faqs.html.erb | 8 ++
web/app/views/corps/features.html.erb | 83 +++++++++++++++++++
web/app/views/corps/logos.html.erb | 12 +++
web/app/views/corps/media_center.html.erb | 33 ++++----
web/app/views/corps/overview.html.erb | 10 +++
web/app/views/corps/photos.html.erb | 6 ++
web/app/views/corps/screenshots.html.erb | 19 +++++
web/app/views/corps/testimonials.html.erb | 81 ++++++++++--------
web/app/views/corps/videos.html.erb | 27 ++++++
web/config/routes.rb | 32 ++++++-
13 files changed, 352 insertions(+), 63 deletions(-)
create mode 100644 web/app/views/corps/audio.html.erb
create mode 100644 web/app/views/corps/faqs.html.erb
create mode 100644 web/app/views/corps/features.html.erb
create mode 100644 web/app/views/corps/logos.html.erb
create mode 100644 web/app/views/corps/overview.html.erb
create mode 100644 web/app/views/corps/photos.html.erb
create mode 100644 web/app/views/corps/screenshots.html.erb
create mode 100644 web/app/views/corps/videos.html.erb
diff --git a/web/app/assets/stylesheets/corp/corporate.css.scss.erb b/web/app/assets/stylesheets/corp/corporate.css.scss.erb
index 2e8ca71d6..c4f69802d 100644
--- a/web/app/assets/stylesheets/corp/corporate.css.scss.erb
+++ b/web/app/assets/stylesheets/corp/corporate.css.scss.erb
@@ -16,10 +16,21 @@
float:left;
}
-div.test-user-desc {
+span.testimonial-user-desc {
font-style: italic !important;
}
+span.press-date {
+ font-style: italic !important;
+ color:#999;
+ line-height:160%;
+}
+
+ul.no-style {
+ padding-left: 0px !important;
+ list-style-type: none !important;
+}
+
#nav {
margin-top:40px;
margin-bottom:30px;
@@ -57,8 +68,6 @@ div.test-user-desc {
cursor:default;
}
-
-
body.corporate {
background-image:url(<%= asset_path('corp/bkg_corporate.gif') %>);
background-repeat:repeat-x;
@@ -115,6 +124,13 @@ body.corporate ul {
font-size:20px;
}
+.wrapper h3 {
+ font-weight:300;
+ font-size:16px;
+ line-height:160%;
+}
+
+
#terms-toc a {
display:block;
}
diff --git a/web/app/controllers/corps_controller.rb b/web/app/controllers/corps_controller.rb
index c5415af19..b81f2fd28 100644
--- a/web/app/controllers/corps_controller.rb
+++ b/web/app/controllers/corps_controller.rb
@@ -6,11 +6,7 @@ class CorpsController < ApplicationController
end
- def contact
-
- end
-
- def help
+ def news
end
@@ -18,11 +14,44 @@ class CorpsController < ApplicationController
end
+ def overview
+
+ end
+
+ def features
+
+ end
+
+ def faqs
+
+ end
+
+ def screenshots
+
+ end
+
+ def photos
+
+ end
+
+ def logos
+
+ end
+
def testimonials
end
- def news
+ def audio
+
+ end
+
+ def videos
+
+ end
+
+ # TODO: FIX THIS
+ def press_releases_launch
end
@@ -34,6 +63,10 @@ class CorpsController < ApplicationController
end
+ def help
+
+ end
+
def cookie_policy
end
diff --git a/web/app/views/corps/audio.html.erb b/web/app/views/corps/audio.html.erb
new file mode 100644
index 000000000..7b9876eb4
--- /dev/null
+++ b/web/app/views/corps/audio.html.erb
@@ -0,0 +1,37 @@
+<% provide(:title, 'Audio Recordings') %>
+<% provide(:purpose, 'media_center') %>
+
+Audio Recordings
+
+
+ The following audio recordings demonstrate both the quality of the real-time audio that musicians hear in their headphones while playing together using the service, and the quality of the automatically mastered recordings that the service generates.
+
+
+
+ The recordings below labeled “Real-Time Streamed Recording” are from the musicians’ headphones while playing in real-time.
+
+
+
+ The recordings below labeled “Mastered Recording” are recordings that the JamKazam service automatically produced by taking the raw audio files captured by the musicians’ audio interfaces and mixing these together as a post process following the actual performance.
+
+
+
+Classical: Pachelbel’s “Canon in D”
+
+
+
+Rock: Poison’s “Nothin’ But a Good Time”
+
+
+
+Jazz: Jimmy Van Heusen’s and Johnny Burke’s “But Beautiful”
+
\ No newline at end of file
diff --git a/web/app/views/corps/faqs.html.erb b/web/app/views/corps/faqs.html.erb
new file mode 100644
index 000000000..1941d4bdd
--- /dev/null
+++ b/web/app/views/corps/faqs.html.erb
@@ -0,0 +1,8 @@
+<% provide(:title, 'Frequently Asked Questions') %>
+<% provide(:purpose, 'media_center') %>
+
+Frequently Asked Questions
+
+
+ The JamKazam FAQ can be found on our support site here: JamKazam Frequently Asked Questions.
+
\ No newline at end of file
diff --git a/web/app/views/corps/features.html.erb b/web/app/views/corps/features.html.erb
new file mode 100644
index 000000000..10892e941
--- /dev/null
+++ b/web/app/views/corps/features.html.erb
@@ -0,0 +1,83 @@
+<% provide(:title, 'Features & Benefits') %>
+<% provide(:purpose, 'media_center') %>
+
+Features & Benefits
+
+
+ Musicians can enjoy four major features of the new JamKazam service, as described below. Also, several Tutorial Videos are available to see how various features work in more detail.
+
+
+
+
+FEATURE: Real-Time Online Sessions
+
+ Musicians can create either public or private sessions, or can find and join other musicians’ public sessions, and can play music together in real time in these sessions from different locations over the Internet as if they are sitting in the same room.
+
+
+BENEFITS:
+
+
+ -
+ Musicians today often spend more time packing, transporting, and setting up and tearing down their gear than they spend actually playing together. With JamKazam, a musician can set up and be ready to play with others in 5 minutes without leaving home.
+
+ -
+ Musicians today often struggle to find a place to play together. Apartments and condos won’t work due to noise and space problems. And musicians in homes often have families and children, which makes weeknights impossible again due to noise issues. With JamKazam, musicians can play together from each of their homes, and because JamKazam digitizes and mixes the audio together into the musicians’ headphones, the level of audio disturbance in each musician’s home can be very low to even silent. For example, keyboards and bass guitars can plug straight into an audio interface, and are effectively silent in the musician’s home, and electric guitar players can either plug straight in, or can run their amp at or below the volume of an acoustic guitar, and can mic the amp and adjust the input gain on the audio interface to make the electric guitar as loud as they want it to be in the master mix digitally. Of course, the volume of acoustic instruments like vocals, wind instruments, and drums will be unchanged. But only one home will have to deal with the volume of the drums, and even in this instance, electronic drum kits can be used, again delivering an effectively silent in-home acoustic experience.
+
+ -
+ Musicians today can effectively play only with other musicians in very close geographic proximity – i.e. in the same town, or the same general area of a larger metropolitan area. Often musicians have friends and colleagues who are too far away to allow for creative collaboration. With JamKazam, musicians can play with other musicians in a far greater geographic area, allowing for collaboration with other musicians who are hundreds of miles away.
+
+
+
+
+
+
+FEATURE: Session Recording
+
+ Musicians can record performances during their real-time, remote sessions. Recordings capture both the composite mix of all performers, as well as each of the individual instrumental and vocal performances at the track level. Musicians can easily share the recording mixes with friends, family and fans via Facebook, Twitter, and email, and they can also open and play back the track-level. In addition, the JamKazam service automatically creates a “mastered” version of recordings using the high-quality tracks captured by the musicians’ audio interfaces prior to encoding and streaming, so mastered recordings are comparable in quality to what can be produced in home studios.
+
+
+BENEFITS:
+
+
+ -
+ Musicians can easily share recordings of their online performances with family, friends, and family.
+
+ -
+ Musicians can open recordings and play along with the recorded tracks, effectively playing with their bandmates or musical collaborators even when those musicians are unavailable. This allows for a variety of practice, experimentation, and creativity difficult to achieve today.
+
+ -
+ Musicians can create recordings comparable in quality to what can be achieved in a home studio, without even being in the same place, and can do so in real-time rather than recording, uploading and mixing tracks asynchronously as happens today. These mastered tracks can be exported into popular DAW software applications for further editing.
+
+
+
+
+
+
+FEATURE: Session Broadcasts
+
+ In addition to recording sessions, musicians can live broadcast their sessions so that family, friends and fans can tune in and listen to these live performances from any location using a computer, tablet or smartphone. Like recordings, live sessions can easily be shared via Facebook, Twitter, or email.
+
+
+BENEFITS:
+
+
+ -
+ Today sessions are effectively private, held in musicians’ homes and open only to the musicians themselves. With JamKazam, musicians can open practice sessions up to others. For example, they can have other musician friends listen in to provide suggestions and constructive criticisms on the musical performances. Or they can allow fans into the “inner circle” to reward and bind super fans closer to the group, providing a level of access that has been impossible.
+
+ -
+ With JamKazam, bands and musicians can also effectively use JamKazam to live broadcast more polished concert performances, with very high quality performance audio streamed live to fans’ computers, tablets, and smartphones, either with the band members in different locations, or with the band playing together in one location.
+
+
+
+
+
+
+FEATURE: Social Networking
+
+ Finally, musicians can use JamKazam to find other musicians in their area, check out their skills, styles, and listen to their performances, and connect to play together online and/or offline.
+
+
+BENEFITS:
+
+ Everyone who plays music knows that it’s far more fun to play with others than to play alone. But many musicians – especially amateur musicians – are not in bands and don’t have established networks of musician friends to play with, simply because of the time and logistical challenges of playing with others, as described earlier. With JamKazam, musicians can easily find other musicians in their area who want to play together online, and who have complementary instruments, skill levels, and musical interests. And they can easily try playing with others without the risk or investment of time to meet in person.
+
\ No newline at end of file
diff --git a/web/app/views/corps/logos.html.erb b/web/app/views/corps/logos.html.erb
new file mode 100644
index 000000000..45691f69a
--- /dev/null
+++ b/web/app/views/corps/logos.html.erb
@@ -0,0 +1,12 @@
+<% provide(:title, 'Logos') %>
+<% provide(:purpose, 'media_center') %>
+
+Logos
+
+Following are links to view and download JamKazam logo image files:
+
+
\ No newline at end of file
diff --git a/web/app/views/corps/media_center.html.erb b/web/app/views/corps/media_center.html.erb
index 6d76a17dc..4eff9e873 100644
--- a/web/app/views/corps/media_center.html.erb
+++ b/web/app/views/corps/media_center.html.erb
@@ -4,7 +4,7 @@
Media Center
-