Skip to content

Instantly share code, notes, and snippets.

@biot023
biot023 / gist:1472200
Created December 13, 2011 13:55
Stack trace of NULL pointer given exception
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/easy.rb:371:in `easy_getinfo_string'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/easy.rb:371:in `get_info_string'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/easy.rb:150:in `primary_ip'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/hydra.rb:242:in `response_from_easy'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/hydra.rb:185:in `get_easy_object'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/easy.rb:337:in `call'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/easy.rb:337:in `success'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/multi.rb:21:in `multi_perform'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/multi.rb:21:in `perform'
/usr/lib/ruby/gems/1.8/gems/typhoeus-0.3.2/lib/typhoeus/hydra.rb:95:in `run'
@biot023
biot023 / gist:1448181
Created December 8, 2011 19:29
Show create table items
*************************** 1. row ***************************
Table: items
Create Table: CREATE TABLE `items` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) default NULL,
`description` text,
`user_id` int(11) default NULL,
`listed_at` datetime default NULL,
`suspended_at` datetime default NULL,
`expires_at` datetime default NULL,
@biot023
biot023 / gist:1447223
Created December 8, 2011 15:09
Indices on items table
+-------+------------+------------------------------------+--------------+---------------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------+------------+------------------------------------+--------------+---------------------+-----------+-------------+----------+--------+------+------------+---------+
| items | 0 | PRIMARY | 1 | id | A | 689365 | NULL | NULL | | BTREE | |
| items | 0 | id | 1 | id | A | 689365 | NULL | NULL | | BTREE | |
| items | 0 | id | 2 | listed_at | A | 689365 | NULL | NULL | YES | BTREE
curl -XPOST "http://localhost:9200/folksy_test_search"
curl -XPUT "http://localhost:9200/folksy_test_search/items/1" -d '{"price":10.0,"material_ids":[1],"listed_at":"20110915T152837","place_id":null,"title":"Red Jumper","section_id":1,"user_login":"user000001","id":1,"category_id":1,"colour_ids":[1],"description":"A beautiful red jumper hand-knitted with quality wool.","keywords":"Men Clothes Jumpers Blue Cotton","subcategory_id":1}'
curl -XPUT "http://localhost:9200/folksy_test_search/items/2" -d '{"price":10.0,"material_ids":[1],"listed_at":"20110915T152837","place_id":null,"title":"Red Jumper","section_id":1,"user_login":"user000003","id":2,"category_id":1,"colour_ids":[1],"description":"A beautiful red jumper hand-knitted with quality wool.","keywords":"Men Clothes Jumpers Blue Cotton","subcategory_id":1}'
curl -XPUT "http://localhost:9200/folksy_test_search/items/3" -d '{"price":3.0,"material_ids":[1],"listed_at":"20110915T152838","place_id":null,"title":"Red Jumper","section_id":1,"user_login":"user
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
@biot023
biot023 / gist:1081527
Created July 13, 2011 22:57
Error created trying to build b2 to install boost with toolset=clang
~/src/boost_1_47_0$ cd tools/build/v2/
~/src/boost_1_47_0/tools/build/v2$ ./bootstrap.sh --with-toolset=clang
-n Bootstrapping the build engine with toolset clang...
engine/bin.macosxx86_64/bjam
Bootstrapping is done. To build and install, run:
./b2 install --prefix=<DIR>
~/src/boost_1_47_0/tools/build/v2$ ./b2 install --prefix=/usr/local/bin
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="9">
<_game class_id="0" tracking_level="0" version="0">
<_current_turn>0</_current_turn>
<_board class_id="1" tracking_level="0" version="1">
<px class_id="-1"></px>
</_board>
</_game>
</boost_serialization>
@biot023
biot023 / gist:1047946
Created June 26, 2011 20:34
Errors when trying to use clang with C++11
clang++ -Wall -g -std=c++0x -stdlib=libc++ -U__STRICT_ANSI__ -c -I include -I /usr/local/include -DENABLE_BIOT023_IDS -DBOOST_TEST_DYN_LINK -o test/test_runner.o test/test_runner.cpp
clang++ -Wall -g -std=c++0x -stdlib=libc++ -U__STRICT_ANSI__ -c -I include -I /usr/local/include -DENABLE_BIOT023_IDS -DBOOST_TEST_DYN_LINK -o test/game_factory_test.o test/game_factory_test.cpp
In file included from test/game_factory_test.cpp:8:
In file included from /usr/local/include/turtle/mock.hpp:15:
In file included from /usr/local/include/turtle/function.hpp:14:
/usr/local/include/turtle/expectation.hpp:99:22: error: too few template arguments for class template 'vector'
typedef std::vector< boost::shared_ptr< detail::sequence_impl > > sequences_type;
^
In file included from test/game_factory_test.cpp:8:
In file included from /usr/local/include/turtle/mock.hpp:15:
passed 2 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.duration/time.duration.comparisons
passed 11 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.duration/time.duration.cons
passed 11 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.duration/time.duration.nonmember
passed 1 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.duration/time.duration.observer
passed 3 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.duration/time.duration.special
passed 2 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.point
passed 2 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.point/time.point.arithmetic
passed 2 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.point/time.point.cast
passed 4 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.point/time.point.comparisons
passed 5 tests in /Users/douglivesey/src/libcxx/test/utilities/time/time.point/time.point.cons
$ rake
(in /Users/douglivesey/work/cpp/cell_biots)
clang++ -Wall -g -std=c++0x -c -I include -I /usr/local/include -DBOOST_TEST_DYN_LINK -o test/test_runner.o test/test_runner.cpp
clang++ -Wall -g -std=c++0x -c -I include -I /usr/local/include -DBOOST_TEST_DYN_LINK -o test/game_factory_test.o test/game_factory_test.cpp
test/game_factory_test.cpp:43:5: error: no member named 'expgenerate_board' in 'cbiots::GameFactory'; did you
mean 'generate_board'?
MOCK_EXPECT( *game_factory, generate_board ).once().with( board_width, board_height ).
^
In file included from test/game_factory_test.cpp:8:
/usr/local/include/turtle/mock.hpp:245:26: note: instantiated from: