Skip to main content

Posts

Showing posts from September, 2018

pyobjc-core pip install error python setup.py egg_info" failed with error code 1 in /tmp/pip-build-io5g0t31/pyobjc-core/ [FIX]

ERROR---  sudo pip3 install pyobjc-core  Collecting pyobjc-core   Downloading https://files.pythonhosted.org/packages/7d/0f/2886aab903aa3971674b68d3fc27cdb292ea07fac2118da0463af113274a/pyobjc-core-5.0.tar.gz (790kB)     100% |████████████████████████████████| 798kB 86kB/s     Complete output from command python setup.py egg_info:     running egg_info     error: PyObjC requires macOS to build         ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-io5g0t31/pyobjc-core/ FIX----- On Linux, this is: pip3 install python3 - xlib sudo apt - get install scrot sudo apt - get install python3 - tk sudo apt - get install python3 - dev pip3 install pyautogui

tesserocr PIP ERROR ON LINUX [FIX]

FIX FOR THIS ERROR---  Collecting tesserocr   Using cached https://files.pythonhosted.org/packages/f8/6d/4e81e041f33a4419e59edcb1dbdf3c56e9393f60f5ef531381bd67a1339b/tesserocr-2.3.1.tar.gz Building wheels for collected packages: tesserocr   Running setup.py bdist_wheel for tesserocr ... error   Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dkMND5/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpLxXWiTpip-wheel- --python-tag cp27:   pkg-config failed to find tesseract/lept libraries: Package tesseract was not found in the pkg-config search path.   Perhaps you should add the directory containing `tesseract.pc'   to the PKG_CONFIG_PATH environment variable   No package 'tesseract' found     Failed to extract tesseract version from executable: [

Functions c++ - hackerrank

  https://www.hackerrank.com/challenges/c-tutorial-functions/problem #include <iostream> #include <cstdio> using namespace std; int max_of_four(int a, int b, int c, int d) {    if (a >= b &&  a>=c && a>=d)       return a;    else if(b>=a && b>=c && b>=d )       return b;    else if(c>=a&& c>=b && c>= d)       return c;    else       return d; }; int main() {    int a,b,c,d;    scanf("%d %d %d %d", &a, &b, &c, &d);     int vv = max_of_four(a,b,c,d);     printf ("%d", vv);     return 0; }

For Loop - c++ hackerrank

For Loop https://www.hackerrank.com/challenges/c-tutorial-for-loop/problem #include <iostream> using namespace std; int main() {    int a, s,i;    cin >>i;    cin>> a;    for(i; i<=a; i++)    {       if(i==1)       {          cout<< "one\n";       }       else if(i==2)       {          cout<< "two\n";       }       else if(i==3)       {          cout<< "three\n";       }       else if(i==4)       {          cout<< "four\n";       }       else if(i==5)       {          cout<< "five\n";       }       else if(i==6)       {          cout<< "six\n";       }       else if(i==7)       {          cout<< "seven\n";       }       else if(i == 8)       {          cout<<"eight\n";       }       else if(i ==9)       {          cout <<"nine\n";       }    }    for(int j=10; j<=a; j++)    {       s = j%2;       if

Conditional Statements C++ - hackerrank

https://www.hackerrank.com/challenges/c-tutorial-conditional-if-else/problem #include <bits/stdc++.h> using namespace std; int main() {     int n;     cin >> n;         //cin.ignore(numeric_limits<streamsize>::max(), '\n');      if(n == 1)       cout << "one";    else if(n == 2){       cout << "two";    }    else if(n== 3){       cout << "three";    }    else if(n == 4){       cout << "four";    }    else if(n == 5){       cout << "five";    }    else if(n == 6){       cout << "six";    }    else if(n ==7){       cout << "seven";    }    else if(n == 8){       cout << "eight";    }    else if(n == 9){       cout << "nine";    }    else if(n>9){       cout << "Greater than 9";    }     // Write Your Code Here     return 0; }

Basic Data Types C++ - hackerrank

Basic Data Types  https://www.hackerrank.com/challenges/c-tutorial-basic-data-types/problem #include <iostream> #include <cstdio> using namespace std; int main() { int i; long l; char c; float f; double d; scanf("%d %ld %c %f %lf", &i, &l, &c, &f, &d); printf("%d\n%ld\n%c\n%0.3f\n%0.9lf\n", i, l, c, f, d); return 0; }

Codewars — Sum of the first nth term of Series

Your task is to write a function which returns the sum of following series upto nth term(parameter). Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +... Rules: You need to round the answer to 2 decimal places and return it as String. If the given value is 0 then it should return 0.00 You will only be given Natural Numbers as arguments. Examples: SeriesSum(1) => 1 = "1.00" SeriesSum(2) => 1 + 1/4 = "1.25" SeriesSum(5) => 1 + 1/4 + 1/7 + 1/10 + 1/13 = "1.57"     My Solution     #include <iostream> #include <iomanip> using namespace std; class ta { float ar[50]; int j,f,k,q; float sum=0.00; public: void taa(int k) { f = k; } void paa() { for(j=0; j<f; j++) { ar[j] = 1.00/(1 + j * 3); } } void baa() { for(q=0; q<f; q++) { sum = sum+ar[q]; } cout <<setprecision(3)<< sum;
#include<iostream> using namespace std; int main() {    int a[3][3], b[3][2], ab[3][2], i,j,k;    int sum=0;    cout<<"enter 1st matrix"<<endl;    for (i=0; i<3; i++)    {       for (j=0; j<3; j++)       {          cin >>a[i][j];       }    }    cout<<"enter 2nd matrix"<<endl;    for(i=0; i<3; i++)    {       for(j=0; j<2; j++)       {          cin>>b[i][j];       }    }    for(i=0; i<3; i++)    {       for(j=0;j<2; j++)       {          sum=0;          for(k=0; k<3; k++)          {             sum=sum+a[i][k]*b[k][j];          }          ab[i][j]= sum;       }    }    cout<<"1st"<<endl;    for(i=0;i<3;i++)    {       for(j=0;j<3;j++)       {          cout<<a[i][j]<<"  ";       }       cout<<endl;    }    cout<<"2nd"<<endl;    for(i=0;i<3;i++)    {       for(j=0;j<2;j++)       {          cout<<b[i][j]<<" 

snap run spotify cannot change profile for the next exec call: No such file or directory snap-update-ns failed with code 1: No such file or directory [FIXED]

ERROR  snap run spotify cannot change profile for the next exec call: No such file or directory snap-update-ns failed with code 1: No such file or directory  Soutions-- snap run spotify cannot change profile for the next exec call: No such file or directory snap-update-ns failed with code 1: No such file or directory open terminal and paste these coammand  systemctl status apparmor      # "Yup, dead apparmor"      systemctl restart apparmor      snap restart lxd                             other snap error fix--   error:cannot list snaps: cannot communicate with server:Get http://localhost/v2/find?q=:dial unix /run/snapd.socket:connect:no such file or directory (fixed)