Wednesday, February 7, 2018

Bootstrap File Style Change

This Site explained very well.

  http://markusslima.github.io/bootstrap-filestyle/

// Include
<script type="text/javascript" src="js/bootstrap-filestyle.min.js"> </script>

// Via JavaScript
$(":file").filestyle();

// Via data attributes
<input type="file" class="filestyle">

Deciding Between ODBC and JDBC Drivers

ODBC is an interface that does not depend on a specific programming language or a database system or an operating system. It can be used to write applications that can query data from any database, regardless of the environment it is running on or the type of DBMS it uses. Major advantage of having ODBC as a universal middleware between an application and a database is that every time the database specification changes, the software does not need to be updated. Only an update to the ODBC driver would be sufficient.
JDBC is a data API for the Java programming language. It is an interface that helps a client to access a database system, by providing methods to query and update data in the databases. JDBC is more suitable for object oriented databases
Java programmers can use JDBC-to-ODBC bridge to talk to any ODBC compliant database.
Deciding Between ODBC and JDBC Drivers :
Use native ODBC for:
  • Fastest performance for data imports and exports
  • Memory-intensive data imports and exports
Use JDBC for:
  • Platform independence allowing you to work with any operating system (including Mac and Linux), driver version, or bitness (32-bit or 64-bit)
  • Using Database Toolbox functions not supported by the native ODBC interface (such as runstoredprocedure)
  • Working with complex or long data types (e.g., LONG, BLOB, text, etc.)
Tip:
  • On Windows systems that support both ODBC and JDBC drivers, pure JDBC drivers and the native ODBC interface provide better connectivity and performance than the JDBC/ODBC bridge.
I think this might be helpful :- Choosing Between ODBC and JDBC Drivers

Thursday, February 1, 2018

CSS Position Explanation

static is the default value. An element with position: static; is not positioned in any special way. A static element is said to be not positioned and an element with its position set to anything else is said to be positioned.
relative behaves the same as static unless you add some extra properties.
Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.
This element is relatively-positioned. If this element was position: static; its absolutely-positioned child would escape and would be positioned relative to the document body.
This element is absolutely-positioned. It's positioned relative to its parent.

REST Springfox/Swagger Example

REST Springfox/Swagger Example
This is a Springfox/Swagger example for documenting REST endpoints.
Build
Execute the following command from the parent directory:
mvn clean install
Once the build completes successfully, you should have the artifact rest-springfox.war in the target folder.
Deploy
You can deploy the rest-springfox.war in a Tomcat web container or any other JEE web container of your choice.
Swagger Endpoints
Once you have successfully deployed the war file, the Swagger endpoints can be accessed at:
  1. Testing Swagger 2.0 JSON API documentation
http://localhost:8080/rest-springfox/v2/api-docs
  1. Testing Swagger UI
http://localhost:8080/rest-springfox/swagger-ui.html
If you are interested in knowing more about this project, you can find in my blog 'Swagger for the REST of Us' .


How to Quickly Get Started with Sonar - DZone Agile

How to Quickly Get Started with Sonar
by Ajitesh Kumar  · Sep. 15, 14 · Agile Zone
See how three solutions work together to help your teams have the tools they need to deliver
quality software quickly. Brought to you in partnership with CA Technologies.
This article represents steps required to quickly get up and running with Sonar and keep it handy for your
personal Java/.NET/PHP etc related projects. Please feel free to comment/suggest if I missed to mention
one or more important points. Also, sorry for the typos.
Following are the key points described later in this article:
Sonar setup instructions
Configure HelloWorld Project for Code Analysis
Sonar setup instructions
Following are two key aspects of getting Sonar and dependencies installed, configured and setup for usage.
Installation of SonarQube
Installation of Code Analyzer
Installation of SonarQube
Following is instructionset
to get setup with SonarQube:
Go to Sonar community edition page and download.
Unzip the downloaded file
Go to <install_directory>/bin folder. You would find different folders related with OS platforms. As I
have 64 bit Win system, I further went inside “windowsx8664″
folder.
You shall find different shell scripts files. For my win platform, I found different *.bat file such as
InstallNTService.bat, StartNTService.bat, StartSonar.bat etc.
Copy the path of this folder which may look like S<install_director>/bin/Windowsx8664
(in case
of my laptop), and append it to “Path” environment variable.
Open a command prompt, type “StartSonar” command and execute. This would start a web server at
default port of 9000.
Open a web browser and access the page, http://localhost:9000. You shall see the page such as that
4/21/2017 How to Quickly Get Started with Sonar DZone
Agile
https://dzone.com/articles/howquicklygetstartedsonar
2/7
shown in the screenshot below. This means that you have been able to successfully start your
SonarQube server. Job, well done! Lets move further to analyze out HelloWorld project. I coded a
HelloWorld Java project using Eclipse IDE.
Sonar comes with an embedded H2 database, by default. For quick setup and testing purpose, you
may live with embedded database. However, for production and real usage, one may want to use
productionread
databases such as MySQL, Oracle etc. For configuration instructions, edit
<install_directory>/conf/sonar.properties to configure the database settings. Templates are
available for every supported database. Just uncomment and configure the template you need and
comment out the lines dedicated to H2 database.
Installation of Code Analyzer
Following is instructionset
to get setup with Code Analyzer (SonarQube Runner). The SonarQube Runner
is recommended as the default launcher to analyze a project with SonarQube.
Goto Installing & configuring Sonar Runner page and download the sonarrunnerdistversionno.
zip file
Unzip the file to appropriate location
Setup the SONAR_RUNNER_HOME environment variable and assign it to SonarRunner
installation directory
Add the <sonarrunner_install_directory>/bin directory to your path.
Check the basic installation by opening a new shell and executing the command sonarrunner
h
(on
Windows platform the command is sonarrunner.
bat h).
If above get executed, you are all set to analyze your first project with SonarQube runner.
Analysis of HelloWorld Java Project
Create a configuration file in the root directory of the project, namely, sonarproject.
properties
You may choose to copy and paste the code given on this page, Analyzing with SonarQube Runner, in
sonarproject.
properties file. For setup purpose, just change the value of sonar.projectName to the
project name you created.
4/21/2017 How to Quickly Get Started with Sonar DZone
Agile
https://dzone.com/articles/howquicklygetstartedsonar
3/7
Open a command prompt, and go to project root folder.
Execute “sonarrunner”
command to run the analysis. You would see the analysis run.
Goto the browser and access the page, http://localhost:9000
You would find your project listed under “PROJECTS”. Click on your project listing and you would
land up on the project dashboard.
That is it!




Sonar setup instructions

This article represents steps required to quickly get up and running with Sonar and keep it handy for your personal Java/.NET/PHP etc related projects. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.
Following are the key points described later in this article:
  • Sonar setup instructions
  • Configure HelloWorld Project for Code Analysis
Sonar setup instructions
Following are two key aspects of getting Sonar and dependencies installed, configured and setup for usage.
  • Installation of SonarQube
  • Installation of Code Analyzer
Installation of SonarQube
Following is instruction-set to get setup with SonarQube:
  • Go to Sonar community edition page and download.
  • Unzip the downloaded file
  • Go to <install_directory>/bin folder. You would find different folders related with OS platforms. As I have 64 bit Win system, I further went inside “windows-x86-64″ folder.
  • You shall find different shell scripts files. For my win platform, I found different *.bat file such as InstallNTService.bat, StartNTService.bat, StartSonar.bat etc.
  • Copy the path of this folder which may look like S<install_director>/bin/Windows-x86-64 (in case of my laptop), and append it to “Path” environment variable.
  • Open a command prompt, type “StartSonar” command and execute. This would start a web server at default port of 9000.
  • Open a web browser and access the page, http://localhost:9000. You shall see the page such as that shown in the screenshot below. This means that you have been able to successfully start your SonarQube server. Job, well done! Lets move further to analyze out HelloWorld project. I coded a HelloWorld Java project using Eclipse IDE.
  • Sonar comes with an embedded H2 database, by default. For quick setup and testing purpose, you may live with embedded database. However, for production and real usage, one may want to use production-read databases such as MySQL, Oracle etc. For configuration instructions, edit <install_directory>/conf/sonar.properties to configure the database settings. Templates are available for every supported database. Just uncomment and configure the template you need and comment out the lines dedicated to H2 database.
Installation of Code Analyzer
Following is instruction-set to get setup with Code Analyzer (SonarQube Runner). The SonarQube Runner is recommended as the default launcher to analyze a project with SonarQube.
  • Goto Installing & configuring Sonar Runner page and download the sonar-runner-dist-versionno.zip file
  • Unzip the file to appropriate location
  • Setup the SONAR_RUNNER_HOME environment variable and assign it to SonarRunner installation directory
  • Add the <sonarrunner_install_directory>/bin directory to your path.
  • Check the basic installation by opening a new shell and executing the command sonar-runner -h (on Windows platform the command is sonar-runner.bat -h).
  • If above get executed, you are all set to analyze your first project with SonarQube runner.
Analysis of HelloWorld Java Project
  • Create a configuration file in the root directory of the project, namely, sonar-project.properties
  • You may choose to copy and paste the code given on this page, Analyzing with SonarQube Runner, in sonar-project.properties file. For setup purpose, just change the value of sonar.projectName to the project name you created.
  • Open a command prompt, and go to project root folder.
  • Execute “sonar-runner” command to run the analysis. You would see the analysis run.
  • Goto the browser and access the page, http://localhost:9000
  • You would find your project listed under “PROJECTS”. Click on your project listing and you would land up on the project dashboard.


Share an Eclipse Project to GitHub in 2 Steps

If you have a project in your eclipse workspace and you want to share it on GitHub, how to do it? Very simple!
Assuming you already registered a GitHub account and you have already installed git on your computer, you can share your eclipse projects to GitHub in 2 easy steps. following approach works for Mac, Linux, and Windows (assuming you have installed cygwin on your windows). If you use BigBucket instead of Github, it is exactly the same!
Step 1: Create a new repository on GitHub



Click the green button and you will see the following page:








You can input only repository name, e.g., "restful-client", and leave others as default.
Step 2: Run the following command lines
On your computer, cd to your project directory in eclipse workspace, and then type the following command lines one by one.

The "init" command initiates a new git repository in the project directory.
When are done, you need to register the new repository with a remote (where you'll upload -- push -- your files to). In this case, the remote is Github. You'll need to get the correct URL for your repository on GitHub.
Type in command line:

In my case, it is [username] is "ryanlr" and [reponame] is "face-collage-maker". So the URL is "git remote add origin https://github.com/ryanlr/face-collage-maker.git"
Now, add all files to your local commit:

Then make an initial commit:








This stages your files locally for commit, but they have NOT actually been pushed yet. You've created a commit in your local repository, but not in the remote one. To put it on the remote, do:


Recent Post

Databricks Delta table merge Example

here's some sample code that demonstrates a merge operation on a Delta table using PySpark:   from pyspark.sql import SparkSession # cre...