An unexpected error occurred: "EISDIR: illegal operation on a directory, read" - reactjs

I have been trying to create react app using the npx command but every time I run it, I get the error message in console:
yarn add v1.22.4
error An unexpected error occurred: "EISDIR: illegal operation on a directory, read".
I also get a yarn-error.log file with the first few lines as thus:
Arguments:
/Users/sammyebinne / .nvm / versions / node / v14 .5 .0 / bin / node / usr / local / Cellar / yarn / 1.22 .4 / libexec / bin / yarn.js add--exact react react - dom react - scripts cra - template--cwd / Users / sammyebinne / Documents / Work / Practice / radler / rad
PATH: /Users/sammyebinne / .npm / _npx / 5326 / bin: /Users/sammyebinne / node_modules / .bin: /Users/sammyebinne / .nvm / versions / node / v14 .5 .0 / bin: /usr/local / bin: /usr/bin: /bin:/usr / sbin: /sbin:~/.npm - global / bin: /Library/Apple / usr / bin: /Users/sammyebinne / .nvm / versions / node / v14 .5 .0 / bin

Related

How to add extra C language library programing enviorment in the docker where chaincode is executing?

I want to use pairing-based cryptography library which doesn't have a go language version in my chaincode.
I have run the official example 'e2e_cli'.
Using Command 'docker ps', we can see nine dockers.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
846a361282bb dev-peer1.org2.example.com-mycc-1.0 "chaincode -peer.add…" 19 minutes ago Up 19 minutes dev-peer1.org2.example.com-mycc-1.0
1cae2900a68a dev-peer0.org1.example.com-mycc-1.0 "chaincode -peer.add…" 20 minutes ago Up 20 minutes dev-peer0.org1.example.com-mycc-1.0
7b6de20b250b dev-peer0.org2.example.com-mycc-1.0 "chaincode -peer.add…" 21 minutes ago Up 21 minutes dev-peer0.org2.example.com-mycc-1.0
d9ab459a1f85 hyperledger/fabric-tools "/bin/bash -c './scr…" 22 minutes ago Up 22 minutes cli
91ec21c0632f hyperledger/fabric-peer "peer node start" 23 minutes ago Up 23 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8052->7052/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
e028c96b2d6c hyperledger/fabric-peer "peer node start" 23 minutes ago Up 22 minutes 0.0.0.0:7051-7053->7051-7053/tcp peer0.org1.example.com
08d057bc084f hyperledger/fabric-peer "peer node start" 23 minutes ago Up 23 minutes 0.0.0.0:10051->7051/tcp, 0.0.0.0:10052->7052/tcp, 0.0.0.0:10053->7053/tcp peer1.org2.example.com
2be6cf82c41e hyperledger/fabric-orderer "orderer" 23 minutes ago Up 22 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
6e084f144bb1 hyperledger/fabric-peer "peer node start" 23 minutes ago Up 22 minutes 0.0.0.0:9051->7051/tcp, 0.0.0.0:9052->7052/tcp, 0.0.0.0:9053->7053/tcp peer0.org2.example.com
I think the docker named 'dev-peer0.org1.example.com-mycc-1.0' is the place where chaincode is executing in node 'peer0.org1'.
So I need to add pbc library programing enviorment to the docker like 'dev-peer0.org1.example.com-mycc-1.0'.
But 'dev-peer0.org1.example.com-mycc-1.0' is created automatically while chaincode is installed and instanced, I couldn't find the way to add the libray.I didn't find volumes path like 'volumes:' settings in file 'docker-compose-cli.yaml'.
cli:
container_name: cli
image: hyperledger/fabric-tools
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.org1.example.com
- peer1.org1.example.com
- peer0.org2.example.com
- peer1.org2.example.com
Here is the part I use PBC library in my chaincode.
package main
/*
#cgo LDFLAGS: -L. -lpbc -lgmp -lcrypto
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pbc/pbc.h"
int myfunc(char * keyword)
{
/*C language codes using PBC library*/
char *str_pairing= "type a\nq 878071079966331252243778198475404981580688\
31994142082110286533992664756308802229570786251794226622214231558587695823174\
59277713367317481324925129998224791\nh 12016012264891146079388821366740534204\
802954401251311822919615131047207289359704531102844802183906537786776\nr
7307\ 50818665451621361119245571504901405976559617\nexp2 159\nexp1 107\nsign1 1\nsi\gn0 1";
pairing_t pairing;
element_t a,b,c,d,e,g,h,r;
pairing_init_set_str(pairing, str_pairing);
element_init_Zr(e, pairing);
element_random(e);
element_init_G1(g, pairing);
element_random(g);
element_init_G1(h, pairing);
element_pow_zn(h, g, e);
element_init_G1(a, pairing);
element_init_G1(b, pairing);
element_init_G1(c, pairing);
element_init_GT(d, pairing);
element_init_Zr(r, pairing);
element_random(r);
element_pow_zn(a, g, r);
element_pow_zn(b, h, r);
element_from_hash(c, keyword, strlen(keyword));
element_pairing(d, c, b);
........
}
*/
import "C"
import "unsafe"
import (
"fmt"
"strconv"
"os/exec"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
……/*go language codes*/
I recompile the image--hyperledger/fabric-ccenv:x86_64-1.0.0, added the library I need.Because the chaincode is compiled in a container which is run base on fabric-ccenv image.

Radiroot package in GAP generating errors

When I run the following commands
g := UnivariatePolynomial(Rationals, [12,-5,0,0,0,1]);
RootsOfPolynomialAsRadicals(g);
I get this error
*** too many arguments: ...;,nf=nfinit([f,nfbasis(f,1)]);fac=lift(nffact
*** ^--------------------
*** at top-level: for(i=1,#fac[,1],for(j=1,fac[i,2
*** ^--------------------
*** incorrect type in _[,_] OCcompoC [not a matrix] (t_POL).
Error, List Element: <list>[1] must have an assigned value in
faktoren[1] := lcoeff * faktoren[1]; at /proc/cygdrive/C/gap486/pkg/Alnuth-3.0.0/gap/factors.gi:99 called from
FactorsPolynomialPari( AlgExtEmbeddedPol( H, poly )
) at /proc/cygdrive/C/gap486/pkg/Alnuth-3.0.0/gap/factors.gi:51 called from
FactorsPolynomialAlgExt( erw.H, poly ) at /proc/cygdrive/C/gap486/pkg/radiroot/lib/SplittField.gi:237 called from
RR_Zerfaellungskoerper( poly, rec(
roots := [ ],
degs := [ ],
coeffs := [ ],
K := FieldByMatrices( [ [ [ 1 ] ] ] ),
H := Rationals ) ) at /proc/cygdrive/C/gap486/pkg/radiroot/lib/Radicals.gi:293 called from
CallFuncList( RootsOfPolynomialAsRadicalsNC, arg
) at /proc/cygdrive/C/gap486/pkg/radiroot/lib/Radicals.gi:253 called from
<function "RootsOfPolynomialAsRadicals">( <arguments> )
called from read-eval loop at line 2 of *stdin*
you can 'return;' after assigning a value
I am using GAP 4.8.6 on windows 10, installed from the windows installer on the GAP downloads page, and PARI/GP 2.9.1 64 bit (stable installer). I've also tried manually downloading and using the latest versions of Alnuth and Radiroot but I'm still getting the same error. Does anyone know how to fix this?
This now works in GAP 4.11.0, with Alnuth 3.1.2, RadiRoot 2.8 and Pari/GP 2.9.3, under macOS:
g := UnivariatePolynomial(Rationals, [12,-5,0,0,0,1]);
RootsOfPolynomialAsRadicals(g);
starts an xdvi viewer which displays the result. It's hard to read as an image, so I am providing the LaTeX source for it, which may be more useful:
\documentclass[fleqn]{article}
\setlength{\paperwidth}{84cm}
\setlength{\textwidth}{80cm}
\setlength{\paperheight}{59.5cm}
\setlength{\textheight}{57cm}
\begin{document}
\noindent
An expression by radicals for the roots of the polynomial $x^{5} - 5x + 12$ with the $n$-th root of unity $\zeta_n$ and
\\
$\omega_1 = \sqrt[2]{ - 10}$,\\
$\omega_2 = \sqrt[5]{\left( - \frac{421}{5}\zeta_{5} - \frac{449}{5}\zeta_{5}^{2} - \frac{49}{5}\zeta_{5}^{3} + \frac{229}{5}\zeta_{5}^{4}\right) + \left( - \frac{168}{25}\zeta_{5} - \frac{849}{25}\zeta_{5}^{2} - \frac{1101}{25}\zeta_{5}^{3} - \frac{582}{25}\zeta_{5}^{4}\right)\omega_1}$,\\
\\
is:
\\
\noindent
$\left( - \frac{2}{11}\zeta_{5} - \frac{1}{11}\zeta_{5}^{2} + \frac{4}{11}\zeta_{5}^{3} - \frac{4}{11}\zeta_{5}^{4}\right)\omega_2 + \left( - \frac{42}{121}\zeta_{5} + \frac{34}{121}\zeta_{5}^{2} - \frac{92}{121}\zeta_{5}^{3} + \frac{15}{121}\zeta_{5}^{4}\right)\omega_2^2 + \left(\frac{91}{605}\zeta_{5} + \frac{7}{605}\zeta_{5}^{2} + \frac{38}{605}\zeta_{5}^{3} + \frac{149}{605}\zeta_{5}^{4}\right)\omega_1\omega_2^2 + \left(\frac{175}{1331}\zeta_{5} + \frac{302}{1331}\zeta_{5}^{2} + \frac{706}{1331}\zeta_{5}^{3} + \frac{482}{1331}\zeta_{5}^{4}\right)\omega_2^3 + \left(\frac{255}{1331}\zeta_{5} + \frac{364}{1331}\zeta_{5}^{2} + \frac{40}{1331}\zeta_{5}^{3} + \frac{246}{1331}\zeta_{5}^{4}\right)\omega_1\omega_2^3 + \left( - \frac{11480}{14641}\zeta_{5} + \frac{420}{14641}\zeta_{5}^{2} + \frac{7725}{14641}\zeta_{5}^{3} - \frac{740}{14641}\zeta_{5}^{4}\right)\omega_2^4 + \left(\frac{786}{14641}\zeta_{5} + \frac{6399}{14641}\zeta_{5}^{2} + \frac{45}{14641}\zeta_{5}^{3} + \frac{1275}{14641}\zeta_{5}^{4}\right)\omega_1\omega_2^4$
\end{document}
It's difficult to say what was the original problem, there were many changes in both packages, which are now hosted on GitHub - the source code repositories are https://github.com/gap-packages/radiroot and https://github.com/gap-packages/alnuth.

How to use "import" in jsx file on play framework

I have a problem in using to ReactRouter.
The problem is that when I try to import "Router" in jsx or js file, like so:
import { Router, Route, hashHistory } from 'react-router'
It gives me the following error:
Uncaught SyntaxError: Unexpected token import
I guess because "ECMAScript 2015 (ES6)" is not supported in a browser. How to solve this problem and use RectRouter in PlayFramework?
My env :
Intellij 15
Playframework 2.5
sbt
In my build.sbt:
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.0")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
// ReactJS
addSbtPlugin("com.github.ddispaltro" % "sbt-reactjs" % "0.5.2")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.1")

using factor in ggplot for python

I'm having trouble using factor in ggplot for python. Here is the R code that I want to re-create in python.
library('ggplot2')
head(iris)
ggplot(iris, aes(Sepal.Length,Sepal.Width)) + geom_point(aes(colour=factor(Species)))
In python I do the following:
from ggplot import *
from sklearn.datasets import load_iris
iris = load_iris()
ggplot(iris.data, aes(iris.data[:, x_index], iris.data[:, y_index])) \
+ geom_point(aes(colour = iris.target)) + xlab('x axis') + ylab('y axis')
I keep getting errors. I believe this has to do with the factor part. I can't set to a factor and then allow it to plot. Any help would be appreciated.

Dynamic changes in resources, Windows Phone

I'm making some changes to resources in runtime to prepare application for different (physical) screen sizes:
var info = DisplayInformation.GetForCurrentView();
Size screenSize = new Size(Math.Round(Window.Current.Bounds.Width * info.RawPixelsPerViewPixel),
Math.Round(Window.Current.Bounds.Height * info.RawPixelsPerViewPixel));
Application.Current.Resources["SmallerText"] = (1.0 / 15.0) * screenSize.Height / info.RawDpiY * 72;
Application.Current.Resources["SmallText"] = (1.0 / 12.0) * screenSize.Height / info.RawDpiY * 72;
Application.Current.Resources["MediumText"] = (1.0 / 10.0) * screenSize.Height / info.RawDpiY * 72;
Application.Current.Resources["LargeText"] = (1.0 / 5.0) * screenSize.Height / info.RawDpiY * 72;
var displayMargin = (1.0 / 320.0) * screenSize.Height;
Application.Current.Resources["DisplayMargin"] = new Thickness(displayMargin);
Now when I try to use modified font sizes, it works:
<Style TargetType="Button" x:Key="BaseButton">
<Setter Property="FontSize" Value="{StaticResource SmallText}" />
But when I try to use modified Thickness, application crashes:
<Grid Grid.Row="0" Margin="{StaticResource DisplayMargin}">
Error message is quite enigmatic:
An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in MyApp.exe but was not handled in user code
WinRT information: Failed to assign to property '%0'. [Line: 17 Position: 50]
Additional information: The text associated with this error code could not be found.
Failed to assign to property '%0'. [Line: 17 Position: 50]
If there is a handler for this exception, the program may be safely continued.
Why can't I use modified Thickness? If I don't modify it from the code behind, everything works correctly.
Edit: Workarounds
Workaround #1:
var displayMargin = (1.0 / 320.0) * screenSize.Height;
Application.Current.Resources.Remove("DisplayMargin");
Application.Current.Resources.Add("DisplayMargin", new Thickness(displayMargin));
Workaround #2:
<Grid Grid.Row="0" Margin="{ThemeResource DisplayMargin}">

Resources