So, I wrote a long email to the London Java Community in answer to an excellent question: “What can men do to support Women in Technology?”
It’s a bit of a brain dump, by no means comprehensive, and is in answer to a specific question in a specific context, but I’ve been asked to make the information public so it can be useful in a broader context. So here it is.
spring cloud configserver dataflow eureka h2 hystrixdashboard kafka zipkinand you’ll have those services running on the appropriate ports! Simple.
This is more common sense than anything else. If you make calls to multiple remote systems and aggregate the results in some way, represented as a marble diagram here ...
The previous tutorial showed how we can auto-generate of spring security using a memory realm. This tutorial expands on this to cover Default JDBC Realms using the source code from the parkrunPB application
The site has the following links and security requirements:
To apply a plugin in our Gradle build script, we can use the plugins DSL. The plugins DSL is very concise and allows Gradle to be more efficient and more in control when loading the plugin. Normally the plugin we define is fetched from the Gradle plugin portal. If we have our own repository, for example on the intranet of our company, we have to define that extra repository with a
pluginRepositories configuration block in the
settings.gradle file of our project.
In the following sample, we have a plugin
mrhaki.gradle.version-file that is stored in the company intranet repository with the URL
The froth of JavaOne has died down (already!) and it’s almost back to business as usual. Although here at JetBrains we’re working hard on our latest product releases, and gearing up to see some of you at Devoxx this week. This month’s annotated monthly looks outward to more than just things that impact Java and the JVM, and pulls together content that affects all developers, like design, architecture and security.
In news that will surprise no-one, Oracle is appealing again. Meh.
Although I tried to make this post comprehensible by itself, you might want to read previous parts before this one.
One of the keys to being a good programmer is working in an organized way. You pick a small, easy problem, solve it and move to the next small, easy one. One after another, step by step, something greater emerges. Our brains have limited capacity and processing speed. We can't do everything at once, we can't solve multiple complicated problems at the same time. Knowing this we can conciously limit our current "context" to something simple enough to chew at once.
I recently had the problem of walking through some data and collect elements on the go. I thought it would be nice to use theStream API in Java 8. After a short search on “the Internet,” I found a solution in this blog post for tree structures and in this one for recursing through a file system (which is a tree structure again). So, story told? No way! I needed to walk through graph structures (i.e., there might be cycles in it). On the contrary, the solutions above will run forever, or more precisely, they will terminate relatively fast with a
A solution is e.g. a breadth-first search (BFS). In essence, a BFS explores the search space level by level. On the go, it stores the so-called open list.
open contains the nodes (on the next level) not explored, yet. Already processed nodes won’t be put into
open again. This enables searching through structures with cycles.
This text mostly focuses on the local notifications and what we can do in UIViewController in Notification Content Extension.
Notifications in iOS 10 got quite a lot of improvements. The first one is a higher contrast with the notification view on a Lock Screen, so it stands out more. The second one is a total customization of notification presentation.
As seen in the picture above, the notifications stand out more and are attention-grabbing.
We can put custom content in the notification: music, video, images, custom drawing and animations.
When a user is unlocking his device, the first thing a user will see when he taps on the Touch ID button are notifications that are waiting for him.
Since the lock screen unlocking procedure has also been changed, the notifications have a greater chance of getting attention from a user. To unlock a phone, the user needs to tap twice and it is during this process that notifications get a small window of opportunity for presentation.
When the phone is locked, tapping the Home button reveals Lock Screen with pending notifications for user.
Tapping on the notification on the lock screen will open associated app for that notification. Swiping the notification to the left reveals View and Clear buttons. The View button is available only if device does not support 3d Touch.
On devices with 3d Touch, the user can get preview of the content by force touching the notification, which is either on the Lock Screen or Springboard. For example, the user receives a notification about new message for him. User can Force Touch notification and open the message view. The user can then type reply directly on the lock screen, instead of opening the app.
When a notification appear on Springboard, user can swipe down on notification view and get content extension presented to him. That is possible if the app has Notification Content Extension implemented about that notification.
In addition, developers can add more than one extension to their app. They just need to create new target in Xcode project and assign a category identifier in extension’s Xcode target Info.plist file.
On the time of writing, no iPad devices has Force Touch feature. Some iPhone models in production do not have Force Touch feature. On these devices, user can reveal notification by swiping.
Developers can add actions to notifications. Actions are visible when user expand the notification.
We don’t need to have Notification Content Extension for this feature.
Developers can add actions to the notification when configuring the category object:
let cool = UNNotificationAction.init(identifier: "CoolAction", title: "Cool", options: [.foreground]) let approve = UNNotificationAction.init(identifier: "ApproveAction", title: "Approve", options: [.foreground]) let later = UNNotificationAction.init(identifier: "LaterAction", title: "Later", options: [.foreground]) let like = UNNotificationAction.init(identifier: "LikeAction", title: "Like", options: [.foreground]) let category = UNNotificationCategory.init(identifier: "CategoryId", actions: [cool, approve, later, like], intentIdentifiers: , options: )
Note that we need category identifier later, when configuring the notification content object.
Notification category needs to be created and registered with
UNUserNotificationCenter early in the application lifecycle, preferably in app delegate.
Every notification can have several actions assigned to it. The actions will appear in an ordered fashion. If we put more notification actions that can fit in the screen real estate, user will not be able to use them.
Actions are the only way a developer can enable user to interact with the notification, because adding Gesture Recognizers or UIControl objects won’t work. UIViewController that is shown when notification is expanded does not process touch input. The default behaviour for tapping the notification view is launching the app.
Notification attachments are a new way of customising notifications. This is a convenient and easy way to add content to notifications without making an extension. With the help of
UNNotificationAttachement class we can attach media files to the notification. By using the options dictionary argument we can also customise the thumbnail image.
We can add three types of attachments to notifications:
1. Image attachment:
2. Video attachment:
3. Music attachment:
When a user interacts with notification, media which is inside attachments are shown or playback controls are presented, depending on media type.
For example, if we send a birthday notification to user we can send image of contact whose birthday it is.
All attachments are created by creating
UNNotificationAttachment object with path to media resource and attaching that object to notification content object.
let url: URL? = Bundle.main.url(forResource: "sound", withExtension: "mp4") let attachment = try? UNNotificationAttachment.init(identifier: "AttachmentId", url: url!, options: [UNNotificationAttachmentOptionsTypeHintKey : "mp4"])
We cannot get text from the user by an UITextView or UITextField. Putting those objects in our UIViewController will just display them, but the user won’t be able to interact with them. The keyboard will not show on touch gesture, instead notification content extension view will process tap gesture as interacting via the notification view. Depending on whether notification occurred in our app or on Springboard, tapping will close the notification view and then show the app.
The Notification Content Extension contains full UIViewController for absolute customization. As mentioned, there is no way to process touches on that screen. But nothing stops developer from putting some pictures to move around and paint some UIView’s using Core Graphics.
Developers can use Core Animation frameworks in their notifications. In this extension, we have several CALayer objects moving around:
Drawing is also possible, here we have UIView with the overriden drawRect method:
As we can see, many things are possible with new notifications.
Ok, so we have powerful notifications. How are we going to write code for them and debug it?
The developer can debug the notification content extension code by putting breakpoints in his project. When trying to debug notifications, breakpoints in the notification target won’t work unless target is changed. In Xcode, target must be switched to point to the notification content extension target.
After that, when Run button is clicked, Xcode will ask to select an app:
Breakpoints that are set in the notification content extension will now be hit and debugging is possible.
Conclusion: we can use full UIViewController capabilities, along with autolayout, to produce beautiful and inviting notifications.
Grab the project here.
ClassNotFoundException and NoClassDefFoundError occur when a particular class is not found at runtime. However, they occur at different scenarios.
ClassNotFoundException is an exception that occurs when you try to load a class at run time using Class.forName() or loadClass() methods and mentioned classes are not found in the classpath.
This article represents a list of web pages which can help one understand the memory usage of Java objects and arrays — along with examples. Please feel free to comment/suggest any other cool pages. Also, sorry for the typos.The in-memory size of the object depends on the architecture, mainly on whether the VM is 32 or 64-bit. The actual VM implementation also matters.
If you’re implementing any projects with Spring and Gradle (for build), as your project grows you may run into this issue. Or you’ve landed on this page by searching on Google for “Unable to locate Spring NamespaceHandler for XML schema namespace” (your actual XML that it’s error-ing out may vary).
Either way, you’re in luck! Most likely, you’re using the fatjar Gradle plugin to create a single JAR for executing as “java -jar one-big-bundle.jar”. The problem that happens is that if two or more dependent jar libraries contain the same file/artifact, then the last one wins the race in the fatjar bundle.
Before we dive into the details, here is a quick snapshot of the related interfaces
|ServerEndpointConfig||A derivative of EndpointConfig interface which is specific for configuration related to server side WebSocket endpoints|
|ServerEndpointConfig.Configurator||An interface whose custom implementation allows sharing of global (for all endpoints) available logic/state as well opportunity to intercept the WebSocket handshake process (via method override)|
|ServerEndpointConfig.Builder||Used only for programmatic server endpoints to build a ServerEndpointConfig instance|
From here on, we’ll explore the configuration strategies for annotated and programmatic server endpoints
This article continues a series on declarative services in OSGi. We started with a basic OSGi bundle, then discussed architecting a multi-bundle application. Then we looked closer at declarative services and how to register them. All of this is fully demonstrated in an example application on GitHub.
With the last article, we left off with a service interface, and implementation, and a few ways to tell the service registry about it. However, we didn't cover the mechanics of registration for our last method (SCR using Java annotations) and we didn't cover service lookup. In this article, I'll be tackling the first of those two topics.
Designing object-oriented software is hard, and designing reusable object-oriented software is even harder.
This is the opening line of the classic manual on software design Design Patterns: Elements of Reusable Object-Oriented Software, published in 1994.
More than 20 years later, this statement still rings true. The first chapter of the book introduces a few high-level principles to accomplish this goal. One of them stands out:
In an earlier blog post, Caching Made Bootiful: The Hazelcast Way, Hazelcast’s Viktor Gamov demonstrated the ease of doing caching with Hazelcast in Spring.
In this post, we’ll continue the theme to show how trivial session clustering is to implement from a coding perspective but also how this can radically change the application architecture for the web tier.
Internationalization is an essential part of development, and it has to be incorporated into the framework you're using from the very start.
Akio Morita, co-founder of Sony (1921-99) said these famous words. Local cultures are much more than just about language. Much like how different groups in the United States have their own in-jokes, dialects, idioms and customs, different countries have their own ideas about how things should be done and how things should be presented. That’s why software, websites, and apps need to be developed with internationalization (i18n) in mind.
Many times, I've seen messy, unmaintainable code, mainly due to the absence of design patterns. But even more often, I've seen design patterns being applied at places where no one will ever value them. Knowing not only when and how to apply design patterns, but also when and where to not use them, is crucial to avoid frustrations at work.
Say you have the OrderState enum and you do different things on different parts of your code, depending on the value of the enum:
Speaker: Josh Long
Hi, Spring fans! In this tip, we’ll look at how to create components that are aware of the Spring container
In two previous articles, I introduced building an OSGi bundle and the architecture of a multi-bundle OSGi solution. One of the key features of that multi-bundle solution in its associated GitHub repository is the use of OSGi declarative services.
OSGi declarative services are the OSGi way to handle the instantiation problem: the fact that we want to code to interfaces, but we need some way to instantiate classes and some way to provide some concrete instance of an interface in order for the parts of our modular application to work together.