Insert If a combination for records don't exist - join

I have two seperate tables, one consists of records and other which is master table of Group combinations.
Records table:
| Mobile | DC | Dept
+--------+----+------
| 123456 | 01 | car
| 098765 | 05 | home
| 123456 | 02 | taxi
| 098765 | 00 | rent
Group Master:
| Dept | Group-Dept
+------+-----------
| car | Vehicle
| taxi | Vehicle
| home | house
| rent | house
Expected output:
| Mobile | DC | Dept | DC-Count | DC-Group
+--------+----+------+----------+----------
| 123456 | 01 | car | 3 | Vehicle
| 098765 | 05 | home | 5 | house
| 123456 | 02 | taxi | 3 | Vehicle
| 098765 | 00 | rent | 5 | house
Please help.

Related

question about creating upper case database name or table name in TDengine database

In TDengine shell, any upper case letter is automatically converted to a lower case letter like below:
taos> create database TEST;
Query OK, 0 of 0 row(s) in database (0.002404s)
taos> show databases;
name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status |
====================================================================================================================================================================================================================================================================================
test | 2021-11-16 16:07:47.410 | 0 | 0 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ms | 0 | ready |
db | 2021-11-16 13:30:46.858 | 13 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ms | 0 | ready |
Query OK, 2 row(s) in set (0.001591s)
taos> use test;
Database changed.
taos> create table STB(ts timestamp, c1 int) tags(t1 int);
Query OK, 0 of 0 row(s) in database (0.002349s)
taos> show stables;
name | created_time | columns | tags | tables |
============================================================================================
stb | 2021-11-16 16:08:34.322 | 2 | 1 | 0 |
Query OK, 1 row(s) in set (0.001501s)
Is there any way to create a database name or table name in upper case letters?
upper case database name is not supported in TDengine database, but upper case table name is supported by use following SQL:
taos> create table `UPPER_CASE_TABLE_NAME` (ts timestamp, c1 int); Query OK, 0 of 0 row(s) in database (0.008671s)
taos> show tables;
table_name | created_time | columns | stable_name | uid | tid | vgId |
==========================================================================================================================================================
UPPER_CASE_TABLE_NAME | 2022-05-05 18:40:21.011 | 2 | | 40813871670686384 | 2 | 145 |
Query OK, 1 row(s) in set (0.007461s)

How to get the number of the instance in Google Sheets?

Consider the following table:
| name | instance |
|------|----------|
| foo | 1 |
| foo | 2 |
| bar | 1 |
| bar | 2 |
| bar | 3 |
| baz | 1 |
| baz | 2 |
What formula should I use to get the instance column?
You can try
=Arrayformula(if(A2:A="",,countifs(A2:A, A2:A, row(A2:A), "<="&row(A2:A))))

ArrayFormula with TEXTJOIN - Combine data of two columns on the same row/cell

I have one Google Sheet that contains ID-values, together with corresponding Names and Attack power. In another sheet, I want to combine Names and Attack power in the same cell using the ID as a reference - separated with row breaks.
Sheet1
Sheet1 looks like this:
| GROUP ID | NAME | ATTACK POWER |
|---------:|:----------|--------------:|
| 101 | guile | 333 |
|----------|-----------|---------------|
| 101 | blanka | 50 |
|----------|-----------|---------------|
| 101 | sagat | 500 |
|----------|-----------|---------------|
| 207 | ruy | 450 |
|----------|-----------|---------------|
| 207 | vega | 150 |
Sheet2
Right now, I have created the following ArrayFormula that sort of does what I want.
In NAME-column:
=ArrayFormula(TEXTJOIN(CHAR(10);1;REPT(Sheet1!B:C;1*(Sheet1!A:A=A2))))
Which returns the following result:
| GROUP ID | NAME |
|---------:|:--------------------------|
| 101 | guile |
| | 333 |
| | blanka |
| | 50 |
| | sagat |
| | 500 |
|----------|---------------------------|
| 101 | ruy |
| | 450 |
| | vega |
| | 150 |
|----------|---------------------------|
The problem is that I can't figure out how to get Name and Attack Power on the same line.
Tried combining with CONCATENATE: =CONCATENATE(ArrayFormula(TEXTJOIN(CHAR(10);1;REPT(Sheet1!B:B;1*(Sheet1!A:A=A2))));" (";ArrayFormula(TEXTJOIN(CHAR(10);1;REPT(Sheet1!C:C;1*(Sheet1!A:A=A2))));")") - but it's not quite right:
| GROUP ID | NAME |
|---------:|:--------------------------|
| 101 | guile |
| | blanka |
| | sagat (333 |
| | 50 |
| | 500) |
|----------|---------------------------|
| 101 | ruy |
| | vega (450 |
| | 150) |
|----------|---------------------------|
I would instead the sheet to look like this:
| GROUP ID | NAME |
|---------:|:--------------------------|
| 101 | guile (333) |
| | blanka (50) |
| | sagat (500) |
|----------|---------------------------|
| 101 | ruy (450) |
| | vega (150) |
|----------|---------------------------|
Is this possible?
=ARRAYFORMULA(TEXTJOIN(CHAR(10), 1,
REPT(Sheet1!B:B&" ("&Sheet1!C:C&")", 1*(Sheet1!A:A=A4))))

Making freeradius 3 in ubuntu 18 look at the mysql nas table for client "secret"

I am running freeradius from the same computer that I am running "radtest" from.
I can get get an "accept" message with user password coming from either "users" file or mysql , and can get client "secret" from clients.conf file, but can't figure out how to get freeradius to look at mysql for the client "secret".
Do I have to somehow disable or override the entry in "cients.conf"?
Here's a summary of file entries, mysql, and test results:
/etc/freeradius/3.0/clients.conf #client localhost with secret testing123
/etc/freeradius/3.0/users #testing Cleartext-Password := "testpwd"
/etc/freeradius/3.0/mods-available/sql #read_clients = yes (/etc/freeradius/3.0/sites- enabled/sql points here)
SELECT * FROM radgroupreply LIMIT 10;
| id | groupname | attribute | op | value |
| 1 | dynamic | Framed-Compression | := | Van-Jacobsen-TCP-IP |
| 2 | dynamic | Framed-Protocol | := | PPP |
| 3 | dynamic | Service-Type | := | Framed-User |
| 4 | dynamic | Framed-MTU | := | 1500 |
| 5 | 2048-1024 | Motorola-Canopy-ULBR | = | 1024 |
| 6 | 2048-1024 | Motorola-Canopy-ULBL | = | 500000 |
mysql> SELECT * FROM radusergroup LIMIT 10;
| username | groupname | priority |
| fredf | dnamic | 2 |
| 0a-00-3e-89-35-32 | 2048-1024 | 2 |
mysql> SELECT * FROM radcheck LIMIT 10;
| id | username | attribute | op | value |
| 3 | fredf | Cleartext-Password | := | wilma |
| 6 | 0a-00-3e-89-35-32 | Cleartext-Password | := | passwordsql |
mysql> SELECT * FROM radreply LIMIT 10;
| id | username | attribute | op | value |
| 1 | fredf | Motorola-Canopy-UserLevel | = | 3 |
| 2 | testuser | Motorola-Canopy-UserLevel | = | 3 |
mysql> SELECT * FROM nas LIMIT 10;
| id | nasname | shortname | type | ports | secret | server | community | description |
| 1 | 10.10.2.2 | Griz450NW | 1 | 1812 | naspass | localhost | ISReader | Griz450NW |
radtest testing testpwd 127.0.0.1 0 testing123 #works
Received Access-Accept Id 107 from 127.0.0.1:1812 to 0.0.0.0:0 length 20
radtest fredf wilma 127.0.0.1 0 testing123 #works
Received Access-Accept Id 242 from 127.0.0.1:1812 to 0.0.0.0:0 length 32
Motorola-WiMAX-Home-BTS = 0x00000003
radtest 0a-00-3e-89-35-32 passwordsql 127.0.0.1 0 testing123 #works
Received Access-Accept Id 27 from 127.0.0.1:1812 to 0.0.0.0:0 length 44
Motorola-Canopy-ULBR = 1024
Motorola-Canopy-ULBL = 500000
radtest 0a-00-3e-89-35-32 passwordsql 127.0.0.1 0 naspass #doesn't work
Radius -X output: Dropping packet without response because of error: Received packet from 127.0.0.1 with invalid Message-Authenticator! (Shared secret is incorrect.)
The NAS table entry worked once I changed the "nasname" to "127.0.0.1" and disabled the client in clients.conf (I just changed "ipaddr" from "127.0.0.1" to "127.0.0.2").

What is the output of "grails stats" for your largest Grails project? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
grails stats gives various code statistics for a given Grails project.
Typical output can look like something along the lines of:
+----------------------+-------+-------+
| Name | Files | LOC |
+----------------------+-------+-------+
| Controllers | 4 | 183 |
| Domain Classes | 8 | 264 |
| Jobs | 1 | 10 |
| Services | 4 | 297 |
| Tag Libraries | 2 | 63 |
| Unit Tests | 17 | 204 |
+----------------------+-------+-------+
| Totals | 36 | 1021 |
+----------------------+-------+-------+
I'm curious about the typical division of code between the various artifacts in Grails projects (such as the ratio LOC(controllers) / LOC(services), etc.).
Please share the grails stats output of your largest Grails project to contribute your statistics to this question.
My current project:
+----------------------+-------+-------+
| Name | Files | LOC |
+----------------------+-------+-------+
| Controllers | 67 | 7665 |
| Domain Classes | 101 | 3736 |
| Jobs | 3 | 45 |
| Services | 61 | 6158 |
| Tag Libraries | 34 | 2357 |
| Groovy Helpers | 54 | 3356 |
| Java Helpers | 1 | 65 |
| Unit Tests | 227 | 24224 |
| Integration Tests | 70 | 10908 |
| Scripts | 2 | 77 |
+----------------------+-------+-------+
| Totals | 620 | 58591 |
+----------------------+-------+-------+
The large number in "Java Helpers" originates mostly from a wsdl2java stub generation.
+----------------------+-------+-------+
| Name | Files | LOC |
+----------------------+-------+-------+
| Controllers | 13 | 1085 |
| Domain Classes | 17 | 802 |
| Services | 19 | 1918 |
| Tag Libraries | 2 | 182 |
| Groovy Helpers | 39 | 1586 |
| Java Helpers | 521 | 42232 |
| Unit Tests | 45 | 5294 |
| Integration Tests | 9 | 836 |
| Scripts | 2 | 22 |
+----------------------+-------+-------+
| Totals | 667 | 53957 |
+----------------------+-------+-------+
+----------------------+-------+-------+
| Name | Files | LOC |
+----------------------+-------+-------+
| Controllers | 40 | 3912 |
| Domain Classes | 42 | 2109 |
| Jobs | 5 | 127 |
| Services | 18 | 2352 |
| Tag Libraries | 12 | 355 |
| Groovy Helpers | 158 | 5249 |
| Java Helpers | 4 | 207 |
| Unit Tests | 54 | 3258 |
| Integration Tests | 22 | 1790 |
| Scripts | 7 | 150 |
+----------------------+-------+-------+
| Totals | 362 | 19509 |
+----------------------+-------+-------+
A pity it doesn't have more stats like average/min/max LOC per class, test coverage, etc ;)
+----------------------+-------+-------+
| Name | Files | LOC |
+----------------------+-------+-------+
| Controllers | 17 | 1961 |
| Domain Classes | 14 | 843 |
| Jobs | 4 | 109 |
| Services | 5 | 831 |
| Tag Libraries | 2 | 789 |
| Groovy Helpers | 38 | 948 |
| Java Helpers | 5 | 445 |
| Unit Tests | 1 | 12 |
| Integration Tests | 1 | 33 |
| Scripts | 1 | 11 |
+----------------------+-------+-------+
| Totals | 88 | 5982 |
+----------------------+-------+-------+
Small app (about 25 stories)

Resources