python – Matplot lib : scalling of the axes on bar plot

I am using following script to plot cluster populations using two lists contained x and y data

# calculate clusters using encore method
cluster = encore.cluster(u, select="all", superposition=False, method=encore.DBSCAN(eps=1))

# make list of population of each cluster;
cluster_sizes= (len(c) for c in cluster.clusters)
# make list of the cluster number;
cluster_numbers=(x+1 for x in range(0,len(cluster_sizes)))

# plot data
plt.bar(cluster_numbers, cluster_sizes)
plt.title('Cluster Populations')
plt.grid(True)
#plt.style.use('ggplot')
plt.savefig(f'clusters.png')
plt.close()

The problem that sometimes on the resulted bar plot the values are ranged by 0.5 along both X and Y (see the enclosed picture as the example). How I could plot only integers along the both axes? In my example graph the X should be scalled from 0 to 20 (avoiding 0.5 spacings) and the Y from 0 to 18 (thus enter image description hereavoiding these unused 0.5 spacings)

signrawtransaction – Can we sign a psbt raw tx having multiple inputs created from BTC node with bitcoinjs lib?

Due to secruity reasons, unavailablity of private keys on my end and as per project requirements I need to build back end apis where I will provide a PSBT raw transaction hex (having multiple inputs) to front end, On front end, user will add their mnemonics and will sign all the psbt inputs individually, once all inputs are signed then a final signed raw tx hex get created.

Upon receiving signed hex I will broadcast it to the btc node and return the txid to the front end.

I am unable to find any way to sign psbt raw transaction inputs ( which is generated from btc node ) using “bitcoinjs-lib”.

Could anyone please suggest how can I achieve this.

Regards,
Giri

innodb – What files of Mysql lib directory safe to be deleted and to be recreated with innodb_file_per_table settings?

I have brand new mysql 8 setup and installed on a centos 7. Unfortunately I forget to set innodb_file_per_table. I would like to dump the database and recreate with the innodb_file_per_table settings. I have google and its say its safe to delete ibdata1 and ib_logfile0 and ib_lofile1. But I could see many other files in it example binlog.000001, binlog.index, .pem file. mysql.ibd, #innodb_temp,undo_001, undo_002, performance_schema, mysql, mysql.sock,mysqlx.sock, sys etc. My question is that which are the files I should delete to get a fresh setup with my new settings?

javascript – POST archivo .txt usando lib. “requests” – Python

Estoy intentando transformar un script de nodeJS a Python. El script manda un archivo .txt a un servidor, luego dicho servidor contiene un microservicio encargado de transformar los datos y los inserta a una base de datos.

La parte del script encargada del envío (en javascript) es:

const url = `${proto}://${host}/api/lecture/file`;
 console.log('Posting to:', url);
  const stream = createReadStream(qsFileName);
  const form = new FormData();
  form.append('files', stream);
  const res = await fetch(url, {
    method: 'POST',
    body: form,
  });
  console.log('Status:', res.status);
  console.log('Response:nn', await res.json());
};

Estoy intentando emular esto en python usando la libreria “requests” de la siguiente manera:

import requests

fileName = 'ejemplo.txt'
url = 'https://hostname.com/api/lecture/file'
file = open('fileName', 'rb')
req = requests.post(url, data= file)
print(req.status_code)

El código de respuesta del requests es 404.

No se si es debido a un problema del formato del data en el requests.post o si debería hacerlo de otra forma, de ser así espero alguien me pueda orientar.

Saludos

linux – R “RPostgrSQL” package fails to install on Centos 8 (as `lib` is unspecified)

I want to install the R package RPostgresql to connect to my database on Centos 8. When I run

> install.packages("RPostgreSQL")

in the terminal I get the following error:

Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
Warning in install.packages("RPostgreSQL") :
  'lib = "/usr/lib64/R/library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel)

From the message I am gathering that I need to setup a personal library but I am not sure about the implications. What I am trying to do is run a r script e.g. new.r that will be called from another bash script.

new.r:

require("RPostgreSQL")

pw <- {
  "XXXX"
}

drv <- dbDriver("PostgreSQL")

con <- dbConnect(drv, dbname = "crex",
                 host = "localhost", port = 5432,
                 user = "postgres", password = pw)
rm(pw) 

dbExistsTable(con, "work")

Can someone please help on this?

sharepoint server – unable to upload Password protected files(Word, Excel) to the SP2013 Doc lib

Have you tried removing the password protection, upload file, then reinstate password protection?

Although with Sharepoint, assuming it’s managed correctly(!), you can remove the need for password protection on individual files. Instead the protection is managed through the use of Sharepoint Groups.

If only one user is allowed access to a group of files. Make a new document library and customise the permissions for that document library. This will involve ‘breaking the inheritance’ for that document library; you can then customise it – i.e. remove the standard user groups that can normally access other document libraries on that site.

Further reading

Link1 – Sharepoint Maven, one of my favourite blogs.

Link2 – same site

Link3 – Bobby Chang, Permissions Worst Practises.

Link4 – Microsoft, Understanding Permissions Levels in Sharepoint.

Link 5 – Microsoft, detailed break-down of out-of-the-box Permissions groups. Useful as a resource for when you are having doubts about what a ‘read only’ or ‘read-write’ permission does.

libraries – CLI and Lib package, where to put module loading code

My Software contains a lib package, a cli package and an arbitrary number of plugin packages.

The plugin packages do the algorithmic work.

The lib package basically just executes the plugins and passes the result of each plugin to the next plugin and exposes the libs functionality to the cli package. The cli package reads the configuration file and passes the configuration(which plugins to execute in which order) to the lib package. The lib is basically a single line of typescript code that uses the compose/pipe/flow function from functional programming and looks like this:

export const bumpup: (plugins: Plugin())=> BumpupData = (plugins) => flow(...plugins)();

The reason for making an extra package for a single line is

  1. Eventually the lib should be usable without the cli by other packages
  2. The lib provides the interfaces for plugins and I don’t want plugin authors to depend on the cli package to write their plugins, especially for the case where the lib is used without the cli

The plugins are read from the configuration and are loaded dynamically at runtime from the node_modules folder with the dynamic import from ES6.

That module loading code takes the name of the package that should be loaded and returns a function complying to the plugin interface that can be passed to the lib function.

In which package does the code for loading the modules belong and why?
What are reason for and against putting that code in one of the packages.
I have the feeling that the pattern of separating software in cliand lib package is very common, is there a name for that pattern so I can read more on that pattern?

c++ – Visual Studio 2019 – Form dentro da Lib não mostra quando adiciono imagem

Olá, fiz um form dentro da minha lib, para mostrar um alerta em um determinado momento, porém se eu adicionar uma imagem ou até mesmo alterar o ícone do form já não é mais possível mostrar o form.

O form está dentro de uma .lib, e eu estou chamando a .lib dentro de um console.

Estou fazendo dessa maneira para criar o form:

int UIMain()
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    MyForm^ NEWUI = gcnew MyForm();
    Application::Run(NEWUI);
    return 1;
}

É como se estivesse limitado para carregar um determinado tamanho da memória, não sei qual é o erro.

Depois de depurar, é esse o erro que estou tendo:
System.Resources.MissingManifestResourceException: ‘Could not find any resources appropriate for the specified culture or the neutral culture. Make sure “FormUI.MyForm.resources” was correctly embedded or linked into assembly “MyConsoleWindow” at compile time, or that all the satellite assemblies required are loadable and fully signed.’