Skip to content

Instantly share code, notes, and snippets.

@dustingetz
Created March 13, 2011 19:50
Show Gist options
  • Select an option

  • Save dustingetz/868368 to your computer and use it in GitHub Desktop.

Select an option

Save dustingetz/868368 to your computer and use it in GitHub Desktop.
wave robot api, add participant trace
2011-03-13 12:44:11.076 /_wave/robot/jsonrpc 200 215ms 270cpu_ms 196api_cpu_ms 0kb WaveRobotGateway
10.12.168.13 - - [13/Mar/2011:12:44:11 -0700] "POST /_wave/robot/jsonrpc HTTP/1.1" 200 639 - "WaveRobotGateway" "dustin-getz.appspot.com" ms=215 cpu_ms=270 api_cpu_ms=197 cpm_usd=0.008149
I 2011-03-13 12:44:10.881
server_rpc_base: None
I 2011-03-13 12:44:10.881
server:https://www-opensocial.googleusercontent.com/api/rpc
I 2011-03-13 12:44:10.882
Incoming: {"events":[{"type":"WAVELET_SELF_ADDED","modifiedBy":"dustin.getz@googlewave.com","timestamp":1300045450639,"properties":{"blipId":"b+c5hJ3nfVB"}}],"wavelet":{"creationTime":1300042639323,"lastModifiedTime":1300045450639,"version":2722,"participants":["dustin.getz@googlewave.com","dustin-getz@appspot.com"],"participantRoles":{"dustin-getz@appspot.com":"FULL","dustin.getz@googlewave.com":"FULL"},"dataDocuments":{},"tags":[],"creator":"dustin.getz@googlewave.com","rootBlipId":"b+c5hJ3nfVB","title":"code `null\u003d\u003dfoo` vs `foo\u003d\u003dnull`","waveId":"googlewave.com!w+c5hJ3nfVA","waveletId":"googlewave.com!conv+root","rootThread":{"id":"","location":-1,"blipIds":["b+c5hJ3nfVB"]}},"blips":{"b+c5hJ3nfVB":{"annotations":[{"name":"conv/title","value":"","range":{"start":0,"end":32}},{"name":"lang","value":"unknown","range":{"start":0,"end":32}},{"name":"spell","value":"sp+1ukQp7ZkJKi\nf\nvs","range":{"start":18,"end":20}},{"name":"lang","value":"en","range":{"start":33,"end":170}},{"name":"style/fontFamily","value":"courier new,monospace","range":{"start":56,"end":72}},{"name":"style/fontStyle","value":"italic","range":{"start":72,"end":170}},{"name":"lang","value":"en","range":{"start":171,"end":446}},{"name":"style/fontFamily","value":"courier new,monospace","range":{"start":205,"end":220}},{"name":"style/fontFamily","value":"courier new,monospace","range":{"start":306,"end":322}},{"name":"lang","value":"en","range":{"start":447,"end":893}},{"name":"spell","value":"sp+1ukQp7ZkJK8\nf\nscan","range":{"start":535,"end":539}},{"name":"style/fontFamily","value":"courier new,monospace","range":{"start":787,"end":796}},{"name":"link/manual","value":"https://gist.github.com/868350","range":{"start":867,"end":879}},{"name":"lang","value":"en","range":{"start":894,"end":1155}},{"name":"lang","value":"en","range":{"start":1156,"end":1270}},{"name":"style/color","value":"rgb(0, 132, 180)","range":{"start":1270,"end":1272}},{"name":"link/manual","value":"http://twitter.com/#!/search?q\u003d%23codestyle","range":{"start":1270,"end":1272}},{"name":"style/fontFamily","value":"\u0027Helvetica Neue\u0027, Arial, sans-serif","range":{"start":1270,"end":1272}},{"name":"lang","value":"unknown","range":{"start":1271,"end":1334}},{"name":"style/fontSize","value":"0.8333333333333334em","range":{"start":1272,"end":1542}},{"name":"style/fontFamily","value":"\u0027Helvetica Neue\u0027, Arial, sans-serif","range":{"start":1334,"end":1335}},{"name":"style/color","value":"rgb(0, 132, 180)","range":{"start":1334,"end":1335}},{"name":"lang","value":"en","range":{"start":1334,"end":1542}},{"name":"link/manual","value":"http://twitter.com/#!/search?q\u003d%23codestyle","range":{"start":1334,"end":1335}}],"elements":{"0":{"type":"LINE","properties":{}},"171":{"type":"LINE","properties":{}},"170":{"type":"LINE","properties":{}},"32":{"type":"LINE","properties":{}},"1155":{"type":"LINE","properties":{}},"33":{"type":"LINE","properties":{}},"1400":{"type":"LINE","properties":{}},"1156":{"type":"LINE","properties":{}},"446":{"type":"LINE","properties":{}},"447":{"type":"LINE","properties":{}},"893":{"type":"LINE","properties":{}},"1334":{"type":"LINE","properties":{}},"894":{"type":"LINE","properties":{}},"1270":{"type":"LINE","properties":{}},"1271":{"type":"LINE","properties":{}},"55":{"type":"LINE","properties":{"indent":"1"}}},"blipId":"b+c5hJ3nfVB","childBlipIds":[],"contributors":["dustin.getz@googlewave.com"],"creator":"dustin.getz@googlewave.com","content":"\ncode `null\u003d\u003dfoo` vs `foo\u003d\u003dnull`\n\nA colleague tweeted: \nif (null !\u003d foo) In my 15 years of programming, I think I forgot an \u0027\u003d\u0027 twice... It doesn\u0027t \"read\" properly, IMHO.\n\nHe prefers to write code like if (cmd \u003d\u003d \"save\"), because if you read it left to right like a sentance, it fits with english grammar: if cmd is \"save\". Switch it up, it just reads wrong. I shared his opinion for a few years until switching styles six months ago. Here\u0027s why:\n\nWhen we\u0027re reading someone else\u0027s code, we usually don\u0027t read line by line, but rather scan until we find what we need. Code tends to follow along the left margins, so when scanning, thats where our eyes are. Thus, I prefer to put the most dominant part of any statement towards the left. To me, it reads better too: you only need to scan if \"save\", my brain fills in the rest based on context. This is more obvious in switch logic [github.com].\n\nOf course, these stylistic things don\u0027t really matter. Scannable code is great, but others may or may not agree. Maintaining \"other people\u0027s code\" is a daily task, so we plow through it and just try to fit in, because you can\u0027t break code you didn\u0027t change[1].\n\nThere are other reasons to use this style[2][3] which may or may not be applicable depending on your environment.\n\n[1] or pollute the history, or cause upstream merge annoyances\n[2] in Java, \"constant\".equals(foo) doesn\u0027t break if foo is null.\n[3] When switching between Java and SQL, its surprisingly easy to inadvertently write \u0027\u003d\u0027 instead of \u0027\u003d\u003d\u0027. An IDE will flag it, so who cares.","lastModifiedTime":1300045406452,"parentBlipId":null,"version":2701,"waveId":"googlewave.com!w+c5hJ3nfVA","waveletId":"googlewave.com!conv+root","replyThreadIds":[],"threadId":""}},"threads":{},"robotAddress":"dustin-getz@appspot.com"}
D 2011-03-13 12:44:10.887
found wave: googlewave.com!w+c5hJ3nfVA
I 2011-03-13 12:44:10.904
<util.waveapi.blip.Annotation object at 0x4fe56b309a2c9818>
I 2011-03-13 12:44:10.904
<util.waveapi.blip.Annotation object at 0x4fe56b309a2c9998>
I 2011-03-13 12:44:10.905
<util.waveapi.blip.Annotation object at 0x4fe56b309a2c9858>
D 2011-03-13 12:44:10.960
published: code `null==foo` vs `foo==null`
I 2011-03-13 12:44:11.054
Outgoing: [{"params": {"capabilitiesHash": "0x980e1cd", "protocolVersion": "0.22"}, "method": "robot.notify", "id": "0"}, {"params": {"waveletId": "googlewave.com!conv+root", "waveId": "googlewave.com!w+c5hJ3nfVA", "blipData": {"waveletId": "googlewave.com!conv+root", "blipId": "TBD_googlewave.com!conv+root_0x1be6778b464a5191", "waveId": "googlewave.com!w+c5hJ3nfVA", "content": "Published to http://www.dustingetz.com/code-nullfoo-vs-foonull", "parentBlipId": null}}, "method": "wavelet.appendBlip", "id": "op1"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment