This works most of the time
def handle(data) do
with {:ok, product} <- Jason.decode!(data),
{:ok, category} <- Category.load(data.category_id)
do
# todo
end
endThis works most of the time
def handle(data) do
with {:ok, product} <- Jason.decode!(data),
{:ok, category} <- Category.load(data.category_id)
do
# todo
end
end| timestamp | method | uri | ip | |
|---|---|---|---|---|
| Oct 18, 2019 @ 09:41:02.000 | - | - | 61.219.11.153 | |
| Oct 18, 2019 @ 09:34:37.000 | GET | / | 164.52.24.162 | |
| Oct 18, 2019 @ 09:33:12.000 | - | - | 61.219.11.153 | |
| Oct 18, 2019 @ 09:32:28.000 | - | - | 61.219.11.153 | |
| Oct 18, 2019 @ 09:26:41.000 | GET | /otsmobile/app/mgs/mgw.htm | 110.105.80.110 | |
| Oct 18, 2019 @ 09:23:42.000 | GET | /ftpsync.settings | 185.234.216.20 | |
| Oct 18, 2019 @ 09:23:41.000 | GET | /deployment-config.json | 185.234.216.20 | |
| Oct 18, 2019 @ 09:23:40.000 | GET | /.vscode/ftp-sync.json | 185.234.216.20 | |
| Oct 18, 2019 @ 09:23:40.000 | GET | /.vscode/sftp.json | 185.234.216.20 |
| loadArticle (res, req) -> | |
| article = yield findArticlebyId(...) | |
| return res.notFound() unless artilce? | |
| res.ok(article) | |
| findArticleById (id) -> | |
| conn = yield conn.Open(). | |
| row = yield conn.QueryAsync("....", id) | |
| new Article(row) |
| func LoadArticle(res http.ResponseWriter, req *http.Request) { | |
| if article, err := FindArticleById(...) | |
| if err != nil { | |
| handleError(res, err) | |
| return | |
| } | |
| if article == nil { | |
| handleNotFound(res, err) | |
| } | |
| } |
| /* | |
| bolt 5000 277963 ns/op | |
| redis 30000 48081 ns/op | |
| pg 10000 149691 ns/op | |
| Yes, the Bolt transactions could be batched. But so too could the PG transactions, | |
| and the Redis work could be pipelined. And that isn't always a workable solution. | |
| */ | |
| import ( |
| # place this in your init.coffee | |
| atom.workspace.observeTextEditors (e) -> | |
| editor = atom.views.getView(e) | |
| clone = editor.querySelector('.wrap-guide').cloneNode() | |
| clone.style.left = (editor.getDefaultCharacterWidth() * 120) + "px" | |
| editor.querySelector('.underlayer').appendChild(clone) |
| /* | |
| Playing with building a specialized set for integers. Specifically: | |
| - Integers are natually randomly distributed (auto-incrementing ids for millions of records would do) | |
| - The number of items is known upfront (can be approximate) | |
| - The set sizes changes infrequently (we're mostly interested in membership tests) | |
| Accomodating constraints, to be sure, but if we can meet the first two requirements, | |
| we'll end up with a little less than 1/2 the memory of a map[int]struct{}, and membership | |
| tests taking about ~1/2 the time. |
| BYTE UNIX Benchmarks (Version 5.1.3) | |
| System: p2.kapi.io: GNU/Linux | |
| OS: GNU/Linux -- 3.13.0-36-generic -- #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 | |
| Machine: x86_64 (x86_64) | |
| Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968") | |
| CPU 0: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (6799.8 bogomips) | |
| Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization | |
| CPU 1: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (6799.8 bogomips) | |
| Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization |
| BYTE UNIX Benchmarks (Version 5.1.3) | |
| System: ip-172-30-0-152: GNU/Linux | |
| OS: GNU/Linux -- 3.13.0-36-generic -- #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 | |
| Machine: x86_64 (x86_64) | |
| Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968") | |
| CPU 0: Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz (5800.1 bogomips) | |
| Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET | |
| CPU 1: Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz (5800.1 bogomips) | |
| Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET |
| BYTE UNIX Benchmarks (Version 5.1.3) | |
| System: ip-172-30-0-254: GNU/Linux | |
| OS: GNU/Linux -- 3.13.0-36-generic -- #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 | |
| Machine: x86_64 (x86_64) | |
| Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968") | |
| CPU 0: Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz (5786.7 bogomips) | |
| Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET | |
| CPU 1: Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz (5786.7 bogomips) | |
| Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET |