Why doesn't my Erlang shell load rebar dependencies? - erlang

I have a simple project using rebar with this config:
{sub_dirs, [
"gen",
"apps/basilisk_server",
"rel"
"apps/*"
"ebin"
"deps/*/ebin"
]}.
{erl_opts, [debug_info, fail_on_warning]}.
{
deps,
[
{ email_address, ".*", { git, "git://github.com/mswimmer/erlang-email-address.git", "master"}},
{ gen_smtp , ".*", { git, "https://github.com/Vagabond/gen_smtp.git" , "master"}},
{ pat , ".*", { git, "https://github.com/selectel/pat.git" , "master"}},
{ thrift , ".*", { git, "https://github.com/MustyMustelidae/ThriftErl.git", "master"}}
]
}.
My directory structure is:
+---.rebar
+---deps
| +---edown
| | +---.rebar
| | +---bin
| | +---doc
| | +---ebin
| | +---priv
| | | \---scripts
| | +---samples
| | \---src
| +---email_address
| | +---.rebar
| | +---ebin
| | +---src
| | \---test
| +---gen_smtp
| | +---.rebar
| | +---ebin
| | +---src
| | +---test
| | \---testdata
| +---gproc
| | +---.rebar
| | +---doc
| | +---ebin
| | +---include
| | +---patches
| | | +---gen_leader
| | | +---kernel
| | | \---stdlib
| | +---priv
| | +---reference
| | +---src
| | +---test
| | | \---eqc
| | \---tetrapak
| +---lager
| | +---.rebar
| | +---ebin
| | +---include
| | +---src
| | \---test
| +---pat
| | +---.rebar
| | +---ebin
| | +---include
| | \---src
| +---proper
| | +---.rebar
| | +---doc
| | +---ebin
| | +---examples
| | +---include
| | +---src
| | \---test
| +---tempo
| | +---.rebar
| | +---c_src
| | +---doc
| | | \---utf8
| | +---ebin
| | +---src
| | \---test
| \---thrift
| +---.rebar
| +---ebin
| +---include
| +---out
| | \---production
| | \---erl
| +---src
| \---test
+---ebin <--- My .app/.beam
\---src <--- My source files
\---gen <---More source files
(Sorry for the wall)
Each of the dependencies has a .app file in it's ebin folder, and I'm running the command erl -pa apps/*/ebin -pa ebin -pa deps/*/ebin. I expect I should be able to run application:ensure_all_started(somedep). where "somedep" is the name of a dependency with a .app defined in it's ebin folder. But when I run it for any of them I get the error {error,{somedep,{"no such file or directory","somedep.app"}}}. When I run it for my own application I get the correct response ({ok,_}). Because I can't start the dependencies' applications, my own application fails with an undef error. Am I missing some step to register my .app files with the shell?

The Windows command shell doesn't expand the wildcards in apps/*/ebin and deps/*/ebin, so the Erlang load path isn't getting set properly.

Related

How MVC architecture deal with multi roles users?

I'm a big fan of Ruby on Rails & Laravel, that doesn't mean I don't follow the "edgy" tech stack, just because I like the simplicity of the mvc concept.
but I'm still confused about, how to deal with different views / business logic for the different user roles.
Let say, I have a project that has 3 types of users (Role) :
Admin
Editor
Public
Let's just say they can all access Post Model with their own permissions.
which one the correct project structure? (mvc pov)
1. Default
The default what I mean is, does mvc expect all business logic to be set in the controllers? so that the controller will have thousands of lines of code, because it manages data scope & views for each one of them.
|-- App
| |-- Models
| | |-- Post
| |-- Controllers
| | |-- PostController
| |-- Views
| | |-- Admin
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
| | |-- Editor
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
| | |-- Public
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
2. Name Spaced Controller
just like the name, each user type having a different namespace controller, so we can easily manage each one of them, but somehow I feel like this one chanhging the MVC structure itself.
|-- App
| |-- Models
| | |-- Post
| |-- Controllers
| | |-- Admin
| | | |--PostController
| | |-- Editor
| | | |--PostController
| | |-- Public
| | | |--PostController
| |-- Views
| | |-- Admin
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
| | |-- Editor
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
| | |-- Public
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
3. Different Apps Each User Types
When it comes to Ruby on Rails with their own "scaffold generator", do I have to make a different app for each users? but I think this one isn't solutions for "mvp" project right?
|-- Admin App
| |-- Models
| | |-- Post
| |-- Controllers
| | |-- PostController
| |-- Views
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
-----------------------------
|-- Editor
| |-- Models
| | |-- Post
| |-- Controllers
| | |-- PostController
| |-- Views
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
-----------------------------
|-- Public
| |-- Models
| | |-- Post
| |-- Controllers
| | |-- PostController
| |-- Views
| | | |--post
| | | | |--index.views
| | | | |--show.views
| | | | |--edit.views
| | | | |--create.views
-----------------------------
please explain for me, maybe someone can provide a solution to this confusion. thanks

visualize monthly input and output (flow) rates in a Google Sheet chart

I have a sheet with ticket data - one ticket in each row. Each ticket has an opened date. When a ticket is closed it gets a closed date.
Looking at a month view we have:
input rate = how many new tickets are opened each month
output rate = how many tickets are closed each month
open tickets = how many tickets are/were open each month
I'll use this as example data:
| opened date | opened month | closed date | closed month |
|:-----------:|:------------:|:-----------:|:------------:|
| 2019-04-03 | 2019-04 | | |
| 2019-03-12 | 2019-03 | | |
| 2019-03-09 | 2019-03 | | |
| 2019-02-12 | 2019-02 | 2019-03-06 | 2019-03 |
| 2019-01-06 | 2019-01 | 2019-05-09 | 2019-05 |
| 2019-01-09 | 2019-01 | | |
| 2019-01-12 | 2019-01 | | |
| 2019-03-09 | 2019-03 | 2019-04-09 | 2019-04 |
| 2019-02-09 | 2019-02 | | |
| 2019-04-12 | 2019-04 | 2019-06-12 | 2019-06 |
| 2019-02-12 | 2019-02 | | |
| 2019-04-03 | 2019-04 | 2019-07-09 | 2019-07 |
| 2019-01-12 | 2019-01 | 2019-03-03 | 2019-03 |
| 2019-03-09 | 2019-03 | 2019-05-12 | 2019-05 |
| 2019-04-12 | 2019-04 | | |
| 2019-03-12 | 2019-03 | | |
| 2019-04-03 | 2019-04 | 2019-07-09 | 2019-07 |
| 2019-03-12 | 2019-03 | 2019-07-03 | 2019-07 |
| 2019-01-09 | 2019-01 | | |
| 2019-01-09 | 2019-01 | 2019-05-09 | 2019-05 |
| 2019-02-12 | 2019-02 | | |
| 2019-03-09 | 2019-03 | 2019-06-06 | 2019-06 |
| 2019-04-03 | 2019-04 | 2019-05-09 | 2019-05 |
| 2019-04-03 | 2019-04 | | |
| 2019-02-03 | 2019-02 | | |
| 2019-04-03 | 2019-04 | 2019-06-03 | 2019-06 |
| 2019-03-12 | 2019-03 | | |
| 2019-01-03 | 2019-01 | 2019-02-06 | 2019-02 |
If I manually combine the opened dates, with the closed dates, I get this:
| month | type |
|:-------:|:------:|
| 2019-01 | opened |
| 2019-01 | opened |
| 2019-01 | opened |
| 2019-01 | opened |
| 2019-01 | opened |
| 2019-01 | opened |
| 2019-01 | opened |
| 2019-02 | opened |
| 2019-02 | opened |
| 2019-02 | opened |
| 2019-02 | opened |
| 2019-02 | opened |
| 2019-02 | closed |
| 2019-03 | opened |
| 2019-03 | opened |
| 2019-03 | opened |
| 2019-03 | opened |
| 2019-03 | opened |
| 2019-03 | opened |
| 2019-03 | opened |
| 2019-03 | opened |
| 2019-03 | closed |
| 2019-04 | opened |
| 2019-04 | opened |
| 2019-04 | opened |
| 2019-04 | opened |
| 2019-04 | opened |
| 2019-04 | opened |
| 2019-04 | opened |
| 2019-04 | opened |
| 2019-05 | closed |
| 2019-05 | closed |
| 2019-05 | closed |
| 2019-05 | closed |
| 2019-05 | closed |
| 2019-05 | closed |
| 2019-06 | closed |
| 2019-06 | closed |
| 2019-06 | closed |
| 2019-06 | closed |
| 2019-06 | closed |
| 2019-08 | closed |
I can put this in a pivot to get:
| month | closed | opened |
|:-------:|:------:|:------:|
| 2019-01 | | 7 |
| 2019-02 | 1 | 5 |
| 2019-03 | 1 | 8 |
| 2019-04 | | 8 |
| 2019-05 | 6 | |
| 2019-06 | 5 | |
| 2019-08 | 1 | |
This shows me how many were opened and closed each month. I can use this as the source for a chart:
But this doesn't show how many were open each month - a running total of new opens, plus old opens, minus closed. If I do the math manually I get:
| month | closed | opened | open |
|:-------:|:------:|:------:|:----:|
| 2019-01 | | 7 | 7 |
| 2019-02 | 1 | 5 | 11 |
| 2019-03 | 1 | 8 | 18 |
| 2019-04 | | 8 | 26 |
| 2019-05 | 6 | | 20 |
| 2019-06 | 5 | | 15 |
| 2019-08 | 1 | | 14 |
So, I am wondering if there is a way to take my source data and generate the pivot table/chart I am after automatically - showing how many opened per month, closed per month, and how many are open each month.
try this double running total:
=ARRAYFORMULA(IF(A2:A<>"",
IF(A2:A, MMULT(TRANSPOSE((ROW(C2:C)<=
TRANSPOSE(ROW(C2:C)))*C2:C), SIGN(C2:C)), IFERROR(1/0))-
IF(A2:A, MMULT(TRANSPOSE((ROW(B2:B)<=
TRANSPOSE(ROW(B2:B)))*B2:B), SIGN(B2:B)), IFERROR(1/0)), ))
UPDATE:
=ARRAYFORMULA(QUERY(SPLIT(QUERY(IF({B2:B; D2:D}<>"", {B2:B&"♦opened"; D2:D&"♦closed"}, ),
"where Col1 is not null", 0), "♦"),
"select Col1,count(Col1) group by Col1 pivot Col2 format Col1'yyyy-mm'", 0))
=ARRAYFORMULA({""; IF(F3:F<>"",
IF(F3:F<>"", MMULT(TRANSPOSE((ROW(H3:H)<=
TRANSPOSE(ROW(H3:H)))*H3:H), SIGN(H3:H)), IFERROR(1/0))-
IF(F3:F<>"", MMULT(TRANSPOSE((ROW(G3:G)<=
TRANSPOSE(ROW(G3:G)))*G3:G), SIGN(G3:G)), IFERROR(1/0)), )})

Column1+Column2 on google spreadsheet

I would like to ask on how to do this in google spreadsheet without using script. Apologies for the title, it is my first time posting a question here. Thank you very much :)
Example:
| 1 | A | A-1 |
| 2 | B | A-2 |
| 3 | C | A-3 |
| | | B-1 |
| | | B-2 |
| | | B-3 |
| | | C-1 |
| | | C-2 |
| | | C-3 |
Assuming 1 is in A1, drag down from Row1:
=OFFSET(B$1,INT((ROW()-1)/3),)&"-"&OFFSET(A$1,MOD((ROW()-1),3),)

Cloud Foundry setup become unresponsive after few hours

I have a 5 node Cloud Foundry setup on Azure as part of API provisioning platform.
(3.5GB)3 nodes - Garden container
(1.5GB)1 node - Postgres
(28 GB)1 node - Rest of Cloud Foundry components like cloud controller, haproxy, gorouter, stager, auctioneer etc
boshuser#boshvm:~$ bosh instances --ps
Acting as user 'admin' on deployment 'single-vm-cf-on-azure' on 'bosh'
Director task 184
Task 184 done
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| Instance | State | AZ | VM Type | IPs |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cell_api_z1/0 (cf0f2f38-9676-4a25-9716-67255be18006)* | running | n/a | resource_api_z1 | x.x.x.x |
| rep | running | | | |
| consul_agent | running | | | |
| garden | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cell_api_z1/1 (4147fa15-98ad-4ba9-a65d-7bd3f0dfafb6) | running | n/a | resource_api_z1 | x.x.x.x |
| rep | running | | | |
| consul_agent | running | | | |
| garden | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cell_api_z1/2 (51219434-846c-4edc-a3f7-ad0b28bbc68d) | running | n/a | resource_api_z1 | x.x.x.x |
| rep | running | | | |
| consul_agent | running | | | |
| garden | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cf_z1/0 (770622e7-0fbb-407e-904a-cc69f5341cef)* | running | n/a | resource_z1 | x.x.x.x |
| | | | | x.x.x.x |
| consul_agent | running | | | |
| nats | running | | | |
| nats_stream_forwarder | running | | | |
| metron_agent | running | | | |
| etcd | running | | | |
| etcd_metrics_server | running | | | |
| rpc_nfsd | running | | | |
| rpc_mountd | running | | | |
| cloud_controller_ng | running | | | |
| cloud_controller_worker_local_1 | running | | | |
| cloud_controller_worker_local_2 | running | | | |
| nginx_cc | running | | | |
| cloud_controller_worker_1 | running | | | |
| cloud_controller_clock | running | | | |
| nfs_mounter | running | | | |
| route_registrar | running | | | |
| consul_template | running | | | |
| haproxy_config | running | | | |
| haproxy | running | | | |
| doppler | running | | | |
| loggregator_trafficcontroller | running | | | |
| uaa | running | | | |
| gorouter | running | | | |
| statsd-injector | running | | | |
| syslog_drain_binder | running | | | |
| bbs | running | | | |
| auctioneer | running | | | |
| converger | running | | | |
| stager | running | | | |
| nsync_listener | running | | | |
| nsync_bulker | running | | | |
| tps_listener | running | | | |
| tps_watcher | running | | | |
| cc_uploader | running | | | |
| ssh_proxy | running | | | |
| file_server | running | | | |
| route_emitter | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| postgres_z1/0 (40f5d667-81c6-4065-98e5-8e272b17ed7d)* | running | n/a | resource_postgres_z1 | x.x.x.x |
| postgres | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
When I deploy the cloud foundry manifest using BOSH. It gets deployed successfully and everything works fine which it should.
The problem starts after few hours of deployment. The 'cf' commands stop responding and the apps deployed on cloud foundry do not respond when accessed from browser.
As a solution I have to recreate the cloud controller node. The setup works fine for few hours and then fail again.
Earlier the cloud controller node had 8GB RAM. I did some memory usage analysis when the setup became unresponsive. I found that on a 8GB node the memory was getting choked. So I concluded the issue might be happening because of low RAM.
As a solution I updated the cloud controller node from 8GB to 28GB and redeployed the cloud foundry manifest. The setup worked fine and I was able to access the apps from browser.
But again after few hours the 'cf' commands became unresponsive and I was not able to access apps from browser. Out of 28GB only around 8GB is getting used. So there cannot be an issue because of low memory.
Not sure why the setup becomes unresponsive after few hours.
Any help would be very much appreciated.
Thanks

How to not get lost reviewing Gerrit reviews comments?

Hey guys I'm having a problem forgetting to answer gerrit reviews comments. I'm wondering if there is any way to summarize all gerrit comments (from all patch sets with its respective replies). Let me give a example:
Me -> P1
Review1 -> comments 1a, 1b, 1c;
Me -> P2 (without answer any comments)
Me -> P3
Me -> 1a done, 1c done;
Me -> P4
Review1 +1, +2, finished;
How can I see that we forget to address the comment 1b ?
Bye
It's not possible. In Gerrit database, there's no difference between "answered" comments and "not answered" ones.
Take a look at the patch_comments Gerrit table:
+-----------------------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+--------------+------+-----+-------------------+-----------------------------+
| line_nbr | int(11) | NO | | 0 | |
| author_id | int(11) | NO | | 0 | |
| written_on | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| status | char(1) | NO | MUL | | |
| side | smallint(6) | NO | | 0 | |
| message | text | YES | | NULL | |
| parent_uuid | varchar(40) | YES | | NULL | |
| change_id | int(11) | NO | PRI | 0 | |
| patch_set_id | int(11) | NO | PRI | 0 | |
| file_name | varchar(255) | NO | PRI | | |
| uuid | varchar(40) | NO | PRI | | |
| range_end_character | int(11) | YES | | NULL | |
| range_end_line | int(11) | YES | | NULL | |
| range_start_character | int(11) | YES | | NULL | |
| range_start_line | int(11) | YES | | NULL | |
+-----------------------+--------------+------+-----+-------------------+-----------------------------+

Resources