Why Does the JIT Continually Recompile the Same Method?

A Stack Overflow user noticed frequent recompilations, even after a substantial JVM uptime, and couldn't find an explanation based on the common knowledge on JIT compilers.

We know that the Java JIT compiler compiles and recompiles methods based on usage statistics. As a method gets called repeatedly, interpretation moves to JIT compilation. More frequent calls can trigger recompilation with a higher optimization level. Despite of that theoretically simple optimization chain, the actual compilation invocations visualized with -XX:+PrintCompilation can look like they're not following that strategy at all.

Packaging Python Classes as a Wheel

Introduction

Recently, while working on a project where we were using Python, I realized how easy the Java package mechanism makes it, to organize and reuse common classes and functions.

Due to my Java hangover, I organized the common classes and functions in a directory hierarchy like com.<company>.<project>.util. The util package contained a few classes for UUID creation as well as classes for date and time manipulation. After placing the files in the above-mentioned directory, I started developing the application as a micro-service. I placed the micro-service code in the directory com.<company>.<project>.<service>. While trying to use the date and time classes in the micro-service, I used the syntax from com.<company>.<project>.util.mydatetime import MyDateTime.

Hello! My name is Edna :)

I'm a digital marketer by profession, and a business owner by passion, gearing towards actually sharing my knowledge to this community. A lot of aspects of my line of work are still stuck between blurred lines, so I'm hoping that I get to help clear things out!

Cheers!

WordPress Editor Beginner’s Guide

Since its launch in 2003 as a blogging platform, WordPress has grown to become the world’s most popular CMS platform. Over 75 million sites worldwide use WordPress, and it powers more than 30% of the entire Internet.

But for such an outstanding tool for running a website, many beginners struggle with WordPress out-of-the-box. It’s not quite as user-friendly on the backend, especially if you don’t have a ton of experience building and managing websites.

Compared to other popular website builders on the market today, WordPress definitely has more of a learning curve, especially when it comes to editing site content and design elements.

If you need some guidance using the WordPress editor, you’ve come to the right place. I’ll explain what you need to know and even show you my favorite tools that will improve your experience.

What Is the WordPress Editor?

The WordPress editor is the backend portion of a WordPress site where webmasters, admins, and other WordPress users control the publishing experience. The editor can be used to publish posts, control page layouts, and build media-rich pages.

In short, your entire WordPress site gets managed through the editor.

There are actually two different versions of the WordPress editor—Classic and Gutenberg. Gutenberg was released with WordPress 5.0 on December 6th, 2018, and it’s a bit more intuitive and user-friendly than the classic version.

5 Tools to Improve WordPress Editor

The WordPress editor is built into every WordPress installation. But there are third-party tools and plugins that you can use to make editing content on your WordPress site much easier. These are my favorites.

#1 — SeedProd

SeedProd is a landing page plugin for WordPress. Its drag-and-drop functionality makes it much easier to create landing pages than WordPress’s built-in editing tools. That’s why more than 1 million WordPress users trust it.

The best part about SeedProd is that it’s code-free. So you don’t need to have a development background or anything like that to create high-converting landing pages on your WordPress site.

Choose from a variety of landing page templates, depending on your industry, goal, and need. SeedProd is continually adding new and improved templates to the platform, from webinars to thank you pages and more.

You can use this plugin to create professional landing pages in minutes. Beginners and advanced users alike love the ability to create custom landing pages or simply fine-tune the templates provided by SeedProd. The plugin is optimized for speed as well. So you won’t have to worry about your new landing pages slowing down your WordPress site.

It integrates with third-party tools as well, like popular email marketing platforms. You can create a landing page with SeedProd and use it to collect leads via MailChimp, ActiveCampaign, and more.

Plans start at $39.50 per year. Try it risk-free with a 14-day money-back guarantee.

#2 — Elementor

With more than five million active installations, Elementor is one of the most popular WordPress plugins on the market today. It’s a user-friendly website builder that eliminates the need to customize your site within the WordPress editor.

The plugin is built for beginners and experts alike, with a drag-and-drop interface to create beautiful pages in minutes. Unlike the WordPress editor, Elementor puts a primary focus on visual design.

This all-in-one solution allows you to control every aspect of your WordPress site from a web design perspective. It’s simple yet powerful and lightweight, so your site will still operate at peak performance.

The plugin is trusted by a wide range of different users. It’s used by business owners, freelancers, agencies, and everything in between.

A unique standout of Elementor compared to other visual design tools on the market today is that it’s developer-friendly as well. As an open-source theme, thousands of developers proactively add themes and other products to extend the plugin’s functionality.

Some of the plugin’s most popular features include the widget builder, popup builder, and theme builder. The plugin works seamlessly with the entire WordPress ecosystem, so there’s a good chance that it will perform well with your favorite tools and plugins.

Elementor’s basic version is free, and premium plans start at $49 per year for a single website. Learn more.

#3 — Thrive Architect

Thrive Architect is a visual page builder for WordPress. It’s designed for business websites with a focus on conversions. The plugin comes standard as part of the Thrive Suite from Thrive Themes.

In addition to this drag-and-drop landing page builder and content editor, you’ll also get tools like Thrive Leads, Thrive Optimize, Thrive Ultimatum, Thrive Apprentice, and more. These themes range from functions for A/B testing to creating professional online courses. So it’s a great value beyond basic WordPress editing.

Since you’re getting access to every Thrive tool, then the plugin is a bit more expensive compared to other opinions on the list. The Thrive Suite starts at $19 per month with an annual billing cycle.

The plugin comes with 290+ conversion-focused WordPress landing page templates. It’s one of the fastest ways to create professional opt-in pages, sales pages, and other customer-focused content on your website.

With drag-and-drop functionality, you can use Thrive Architect to edit WordPress pages without writing a single line of code. It even has tools and features for blog formatting, product launches, sales copywriting, and more.

Whether you just want to edit a high-converting home page or manage every component of your WordPress design, Thrive Architect should be a top consideration.

#4 — Divi

Divi by Elegant Themes is one of the most popular and versatile WordPress editing tools on the market today. It’s more than just a WordPress theme; this is a complete solution for creating and editing WordPress pages. This website builder essentially replaces the built-in WordPress editor.

Whether you’re a first-time WordPress user or a seasoned veteran, Divi can make your life much easier. It’s the ideal solution for creating exceptional designs in a way that’s surprisingly easy to do. If you find the existing WordPress editor too rigid or hard to navigate, Divi will eliminate those concerns.

As a WYSIWYG (what you see is what you get) editor, you can visually edit your WordPress site and see the changes in real-time.

The plugin is intuitive, so you won’t be overwhelmed with the countless customization options. There are no coding or confusing backend components to worry about. You can add, delete, and move elements around using Divi’s drag-and-drop functionality on the front end of your WordPress site.

Benefit from features like inline text editing, custom CSS control, and the ability to undo/redo your work. So if you make a mistake or want to change something, restoring the previous version is just a click away.

A single license gives you full access to use Divi for unlimited WordPress sites with an unlimited number of users. Get it now for $89 per year or a one-time purchase of $249 for lifetime access.

#5 — Themify Builder Pro

Themify Builder Pro is a WordPress theme building tool, hence the name. It allows you to customize, edit, and create an entire WordPress site using a visual drag-and-drop builder. You’ll have complete control over customizing headers, footers, pages, posts, archives, 404s, and more.

The plugin is even compatible with WooCommerce, so you can use it to customize the theme of your ecommerce website. It’s a perfect solution for people who want to edit and design dynamic WordPress elements without coding.

The plugin is extremely powerful and makes editing a breeze. You can use it to create custom conditions and rules for how templates will be displayed on your site.

For example, you can set a condition for your entire website or just apply it to specific posts or pages. So everything can be controlled within a single theme.

Use it to manage dynamic content as well. For example, you can use Themify to a post’s featured image and turn it into a background. Take the meta and custom fields from a post and display them anywhere in a template as well. It works with custom fields that were created manually within WordPress and third-party plugins as well.

Sign up for Themify Builder Pro for $69 and get access to all 25 builder add-ons as well.

The Basics of WordPress Editor

Let’s take a closer look at the core components and features of the WordPress editor. This will make things easier for you to understand as a complete beginner.

Classic Editor vs. Gutenberg Editor

As previously mentioned, there are two different editors in WordPress. The Gutenberg editor is available on WordPress versions 5.0 and higher, and the classic editor is for all previous installations.

Personally, I think the Gutenberg editor is much more user-friendly. But some of my sites are still using the classic editor, so I’m exposed to both of these tools daily.

The Gutenberg editor uses blocks to manage site elements and layout options. So essentially, every component of your WordPress site will be in its own block. You won’t need to have much knowledge or experience with HTML or CSS, so it’s easier to edit and create content. Gutenberg also reduces the need to add certain plugins to your site, as it comes with built-in editing tools that were only accessible through plugins on the previous WordPress versions (unless you’re proficient with coding).

The Classic editor has fewer frills and looks a bit dated out of the box. When it comes to editing content, it feels like you’re working with more of a blank canvas. Some users like this, but others find it a bit intimidating. If you’ve never used WordPress and have zero coding experience, the Classic editor can feel a bit confusing and challenging to learn.

WordPress Themes and Plugins

Regardless of the WordPress editor you’re using, you’ll manage your site from the back end. WordPress doesn’t have drag-and-drop functionality, WYSIWYG builders, or frontend design tools built-in.

That’s why so many people use third-party tools to improve their editing experience, especially as a beginner.

A simple plugin can eliminate the need for you to use the WordPress editor. These can be extremely useful as you’re building pages and creating a new site from scratch.

Pages vs. Posts

When editing content on your WordPress site, the editing typically falls into one of two categories—pages or posts.

Pages are static and not impacted by date. They can best be described as permanent fixtures on your site. Your home page, about us page, contact page, and main blog page are all excellent examples of this.

Posts are articles and blogs that get published on your site in reverse chronological order. There are different ways to display posts on your website. It’s also worth noting that WordPress has custom post types like testimonials, portfolio projects, and more.

3 Tricks For WordPress Editor

To make your life easier using the WordPress editor, follow these few quick tips and best practices. These are easy for beginners to follow.

Trick #1: Use WordPress-Specific Web Hosting

Your web hosting provider can make or break your WordPress experience. Some of the best web hosting for WordPress solutions come with built-in editing tools and page builders as well.

If you’re going to be using third-party tools and plugins to edit your WordPress site, having a host optimized for WordPress is crucial. Otherwise, these plugins, themes, and add-ons can slow down your website and ultimately crush its performance.

Trick #2: Learn Keyboard Shortcuts

There are lots of different elements and capabilities built into the WordPress editor. So when you’re adding a page, creating a post, or changing content, it can be overwhelming to navigate and find what you need.

But learning a few useful keyboard shortcuts will make it easier for you to accomplish common formatting tasks faster. For example, there are keyboard shortcuts for saving changes, undoing last changes, redoing last undo, adding a link, bolding text, and more. So if you’re constantly performing a certain function in the editor, lookup the keyboard shortcut, and it will save you from making extra and unnecessary clicks and mouse movements.

Trick #3: Check Post Formatting

Many WordPress users like to write blogs outside of WordPress because they are more comfortable with another text editor or word processor. For example, you might prefer to write your content in Google Docs or Microsoft Word before adding it to WordPress.

Just be aware that WordPress doesn’t always play nice with copy/paste from other platforms. Some of your formatting might have some problems.

Headers and line spacing issues are two common problems that I’ve seen when copying and pasting posts into WordPress. The Gutenberg editor works better than the classic editor for this scenario.

But it’s always in your best interest to go back and check the formatting before you post anything. It may involve a few extra manual clicks on your end to separate paragraphs, re-create a bullet list, or something along those lines.

Revealing the Secrets of Kubernetes Secrets

Kubernetes secrets are the native resources for storing and managing sensitive data, like passwords, cloud access keys, or authentication tokens. You need to distribute this information across your Kubernetes clusters and protect it at the same time. When sending your password to each node in your cluster, it’s critical to ensure that only authorized entities—users, services, or workloads—are able to access it.

Kubernetes Secrets

The building blocks of Kubernetes computation are pods made up of containers. You can bake your sensitive passwords into container images or configure them as part of pod definitions. The more secure and Kubernetes-native approach uses secret objects and introduces them in pod specifications (e.g., a file or environment variable).

A programming lab question.

Write a Java class Clock for dealing with the day time represented by hours, minutes, and
seconds. Your class must have the following features:
Three instance variables for the hours (range 0 - 23), minutes (range 0 - 59), and
seconds (range 0 - 59).
Three constructors:
o default (with no parameters passed; is should initialize the represented time to
12:0:0)
o a constructor with three parameters: hours, minutes, and seconds.
o a constructor with one parameter: the value of time in seconds since midnight (it
should be converted into the time value in hours, minutes, and seconds)
Instance methods:
o a set-method method setClock() with one parameter seconds since midnight (to be
converted into the time value in hours, minutes, and seconds as above).
o get-methods getHours(), getMinutes(), getSeconds() with no parameters that return
the corresponding values.
o set-methods setHours(), setMinutes(), setSeconds() with one parameter each that set
up the corresponding instance variables.
o method tick() with no parameters that increments the time stored in a Clock object
by one second.
o method addClock() accepting an object of type Clock as a parameter. The method
should add the time represented by the parameter class to the time represented in
the current class.
o Add an instance method toString() with no parameters to your class. toString() must
return a String representation of the Clock object in the form "(hh:mm:ss)", for
example "(03:02:34)".
o Add an instance method tickDown() which decrements the time stored in a Clock
object by one second.
o Add an instance method subtractClock() that takes one Clock parameter and returns
the difference between the time represented in the current Clock object and the one
represented by the Clock parameter. Difference of time should be returned as an
clock object.
Write a separate class ClockDemo with a main() method. The program should:
instantiate a Clock object firstClock using one integer seconds since midnight obtained
from the keyboard.
tick the clock ten times by applying its tick() method and print out the time after each
tick.

Extend your code by appending to it instructions instantiating a Clock
object secondClock by using three integers (hours, minutes, seconds) read from the
keyboard.
Then tick the clock ten times, printing the time after each tick.
Add the secondClock time in firstClock by calling method addClock.
Print both clock objects calling toString method
Create a reference thirdClock that should reference to object of difference of firstClock
and secondClock by calling the method subtractClock().

Interview With Jeremy Evans, Lead Developer of Sequel and Roda

Introduction

Jeremy Evans is the lead developer of the Sequel database library, the Roda web toolkit, the Rodauth authentication framework, and many other Ruby libraries. He is the maintainer of Ruby ports for the OpenBSD operating system, and has contributed to CRuby and JRuby, as well as many popular Ruby libraries. We are happy to present a brand-new interview with Jeremy to our readers. Hope you enjoy it!

The Interview

Evrone: You became a Ruby committer and received the Ruby prize 2020 with your work on keyword arguments separation. Could you tell us how did it happen, how did you feel about that?

The Kano Model: Developing for Value and Delight

Even though we have been developing software on the mainframe platform for decades we still have ways to learn and improve. We continually face the problem of meeting user needs with the resources we have on hand. This forces us to be careful about what we choose to do—we must look at whether we are focusing on the right things. While there are basic expectations that must be met, are we providing things that excite and delight? That is, the things that make users feel connected and generate passion. Users that feel a connection with your applications can obtain greater value from them.

How to provide things that excite while still delivering on basic needs is difficult to manage, but there are tools to help. For one the Kano model created by Japanese educator, lecturer, writer, and consultant in the field of quality management, Dr. Noriaki Kano. He sought to resolve these issues with a prioritization framework. The framework focuses on the three patterns of customer expectations versus the investments organizations make to delight their customers and do what it takes to positively impact customer satisfaction.

How to Know if a Meeting Is Worthwhile Before Scheduling it

Do you feel a shiver down your spine when you hear the word “meeting”?

If you dread meetings, you aren’t alone. Common complaints about meetings are that they happen too often, they’re too long, and they don’t successfully address problems. In short, they’re not worthwhile.

Apache Kafka for the Connected World: Vehicles, Factories, Cities

The digital transformation enables a connected world. People, vehicles, factories, cities, digital services, and other "things" communicate with each other in real-time to provide a safe environment, efficient processes, and a fantastic user experience. This scenario only works well with data processing in real-time at scale. This blog post shares a presentation that explains why Apache Kafka plays a key role in these industries and use cases but also to connect the different stakeholders.

Software is Changing and Connecting the World

Event Streaming with Apache Kafka plays a massive role in processing massive volumes of data in real-time in a reliable, scalable, and flexible way integrating with various legacy and modern data sources and sinks.

getting the last modified date of file in java

I am trying to get information on when was the last date a file was modified in java. I have the date in long format. I dont know why the long object is showing the year to be 1970.Below is my code


File mypath=new File(my_global_folder+"/"+mydata.getItemAtPosition(position));
 long time=mypath.lastModified();
 //When i try to convert long to Date the year part reads 1970
 Date mydate= new Date(time);


Can anyone help me modify the code to give the right lat modified date

How to Display Announcements in Your WordPress Blog

Do you want to display announcements in your WordPress blog or website?

Adding announcements to your site is an effective way to direct user attention and boost conversions. They can be used to convey important messages, redirect users to popular content, promote special offers, and more.

In this article, we will show you how to easily display announcements in WordPress.

How to display announcements in WordPress blog

Why Add Announcements in WordPress?

Many popular websites display special announcements as a floating bar on the top or at the bottom. These announcement bars are highly effective, which is why you are seeing them on more and more sites.

Announcements are immediately noticeable on any website due to their placement. Usually, it is a full-width bar on either the top or the bottom of a page.

Announcement bar example

You can use it to offer special discounts, run time-sensitive marketing campaigns, ask users to participate in surveys, read a new blog post, etc.

You can also add visual effects, countdown timers, and email forms into your announcement bar.

Having said that, let’s take a look at how to easily add announcements in WordPress.

Method 1: Display Announcements in WordPress Using OptinMonster

For this method, we will be using the OptinMonster. It is the most popular lead generation and conversion optimization software on the market.

OptinMonster helps you convert website visitors into subscribers and paying customers. It comes with many campaign types, including announcement bars that can be displayed on the top or at the bottom of your website.

Most importantly, it comes with powerful display rules which allow you to show different content to different users. You can also choose where and when to show your announcements.

Disclosure: OptinMonster is one of our premium products. WPBeginner users can try the free version by installing our OptinMonster plugin and signing up for a free account through the plugin.

The free version is not visible on the main OptinMonster website.

OptinMonster

First, you need to install and activate the OptinMonster plugin. For more details, see our step by step guide on how to install a WordPress plugin.

This plugin acts as a connector between your WordPress website and your OptinMonster account.

Upon activation, you need to visit OptinMonster » Settings page and click on the ‘Connect existing account’ or Create a New account button.

Connect account

This will bring up a popup where you can log in and connect your WordPress website to your OptinMonster account.

Now that your WordPress site is connected, you are ready to create your first geotargeted campaign. Go to the OptinMonster » Campaigns page and click on the ‘Add New’ button.

Create new campaign

First, you’ll need to choose your campaign type. OptinMonster supports lightbox popups, floating bars, inline optins, fullscreen, slide-in, and gamified campaigns.

For the sake of this tutorial, we’ll choose a Floating bar campaign that allows you to display a floating bar on the top or bottom of your website.

Choose floating bar campaign

Below that, you can select a campaign template by clicking on it.

Next, you need to enter a name for your campaign. You can enter any name here, and then click on the ‘Start building’ button.

Campaign name

This will launch OptinMonster’s campaign builder interface with a live preview of your campaign in the right panel.

OptinMonster campaign builder

You can simply point and click on any item in the preview to edit, move, or delete it. You can also add new elements by clicking on the Add Blocks button at the top.

In this example, we are using an announcement bar promoting a special offer with a countdown timer to create FOMO effect.

If you want to display the notification bar at the top, simply click on the Floating Settings from the left column and then check the toggle to move it to the top.

Announcement bar on the top

Once you are finished with the campaign design and content, switch to the Publish tab and change the campaign status to ‘Publish’.

Publish campaign

After that, click on the Save button to store your settings and close the campaign builder.

OptinMonster will now take you to the Output settings page. From here, you can choose where you want to display your campaign.

Output settings for your announcement bar

After that, change the Visibility status to Published and click on the Save button to make your campaign live.

You can now visit your website to see your announcement bar in action.

Announcement bar preview

Method 2: Display Announcements in WordPress Using Notibar

OptinMonster is a powerful tool with tons of options, like email form integration, timers, unlimited colors and designs, and powerful targeting controls.

However, if you just want to quickly show an announcement without using advanced features, then you can use this method.

First, you need to install and activate the Notibar plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » Notibar page to configure plugin settings which will launch in the Theme Customizer with a live preview.

Customizing your notification bar

You can start by switching to the General Options tab and select a position, width, and button type for your notification bar.

Notification bar general options

Next, go back and switch to the ‘Content Options’ tab. From here you can enter the content you want to show for your announcement.

Content options for your announcement bar

The plugin allows you to add different content for mobile devices.

After that, you can go back and switch to the ‘Style Options. From here you can choose colors and font-size for your announcement bar.

Style Options for your announcement bar

Finally, switch to the Display Options tab and choose where you want to show / hide your announcement bar content.
Display options

The plugin allows you to hide it for devices, homepage, pages or posts, or enter specific post/page ID where you don’t want to show the notification bar.

Once you are finished, simply click on the ‘Publish’ button at the top to save your changes and make your announcement bar live.

You can now visit your WordPress blog to see your announcement in action.

Notification bar preview

We hope this article helped you learn how to easily display announcements in your WordPress blog. You may also want to see our WordPress conversion tracking guide to see exactly how users interact with your announcements, and our comparison of the best WordPress landing page plugins to boost your conversions.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Display Announcements in Your WordPress Blog appeared first on WPBeginner.