How to Tune Garbage Collection in Java

Garbage collection is the mechanism by which the JVM reclaims memory on behalf of the application when it's no longer needed. At a high level, it consists of finding objects that are no longer in use, freeing the memory associated with those objects, and occasionally compacting the heap to prevent memory fragmentation.

The garbage collector performs it's work using one or more threads. But in order to do the job of tracking down object references and moving objects around in memory, it needs to make sure that the application threads are not currently using those objects because if, for example, an application thread is using an object and then the memory location of the object changes due to GC, then bad and unpredictable things could happen. This is why garbage collectors must pause all application threads when performing certain tasks. These pauses are sometimes called Stop-The-World pauses, and the minimization of them is the primary concern of GC tuning, as they can have a huge impact on the performance of a Java application.

Tutorial: MCUXpresso SDK With Linux, Part 1: Installation and Build With Make

I admit: my work laptop machine is running a Windows 10 OS by default. But this does not prevent me running Linux in a Virtual Machine (VM). Each host platform has its benefits, and I don’t feel biased to one or the other, but I have started using Ubuntu more and more, simply because I have worked more on Embedded Linux projects. While I have used mostly Windows with Eclipse for NXP LPC, Kinetis, and i.MX platforms in the past, I started using Ubuntu, too, from last year with the NXP MCUXpresso SDK. I did not find much documentation about this on the web, so I thought it might be a good idea to write a tutorial about it. So, here we go…

Building NXP MCUXpresso SDK on Linux Ubuntu

Still Using SHA-1 for Internal Certificates? It’s Almost Too Late to Update

How many organizations may have overlooked or delayed the migrations of SHA-1 certificates in internal environments? They are hard to find, hard to track, harder to monitor, and may not have expiration dates that would drive migration.

Everyone who didn’t feel they had to worry too much about replacing those hard-to-find internal SHA-1 certificates will now have to start worrying. Microsoft is in the process of phasing out the use of the Secure Hash Algorithm 1 (SHA-1) code-signing encryption to deliver Windows OS updates. On February 15th, 2018, Microsoft announced that customers running legacy OS versions will be required to have SHA-2 code-signing support installed on their devices by July 2019.

IntelliJ Themes Contest 2019: Add More Color to Your IDE!

We are thrilled to announce IntelliJ Themes Contest 2019! Create the community’s most-loved theme plugin for any IntelliJ-based IDEs: IntelliJ IDEA, PhpStorm, PyCharm, RubyMine, WebStorm, DataGrip, GoLand, CLion, Rider, or AppCode, and win a prize!

IntelliJ IDEA 2019.1 arrived last month with official support for color customization of the IDE appearance, which means it’s up to you to decide what your IDE looks like! You can customize the colors of most of its parts, from toolbars, windows, buttons and icons, to the background, the editor scheme, and much more.

Tom’s Tech Notes: IoT Fails [Podcast]

Welcome to our latest episode of Tom's Tech Notes! In this episode, we'll hear advice from a host of industry experts about where organizations go wrong when implementing IoT so you don't make the same mistakes.

As a primer and reminder from our initial post, these podcasts are compiled from conversations our analyst Tom Smith has had with industry experts from around the world as part of his work on our research guides.

Google Apps Script for Developers

Google Apps Script makes it is easy for you to integrate data and functionality from Gmail, Google Drive, Google Maps, YouTube, and most other Google APIs. Apps Script is JavaScript under the hood so you don’t have to learn a new language and you don’t have to manage any servers since all your code runs on the Google Cloud, not your browser.

In this video tutorial, you’ll learn how to develop Google Apps Script projects locally on your computer inside Visual Studio Code. You can write your code in modern JavaScript, neatly organized in modules, and the build environment will use Babel and Webpack to transform your code into a version of JavaScript that is compatible with Apps Script.

Modern Development with Google Apps Script

There are quite a few advantages with having a local development environment vis-a-vis writing code in the Apps Script Cloud IDE.

  1. You can write code with ES6 Classes, Arrow Functions, Modules, Destructing and use all the other modern JavaScript features.
  2. The development experience inside VS Code is unmatched and tools like ESLint and Prettier make it easier for you to catch errors early in the development.
  3. The build and deployment process can be completely automated with npm scripts and CLASP, Google’s command line utility for Apps Script.
  4. VS Code has built-in support for Git and integrates with source control providers like Github and Gitlab. It is therefore easier to track changes and restore previous versions of the code.
  5. You can quickly integrate JavaScript libraries like LoDash, Moment, Underscore and any of the NPM packages into your code.
  6. You can use modern frameworks like React, Vue.js and Angular to build the HTML frontend that connects to the backend with the Google Script Client API.

Getting Started with the Apps Script Starter

The Starter kit is a boilerplate for quickly getting started with local Apps Script development locally inside VS Code. Open your terminal and run the following commands:

1. Clone the Github repository to a local folder

git clone https://github.com/labnol/apps-script-start my-project

2. Switch to the project folder

cd my-project

3. Install all the project dependencies and utilities

npm install

4. Connect CLASP to your Google account

npx clasp login

5. Create a new Google Apps Script project in your Google Drive with CLASP

npx clasp create "My Project" --rootDir ./dist

This command will create a new .clasp.json file in your project folder that links the local folder with your Apps Script project. During build, Webpack will bundle all your code in a single JavaScript file and add it to the ./dist folder that Clasp will push to your Apps Script project.

Next, open the current project folder inside VS Code with the code . command. It includes some sample code but we will start with a blank folder so delete everything that’s inside the src folder.

Inside the src folder, create a new file – email.js – and write a simple arrow function that prints a list of all the email addresses connected to your Gmail account.

apps-script-starter (1).png

Next, create an index.js file (entry point) in the src folder, import the email function that you’ve created inside the email.js file and add it to the global object. This is a requirement of the Webpack plugin for Google Apps Script.

You can also add a function expression to the global object directly, like doGet in the example below.

htmlservice-doget.png

Now that your JavaScript code is ready, open the appsscript.json file in your project folder and modify the oAuthScopes property to only include the scopes that are required by your project.

Next, jump to the command line terminal and run the deploy command to push your code to the Apps Script project.

npm run deploy

After the deployment is complete, open the associated script in the browser with the CLASP open command.

npx clasp open

Inside the Apps Script Editor, go to the Run menu and choose the getEmailAddress function from the list. Open the logs and you should see your email addresses in the window.

Then go to the Publish menu, choose Deploy as web app and open the URL in a new browser tab to check the program output. That’s how easy it is to build projects with the Google Apps Script starter kit.

Using Git with Google Apps Script

Create a new repository in Github and make a note of the URL of the new repository. Next, open the terminal and run the following commands to push your Apps Script project to Github.

github-apps-script.png

Also see: Most Useful Google Apps Scripts

The same approach is used by Digital Inspiration for building popular Google add-ons including Gmail Mail MergeGoogle Forms Notifications and Document Studio.

The post Google Apps Script for Developers appeared first on Digital Inspiration.