server – How can I change Folder and File Ownership? CHOWN does not seem to work

I have a website, where the Web Files are currently owned by a variety of different people. I would now like to change the Folder/File ownership to reflect the following:

User: dummy.profile
Group: psacln

I initially logged in, via SSH, as the domain subscriber. Once logged in, I entered the following command:

chown -R dummy.profile:psacln *

This produced the following output:

chown: changing ownership : Operation not permitted

I then came across an article that stated that Folder and File ownership can only be changed if logged in as Root.

I then logged in as Root, where I could see the ‘$’ prefix had been replaced with an ‘#’. As I was logged in as Root, I obviously need to specify the domain location. As such, I entered the following command line:

chown -R dummy.profile:psacln /var/www/vhosts/

This time, I received the following response:

chown: cannot access '/var/www/vhosts/': No such file or directory.

Is anyone able to point out where I could be going wrong here?

Issue in debugging javascript file in chrome extension

I am trying to debug javascript based chrome extension. Below is the snapshot:

enter image description here

We see the path chrome-extension://bdfnheiehojbopajpblpiighmlbklhpl/control.js in the image above.
But I don’t see any directory named bdfnheiehojbopajpblpiighmlbklhpl in my system. I want to put breakpoint in other files than which are open in the image above. How to do it?.

Oracle – LRM-00109: could not open parameter file

Sometimes I get the following error:

SQL*Plus: Release Production on Mon Aug 10 16:59:04 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initimootstb.ora'

But I don’t understand that issue because I have a spfile configured:

(oracle@serverdg dbs)$ srvctl config database -d mootstb
Database unique name: mootstb
Database name: mootdb
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +data/mootstb/parameterfile/spfile.279.1047485987 <<SPFILE EXISTS IN LOCATION

Why the database is looking for init parameter file? just the spfile is not enough?

My workaround to resolv it is to create initINSTANCE_NAME.ora and put there a spfile=+data/mootstb/parameterfile/spfile.279.1047485987 but I guess this is not a correct way to use the spfile.

Compare and merge the multiple properties files and append the folder name to the file in java

I had the multiple properties files in subfolders and I need to compare and merge the key values pairs of files and append the folder name for the output file.


 RootFolder: ---------------------->Subfolder:AB-->                                            key1=common key value 1     
   key1=common key value 1                           key2=common key value of AB
   key2=common key value 2                         
   key1=test2 key value 1                             key1=test2 key value 1
   key2=test2 key value 2                             key2=test2 key value 2
   key3=test2 key value 3                             key3=test2 key value of AB

Output should be:
        key1=test2 key value 1                                    
        key2=common key value of AB         
        key3=test2 key value of AB  

Could you guys please help me on this . I have tried the below code

 String rootfile="/workspace/";
 String testfile="/workspace/";
 FileReader rootCommon=new FileReader(rootfile);
 FileReader roottest=new FileReader(testFile);
 Properties rootTest = new Properties();
 Properties merged = new Properties();

magento2 – How to use orderCollectionFactory and productCollectionFactory together in Model file?

I have created a custom attribute in product and saved a string in that value and I want if some one order those product of same value string i want that collection of product.
So, i want to use

MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory,
MagentoSalesModelResourceModelOrderCollectionFactory $orderCollectionFactory

these together is there a way to get these product.

python – Load multiple worksheets from Excel file to multiple DataFrames

The spreadsheet can be found just above the references section at this link.

It’s a publication for STR DNA locus frequencies to calculate match probabilities. I’d like to build a match probability calculator and scale it up to do hundreds of thousands of calculations rather than just one. The first step is loading the frequencies into memory and the subject of this code. I figured a dataframe for each population set would be alright.

The first row in each worksheet is just a population label. It can be ignored.

The second row is the header: The first column “Allele” is the STR allele call. This is what will be compared to for matching. This will typically be an integer but sometimes can have a decimal of .1, .2, or .3 most commonly. Sometimes they are a string with a greater than or less than symbol (e.g.; “<9.2”, “>17”) although I don’t know if there are any in the excel file.

The 2nd through 25th columns are the different locations that are tested. Each is independent.

I will ignore anything after the 25th column and anything past the last row of frequencies. Most of the data points within these bounds are empty. They will be filled with what is called the minimum allele frequency. If you are interested in anything further I’d be happy to chat, but it’s probably not pertinent to the discussion at hand.

I’m sure there is a more elegant way to do this and probably a quicker way to do it. That’s why I am here. If there’s a better structure to put this in, or a faster/more elegant way to do it, please let me know. This is my first stab at it. The frames take about 3 seconds to load all the data. I’m guessing it should be much quicker than that. Anyway, here’s my code.

# -*- coding: utf-8 -*-
import pandas as pd

#create dataframes for population tables
caucasian_freq = pd.DataFrame()
swh_freq = pd.DataFrame()
seh_freq = pd.DataFrame()
agg_aa_freq = pd.DataFrame()
aa_freq = pd.DataFrame()
bah_freq = pd.DataFrame()
jam_freq = pd.DataFrame()
trin_freq = pd.DataFrame()
cham_freq = pd.DataFrame()
fili_freq = pd.DataFrame()
apa_freq = pd.DataFrame()
nav_freq = pd.DataFrame()

#get the file name 
expanded_frequencies = '1-s2.0-S1872497316301429-mmc1.xlsx'

#for the number of columns containing frequencies
data_columns = (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25)
#for minimum allele frequency 
min_freq = (0.0124, 0.0120, 0.0095, 0.0046, 0.012, 0.0159, 0.0141, 0.0316, 0.0263, 0.0550, 0.0130, 0.0175)

#import the different freq sets - ignore the first row, don't read anything past column 25
caucasian_freq = pd.read_excel(expanded_frequencies, "Caucasian", header=1, usecols= data_columns)
swh_freq = pd.read_excel(expanded_frequencies, "SW Hispanic", header=1, usecols= data_columns)
seh_freq = pd.read_excel(expanded_frequencies, "SE Hispanic", header=1, usecols= data_columns)
agg_aa_freq = pd.read_excel(expanded_frequencies, "African Amer Bahamian Jamaican", header=1, usecols= data_columns)
aa_freq = pd.read_excel(expanded_frequencies, "African American", header=1, usecols= data_columns)
bah_freq = pd.read_excel(expanded_frequencies, "Bahamian", header=1, usecols= data_columns)
jam_freq = pd.read_excel(expanded_frequencies, "Jamaican", header=1, usecols= data_columns)
trin_freq = pd.read_excel(expanded_frequencies, "Trinidadian", header=1, usecols= data_columns)
cham_freq = pd.read_excel(expanded_frequencies, "Chamorro", header=1, usecols= data_columns)
fili_freq = pd.read_excel(expanded_frequencies, "Filipino", header=1, usecols= data_columns)
apa_freq = pd.read_excel(expanded_frequencies, "Apache", header=1, usecols= data_columns)
nav_freq = pd.read_excel(expanded_frequencies, "Navajo", header=1, usecols= data_columns)

#truncate rows without data - the row after the last row of data is a duplicate of 
#the header row. Use it to find the last row of data
caucasian_freq = caucasian_freq.truncate(after=caucasian_freq.loc(caucasian_freq('Allele') == 'Allele').index(0)-1)
swh_freq = swh_freq.truncate(after=swh_freq.loc(swh_freq('Allele') == 'Allele').index(0)-1)
seh_freq = seh_freq.truncate(after=seh_freq.loc(seh_freq('Allele') == 'Allele').index(0)-1)
agg_aa_freq = agg_aa_freq.truncate(after=agg_aa_freq.loc(agg_aa_freq('Allele') == 'Allele').index(0)-1)
aa_freq = aa_freq.truncate(after=aa_freq.loc(aa_freq('Allele') == 'Allele').index(0)-1)
bah_freq = bah_freq.truncate(after=bah_freq.loc(bah_freq('Allele') == 'Allele').index(0)-1)
jam_freq = jam_freq.truncate(after=jam_freq.loc(jam_freq('Allele') == 'Allele').index(0)-1)
trin_freq = trin_freq.truncate(after=trin_freq.loc(trin_freq('Allele') == 'Allele').index(0)-1)
cham_freq = cham_freq.truncate(after=cham_freq.loc(cham_freq('Allele') == 'Allele').index(0)-1)
fili_freq = fili_freq.truncate(after=fili_freq.loc(fili_freq('Allele') == 'Allele').index(0)-1)
apa_freq = apa_freq.truncate(after=apa_freq.loc(apa_freq('Allele') == 'Allele').index(0)-1)
nav_freq = nav_freq.truncate(after=nav_freq.loc(nav_freq('Allele') == 'Allele').index(0)-1)

#fill in nas with the minimum allele frequency
caucasian_freq.fillna(min_freq(0), inplace = True)
swh_freq.fillna(min_freq(1), inplace = True)
seh_freq.fillna(min_freq(2), inplace = True)
agg_aa_freq.fillna(min_freq(3), inplace = True)
aa_freq.fillna(min_freq(4), inplace = True)
bah_freq.fillna(min_freq(5), inplace = True)
jam_freq.fillna(min_freq(6), inplace = True)
trin_freq.fillna(min_freq(7), inplace = True)
cham_freq.fillna(min_freq(8), inplace = True)
fili_freq.fillna(min_freq(9), inplace = True)
apa_freq.fillna(min_freq(10), inplace = True)
nav_freq.fillna(min_freq(11), inplace = True)

package management – Ubuntu Software Center (“Software” program) and “Snap Store” missing on fresh Ubuntu 20.04 install (& can’t install *.deb files from GUI file manager)

For some reason, both my Ubuntu Software Center (now simply called “Software”) and the Snap Store weren’t present on my Fresh Ubuntu 20.04 install. To install them, simply run the following two commands:

sudo apt install gnome-software  # "Software"
snap install snap-store          # Snap Store

Here’s what their icons look like now when I press the Super key (Windows key on a PC keyboard, or Command key on a Mac running Linux), then search for them:

Ubuntu Software Center (now just called “Software”):

enter image description here

Ubuntu “Snap Store”:

enter image description here

Now, to install a *.deb file using the GUI file manager, such as nautilus (default), or nemo (my preferred choice), simply right-click the *.deb file and go to –> Properties –> “Opens With” tab –> select “Software Install” (which is now available since you just installed gnome-software) –> and click “Set as default” –> Close.

enter image description here

Now you can just double-click the *.deb file in your GUI file manager to install it!

Note: you might also consider trying the gdebi package installer, as described here: Problem installing .deb in Software Install Ubuntu 20.04. Apparently, in some cases where the “Software Install” GUI option fails, and you would have to otherwise manually run sudo dpkg -i myfile.deb to install the *.deb file, the “GDebi Package Installer” GUI option works.

Other references:

  1. This answer helped me identify the existence of gnome-software and the snap-store: Ubuntu Software doesn’t open in Ubuntu 20.04

8 – Views_pre_render How do I get a file’s path url if I only have the file name?

I have a dynamically created Views listing page where I display fields from “Collection Items” node type in this order:

  1. Item Title
  2. Item Status
  3. Date Stamp
  4. Document (uploaded file. I’m only getting the filename here)

My goal right now is to take the path of the uploaded document and use it as a link in the title. Like so

<a href="path/to/file"> Item Title </a>

I’m trying to achieve this with hook_views_pre_render(), but am stuck just testing out some code I found from here.

Here is my code:

use DrupalCoreRoutingRouteMatchInterface;
use DrupalcollectionsEntityCollectionsEntityInterface;
use DrupalcollectionsEntityCollectionsEntityType;

function collections_views_pre_render(&$view){
  $results = $view->result;
  $view_id = $view->storage->id();
  $current_display = $view->current_display;

  if(strpos($view_id,"collection__" ) > -1 && $current_display == "default_page"){
  foreach ($results as $key => $result){

    //prints 0123456
      echo $key;

      //breaks the site. Gets message "The website encountered an unexpected error. Please try again later."
      $parent_id_value =  $result->_entity->parent_id->getValue()(0)('value');
      $parent_type_value =  $result->_entity->parent_type->getValue()(0)('value');
      $media_field= $result->_entity->field_media_field->getValue()(0)('value');


Once I got the file’s path, I would then be trying the solution offered here:

$link = DrupalCoreLink::createFromRoute($parent_id_value, 'entity.node.canonical', ('node' => $parent_id_value));