DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Integration Topics

article thumbnail
My Experiences with Maven in IntelliJ IDEA and NetBeans IDE
With IntelliJ IDEA supporting a fully-functional integration with Maven, you can automate your entire building process. The result is that you can create a new Maven project as well as easily handle multi-module projects. Netbeans IDE on the other hand, simplifies the development of mobile applications as well as web and desktop applications using Java and HTML5. So imagine my surprise when some weeks ago, I saw a colleague fighting IntelliJ's Maven support. A dependency was not detected by IntelliJ's Maven support and to fix it, he had to remove the dependency from the POM, save it, add it back to the POM and save it again. Hmmm... somehow not quite optimal. This was the reason for me to take a look at IntelliJ's Maven support and compare some points with the support provided by NetBeans. Let’s look first at how IntelliJ IDEA can support an integration with Maven that is fully functional. This will assist you in automating the whole build. It doesn’t matter whether you wish to create a totally new Maven project, synchronize with an existing open project or add Maven support to existing IntelliJ IDEA projects. You can also manage projects that are multi-module. Creating New Maven Projects These are the steps I’d follow to create a new Maven Project. If you’re starting from scratch and there’s no project open currently in IntelliJ IDEA, go to the Welcome screen and click on New Project. Alternatively, you can select File and then create a new project for the main menu. Once you’ve created your new project, you must name it and if you require it, change its location. You’ll want to create the Git repository, so select the new project for placement under version control. Just be aware that you can do this at any time later in the build. Don’t forget to tick the box. Your project requires a language selection, so do that as well as add any other languages you may want via plugins. You do this by clicking “App>general add”. Under "build system", select Maven followed by specifying the project’s SDK. Or, you can go with the default or JDK. While it is not necessary, it’s a good idea to have a file with a basic sample code, so tick the “add sample code” box. Don’t neglect to specify Maven’s coordinates, which are included in the pom.xml file. You’ll find these in the advanced settings where a new project package is identified in the Groupid box and the project name is specified via the Artifactid box contents. Maven naming conventions follow Jav’s package name rules. This is in the format of a reversed domain name that you control e.g. org.apache.maven. While the naming conventions are not enforced, you’ll have a hard time getting names that don’t follow the rules in the Maven central repository, especially if it is a single word used for group IDs. When you’ve finished your selections, then click “create”. Handling Maven Projects If you open a Maven project in IntelliJ, IntelliJ still generates a default project folder (".idea") and file (".iml"). This means IntelliJ must always ensure that data in the POM is kept in sync with its proprietary structures. However, IntelliJ only handles one direction. Changes in the POM are recognized and the project settings are in sync most times. But if you change something in the project settings, these changes are not reflected in the POM. So, as my colleague experienced, you have to do it twice. Also, IntelliJ lists the "target" folder and ".idea" project settings folder in the logical project view, which is not useful most of the time. In IntelliJIDEA, the Maven project pom.xml file has a compiler included as well as the target Java version. There’s also a Maven tool window and any dependencies that are required to start work. Just bear in mind that the version of Java that is specified in the pom.xml file will, in all likelihood, override the "JDK for importer" option’s specification version. You can find this in the Maven settings. Configure Maven Settings To make things easier, configure your Maven settings before opening new projects. Configuring IntelliJ IDEA to display the Maven settings prior to opening an existing project that is being opened for the first time in IntelliJ IDEA is done at the application level. Once set, they’ll appear for any new project that you open. On the Welcome screen, “All settings” under the customize option. You can also access it from the main menu by selecting “file”, then “new project setup” followed by “preferences for new projects.” In the “preferences” dialog under settings, choose “build”, then “execution”. Under deployment, select Maven as your option under “build tools.” Now go to the Maven settings dialog and make the selection “Show settings dialog for new Maven projects”. You can then click OK and your changes will be saved for all future projects. What this does is, each time you open new projects, the Maven settings dialog is displayed by IntelliJ IDEA and you can then specify the local Maven repository’s location as well as a user settings file. In contrast, NetBeans uses the POM for pretty much everything. The Maven POM file defines the project, as shown below. If you change something in the project settings, it is directly stored in the POM. Only in rare cases, e.g., if you redefine actions, does NetBeans need to create a specific file. NetBeans only shows important information in the Projects window, as shown above. However, if you do want to see the Maven "target" folder, you can easily switch to the Files tab: Building Maven Projects When you build a Maven project in IntelliJ, with the default IDE commands, Maven is not used for the build process. The same goes for tests. If you are using different profiles for local development and your continuous integration server, you have to use Intellij's Maven integration tab to build and test your project with Maven. This is really ugly because you cannot use all the shortcuts that make life easier. NetBeans uses Maven for all that. You can simply press F11 or use the default toolbar button or menu item to build your applications with Maven. This same action works whether you are using Maven, a plain NetBeans Ant build script, or Gradle. It’s always the same consistent procedure. You can even change the Maven command that is used to build the project via F11. You are completely free to configure what you need: Executing Maven Goals Running Maven goals in IntelliJ displays a dialog with just two text fields and you have to type all the Maven parameters by hand. Hey man, it could be so much easier. Running a custom goal in NetBeans gives you a fantastic dialog with lots of possibilities. You can choose the profile, add properties, and even save everything to run it again later. This saves a lot of work. Conclusion There are many smaller issues that show that NetBeans has a smoother Maven integration than offered by IntelliJ. My impression is that IntelliJ's Maven support is just an extension to its default project management system since It still needs the default IntelliJ project folders and files. Meanwhile, NetBeans provides a much deeper and more complete integration. One more thing. I’m not an IntelliJ user so please forgive me if there is a mistake in my observations. I'm also not trying to start a new IDE war. What I want to do by means of this article is to get readers to think out of the box. If you are familiar with your IDE, that is great. If you are productive with your IDE, that is great. But if you think an IDE needs to be expensive in order to be a good product, you are totally wrong and should definitely give NetBeans a try. Thorsten Marx is a product manager and developer at e-Spirit AG in Germany.
July 24, 2022
by Thorsten Marx
· 17,412 Views · 2 Likes
article thumbnail
Mixing Swing and Native Components
Bringing Together Various Components There are situations in which it may be to the benefit of a programmer or other computer user to look at bringing together native components of a system with swing components. These are components that they have either created on their own accord or components that they have brought over from another service. Either way, combining the native components that already exist in a system with swing components is a great way to achieve some surprising results. You might want to think about giving this a try if you are thinking about how you can bring your talents up to date for use in the world as it is today. DJ Native Swing is a nice solution to embed native components (Web Browser, Flash Player, etc.). There was still a general issue that this library did not resolve though: the possibility to mix heavyweight and lightweight components with lightweight components on top, to change their Z-order or re-parent them. Fortunately, The release 0.9.3 offers interesting advances in this area. Using these features is as simple as changing some options before instantiating native components, in order to extend their behavior. You can try all the features (including the new options) with the Webstart Demo: http://djproject.sourceforge.net/ns/DJNativeSwingDemo.jnlp The Webstart demo is configured to work on Windows. It also works on Linux (GTK, x86/i386) where XULRunner is installed. Note that this demo is part of the release package. Run Tests on Every Component It is a good idea to run a demo of any components that you think you might want to put together. The reason for this is that you need to make sure those components will work for you as you anticipate that they will. This is far from a guarantee, and that is why you are called upon to pay careful attention to the things that you are running through these systems. It is entirely possible that you might find some errors that you made along the way when you are checking out the system to see where you went wrong. There is nothing bad about looking over something and realizing that you still have some room to grow and figure things out. As a matter of fact, this is a great way to grow as a person and as a programmer. You cannot begin to take steps in the right direction if you don't figure out where you can improve upon the decisions that you have made before. In my opinion, this gets us one step closer to proper native integration. What do you think? Have you got any comments or suggestions? Mixing Things Up for a New Creation Believe it or not, one of the best things that you can do to mix things up and keep your creations fresh is to look at how you can combine native components with the swing components that you bring into the system. It is a way for you to show the people who will ultimately use your creations that you are serious about making something that they stand to benefit from. If that is the kind of thing that you are into, then you need to give it a try right now. After all, there may be a tremendous number of people just waiting to see what you are all about and what you can offer to them. If you provide them with things to get excited about, then they will keep coming back for more. -Christopher
Updated July 24, 2022
by Christopher Deckers
· 20,825 Views · 2 Likes
article thumbnail
Hack OpenJDK with NetBeans IDE
You've come to the right spot if you are trying to hack OpenJDK with NetBeans IDE. This article explains what OpenJDK with NetBeans is and how you can use NetBeans to create OpenJDK. But before we dive in, first things first: What are Hack OpenJDK and NetBeans IDE? Open Java Development Kit (JDK) is an open-source implementation of the Java Platform or Standard Edition. That means anyone can access the source code and GNU General Public license of the OpenJDK. You may also ask, "then what is Netbeans?" NetBeans is also an open-source integrated development environment for developing with Java, PHP, C++, and other programming languages. All THE applications are developed modules in Java. The OpenJDK repository contains a NetBeans project for all C/C++ parts of the OpenJDK, including Hotspot. So, since NetBeans is an Apache project, it is pretty easy to download and hack the code. You can run it on operating systems like Windows, Linux, and macOS. Remember, to use NetBeans for Java programming; you first need to install Java Development Kit (JDK). Can I use NetBeans with OpenJDK? Yes, you can. The latest NetBeans version of NetBeans is at NetBeans IDE 6.0 Beta 1. But keep this in mind, to hack OpenJDK, you'll need only the Java SE version. Which JDK is compatible with NetBeans? The JDK is compatible with JDK 8 features. That includes annotations, compact profiles, lambda expressions, and repeatable. When you use any of those constructs in your code, they will automatically highlight errors and allow you to fix syntax. Review, Hacking, and Develop OpenJDK. You follow these simple: Get OpenJDK, as follows: #hg clone http://hg.openjdk.java.net/jdk8/build jdk_trunk #cd jdk_trunk #sh get_source.sh #mkdir build #cd build #sh ../configure. After you’ve "configured", the step is complete, remember the value assigned to "Boot JDK" and then:#export IDE_ALT_BOOTDIR=jdk_path_found_by_configure #netbeansStart NetBeans IDE (with C++ support) and open projects from "common/nb_native". Just make sure that the project already contains configurations for Solaris, Linux, and macOS. You can do this by switching to the appropriate configuration and enjoying hacking OpenJDK. Next up, navigate inside your NetBeans project directory. Once there, you will find a directory called incubator-Netbeans. This directory contains sufficient NetBeans modules. Is OpenJDK with NetBeans IDE secure? As the emphasis increases, so does the need for security. Hence, you can easily create the Secure Directories. You can do this by choosing File > New Project (Ctrl-Shift-N), selecting Web Application from the Java Web category, and clicking Next. Regression testing verifies that system changes do not interfere with existing features or code structure. They are part of almost every test suite in software development lifecycles. It is common for developers to change or add a code section and unintentionally disrupt something that is working just fine. Visual regression testing functions on the same logic but confines it to the visual aspects of the software. It works by comparing two images and automating complicated scenarios, like when we cannot identify the elements in the DOM tree. However, visual regression can be used on any website. How Does Visual Regression Testing Work? During the first run, the visual comparison tool captures the snapshot called the base image. The subsequent run compares the base image if there is no difference test is passed, and if there is a difference, the test is considered as failed. Visual regression is also called visual comparison testing. In this tutorial, we will discuss automated visual regression using Playwright. Prerequisites for Visual Regression with Playwright Download and install NodeJS Download and install Visual Studio Code (Recommended) Install Playwright NPM module Install @playwright/test module Note Throughout this tutorial, we are using Playwright with JavaScript. Playwright comes with the default visual comparison tool, so there is no need to install additional packages. Create Simple Visual Comparison Tests Using Playwright In your tests folder, create a new JavaScript file example demo.spec.jspage.screenshot() function takes the screenshot, and expect in the @playwright/test module provides the assertion for matching the images that are .toMatchSnapshot(). Inside the newly created JavaScript file, create a new test that performs the visual comparison like below. Visual Comparison in Playwright to Ignore Minor Differences The above comparison technique matches the screenshot pixel by pixel, which means each pixel should match exactly. This behavior can be modified by passing the argument maxDiffPixels = . Example JavaScript const { test, expect } = require('@playwright/test'); test('Visual Comparison Test Demo', async ({ page }) => { await page.goto('https://playwright.dev'); expect(await page.screenshot()).toMatchSnapshot({ maxDiffPixels: 200 }); }); In the above example, we have specified the maxDiffPixels value as 200, which means the maximum pixel difference can be 200. Image Comparison in Playwright With Threshold Option Playwright toMatchSnapshot() accepts threshold, threshold ranges from 0 to 1, default value is 0.2. The threshold is tolerance of image differences. Example Code JavaScript const { test, expect } = require('@playwright/test'); test('Visual Comparison Test Demo', async ({ page }) => { await page.goto('https://playwright.dev'); expect(await page.screenshot()).toMatchSnapshot({threshold:0.5}); }); In the above code, the threshold is mentioned as 0.5. Playwright Visual Comparison Tips and Tricks In Playwright, we can pass the image file name; instead of default comparison, Playwright compares with the specified filename. Example expect(await page.screenshot()).toMatchSnapshot('home.png'); Playwright also allows us to compare element snapshots; we can take a snapshot of DOM elements and compare. Example expect(await page.locator('xpath=//*[@id="__docusaurus']).screenshot()).toMatchSnapshot(); Visual Regression With Playwright Using Percy Percy is a web-based tool for visual testing with a free tier, and it provides both manual and automation capability for visual comparison. Percy supports Playwright integration. Percy is now a part of Browserstack. If you already have a BrowserStack account, you can sign in with BrowserStack or sign up and create one. Using Percy With Playwright Step 1 – Install Percy modules using the following command. npm install --save-dev @percy/cli @percy/playwright Step 2 – Create a new JavaScript Playwright test file like below. JavaScript //demo.spec.ts const { chromium } = require('playwright'); const percySnapshot = require('@percy/playwright'); (async () => { const browser = await chromium.launch(); const page = await browser.newPage(); await page.goto('https://www.browserstack.com/', { waitUntil: 'networkidle' }); await percySnapshot(page, 'Example Site'); await browser.close(); })(); In the above example, we are navigating to https://www.browserstack.com/, and we are taking a snapshot using the percySnapshot() function. Setting Up Percy Step 1 – Login to Percy. If you don’t have an account, create one. Step 2 – Create a new project. Step 3 – Copy Percy token. Step 4 – In your Visual Studio Code Terminal, set the PERCY_TOKEN environment variable using the below commands: Powershell / Visual Studio Code Terminal $env:PERCY_TOKEN = "your_token"
July 24, 2022
by Vladimir Voskresensky
· 16,894 Views · 2 Likes
article thumbnail
API Security Weekly: Issue 170
Discover benefits of a DevSecOps approach to API security, API vulnerabilities at F5, trends in API integration, bot attacks on APIs on the rise, and more.
July 21, 2022
by Colin Domoney
· 5,286 Views · 1 Like
article thumbnail
Learn How To Use DynamoDB Streams With AWS Lambda and Go
This blog post will help you get quickly started with DynamoDB Streams and AWS Lambda using Go. It will cover how to deploy the entire solution using AWS CDK.
July 21, 2022
by Abhishek Gupta DZone Core CORE
· 35,188 Views · 4 Likes
article thumbnail
Invoking an AWS Lambda Function During a CDK Deployment
Custom Resources in AWS CDK are powerful and give you much flexibility. You can leverage the Provider framework when you need more than a single API call.
Updated July 20, 2022
by Jeroen Reijn DZone Core CORE
· 3,867 Views · 2 Likes
article thumbnail
Should You Invest in a Digital Transformation Office?
With so much at stake when it comes to transforming an organization, Sabine Laute suggests that a dedicated transformation office could be a solution.
July 20, 2022
by David Brown DZone Core CORE
· 5,505 Views · 3 Likes
article thumbnail
10 Threats to an Open API Ecosystem
Worried about threats to your Open API ecosystem? Prepare yourself with this list of noteworthy tips and best practices.
July 19, 2022
by Michael Bogan DZone Core CORE
· 6,966 Views · 2 Likes
article thumbnail
API Security Weekly: Issue 169
In this update, learn more about an insecure API in WordPress plugin and a Tesla 3rd party vulnerability, as well as become introduced to vAPI.
July 18, 2022
by Colin Domoney
· 4,449 Views · 2 Likes
article thumbnail
Image Generation in Action: 3 Methods With Code Samples and Image Generation API
In this article, learn possible solutions needed to generate images programmatically, possible caveats and pitfalls you may hit, as well as best practices.
July 18, 2022
by Max Shash DZone Core CORE
· 4,761 Views · 3 Likes
article thumbnail
CMS, CRM, and ERP – What Is It and Why?
This article explains CMS, CRM, and ERP with all their similarities and differences.
July 15, 2022
by Anna Smith
· 8,891 Views · 6 Likes
article thumbnail
How to Improve Data Quality With GCP Protocol Buffers
This is a guide on how to enforce schema changes in Google BigQuery leveraging Google Protocol Buffers, aka Protobuf.
July 15, 2022
by Yuliia Tkachova
· 6,695 Views · 3 Likes
article thumbnail
10 Error Status Codes When Building APIs for the First Time and How To Fix Them
Things don’t always go smoothly when first using an API, especially if you’re a beginner. We compiled the 10 most common error codes when building an API.
July 15, 2022
by Kay Ploesser
· 8,831 Views · 4 Likes
article thumbnail
API Security Weekly: Issue 168
Learn about API vulnerability in Safari 15 leaking user info, vulnerabilities in AWS, and a podcast with Rinki Sethi and Alissa Knight discussing API security.
July 15, 2022
by Colin Domoney
· 7,208 Views · 1 Like
article thumbnail
AWS Lambda Provisioned Concurrency AutoScaling Configuration With AWS CDK
This article presents a quick intro to provisioned concurrency scaling and strategies.
July 14, 2022
by Jeroen Reijn DZone Core CORE
· 4,383 Views · 2 Likes
article thumbnail
How To Perform OCR on a Photograph of a Receipt Using Java
Learn of challenges associated with processing physical receipts for digital expensing operations and discover an OCR API solution to alleviate the problem.
July 14, 2022
by Brian O'Neill DZone Core CORE
· 6,741 Views · 4 Likes
article thumbnail
Everything You Should Know About APIs
API stands for Application Programming Interface. In this article, you will learn the processes, benefits, and working of APIs.
July 14, 2022
by Himanshu Mehra
· 17,515 Views · 12 Likes
article thumbnail
Learning About the Headers Used for gRPC Over HTTP/2
In this article, we take a look some next-generation HTTP headers available for integration developers to use when designing APIs.
Updated July 13, 2022
by Kin Lane
· 47,446 Views · 4 Likes
article thumbnail
Building a REST Service That Collects HTML Form Data Using Netbeans, Jersey, Apache Tomcat, and Java
The Jersey project is very well documented so it makes it easy to learn REST with Java. In this article I’m going to build two projects. The first project will be a very simple HTML page that presents a form to the user and then submits it to a REST project residing on the same server. The second project will be the REST part. For this article I used the following tools: 1. Netbeans 7 2. Apache Tomcat 7 3. Jersey 4. Java I built this on OS X Lion. Go ahead and create a new Maven Web Application with Netbeans 7 called: MyForm Once the project has been generated take the resulting (default) index.jsp file and delete it. In its place add a file called: index.html and add the following content to it: Name: Message: Item 1: Item 2: Basically, I created a simple (ugly) form that takes a few parameters the user enters. They submit the form and the data is sent to the REST project we will soon be building. The idea here is we are using an HTTP POST to create a new message. That’s it for the first project! With Netbean’s Maven integration do a Clean and Build and then deploy the resulting WAR file to Apache Tomcat. Create another new Maven Web Application with Netbeans 7 called: RESTwithForms Add two new Java classes to the new project: 1. MyApplication 2. MessageResource The code for MyApplication.java is as follows: package com.giantflyingsaucer; import com.sun.jersey.api.core.PackagesResourceConfig; import javax.ws.rs.ApplicationPath; @ApplicationPath("/") public class MyApplication extends PackagesResourceConfig { public MyApplication() { super("com.giantflyingsaucer"); } } In a brief nutshell this code allows us to make use of some Servlet 3.0 goodies (we don’t need to create a web.xml file for this project as an example). For more details see the sections titled: Example 2.8. Reusing Jersey implementation in your custom application model and Example 2.9. Deployment of a JAX-RS application using @ApplicationPath with Servlet 3.0 at this link. The real guts of the REST project are in the MessageResource.java file as seen below: package com.giantflyingsaucer; import java.net.URI; import java.util.List; import java.util.UUID; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; @Path("/messages") public class MessageResource { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response createMessage(@FormParam("name") String name, @FormParam("message") String message, @FormParam("thelist") List list) { if(name.trim().length() > 0 && message.trim().length() > 0 && !list.isEmpty()) { // Note 1: Normally you would persist the new message to a datastore // of some sort. I'm going to pretend I've done that and // use a unique id for it that obviously points to nothing in // this case. // Note 2: The way I'm returning the data should be more like the commented // out piece, I am being verbose for the sake of showing you how to // get the values and show that it was read. return Response.created(URI.create("/messages/" + String.valueOf(UUID.randomUUID()))).entity( name+ ": " + message + " --> the items: " + list.get(0) + " - " + list.get(1)).build(); // This is a more real world "return" //return Response.created(URI.create("/messages/" + String.valueOf(UUID.randomUUID()))).build(); } return Response.status(Response.Status.PRECONDITION_FAILED).build(); } } Note: Pay special attention to the comments. Please don’t email me stating I shouldn’t be returning text back with the values, also please don’t tell me I should be iterating the list, etc. this is just a demo. You will obviously do this differently in a production environment. The key here is simplicity and minimal code. At this point you need to add jersey-server as a dependency in your POM file. com.sun.jersey jersey-server-linking 1.9.1 With Netbean’s Maven integration do a Clean and Build and then deploy the resulting WAR file to Apache Tomcat. You are now ready to test it out. Load up the HTML file from the first project and enter some data and then submit it. If you have a tool like FireBug for Firefox, you can also see that an HTTP 201 was returned (if successful). If you don’t enter any data in the form then you should get an HTTP 412 back. With not much more work you could just as easily use something like jQuery and submit the form via AJAX.
July 13, 2022
by Chad Lung
· 66,868 Views · 4 Likes
article thumbnail
Best Runtime for AWS Lambda Functions
This blog contains comparative analysis to get best runtime for AWS Lambda functions.
July 13, 2022
by Emin Bilgic
· 8,408 Views · 3 Likes
  • Previous
  • ...
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×