Skip to main content

Featured

Building a gRPC Service with Nested Messages, Repeated Fields, and Oneof in Python

Introduction:  gRPC is a high-performance, open-source framework developed by Google for building efficient and scalable distributed systems. It provides a language-agnostic way to define and implement services using Protocol Buffers (protobuf) as the interface definition language. In this tutorial, we'll explore how to build a gRPC service in Python that incorporates advanced features such as nested messages, repeated fields, and oneof. These features allow us to create complex data structures and handle scenarios where multiple values or mutually exclusive fields are involved.   Prerequisites: Basic understanding of gRPC and Protocol Buffers. Python development environment set up.   Step 1: Define the Protocol Buffers (protobuf) File  Start by defining the service and message definitions in a proto file. Here's an example of a proto file named example.proto that defines a gRPC service with nested messages, repeated fields, and oneof: syntax = "proto3" ; package

Freeze Row and Column of Table Header with CSS

In case you have really big data and need to fit in on table with small user screen and you must show the header title, this below is the solution.

CSS

/* Use overflow:scroll on your container to enable scrolling: */
div.schedule {
height: 400px !important;
width: 100%;
overflow: auto;
}

/* Use position: sticky to have it stick to the edge
* and top, right, or left to choose which edge to stick to: */

.schedule thead th {
position: -webkit-sticky; /* for Safari */
position: sticky;
top: 0;
}

.schedule tbody th {
position: -webkit-sticky; /* for Safari */
position: sticky;
left: 0;
}

/* To have the header in the first column stick to the left: */
.schedule thead th:first-child {
left: 0;
z-index: 2;
}


/* Just to display it nicely: */

.schedule thead th {
background-color: #BBB;
z-index: 1;

}

.schedule tbody th {
background-color: #BBB;
}

.schedule table {
border-collapse: collapse;
}

.schedule td{
background: rgba(255, 185, 80, 0.466);
border: 1px solid #BBB
}
.schedule th {
border: 1px solid #BBB;
}

.schedule tr, .schedule td, .schedule th{
height: 100%;
}

.schedule th > div, .schedule td > div {
height: 100%; 
  width: 50px;
}
.schedule th > div {
background-color: #FFF;
}

complete works available at 

Train
CKP arr
CKP dep
TJS arr
TJS dep
PAB arr
PAB dep
PRI arr
PRI dep
PAS arr
PAS dep
CKM arr
CKM dep
PGB arr
PGB dep
CRA arr
CRA dep
HGL arr
HGL dep
CLH arr
CLH dep
102C


19:01
19:01
19:04
19:04
19:08
19:08
19:12
19:12
19:16
19:16
19:22
19:22
19:27
19:27
19:32
19:34


104C


12:22
12:22
12:26
12:26
12:30
12:30
12:34
12:34
12:38
12:38
12:45
12:47
12:53
12:53
12:59
13:01


106


18:11
18:11
18:14
18:14
18:18
18:18
18:22
18:22
18:26
18:26
18:32
18:32
18:37
18:37
18:41
18:41


10C


09:56
09:56
09:59
09:59
10:02
10:02
10:05
10:05
10:08
10:08
10:13
10:13
10:17
10:17
10:21
10:21


110A


14:54
14:54
14:58
14:58
15:02
15:02
15:06
15:06
15:10
15:10
15:16
15:16
15:21
15:21
15:27
15:29


122C


13:06
13:06
13:10
13:10
13:14
13:14
13:18
13:18
13:22
13:22
13:30
13:32
13:38
13:38
13:44
13:46


124A


22:59
22:59
23:02
23:02
23:06
23:06
23:10
23:10
23:14
23:14
23:20
23:20
23:25
23:25
23:29
23:29


128A


17:12
17:12
17:15
17:15
17:19
17:19
17:23
17:23
17:27
17:27
17:33
17:33
17:38
17:38
17:42
17:42


12A


17:49
17:49
17:52
17:52
17:56
17:56
18:00
18:00
18:04
18:04
18:09
18:09
18:14
18:14
18:18
18:18


130A


10:32
10:32
10:35
10:35
10:39
10:39
10:43
10:43
10:47
10:47
10:54
10:56
11:02
11:02
11:07
11:09


134C


07:18
07:18
07:21
07:21
07:25
07:25
07:29
07:29
07:33
07:33
07:39
07:39
07:44
07:44
07:49
07:51


136D


22:25
22:25
22:28
22:28
22:32
22:32
22:36
22:36
22:40
22:40
22:46
22:46
22:53
23:02
23:08
23:08


138C


00:32
00:32
00:36
00:36
00:41
00:41
00:46
00:46
00:50
00:50
00:57
00:57
01:02
01:02
01:08
01:08


144E


08:10
08:10
08:13
08:13
08:17
08:17
08:21
08:21
08:25
08:25
08:31
08:31
08:37
08:37
08:43
08:57


14A


08:24
08:24
08:27
08:27
08:30
08:30
08:34
08:34
08:38
08:38
08:43
08:43
08:47
08:47
08:51
08:51


150B


19:20
19:20
19:23
19:23
19:27
19:27
19:31
19:31
19:35
19:35
19:41
19:41
19:46
19:46
19:50
19:50


154C


08:39
08:39
08:42
08:42
08:45
08:45
08:49
08:49
08:53
08:53
08:59
08:59
09:04
09:04
09:08
09:08


156D


20:08
20:08
20:11
20:11
20:14
20:14
20:18
20:18
20:22
20:22
20:28
20:28
20:33
20:33
20:38
20:38


20F


11:08
11:08
11:11
11:11
11:15
11:15
11:19
11:19
11:23
11:23
11:29
11:29
11:35
11:35
11:40
11:42


2508A


06:34
06:34
06:38
06:38
06:43
06:43
06:49
06:49
06:54
06:54
07:02
07:02
07:08
07:08
07:14
07:14


2516


05:16
05:16
05:20
05:20
05:25
05:25
05:31
05:31
05:36
05:36
05:44
05:44
05:50
05:50
05:56
05:56


2518


15:15
15:15
15:20
15:20
15:25
15:25
15:31
15:31
15:36
15:36
15:44
15:44
15:51
15:51
15:57
15:57


2520


15:24
15:24
15:29
15:29
15:35
15:35
15:40
15:40
15:47
16:10
16:22
16:22
16:29
16:29
16:35
16:35


2522


01:50
01:50
01:54
01:54
01:59
01:59
02:04
02:04
02:13
02:40
02:51
02:51
02:57
02:57
03:03
03:03


2524


01:28
01:28
01:32
01:32
01:37
01:37
01:43
01:43
01:48
01:48
01:56
01:56
02:03
02:03
02:09
02:09


2526A


03:54
03:54
03:58
03:58
04:03
04:03
04:09
04:09
04:14
04:14
04:22
04:22
04:28
04:28
04:34
04:34


2528


11:30
11:30
11:34
11:34
11:39
11:39
11:45
11:45
11:50
11:50
11:58
11:58
12:04
12:04
12:10
12:10


254B


18:36
18:36
18:39
18:39
18:43
18:43
18:47
18:47
18:51
18:51
18:57
18:57
19:02
19:02
19:06
19:06


256A


15:42
15:42
15:46
15:46
15:51
15:51
15:55
15:55
15:59
15:59
16:05
16:05
16:10
16:10
16:16
16:18


260A


06:19
06:19
06:23
06:23
06:27
06:27
06:31
06:31
06:35
06:35
06:42
06:44
06:50
06:50
06:56
06:58


26A


18:45
18:45
18:48
18:48
18:51
18:51
18:55
18:55
18:58
18:58
19:03
19:03
19:08
19:08
19:12
19:12


2704


04:49
04:49
04:53
04:53
04:58
04:58
05:04
05:04
05:09
05:09
05:17
05:17
05:24
05:24
05:30
05:30


2748F


06:34
06:34
06:38
06:38
06:43
06:43
06:48
06:48
06:53
06:53
07:01
07:01
07:08
07:08
07:13
07:13


282


11:45
11:45
11:48
11:48
11:53
11:53
11:57
11:57
12:02
12:02
12:10
12:12
12:18
12:18
12:23
12:23


28A


21:06
21:06
21:09
21:09
21:13
21:13
21:17
21:17
21:21
21:21
21:27
21:27
21:32
21:32
21:36
21:36


292E


08:00
08:00
08:04
08:04
08:08
08:08
08:13
08:13
08:17
08:17
08:23
08:23
08:29
08:29
08:33
08:33


294B


23:57
23:57
00:00
00:00
00:05
00:05
00:09
00:09
00:14
00:14
00:20
00:20
00:26
00:26
00:31
00:31


296C


20:58
20:58
21:01
21:01
21:05
21:05
21:09
21:09
21:13
21:13
21:19
21:19
21:24
21:24
21:28
21:28


298


21:59
21:59
22:02
22:02
22:06
22:06
22:10
22:10
22:14
22:14
22:20
22:20
22:25
22:25
22:29
22:29


2B


09:26
09:26
09:29
09:29
09:32
09:32
09:35
09:35
09:38
09:38
09:43
09:43
09:47
09:47
09:51
09:51


320A


10:53
10:53
10:56
10:56
11:00
11:00
11:05
11:05
11:09
11:09
11:17
11:19
11:25
11:25
11:31
11:33


4B


21:41
21:41
21:44
21:44
21:47
21:47
21:50
21:50
21:53
21:53
21:58
21:58
22:02
22:02
22:06
22:06


7050A


12:40
12:40
12:44
12:44
12:48
12:48
12:53
12:53
12:57
12:57
13:05
13:07
13:13
13:13
13:19
13:21


72C


19:55
19:55
19:58
19:58
20:02
20:02
20:05
20:05
20:09
20:09
20:14
20:14
20:18
20:18
20:21
20:21


74A


17:04
17:04
17:07
17:07
17:11
17:11
17:15
17:15
17:19
17:19
17:25
17:25
17:30
17:30
17:34
17:34


76E


18:23
18:23
18:26
18:26
18:30
18:30
18:34
18:34
18:38
18:38
18:43
18:43
18:48
18:48
18:52
18:52


78A


20:20
20:20
20:23
20:23
20:26
20:26
20:30
20:30
20:34
20:34
20:39
20:39
20:44
20:44
20:48
20:48


82D


10:16
10:16
10:19
10:19
10:22
10:22
10:25
10:25
10:28
10:28
10:33
10:33
10:37
10:37
10:41
10:41


84D


22:36
22:36
22:38
22:38
22:41
22:41
22:45
22:45
22:48
22:48
22:53
22:53
22:57
22:57
23:00
23:00


86B


23:25
23:25
23:28
23:28
23:31
23:31
23:35
23:35
23:39
23:39
23:44
23:44
23:49
23:49
23:53
23:53


8C


21:51
21:51
21:54
21:54
21:57
21:57
22:00
22:00
22:03
22:03
22:08
22:08
22:12
22:12
22:16
22:16


KP/12774


02:08
02:08
02:11
02:11
02:15
02:15
02:19
02:19
02:23
02:23
02:29
02:29
02:34
02:34
02:39
02:39


Comments