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
/** | |
* Usage: | |
* Instead of using: | |
* val nrToken = NewRelic.getAgent.getTransaction.getToken | |
* val future: Future[T] = Future { | |
* nrToken.link | |
* | |
* } | |
* nrToken.expire() | |
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 controllers | |
import helpers.SecureController | |
trait AlwaysSecureController extends extends Silhouette[User,SessionAuthenticator] { | |
def Action = SecuredAction | |
} | |
class TestAlwaysSecure @Inject() (implicit val env: Environment[User, SessionAuthenticator]) | |
extends AlwaysSecureController { |
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 controllers | |
import com.google.inject.Inject | |
import com.mohiva.play.silhouette.api.{Environment, Silhouette} | |
import com.mohiva.play.silhouette.impl.User | |
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | |
import play.api.mvc.{AnyContent, Action} | |
import scala.concurrent.Future |
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
def my_dumb_scopes(): | |
foo = None | |
try: | |
foo = "whatever" | |
except: Exception as e: | |
pass | |
else: | |
pass | |
try: |
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
def my_dumb_scopes(): | |
try: | |
foo = "whatever" | |
except: Exception as e: | |
pass | |
else: | |
pass | |
try: | |
this.causes_an_exception() |
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
def function(i:Any) : Iteratable = { | |
...... | |
} | |
val firstSeq = Seq(.....) | |
//this is much faster | |
val flatMapped = firstSeq.flatMap(i => function(i)) | |
//than this, which spends a TON of time in scala.collection.generic.Growable ++ | |
var concatenatedSeq = Seq() |
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
A = LOAD 'file1' using PigStorage(); | |
e = FOREACH summedNewEvents { | |
%declare limitKey key | |
rolls = (LOAD 'hbase://myAggregateTable' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('data:count', '-loadKey true -caching 2500, -gt $A.$0, -lt $A.$1}') AS (key:chararray, numEvents:long)); | |
existingNumEvents = FOREACH rolls GENERATE SUM($0); | |
GENERATE key, existingNumEvents + numEvents; | |
} |
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
--key: sometext|commonval data:date 2013-02-11,2013-05-24 | |
table1 = LOAD 'hbase://table1' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('data:count' | |
, '-loadKey true') AS (id:chararray, count:chararray); | |
--key sometext|date|moretext|lasttext data:count 5 | |
table2 = LOAD 'hbase://table2' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('data:dates' | |
, '-loadKey true') AS (id:chararray, dates:chararray); | |
table1 = foreach table1 generate STRSPLIT(id, '\\|') as key, STRSPLIT(dates, ',') as date; |
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
def my_fun(): | |
print "foo" | |
from inspect import getargspec | |
defaults = getargspec(my_fun).defaults | |
len(defaults) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: object of type 'NoneType' has no len() | |
def my_fun2(a="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
FSReadError in /var/cassandra/data/et/http_request/ks-mycql3table-ic-1799-Data.db | |
at org.apache.cassandra.io.compress.CompressedRandomAccessReader.reBuffer(CompressedRandomAccessReader.java:93) | |
at org.apache.cassandra.io.util.RandomAccessReader.seek(RandomAccessReader.java:312) | |
at org.apache.cassandra.io.sstable.SSTableScanner.seekTo(SSTableScanner.java:98) | |
at org.apache.cassandra.db.RowIteratorFactory.getIterator(RowIteratorFactory.java:73) | |
at org.apache.cassandra.db.ColumnFamilyStore.getSequentialIterator(ColumnFamilyStore.java:1424) | |
at org.apache.cassandra.db.ColumnFamilyStore.getRangeSlice(ColumnFamilyStore.java:1476) | |
at org.apache.cassandra.service.RangeSliceVerbHandler.executeLocally(RangeSliceVerbHandler.java:46) | |
at org.apache.cassandra.service.RangeSliceVerbHandler.doVerb(RangeSliceVerbHandler.java:58) | |
at org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:56) |
NewerOlder