[Java] Use C/C++ DLL from Java with JNA
In this article I will create a simple Calculator for example.
- Math function are implemented in DLL (add/sub/mul/dev)
- Use java swing to create GUI
- Use JNA java libary to call math function from DLL
1. Create math C/C++ DLL library
- Open Microsoft Visual Studio
- File > New > Project > Visual C++ > Windows Desktop > Dynamic-Link Library with exports (DLL)
[Java] GUI Application (Swing on Eclipse)
1. Install Eclipse for java
Download and install "Eclipse IDE for Java Developers"
2. Create new project
- Open Eclipse
- File > New > Java Project
- Fill project name
- Click Finish button
3. Add external library
- Create new folder and put jar into there
Right click on project > Properties > Java Build Path > Libraries > Add JARs...
4. Export to Runnable JAR file
Right click on project > Export > Java - Runnable JAR file > Next
Windows Batch Script Tutorial
https://www.tutorialspoint.com/batch_script/index.htm
https://en.wikibooks.org/wiki/Windows_Batch_Scripting
call :myhead 2
exit /b
:: Function myhead
:: ===============
:: %1 - lines count
:myhead
setlocal EnableDelayedExpansion
set counter=1
set mycmd=wmic os get LocalDateTime
for /f "tokens=*" %%i in ('%mycmd%') do (
echo %%i
set /a counter=!counter!+1
if !counter! gtr %1 exit /b
)
exit /b
Ex2:
setlocal EnableDelayedExpansion
set counter=1
set mycmd=wmic os get LocalDateTime
for /f "tokens=*" %%i in ('%mycmd%') do (
::echo %%i
set myresult=%%i
::echo !myresult!
set /a counter=!counter!+1
if !counter! gtr 2 goto end_wmic
)
:end_wmic
echo %myresult%
Cloudinary Cloud Image API
1.Install
npm install cloudinary
2.API
https://cloudinary.com/documentation/cloudinary_references
nodejs example:
var cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: 'anhcuatui',
api_key: '28648234628',
api_secret: 'sdfkhksdjweuhuidshfuisdsfu'
});
//upload image
cloudinary.uploader.upload("girl.jpg", function(error, result) {console.log(result, error)});
//get all resource
cloudinary.api.resources(function(error, result) {console.log(result, error); });
Note:
cloud_name, api_key, api_secret information