How can I test my locally stored webpages? - html

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.

Related

how to run dotnet core's standalone program on mac

a rudimentary question, but please let me know.
I want to run the following program which will process and return the result by json when accessed by GET or POST.
FileManagerController.cs
For example, in PHP you just need to place it in the htdocs folder of Apache.
I would like to do the same thing with dot net core mvc.
but I don't know what kind of words to search.
Also, in the near future we would like ruby to work the same way in another project.(In a way that doesn't use a framework such as rails)
So, please tell me how to find out how to run various languages alone on a web server.
You need to make a "project" (file type .csproj) that you can build and run on your machine. Check out the Getting Started with ASP.NET page for instructions to install the SDK and create a new project and run it.
To run your code file above, you can:
$ dotnet new mvc
Copy the above FileManagerController.cs file into the generated Controllers folder.
$ dotnet run
Your app will be running on http://localhost:5000, you can hit your web site using the url /FileManager.

Openshift: how to import MySQL driver to the tomcat/lib directory

I would like to connect my web application (running on tomcat 7) to MySQL (v5.6.20). It is ok if I include the driver mysql-connector-java-5.1.31-bin.jar into my web application. But would like to have it for all my apps. On my local computer, I put the file in tomcat/lib and everything is fine.
How to do the same with openshift? Is it a bad idea to do so?
I am a total beginner. What I do to upload my application (war files) is
git add --all
git commit --m "text"
git push
Thanks a lot for your help!!
Here are two KB articles from the Help Center that I think will help you get going, the first shows how to use the pre-configured database connections that come with each of the Java containers on OpenShift (https://help.openshift.com/hc/en-us/articles/202399720-How-to-use-the-pre-configured-MySQLDS-and-PostgreSQLDS-data-sources-in-the-Java-cartridges), They are very easy to use.
The second shows you how to include external libraries (jar files) inside your application without using maven (https://help.openshift.com/hc/en-us/articles/202399730-How-to-include-libraries-jar-files-in-your-java-application-without-using-Maven).
A third option, if you are using a Maven based project (similar to the default applications that come with the Java cartridges), is to add the mysql driver as a dependency to your pom.xml file, and it will be loaded into the correct place in your application when you do a git push. If you want to go that route, I think that this article will help: http://www.java-tutorial.ch/core-java-tutorial/mysql-with-java-and-maven-tutorial

How to build OpenSSL for WP8?

How to build OpenSSL for WP8?
AFAIK, we must replace winsock.h by winsock2.h because WP8 only supports winsock2.h. And maybe we must replaces code to target WinRT architecture on WP8 (ThreadPool, ...)
The caveat is that we must build OpenSSL as WP8 static library, so that the output lib can be wrapped by WP8 runtime component, right ?
You can use the Microsoft openssl fork on github with support for windows phone 8.1/8.0 and Windows Store 8.1, that address the entropy on each platform using windows random generators, instructions are located at INSTALL.WINAPP, there is a script located at
ms\do_vsprojects.bat
you should be able to just execute that script withing the root location and open vsout\openssl.sln to build the openssl libraries for different windows platforms.
The fork is located at
https://github.com/microsoft/openssl
At this momment these changes are being in process to be integrated with the main OpenSSL source code base.
here is what you have to do, go to this link and download the VSbuild, now put that into the source files downloaded from the OpenSSL website, the folder structure should look like this:
apps
bugs
certs
.....
vsbuild
once that is done, open the solution, it should upgrade it to VS12, change the settings to a Windows Phone RT build, to generate DLL's there is no need to build *_lib*, so change the other projects, most changes you need to do are to libeay32, do not compile openssl project, just ignore that, start by building libeay32, and start making changes to the code, as there are some functions we don't have in WinRT, you can either #ifdef them out, or create your own functions,
NOTE for rand_win.c change the functions to use rand_s and #ifdef most of the code there is, this might muck up the security, you will have to test it out yourself
Good Luck !
This is so that if anyone wants to build the new version of OpenSSL "1.0.1g" that fixes the Heartbleed problem you can follow the previous steps whit the following changes:
I renamed the folder include to --include and create a new folder named include, the VS project will take care of copying the information, --include if you like you can remove this, when i build the project without this change there where compilation issues.
Note: the include folder that i changed is the one found in the root not the one found under VSbuild
Enjoy
Here is a download of pre-compiled OpenSSL libraries for Windows Phone 8.1 among other platforms:
https://www.teskalabs.com/blog/openssl-binary-distribution-for-developers-static-library
Disclaimer: I run that site.

How to use db-mysql extension for NodeJS under Windows?

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.

MySQL C API libraries for iPhone

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.