I'm using NodeJS under Windows (with node.exe downloaded from NodeJS site). I would like to use this db-mysql extension with it ( https://github.com/mariano/node-db-mysql/ )
I have no idea how to use it. Is it necessary to rebuild the whole node.exe or is it possible to build just the extension? I'm not able to run NPM with node.exe (it results in error) as the installation instructions says.
Thanks
Sorry but you will have to have a full tool-chain(Cygwin) that can compile c. That means you have three alternatives:
Use linux (in a VM) or mac
Install node from cygwin ( https://github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows) )
Use another database (eg. node-dirty: https://github.com/felixge/node-dirty) that doesn't need to be compiled.
You can't use NPM (Node Package Manager) with the Windows executable node.exe as for all I know.
Instead you should download the zip/tar module from https://github.com/mariano/node-db-mysql/downloads and place the contents into a *node_modules* folder above your script(s).
Example structure:
/nodestuff
/node_modules
/db-mysql // The module
/script
app.js // Your script
Then just follow the instructions on https://github.com/mariano/node-db-mysql/ in order to create a database connection.
Good luck.
Related
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
I want to import and use dataset package of python at AWS Lambda. The dataset package is about MySQL connection and executing queries. But, when I try to import it, there is an error.
"libmysqlclient.so.18: cannot open shared object file: No such file or directory"
I think that the problem is because MySQL client package is necessary. But, there is no MySQL package in the machine of AWS Lambda.
How to add the third party program and how to link that?
You should install your packages in your lambda folder :
$ pip install YOUR_MODULE -t YOUR_LAMBDA_FOLDER
And then, compress your whole directory in a zip to upload in you lambda.
What you have to do is to include the binaries needed with your lambda package.
You need to utilize pip and create an isolated environment.Your zip uploaded to lambda needs to have the python2.7/site-packages included (the ones installed with pip).
Now there are extreme cases of os-related dependencies.
This has a tricky solution.
In those cases you have to spawn an amazon linux ec2 instance in order to build/get those dependencies and package them with your lambda.
Once your lambda is packaged you can close the ec2 instance.
Check this guide if virtualenv is not enough.
This is an os dependent system file. I'm guessing that you successfully installed the Python mysql client, but you still need the system mysql client, which seems to be a different version on your system than the lambda one. While building your virtual environment on the official lambda image will definitely fix this problem, you might have some luck copying your own copy of this system file into your lambda zip file.
I found mine with
locate libmysqlclient.so.18
Note: depending on your system, the version number at the end might be different. Use the version in the error you receive.
Adding that file on the top level of my zip file with
cd \path\from\locate\to\libmysqlclient
followed by
zip -u \path\to\lambda\zip\file.zip libmysqlclient.so.18
worked for me.
I have my HTML pages locally stored on my Mac. I already bought the domain and the hosting service. There's a way with which I can test these local webpages so that I can see how they render on different devices? I have heard about local server for testing or using devices via USB attached to the PC. Is there not a more standard and unified way to testing them? It can be everything (software, online services, ...) I'm not interested in emulators/simulators.
If you have only html and/or Javascript code:
Open it with your browser, it will be enough
If you have PHP code:
Install a local web-server (Ex: Apache)
If you have MySQL code:
Install a MySQL server
Usually, installing Mamp (or an equivalent for Android/iOS) is enough to do every basic things. It will provide you SQL and PHP server
Hope it helped you
Creating a local server: Node.js and BrowserSync
I've found a very simple way to test webpages (in my case, HTML5 pages) that are saved in PCs memory so that we could test them directly into all the different devices available, without using simulators/emulators.
The solution is creating a local server using two great totally free tools: Node.js and BrowserSync. Before writing this answer, I tried this solution on my own, and I was completely satisfied of the result! You can find the source for this answer at JavaScript Kit.
Here you are the main steps:
Install Node.js (verify if Node.js is correctly installed with the node- v command from the terminal);
Install BrowserSync using npm install -g browser-sync directly from the terminal. Be careful you need root permissions (I simply used sudo npm install -g browser-sync);
Run BrowserSync:
Navigate to your target directory (the one which contain the static files used to create the website, that's the HTML (and CSS) files) using the command line (to make an example, it could be cd folderA/folderB);
Create a local server inside that directory, with browser-sync start --server.
These are the main steps, but you can directly read the solution from the original source I linked some lines before.
I have made a VS2010 project which installs MySQL by calling MySQLInstallerConsole.exe with necessary arguments. This works perfectly however, when I try to run this project's exe as a custom action it executes the exe but MySQL is not installed.
I checked the log file for MySQL exe and it had the following error:
Error 50: Package Name State change request failed.
What does this really mean, any solutions?
There are at least a couple of things that have something to do with this:
I believe the MySQL installer is an MSI file according to this:
http://dev.mysql.com/downloads/installer
You cannot install an MSI from a custom action of a Visual Studio setup because recursive calls to MSI installs are not allowed.
In a Everyone install custom actions run with the SYSTEM account, and installs are not often expecting this if they want to install files in user-profile folders because the SYSTEM account doesn't have any.
You need to bootstrap this somehow, and I think people are often using the WiX Burn bootstrapper for that. You define the ProductCode, name etc of the product and define how to install it.
Does anybody know where to get a MySQL libraries compiled for the arm iPhone architecture?
Or how to cross-compile MySQL for arm?
Thanx
Here's how I did it:
1) Download the source code version of Connector/C from MySQL
2) Download cmake (if you have macports installed, type "sudo port install cmake")
3) Get toolchain files from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
4) In the toolchain file for the simulator, remove one architecture from the line containing CMAKE_OSX_ARCHITECTURES
5) If you want to build for the simulator, copy the missing headers in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/netinet/ (ip.h and in_system.h) from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/usr/include/netinet
6) Create a directory called "compiled_library" somewhere, eg on your Desktop
7) Call cmake like this:
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/iphone-toolchain-file -DCMAKE_INSTALL_PREFIX=/path/to/compiled_library -DHAVE_FDATASYNC:INTERNAL=0
8) Note that if you want to run cmake a 2nd time, you might have to delete the cache file first
9) type make install
10) Now you have the compiled library in /path/to/compiled_library. Copy the header file directory and libmysql.a to your xcode project via "Add existing files...". The library should be automtically added to the linker stage.
11) WOOHOO. Use the mysql C API.
12) If this is too much work, I'm currently writing a MySQL wrapper framework for the iPhone. I will publish it sometime in the next ten years and put a link here.
EDIT:
Someone else created an Objective C Wrapper for the MySQL client library: http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/
do you need client or server libraries? Anyway, since OS X supports unix scripts you should at least try build using "regular Unix" approach:
client:
http://dev.mysql.com/doc/refman/5.1/en/connector-c-building.html
server:
http://dev.mysql.com/doc/refman/5.1/en/installing-source.html
You can use Kumulos 'Hookup' http://www.kumulos.com/2011/07/06/introducing-hookup/ feature to build a suite of web services for your MySQL database.
Basically you define your different web services in the online control panel, then it builds all the Objective-C code and server side code.
I believe this is the easiest way to achieve your goals, and probably a lot better than using a direct Objective-C MySQL library.
This worked for me:
https://github.com/thrivesmart/just-mysql-example-mac-app-objective-c-xcode/issues/1
No compilation needed
Just use that LIB and replace the lib with the other repo!
I don't believe you can run MySQL on the iPhone. As Ben pointed out SQLite is built into the iPhone and you can use Core Data to manage structured data.