Posts

Showing posts from October, 2020

Couldn't connect to Docker daemon at http+docker://localhost - is it running?

sudo docker-compose up

Python web service request error from file or either postman

# extracting data from postman contentJson = request.get_json(force=True) image = contentJson # extracting data from local python file # image = {'content': request.form['content']} I have to forcefully convert the json image content into json for postman for request from python file, normal

docker Installation

https://www.youtube.com/watch?v=oakEYwFReLA&ab_channel=CyberJunkie 0) To check if it is ok to download from this site: curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add 1) Change permission to write in sources.list.d file: chmod 777 /etc/apt/sources.list.d 2) add docker link to sources file: echo 'deb https://download.docker.com/linux/debian stretch stable'> /etc/apt/sources.list.d/docker.list 3) remove if already exist: apt remove docker docker-engine docker.io 4) install docker: sudo apt-get install docker-ce 5) check if docker works: sudo docker run hello-world

pycharm install parameter hint

 go to marketplace in plugin and install  pythonz

ModuleNotFoundError: No module named 'tkinter' pycharm

you need to install tkinter in your linux. using this command  sudo apt install python3-tk

File uploading problem

 Take file as part from form. Then create a folder in target. Target is a folder which will be run during execution. Upload photo there and name in the data base.  // Uploading picture try { String path = request . getRealPath ( "image" ) + File . separatorChar + "products" + File . separatorChar + pPhoto . getSubmittedFileName (); System . out . println ( path ); FileOutputStream fos = new FileOutputStream ( path ); InputStream fis = pPhoto . getInputStream (); // Reading data byte [] data = new byte [ fis . available ()]; fis . read ( data ); // This will place the file data in byte[] data // Writing the data fos . write ( data ); fos . close (); fis . close (); } catch ( Exception e ) { e . printStackTrace (); }

Friend declaration 'bool operator==(const ADS_set&, const ADS_set&)' [-Wnon-template-friend]

// friend bool operator==(const ADS_set&, const ADS_set&); template < typename K, size_t S > friend bool operator==(const ADS_set < K , S> &lhs, const ADS_set < K , S> &rhs); // friend bool operator!=(const ADS_set&, const ADS_set&); template < typename K, size_t S > friend bool operator!=(const ADS_set < K , S> &lhs, const ADS_set < K , S> &rhs); https://stackoverflow.com/ questions/3989678/c-template- friend-operator-overloading f riend is not the member of the ADS_Set class, but it is the member of namespace. since friend is non template but ADS_set is template. We are not able to declare it outside class using template. Best is to have body of friend inside class. Otherwise, change the friend function as show above, make it template and use it outside class. Comments is original function declaration, another one is changing it, so we can use it outside class template