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
*************************** 1. row *************************** | |
id: 1 | |
select_type: SIMPLE | |
table: players | |
type: index | |
possible_keys: PRIMARY | |
key: index_players_on_LastName | |
key_len: 768 | |
ref: NULL | |
rows: 10 |
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
desc "all in one" | |
task :all_in_one => :environment do | |
#q here is a message q. Assume it receives messages at the rate of 10/second | |
q.subscribe(:block => true) do |delivery_info, properties, body| | |
#process the message (body) | |
puts "I got a message: #{body}" | |
#I'd like every 10 seconds to output Total Messages Received: 13021 | |
end |
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
p = Person.create | |
p.items << Item.create | |
Rails.cache.write(Time.now, p) | |
=> false | |
p.reload | |
Rails.cache.write(Time.now, p) | |
=> <truthy> |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.Windows.Forms; | |
using System.Runtime.Remoting; | |
using System.Runtime.Remoting.Channels; | |
using System.Runtime.Remoting.Channels.Tcp; | |
using QTrack.QT500.Demo.Core; | |
using QTrack.RemoteEvents; |
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
[2013-12-05 13:28:28] requirements_osx_brew_libs_install | |
requirements_osx_brew_libs_install () | |
{ | |
brew unlink "$@" || true; | |
brew install "$@" || { | |
typeset ret=$?; | |
rvm_warn "There were package installation errors, make sure to read the log. | |
Try \`brew tap --repair\` and make sure \`brew doctor\` looks reasonable. |
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
SELECT DISTINCT ON (date_trunc('day', recorded_at)) COUNT(*) | |
FROM tracked_points WHERE worker_id = 1 AND recorded_at > '2013-11-14' |
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
"HashAggregate (cost=142395.01..142395.21 rows=20 width=4) (actual time=1693.497..1693.500 rows=21 loops=1)" | |
" -> Seq Scan on tracked_points (cost=0.00..121326.67 rows=4213667 width=4) (actual time=0.006..665.009 rows=4206624 loops=1)" | |
"Total runtime: 1693.546 ms" |
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
SELECT tracked_point_zones.worker_id, tracked_point_zones.zone_id, COUNT(*) FROM tracked_point_zones | |
LEFT JOIN zones ON zones.id = tracked_point_zones.zone_id AND tracked_point_zones.recorded_at > '2013-11-01' AND tracked_point_zones.worker_id = 5 | |
GROUP BY tracked_point_zones.worker_id, tracked_point_zones.zone_id | |
ORDER BY COUNT(*) DESC |
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
To install PostGIS/Postgres: | |
sudo apt-get install python-software-properties | |
sudo apt-add-repository ppa:ubuntugis/ppa | |
sudo apt-get update | |
sudo apt-get install postgresql-9.1-postgis |
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
UPDATE tracked_points SET worker_id = worker_tags.worker_id | |
FROM tags LEFT JOIN worker_tags ON tags.id = worker_tags.tag_id | |
WHERE (tags.frequency = tracked_points.frequency OR worker_tags.id IS NULL) | |
AND tracked_points.worker_id_checked_at IS NULL |
NewerOlder