phpstorm cannot find class ZMQContext - phpstorm

Hi I'm creating project according to Tutorial on Ratchet website.
I installed zeromq version 0.3.0 through composer in phpstorm.(I checked if I installed right zeromq with phpinfo() and also with php-m in terminal)
In file post.php I cannot create new object of class ZMQContext(). - php storm cannot find this class.
I found the same issue on stackoverflow but solution is for linux.I'm using win.
When I want to use this in code: use React\ZMQ. - I don't see there class ZMQContext
Thanks for answer.

You can get PHPStorm to auto-complete code that uses the ZMQ PHP extension.
Save this stub file: https://gist.github.com/Mikulas/c22e44a918c7af5de5e6
I saved it (on OSX) under /Applications/PhpStorm EAP.app/Contents/plugins/php/lib/extensions/zmq.php
Then go to PHPStorm > Preferences > Languages & Frameworks > PHP > include path and add that extensions folder.
Now go back to your file and you'll see PHPStorm auto-completing stuff from the ZMQ extension.
Have fun! I hope you'll find this useful.

It looks like you've installed the PHP PECL extension. You also need to install the ZeroMQ library on your system that ext-zmq will use. If you're an a Debian based system try sudo apt-get install libzmq-dev or a RH based system sudo yum install zeromq zeromq-devel.

Related

How to install Google Apis Drive v3 via command line on Ubuntu-18.04

I have been trying to install Install-Package Google.Apis.Drive.v3 using this source with the difference that I have Ubuntu-18.04 instead of Windows.
I know it may be a simple question but I have been trying research how to do that from this morning. I installed sudo apt install nuget on my machine and have been trying to add packages or as in this case the Google.Apis.Drive.v3 package but no luck.
I went through this source which was useful, but does not carry information I was able to replicate on my Linux machine.
Also this source, this one and this one too. But also this last one is for Windows and was not very useful.
How do I install Google Apis Drive V3 via command line easily as it is documented for windows but on Ubunbtu-18.04?
Thanks for pointing to the right direction for solving this problem.
Solution
The way you install your Drive API's library is depending on the programming language you are aiming to use. These are the following commands to run depending on the different languages to interact with the API (with their respective links to the source of the setup):
Python:
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
C#/.NET:
Create a new Visual C# Console Application project in Visual Studio.
Open the NuGet Package Manager Console, select the package source nuget.org, and run the following command:
">Install-Package Google.Apis.Drive.v3
Java:
gradle init --type basic
mkdir -p src/main/java src/main/resources
Node.js:
npm install googleapis#39 --save
For the Browser check out the steps to follow here
I hope this has helped you. Let me know if you need anything else or if you did not understood something.
NOTE: For all Ubuntu-18.04 users that wish to install via command line the correct way is: sudo dotnet add package Google.Apis.Drive.v3

How to install Mysql-server in Ubuntu offline

I need to install Mysql-server in an Ubuntu 18 machine which do not have any internet access. There are plethora of instruction material exist on this this subject but all they require Ubuntu machine to be online.
One such documentation can be available here (quite comprehensive though)
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
Any help on offline installation of Mysql-server will be highly helpful.
I suggest you follow this guide on how to use apt-offline. https://linoxide.com/debian/install-debian-packages-offline/
As a general guide:
You start by having apt-offline installed on both PCs, this is done by default on the desktop releases, but can easily be installed by just downloading the .deb package for your release from the packages.ubuntu.com website: https://packages.ubuntu.com/bionic/all/apt-offline/download
Then create a signature that can be put onto another PC that'll do the downloading/fetching updates and make a note that we also need mysql-server
apt-offline set offline-servers-state.sig --install-packages mysql-server
You can then use this signature on a PC connected to the internet using the same tool to check for updates and/or download the required files into a zip file
apt-offline get --bundle zip/file/location/bundle.zip offline-servers-state.sig
Once downloaded you can put this .zip back on the offline server to install the packages
apt-offline install zip/file/location/bundle.zip
You can visit https://dev.mysql.com/downloads/mysql/ from a computer that can go online.
Then, select your OS and version
Download DEB Bundle on a computer that can go online. Move the downloaded file internally to your system that cannot hit the Internet.
Your downloaded file will be a .tar. Use command tar -xvf filename.tar (See https://www.cyberciti.biz/faq/tar-extract-linux/ for command).
You will get a new directory. cd that-directory will get you in that directory. You will see a bunch of .deb files.
Install the deb files one by one using sudo apt-get install filename.deb depending on what you want to install. Other commands to install deb files can be found in this discussion https://unix.stackexchange.com/questions/159094/how-to-install-a-deb-file-by-dpkg-i-or-by-apt.

How do I enable the intl extension in CakePHP?

I am using CakePHP 3 and MAMP Pro server for my project. When I am trying to bake the cake, this error shows up:
Fatal error: You must enable the intl extension to use CakePHP.
I have even included intl.so and extension=php_intl.dll in my php.ini file but couldn't figure out solution for this error.
this issue was happening to me some days ago. I had installed Ubuntu 18.04 and php 7.1.
I was trying to run the comman php cake.php bake in orden to use cakephp's console but I was getting the following error message:
You must enable the intl extension to use CakePHP.
This extension (intl) was installed for php 7.1 (php7.1-intl) but this message was appearing every time I used php cake.php bake
After some google searches, I saw that I have to install the extension but with the following command:
sudo apt-get install php-intl
The same issue happened with mbstring extension, I used the command:
sudo apt-get install php-mbstring
then I restarted the apache server with:
sudo service apache2 restart
It's difficult to pinpoint exactly what's wrong without seeing your system setup. However based on what was said in the question, you may be setting up the intl extension incorrectly.
First off, if your OS is Linux/macOS and the PHP extension is a shared library (i.e. has a .so extension) then the php.ini entry should be extension=intl.so not extension=php_intl.dll. Also make sure the intl.so file is in the directory configured under the ini entry extension_dir. Otherwise make sure the extension ini entry is fully qualified (e.g. extension=/path/to/extension/dir/intl.so).
If you are using a Linux OS that has a package manager such as Debian/Ubuntu, you may be able to more easily install the extension for the PHP packaged for that distro. For example, in Ubuntu/Debian the package php5-intl provides the intl extension for PHP5 (I assume it's something similar for PHP7 if you've enabled those repos).
If you build PHP from source, you can try bundling the extension into your PHP. See the instructions from the manual.
I faced the same issue.
I added extension="php_intl.dll" in php.ini and restarted the Apache server.
Now it is working.
I had the same issue. After starting from scratch, I did :
$ brew install php
$ composer install && composer update && composer dump-autoload --optimize
$ composer self-update && composer create-project --prefer-dist cakephp/app:^3.8 cms
$ cd cms
$ bin/cake server
And it was working !

How do I use electron-compile?

I'm having trouble with electron-compile.
The docs state
How does it work? (Easiest Way)
Change your reference to electron-prebuilt to electron-prebuilt-compile. Tada! You did it.
What reference, where? You can't be talking about package.json?
I've always run electron using supervisor -x "electron" -i "./" .
What am I completely missing / what should be the contents of my pull request to make this clearer?
I've installed electron-compile with npm i electron-compile --save-dev
I'd like to have es2015/jsx precompiled to es5, so that I can run a react application in electron. electron-compile appears to solve this problem.
You should install Electron as a dev reference in package.json, yes:
npm install --save-dev electron-prebuilt-compile
Don't install Electron as a global because then other people have to set stuff up to run your app (i.e. they now have to micromanage which version of Electron they have installed globally)
With the recent versions (electron 1.3.5), I was unable to get electron-prebuilt-compile working, well it works for development but packaging for production has no real working examples.
It seems the compiling and packaging needs to be done manually, so in case anyone needs a working example, it's here. Hope to save someone some time and pain.

Make TortoiseHG use my Python installation

I created some python hooks for Mercurial that use some external libraries (namely jira-python). In Linux, I install the packages using pip. In Windows, however, Mercurial comes with a bundled version of Python. My hooks fail when I run them because the external packages are not installed.
I want to make Mercurial / TortoiseHG use my Python installation so I can control its environment. How can I do that?
You can install Mercurial package for Python:
Mercurial 2.4 Python 2.7 package - x86 Windows
Mercurial 2.4 Python 2.7 package - x64 Windows
For TortoiseHG-specific details I can suggest to inspect %TortoiseHg%\library.zip - it contains (some? all?) needed for TortoiseHG|Mercurial Python's modules, which list you can (try) to extend: "in Where is the Python path for TortoiseHG?" topic Steve Borho wrote:
TortoiseHg's entire python environment is contained within the library.zip that comes packaged
with it.
What I suspect you can do is add a line or two to the top of your reviewboard extension file to add your installed python path to sys.path before trying to import simplejson
Hint for adding python path to sys.path is applicable for you too
Recommendation from Convert Extension page
you'll need to use a Mercurial installed on top of a stand-alone Python, and you may also need to do something like
set HG=python c:\Python25\Scripts\hg
to override the default Win32 binaries if you have those installed also
I have Mercurial installed through pip, and I also have TortoiseHg. My system path selects the Python version first.
I renamed C:\Program Files\TortoiseHg\hg.exe to something else, and then ran TortoiseHg. Everything still worked, but I haven't got a good way of verifying it does what you want. You can give it a shot.