nocin.eu

Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[nodejs] workspaces

If you have subdirectories or additional applications which have its own package.json file, you can add them via the workspaces setting to your main project.

 {
  "name": "my-project",
  "workspaces": [ 
     "./app/*"
   ]
}

When running npm install it will now also install the dependencies of all projects in the app folder.

[SAP] Reset different SAP buffers

https://wiki.scn.sap.com/wiki/display/Basis/How+to+Reset+different+SAP+buffers

    /$SYNC - Resets the buffers of the application server
    /$CUA - Resets the CUA buffer of the application server
    /$TAB - Resets the TABLE buffers of the application server
    /$NAM - Resets the nametab buffer of the application server
    /$DYN - Resets the screen buffer of the application server
    /$ESM - Resets the Exp./ Imp. Shared Memory Buffer of the application server
    /$PXA - Resets the Program (PXA) Buffer of the application server.
    /$OBJ - Resets the Shared Buffer of the application server.

[ABAP] Filter table using VALUE FOR

DATA(lt_result) = VALUE z_type( FOR line IN lt_table
                                WHERE ( value IN lr_values )
                                ( field = ls_line-value ) ).

[ABAP] Selection Screen Tabbed Block

SELECTION-SCREEN BEGIN OF BLOCK bl4 WITH FRAME TITLE TEXT-t01.
SELECTION-SCREEN BEGIN OF TABBED BLOCK tbl FOR 10 LINES.
SELECTION-SCREEN TAB (15) tbl_tab1 USER-COMMAND tab1 DEFAULT SCREEN 1001.
SELECTION-SCREEN TAB (15) tbl_tab2 USER-COMMAND tab2 DEFAULT SCREEN 1002.
SELECTION-SCREEN TAB (15) tbl_tab3 USER-COMMAND tab3 DEFAULT SCREEN 1003.
SELECTION-SCREEN END OF BLOCK tbl.
SELECTION-SCREEN END OF BLOCK bl4.

* Subscreen 1001 Tab1
SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.
PARAMETERS p_bool1 TYPE abap_bool AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1001.

* Subscreen 1002 Tab2
SELECTION-SCREEN BEGIN OF SCREEN 1002 AS SUBSCREEN.
PARAMETERS p_btp1 TYPE flag RADIOBUTTON GROUP rbg DEFAULT 'X'.
PARAMETERS p_btp2 TYPE flag RADIOBUTTON GROUP rbg.
PARAMETERS p_btp3 TYPE flag RADIOBUTTON GROUP rbg.
SELECTION-SCREEN END OF SCREEN 1002.

* Subscreen 1003 Tab3
SELECTION-SCREEN BEGIN OF SCREEN 1003 AS SUBSCREEN.
PARAMETERS p_bool2 TYPE flag AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1003.

INITIALIZATION.

  " provide tab names
  tbl_tab1 = 'Tab1'.
  tbl_tab2 = 'Tab2'.
  tbl_tab3 = 'Tab3'.

  " set active tab (activetab value must be in uppercase)
  tbl-activetab = 'TAB2'.
  tbl-dynnr     = 1002.
  tbl-prog      = sy-repid.

AT SELECTION-SCREEN.

  " click on tabstrip event
  CASE sy-ucomm.
    WHEN 'TAB1'.
      MESSAGE 'TAB1' TYPE 'S'.
    WHEN 'TAB2'.
      MESSAGE 'TAB2' TYPE 'S'.
    WHEN 'TAB3'.
      MESSAGE 'TAB3' TYPE 'S'.
  ENDCASE.

[CAP] min and max functions

Since there is nothing in the official CAP documentation about min and max functions, I figured out the following syntax:

    const result1 = await cds.run(`SELECT *, MAX(seqNr) FROM ${myTable} LIMIT 1`) //returns array

    const result2 = await SELECT.one.from(myTable, [`MAX(seqNr)`]).columns('*') //returns object 

    const result3 = await SELECT.one.from(myTable).columns('MAX(seqNr)') //returns object containing only the max counter value

[Proxmox] Upgrade 7.4 to 8.0 – Failed to run lxc.hook.pre-start for container

After updating my Proxmox Server to PVE8.0, suddenly two lxc containers did not start anymore.

root@pve:~# pct start 192
run_buffer: 322 Script exited with status 2
lxc_init: 844 Failed to run lxc.hook.pre-start for container "192"
__lxc_start: 2027 Failed to initialize container "192"
startup for container '192' failed

I tried to view the error.log but couldn’t find any helpful information.

lxc-start -lDEBUG -o error.log -F -n 192

When googling, I stumbled across this reddit post. Although the issue was a bit different, I tried the recommended steps. The first command, directly led me to the right direction…

root@pve:~# pct mount 192
mounting container failed
directory '/mnt/nfs/data/folder' does not exist

For whatever reason, after restarting proxmox it did not mount the nfs shares properly on the host. And of course, after this hint, I noticed that both containers were trying to mount some of these folders, which were actually nfs shares from my NAS. A simple mount -a on the host fixed it immediately. Besides of this little problem, everything went well with the proxmox upgrade!