Discover gists
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
<<-BENCHMARK | |
A quick benchmark vs Starling | |
doesn't deal with contention | |
running in Production mode | |
with 50,000 pre-existing RudeQueue items | |
user system total real | |
rudequeue 49.060000 2.970000 52.030000 ( 77.439360) | |
starling - one 1.710000 0.890000 2.600000 ( 11.684323) | |
starling - many 1.170000 0.610000 1.780000 ( 16.830219) >> @starlings.length => 128 |
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
-module(couchdb_btree_vs_dets). | |
-author('cooldaemon@gmail.com'). | |
-export([test/0, test/1]). | |
test() -> test(1000). | |
test(Count) -> | |
KVs = lists:map( | |
fun (N) -> {N, {foo, bar, baz}} end, | |
lists:seq(1, Count) |
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
#!/system/bin/sh | |
# | |
# VALUES (_id,name,numeric,mcc,mnc,apn,user,server,password,proxy,port,mmsproxy,mmsport,mmsc,current) | |
# | |
SQLITE="/system/bin/sqlite3" | |
DB="/data/data/com.google.android.providers.telephony/databases/telephony.db" | |
# Telecom New Zealand |
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
#!/system/bin/sh | |
# | |
# VALUES (_id,name,numeric,mcc,mnc,apn,user,server,password,proxy,port,mmsproxy,mmsport,mmsc,current) | |
# | |
SQLITE="/system/bin/sqlite3" | |
DB="/data/data/com.google.android.providers.telephony/databases/telephony.db" | |
# Telecom New Zealand |
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) Error: | |
test_joins_with_namespaced_model_should_use_correct_type(HasManyAssociationsTest): | |
ActiveRecord::StatementInvalid: PGError: ERROR: column "companies.type" must appear in the GROUP BY clause or be used in an aggregate function | |
: SELECT companies.*, COUNT(companies.id) AS num_clients FROM "companies" INNER JOIN "companies" clients_companies ON clients_companies.firm_id = companies.id AND "clients_companies"."type" = E'Namespaced::Client' WHERE ("companies"."id" = 16) AND ( ("companies"."type" = 'Namespaced::Firm' ) ) GROUP BY companies.id | |
./test/cases/../../lib/active_record/connection_adapters/abstract_adapter.rb:160:in `log' | |
./test/cases/../../lib/active_record/connection_adapters/postgresql_adapter.rb:488:in `execute_without_query_record' | |
./test/cases/helper.rb:38:in `execute' | |
./test/cases/../../lib/active_record/connection_adapters/postgresql_adapter.rb:945:in `select_raw' | |
./test/cases/../../lib/active_record/connection_adapters/postgresql_adapter.rb:932:in `se |
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
<display:table name="objectlist" class="table" id="object" requestURI=""> | |
<display:column property="objectattribute1" titleKey="i18nColumnTitleKey"/> | |
<display:column titleKey="i18nColumnTitleKey"> | |
<a href="<c:url value="/namespace/editObject.html?id=${object.id}&second=${object.otherAttribute}"/>">${object.displayAttribute}</a> | |
</display:column> | |
</display:table> |
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
2) Error: | |
test_counting_using_sql(HasManyAssociationsTest): | |
ActiveRecord::StatementInvalid: PGError: ERROR: subquery must return only one column | |
: SELECT "companies".id FROM "companies" WHERE (SELECT * FROM companies WHERE client_of = 1) AND ( ("companies"."type" = 'Client' OR "companies"."type" = 'SpecialClient' OR "companies"."type" = 'VerySpecialClient' ) ) LIMIT 1 |
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
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb | |
index a28be9e..9c44eb9 100644 | |
--- a/activerecord/lib/active_record/associations/association_collection.rb | |
+++ b/activerecord/lib/active_record/associations/association_collection.rb | |
@@ -206,7 +206,11 @@ module ActiveRecord | |
end | |
def empty? | |
- size.zero? | |
+ if loaded? || @reflection.options[:counter_sql] |
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
#!/usr/bin/env python | |
# | |
# Little command-line utility for telling you stuff about your Mac without | |
# having to click around all over the place. Originally found here and | |
# then cleaned up significantly: http://gist.github.com/1617 | |
# | |
import sys | |
import commands | |
import plistlib |
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 7f49582ac214d20258dccd222e360350591e1cce Mon Sep 17 00:00:00 2001 | |
From: =?utf-8?q?Tarmo=20T=C3=A4nav?= <tarmo@itech.ee> | |
Date: Wed, 23 Jul 2008 14:57:42 +0300 | |
Subject: [PATCH] has_many association and named_scope empty?() uses exists?({}) instead of counting. | |
This way the database only has to find one match using an index | |
instead of counting all the matches. If the association or scope | |
is already loaded or the association has a custom counter_sql | |
size check is used instead. | |
--- |