<script type="text/javascript">
var data = {
"id" : "aaa",
"hoge" : 100
};
This file contains hidden or 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
# irb | |
2.3.1 :001 > q = Queue.new | |
=> #<Thread::Queue:0x00000002150908> | |
2.3.1 :002 > q.push(:a) | |
=> #<Thread::Queue:0x00000002150908> | |
2.3.1 :003 > q.push(:b) | |
=> #<Thread::Queue:0x00000002150908> | |
2.3.1 :004 > q.pop | |
=> :a | |
2.3.1 :005 > q.pop |
This file contains hidden or 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
# coding: utf-8 | |
require 'json' | |
def get_bqtype(k, obj) | |
return case obj | |
when TrueClass, FalseClass then "BOOLEAN" | |
when String then "STRING" | |
when Float then "FLOAT" | |
when Fixnum, Bignum | |
return "TIMESTAMP" if ["timestamp", "_ts"].include?(k) |
This file contains hidden or 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
irb(main):007:0* require 'Oj' | |
=> false | |
irb(main):008:0> Oj.load('{"x": 1e-314}') | |
=> {"x"=>0.0} | |
irb(main):009:0> Oj.default_options = { :bigdecimal_load => :bigdecimal } | |
=> {:bigdecimal_load=>:bigdecimal} | |
irb(main):010:0> Oj.load('{"x": 1e-314}') | |
=> {"x"=>#<BigDecimal:7fd73a87d188,'0.1E-313',9(18)>} |
This file contains hidden or 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
# coding: utf-8 | |
require 'json' | |
rand = Random.new | |
i = 0 | |
while true do | |
i += 1 | |
obj = { |
This file contains hidden or 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
[2015-07-11T00:40:12+00:00] ERROR: service[td-agent] (td-agent::default line 119) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' | |
---- Begin output of /sbin/service td-agent start ---- | |
STDOUT: Starting td-agent: [FAILED] | |
STDERR: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate googleauth-0.4.1, because multi_json-1.11.1 conflicts with multi_json (= 1.11) (Gem::LoadError) | |
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:746:in `activate' | |
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies' | |
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:766:in `each' | |
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies' | |
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:750:in `activate' | |
from /usr/lib64/ |
This file contains hidden or 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
# coding: utf-8 | |
require 'json' | |
require 'yajl' | |
x = eval('{"logType"=>"ads", "abc"=>"\xE3\x82\xA4\xE3\x83\xB3\xE3\x82\xB9\xE3\x83\x88\xE3\x83\xBC\xE3\x83\xAB", "time"=>"2015-05-17T03:00:00Z", "tag"=>"aaa"}') | |
puts x["abc"].force_encoding("ASCII-8BIT") | |
puts x["abc"].encoding | |
puts x |
This file contains hidden or 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 class MyFactory { | |
public static Configuration newConfiguration() { | |
Configuration conf = new Configuration(); | |
conf.setInt("xxx", 111); | |
return conf; | |
} | |
} | |
// こーいう場合(Factoryクラスがstaticメソッドでかつ他のクラスの場合) XMLどう書けばいいの... | |
// factory-beanはbean指定だからインスタンス化必須? |
This file contains hidden or 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
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.11</version> | |
<scope>test</scope> | |
<exclusions> | |
<exclusion> | |
<artifactId>hamcrest-core</artifactId> | |
<groupId>org.hamcrest</groupId> | |
</exclusion> |
NewerOlder