Trying to Update an list inside a forum using arrayForm

I’m trying to update my playlist form that contains normal input and an arrayform that contains a list of songs.
when I try to change the two input it works but when I try to change anything in the array all the songs inside the playlist get deleted

before updating the array list:

enter image description here

after I press on edit here’s what I get:

enter image description here

and when I try changing anything in the ArrayList I get this

enter image description here

and when I try to edit it once more I get this
enter image description here
and an error :

ERROR TypeError: Cannot read property ‘map’ of undefined

I will leave bellow all the function I used :
this in my main component:
editPlaylist(playlist: Playlist, index: number) {
const dialogRef = this.dialog.open(DialogComponent, {
width: ‘900px’,
data: {
songs:this.songs,

        operation: 'edit',
        playlistData: playlist,
        position: index
      }
    });

    dialogRef.afterClosed().subscribe(result => {
      if (result) {
         this.playlists[index] = playlist;
        this.songs= result.song;
        this.playlists[index].name = result.name;
        this.playlists[index].description = result.description;



        this.playlists[index].songs = result.song;

      }
    });
  }

and this in my dialog componenets
ngOnInit(): void {

   this.form = new FormGroup(
      {
        name:new FormControl('', Validators.required),
        description:new FormControl('',Validators.required),
        title:new FormControl('',Validators.required),
        artist:new FormControl('',Validators.required),
        duration:new FormControl(0,[Validators.required , Validators.min(0)]),
        songs:  this.formBuilder.array([ this.createSong() ])


      }
    )
    if (this.data.operation === 'edit') {
      this.form = this.formBuilder.group({
        name: [this.data.playlistData.name, Validators.required],
        description: [this.data.playlistData.description, Validators.required],
        songs: this.formBuilder.array(
          this.data.playlistData.songs.map(song => this.formBuilder.group({
            title: [song.title, Validators.required],
            artist: [song.artist, Validators.required],
            duration: [song.duration, Validators.compose([Validators.required, Validators.min(0)])],
          }))
        ),
      })

    }
      }

please if someone is familiar with arrayform help me

Go to Source
Author: Nisrine Hafi

Corrupted ext4 disk with windows disk manager

I am the main linux person in our team (which is a sad state of affairs), and am trying to fix a problem created by one of our windows users.

They had a 5TB drive with a single ~5TB ext4 partition with a bunch of video files. They weren’t the one who set up the drive, so when they couldn’t access it in windows they went into disk manager and ” converted to GPT” in windows disk manager. Now it isn’t accessible in ubuntu either.

Disk: Seagate ST5000DM

fdisk reports: the wrong disk size

Disk /dev/sdg: 561.5 GiB, 602934566912 bytes, 1177606576 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa6985519

Testdisk reports the wrong disk size: >Disk /dev/sdg – 602 GB / 561 GiB – ST5000DM 000-1FK178

fsck reports:

fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks…
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdg

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193
or
e2fsck -b 32768

Found a PMBR partition table in /dev/sdg

Gdisk reports:
Caution: The CRC for the backup partition table is invalid. This table may
be corrupt. This program will automatically create a new backup partition
table when you save your partitions.

Problem: The secondary header’s self-pointer indicates that it doesn’t reside
at the end of the disk. If you’ve added a disk to a RAID array, use the ‘e’
option on the experts’ menu to adjust the secondary header’s and partition
table’s locations.

Problem: Disk is too small to hold all the data!
(Disk size is 1177606576 sectors, needs to be 9767541168 sectors.)
The ‘e’ option on the experts’ menu may fix this problem.

Problem: GPT claims the disk is larger than it is! (Claimed last usable
sector is 9767541134, but backup header is at
9767541167 and disk size is 1177606576 sectors.
The ‘e’ option on the experts’ menu will probably fix this problem

Problem: partition 1 is too big for the disk.

Partition(s) in the protective MBR are too big for the disk! Creating a
fresh protective or hybrid MBR is recommended.

Identified 6 problems!

File recovery programs can still read the files, so I can fall back on that if I have to, but it will take forever and lead to endless sorting and renaming of files. I am hoping I can ” fix” the partition table to be able to mount the drive and immediately back up the data onto a secure, backed up location.

Thanks for any assistance. Any guidance on what to try is appreciated. I haven’t had to deal with this kind of thing before, my linux usage is pretty vanilla.

Go to Source
Author: Chris Hall

validationRegex to accept/validate listed characters

5 to 16 alpha or alphanumeric to include special characters such as:
◦*Hyphen ( – )
◦*Slash ( / )
◦*Backslash ( )
◦*Asterisk ( * )
◦*Dollar Sign ( $ )
◦*Period ( . )
◦*Ampersand ( & )
◦*Comma ( , )
◦*Number Sign ( # )
◦*Open Parenthesis ( ( )
◦*Closed Parenthesis ( ) )
◦*Colon ( : )

Current code example:

PASSWORD: {id: password, label: PASSWORD, name: PASSWORD, validationRegex: ^[a-zA-Z0-9]+$, minLength: 5, maxLength: 16, errorMsg: message}

Go to Source
Author: Marcus

Why can’t expose my local port publicly with ssh remote forwording via vps?

I build a simple web on local pc,want to expose my local port with ssh remote forwording via my vps.
Setting in my vps.

vim /etc/ssh/sshd_config
GatewayPorts yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

systemctl restart sshd

Open port 8001 on my vps.

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

Build a ssh remote port forwording on my local pc.

ssh -fNR  0.0.0.0:8001:localhost:80  root@vps_ip

Check port 8001 on my vps.

netstat -plant  | grep  8001
tcp        0      0 127.0.0.1:8001          0.0.0.0:*               LISTEN      797/sshd: root      
tcp6       0      0 ::1:8001                :::*                    LISTEN      797/sshd: root  

It is ready to listen on 8001.
To ping the vps_ip from other pc(not the previous local pc),shows that connection between pc is in good status.
Input http://vps_ip:8001 in other pc.

The connection was reset

The connection to the server was reset while the page was loading.

    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer’s network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

Why can’t expose my local port publicly with ssh remote forwording via vps?

Go to Source
Author: it_is_a_literature

License Management

I have a desktop app that I want to sell it’s licenses.
I’m looking for an automated way to create and manage the licenses.
I also want to have something like a panel that shows me which user has which version and such stuff.
I prefer not to implement a client/server pattern myself. In other words I’m looking for something ready to use. Any advice?

Go to Source
Author: Sepehr Nematollahi

Foreign keys to primary tables or nested table

In this hypothetical example should the foreign key constraint setup for the ProductId and UserId columns in the ProductUserCommentAction table be referencing the Product/User tables as shown in the first diagram OR is it OK for those columns to reference the ProductUserComment table as shown in the second diagram?

I like how it’s setup in the second diagram as it reduces the spider web in visualizations.

Are there any downsides to this second approach?

enter image description here

Versus

enter image description here

Go to Source
Author: TugboatCaptain

Drawbacks of having pruned and collapsed packets

I am a newbie in networking field, I come across a note that we should not have pruned packets and collapsed packets, if we have, we should have to optimize the system.

But the note (neither the internet) didn’t provide much context on why we shouldn’t have pruned and collapsed packets and what problems that it makes?

$ netstat -s | grep socket      
299 packets pruned from receive queue because of socket buffer overrun
2701 TCP sockets finished time wait in fast timer
5 delayed acks further delayed because of locked socket
92 packets collapsed in receive queue due to low socket buffer

Here, you can see I have 299 packets which were pruned and 92 packets were collapsed.

Is it bad? if yes, why? what issues I will face due to this?

Go to Source
Author: smc

How can your BIOS be infected or hacked and Can a BIOS virus be used to “steal data”?

I know that BIOS can get virus but it’s very rare, but it seems to me it’s pretty impossible or improbable for a virus to creep into your BIOS via normal computer use.
Let’s say I’m using windows 10, even if I go as far as downloading a malware on my windows 10, it would seem that the worst damage it can do it to my windows 10 itself, not the BIOS, is that accurate? (Or at least, it’s incredibly difficult).
If I don’t deliberately take a usb drive, and go into BIOS to m-flash it, how can I possibly infect a BIOS? So similarly, since your network would only work in the OS level, how can anyone possibly modify your BIOS by hacking your operating system?

And in the other direction, Supposed by some means my BIOS was infected with some virus, how can anyone possibly steal information on an operating system using the BIOS when the BIOS itself cannot be connected to the internet?

It seems to me the damage a BIOS can do is very local.

Go to Source
Author: Ecotistician

Can a kubernetes pod be forced to stay alive after its main command fails?

After starting a long running kubernetes job we’ve found that the final result will fail to upload to its final location. We would like to force the pod to stay open after the main process fails so we can exec in and manually process the final results. If the main process fails and the pod exits before uploading the final result we will lose a large amount of time to re-process the job.

Is there a way to ensure the pod stays alive manually?

Go to Source
Author: David Parks

Why is Git Windows committing on merge, even with merge.commit=no?

I am using Git Bash in Windows 10, version: git version 2.25.1.windows.1. Let me know if I need to be more specific. I am also using GitExtensions but my question is around merging from Git Bash.

When I merge from there, i.e.:

git merge feature-branch-name

it commits even though, as far as I can tell, all three of my Git config files are set otherwise. I know I can specify --no-commit in the command but I would like not to have to do that.

From the source code directory, git config --list produces the output below, where it shows three times that merge.commit=no.

diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=false
core.fscache=true
core.symlinks=false
core.editor="C:\Program Files\Notepad++\notepad++.exe" -multiInst -notabbar -nosession -noPlugin
credential.helper=manager
merge.ff=no
merge.commit=no
core.editor="C:/Program Files (x86)/GitExtensions/GitExtensions.exe" fileeditor
user.email=craig@wereallconnected.ca
user.name=Craig Silver
merge.tool=winmerge
merge.ff=no
merge.commit=no
mergetool.winmerge.path=C:/Program Files (x86)/WinMerge/winmergeu.exe
mergetool.winmerge.cmd="C:/Program Files (x86)/WinMerge/winmergeu.exe" -e -u  -wl -wr -fm -dl "Mine: $LOCAL" -dm "Merged: $BASE" -dr "Theirs: $REMOTE" "$LOCAL" "$BASE" "$REMOTE" -o "$MERGED"
pull.rebase=false
fetch.prune=false
rebase.autostash=false
diff.guitool=winmerge
difftool.winmerge.path=C:/Program Files (x86)/WinMerge/winmergeu.exe
difftool.winmerge.cmd="C:/Program Files (x86)/WinMerge/winmergeu.exe" -e -u "$LOCAL" "$REMOTE"
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.sshcommand=ssh
merge.ff=no
merge.commit=no
submodule.active=.
remote.origin.url=REMOVED
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.puttykeyfile=REMOVED
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.FMS-1203_data-structures-algorithms-string-matching.remote=origin
branch.FMS-1203_data-structures-algorithms-string-matching.merge=refs/heads/FMS-1203_data-structures-algorithms-string-matching
branch.FMS-1205_recency-trumps-frequency-for-small-fr-diff.remote=origin
branch.FMS-1205_recency-trumps-frequency-for-small-fr-diff.merge=refs/heads/FMS-1205_recency-trumps-frequency-for-small-fr-diff
branch.FMS-1204_debug-window.remote=origin
branch.FMS-1204_debug-window.merge=refs/heads/FMS-1204_debug-window

Also, git config --get merge.commit outputs no.

FYI, GitExtensions behaves correctly: merging there does not commit.

What am I missing?

Go to Source
Author: Craig Silver

is there a better way to search for shell-script commands in google

Many times , i was stuck in shell script commands and couln’t even find it on google, when i directly type them in the search.Is there any way to search for , or any other reference site where i can get most information on the commands.
could you please explain what these does.

1) -inv ${SITE}

2) ${first}/* ${second}

Go to Source
Author: nikhil2000

The following information may help to resolve the situation in kali linux [closed]

$ sudo apt-get dist-upgrade
[sudo] password for somasekhar: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Error!
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Breaks: libgcc-9-dev (< 9.3.0-5~) but 9.2.1-22 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

How do I solve the error?

Go to Source
Author: somA SekhaReddy

Circumventing Local Subnet Control Restrictions with Iptables

I have three wireless speakers that, for security reasons, only permit local subnet control. My network is setup such that the wired and wireless devices are on separate subnets, so right now the speakers cannot be used from the wired clients. I can setup a Ubuntu 18.04 virtual machine with interfaces in both subnets, but am not familiar enough with iptables to configure the forwarding correctly.

The speakers have IP addresses 192.168.100.200, 192.168.100.201, and 192.168.100.202. The wired clients exist in the 192.168.50.0/24 subnet. Each speaker needs to have two ports (8000, 9000) reflected. My reflection virtual machine has interfaces in both subnets, 192.168.100.250 and 192.168.50.250. What is the correct iptables setup to do the following:

192.168.50.250:8000 -> 192.168.100.200:8000 via 192.168.100.250
192.168.50.250:8001 -> 192.168.100.201:8000 via 192.168.100.250
192.168.50.250:8002 -> 192.168.100.202:8000 via 192.168.100.250
192.168.50.250:9000 -> 192.168.100.200:9000 via 192.168.100.250
192.168.50.250:9001 -> 192.168.100.201:9000 via 192.168.100.250
192.168.50.250:9002 -> 192.168.100.202:9000 via 192.168.100.250

Does this setup make sense? Short of changing out the speakers for ones that are more compatible with my network setup, is there an easier way to do this that I did not think of?

Thanks!

Go to Source
Author: user986713

How do I mitigate replay attacks when talking about actions that shouldn’t happen twice?

A nonce is supposed to first help me against CSRF and help against replay attacks is just a bonus if I “personalize” the nonce to something like pay-user-{id}, but here’s the problem – if my link looked like /wordpress/admin_ajax.php?action=pay-user&id=20&security=ej3548 I have 2 cases to take care of:

  1. I created a nonce without the specific user ID, pay-user – if an attacker obtains the nonce, he can make me click that link and pay any user.
  2. I created a nonce with the specific user ID, pay-user-{id} – if an attacker obtains the nonce, he can only make me replay that request, since the nonce was made to verify that specific (to {id}) action.

But that’s still an issue in a lot of cases, paying someone is a prime example. I can’t be made to pay someone else, but if I make that request 10 times, I’ll pay that specific person 10 times.

Is there no specific “per request” hashing?

What to do?

Go to Source
Author: Daniel Simmons