Blog


Vanessa Foster's account of a misguided youth, fleeing the FBI from Texas all the way to Alaska, is everything a great memoir should be. It's a love-crazed and drug-twisted adventure where one mishap after another unravels her world until little remains, but a helpless wish for grace and a humbled reliance on the aid of culinary angels. It's also a poetic search through the colorful, but frayed and fading pieces of a once hopeful reality. She gropes desperately for a thread of meaning while fumbling with her exhilarating lover in his schizophrenic downward spiral. With all hopes, dreams, family, and innocence seemingly lost, she is finally relented with a gift of grace, illuminated with spiritual truth, and crowned a woman. In losing almost everything, she gains something that is more.

Vanessa Foster delivers all the things we seek from a good story - escape, adventure, entertainment, spiritual retreat and self-discovery. And it's all true.

As a wanna-be writer, I have to envy her. The book reminded me of The Road by Cormac McCarthy. It's not a similar story, but she's similar in her ability to break all the rules of writing in eloquent service of honesty and poetic truth. Like McCarthy, she dismisses quotation marks from dialog in a way that makes the words of others somehow also her own - a technically challenging feat that paints every external scene with vivid emotions from her own mind - her own experience of each moment. In this, she enables us to feel what she felt and to see things as she saw them. We become her. We become who she was, and then we become with her as she changes into something new. Ultimately, we are left with the memory of an experience that might as well have been our own - complete with its hard-earned rewards, and yet all under the safety of our bedside reading lamp.

Today, finding a good book, much less a great one, is a difficult task; they are few and far between. But if you're anything like me, I think you'll find that Vanessa Foster's More Than Everything is at least more than many.


Here's how to use query parameters from the HTPP request (or from the URL) in a personalization component. This page came from my raw notes and hasn't yet been rewritten for the broader audience; sorry. Posting it anyway for those who won't mind a little sloppiness.



The personalization component must be rendered by the WCM servlet (the URL of which you can get from Previewing the component - DONT FORGET TO REMOVE NO CACHE PARAMS IN PROD). If you access it as rendered within the Web Content Viewer, the rule will not have access to the Request and won't be able to get the request parameters.


Assuming the following taxonomy and categories...


And assuming the following content...


We're going to create the following PZN rule...

We created 3 request parameters so that we can enforce a rule that insists that all 3 must be on the content (AND). With this, we can add the following to the URL:

&cat1=testcat1&cat2=testcat2&cat3=testcat3

We could alternatively have only 1 request param and do something like this:

&cats=testcat1,testcat2,testcat3

The problem with that is that it will only enforce an OR evaluation. If any content is tagged with any one of the given categories, it will show up.

Because we need to ensure that only content tagged with all 3 categories shows up, we create 3 separate request params. This allows us to use the PZN rule to enforce the AND condition.


Here's how you make establish the request parameters and make them available in the pzn rule.


Step one: Click the value slot...


Step two: Navigate to Manage Properties... under the Request item...

When you're just starting, you list may be empty (mine has some examples in it already). 


Step Three: Click Add Dynamic Property...

Step four: Fill out as follows...for example...


Click SAVE.

Click DONE.

Your new item should show in the list under Request...






Preview the PZN Component. Remove the unecessary params (like no chache) from the URL for PROD. Add your parameters and category names to the URL. For example:


http://local.base22.com:10039/wps/wcm/myconnect/web%20content/articles?source=library&srv=cmpnt&cmpntid=0d99a109-b8c7-4f38-a9ae-8d48faf37e32&cat1=testcat1&cat2=testcat2&cat3=testcat3


And you get:




 

The IBM Digital Experience suite includes IBM WebSphere Portal, IBM Web Content Manager, IBM Forms Experience Builder, and IBM Web Experience Factory. Following is my curated list of various reference resources related to these products.

Click on headers to sort columns in the table below.

ResourceAbstractTopicSub-topicResource TypeSourcePublished or Last Mod
Adding Bootstrap to a Portal ThemeThis article explains the steps needed to add Bootstrap to a modularized Portal theme:Theme DevelopmentBootstrap
IBM developerWorks, IBM Digital Experience Developer Center2016-01-29
Bootstrap meets PortalHow to integrate Twitter Bootstrap with WebSphere Portal and provide the different artifacts that are required. Theme DevelopmentBootstrap


Simple Theme Custom EAR File Creation

This sample allows you to quickly make a copy of the Simple Theme ear files and install your own custom version. This will allow you to change the jsps and dynamic content spots in the theme.


Theme DevelopmentSimple Theme
GitHub, Digital Experience2016-01-26
Simple Theme Bootstrap LayoutsThis sample contains four sample layouts which use the Bootstrap framework grid system, which is included in the Simple Theme's static files. Theme DevelopmentBootstrap

2016-01-26
Theme PAA for IBM WebSphere PortalProvides access to the Portal 8.5 Theme as a PAA deliverableTheme Development



Developing themes and skins
Theme Development
Product Documentation

Getting started with Themes
Theme Development
Product Documentation

Theme Manager


Theme Development
Product Documentation

DX Performance Testing Substitution Patterns for Reusable Test SuitesThis article will give you an overview over common portal specific substitution parts when writing reusable & dynamic performance tests. This article will not give you any concrete examples based on a specific tool like JMeter or Rational Performance Tester. Instead all examples consist of a little snippet and a potential regular expression to find the areas for substitution.Performance Testing and Tuning



Portal V8.5 Performance Tuning Guide
Performance Testing and Tuning



Resolver Samples for WebSphere PortalIllustration of late binding to an application using the resolver framework in WebSphere Portal



2015-09-20
How to create a custom HTML editor integration You can use custom HTML editors in all HTML fields of the authoring interface or specific HTML elements that are defined in an authoring template. Custom HTML fields are used to integrate third-party editors into the authoring interface.




Sample Custom Script Plugins for WCMSamples of WCM Plugins with a JavaScript implementation




IBM Digital Experience Developer CenterFor developers who use IBM Digital Experience products and tools




IBM Digital Experience V8.5 API and Developer Reference Documentation

API, SPI, and other reference documentation for developers is provided here for convenience. The most current documentation is installed with the respective products.

SDK and API
Site

Sample Node.js Build Tools for Script PortletSample Node.js Build Tools for Script Portlet



2015-07-08
WCM Sample Custom Workflow ActionsSample custom workflow actions for IBM Web Content Manager



2014-07-19
WCM Syndication HealthcheckPeriodically update a content item on the authoring server and verify that the update appears on the rendering server.



2014-06-06
RSS Sample for IBM Digital Data Connector in WebSphere PortalRSS Sample for IBM Digital Data Connector in WebSphere Portal - integrate remote RSS data without writing code and style it with Web Content Manager



2014-07-04
IBM Digital Experience Wiki





IBM Digital Experience YouTube Channel





IBM ADL4WCM YouTube Channel





WCM 8.5 - CF07 - Storing Translated Strings as Content

Previously, the strings used by the text provider plug-in had to be stored in a custom plug-in. Now they can be stored in content items and site areas, allowing users to create and maintain text provider strings from within Web Content Manager.
Multilingual

2015-07-28
IBM Forms Experience Builder 8.6.4This documentation set contains information for both administrators who install and configure the product, and users who design and build IBM® Forms Experience Builder applications.

Product Documentation

What's new with CF08 - IBM

What's new with Combined Cumulative Fix 08.

IBM®
IBM Knowledge Center



What's new with CF07 - IBM

What's new with Combined Cumulative Fix 07.




What's new with CF06 - IBM







What's new with CF03 - IBM







Web Developer Toolkit for IBM Digital Experience





Leveraging the Power of Web Content Manager Within a Portal Theme


Theme Development



A Step-By-Step Guide to performing a standalone WebSphere Portal 9.0 installationThis guide is meant to provide a step-by-step for the setup and installation of a standalone IBM WebSphere Portal 9.0. We will also cover prerequisites



2017-01




About

Keyboard shortcuts and various tips for IntelliJ IDEA. This document assumes IntelliJ on a Mac, using the Keymap setting for Mac OS X 10.5+ (in Preferences > Keymap). I know you can get all these through Help > Keymap Reference in IntelliJ, but I like to maintain my own list so that I can organize and search it the way I prefer, plus have a place to add my own additional notes.

Editing

Comment / uncomment selected textSelect block of text and then press Command + /
Spread selection from cursor (to word, then line, etc.)ALT + up arrow or down arrow
Format selected codeCTRL + ALT + I
Format all codeALT + CMD + L
Autocomplete method parameter infoCMD + P (when cursor is in method signature)
Invoke a Surround Template (ex: surround a line with try/catch)OPTION + CMD + T
Complete a statementSHIFT + CMD + ENTER


Navigation

Tool Windows and Dialogs

ProjectCMD + 1
Version ControlCMD + 9
PreferencesCMD + ,
BreakpointsSHIFT + COMMAND + F8
Recent FilesCMD + E
Search EverywhereSHIFT + SHIFT
Search ClassesCMD + O
Search SymbolsOPTION + CMD + O
Navigate back and forth through recent filesCMD + [ and CMD + ]
New file (where selection is in Project window)

CMD + N

Note: you can use slashes to create entire trees abc/def/ghi/jkl...

Hide all other windowsSHIFT + CMD + F12
Stretch pane right or leftSHIFT + CMD + left or right arrow
Clipboard HistorySHIFT + CMD + V
Method List (of the active editor file)CMD + F12
Navigation Bar

CMD + up arrow

Note: This is particularly useful if you turn off the normal navigation bar in preferences to save UI space.

Action SearchSHIFT + CMD + A (try, for example, "RESTful Web Service")
Version Control Quick ListCTRL + V
Quick Switch SettingsCTRL + ~
Quick DocumentationCTRL + J (and then again to pin it open at larger size).


Live Templates

Live templates can be found in Preferences > Editor > Live Templates. Learn them!

To use a live template, enter its short text in the editor and then press tab to replace the short text with its template.


Here's a SPARQL query that counts all statements (triples) in a repository.

Count all statements
SELECT (COUNT(?s) AS ?triples) WHERE {
    ?s ?p ?o
}

Note that this can be a long running query. For me it took took 21 seconds to count the statements in a repository with 30 million triples.

Example SPARQL queries that can help you list the classes in an ontology.

List all classes


List all classes
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 
SELECT DISTINCT ?type
WHERE {
  ?s a ?type.
}

Note: The SPARQL keyword a is a shortcut for the common predicate rdf:type, giving the class of a resource.

List all classes with a given prefix


List all classes with a given prefix
PREFIX bc: <http://base22.com/ont/bc#>

SELECT DISTINCT ?type
WHERE {
  ?subject a ?type.
  FILTER( STRSTARTS(STR(?type),str(bc:)) )
}


List class hierarchy


List all classes with a given prefix
SELECT DISTINCT ?subject ?label ?supertype
WHERE {
    { ?subject a owl:Class . } UNION { ?individual a ?subject . } .
    OPTIONAL { ?subject rdfs:subClassOf ?supertype } .
    OPTIONAL { ?subject rdfs:label ?label }
} ORDER BY ?subject

Recently I completed a little study incorporating Spring for Stardog into a Spring Boot web app, with successful results. Here's how.

Contents

Introduction

Stardog is a Java based RDF repository server (a.k.a. triple-store and more), which supports the RDF graph data model; SPARQL query language; property graph model and Gremlin graph traversal language; HTTP and SNARL protocols for remote access and control; OWL 2 and user-defined rules for inference and data analytics; virtual graphs; geospatial query answering; and programmatic interaction via several languages and network interfaces. At this point, I don't have a lot of experience with Stardog, but I've been experimenting with it to see what I can learn. As part of my study, I recently incorporated Stardog Spring into a Spring Boot web app - taking notes along the way. Here's my notes on how I got it setup and working successfully.

Download and Install Stardog

For my local development environment on Mac OS, I installed Stardog 5 BETA (Community Edition).

You can download Stardog at www.stardog.com. Once you've downloaded it, unzip the archive to a destination directory. I'm put mine in /Users/cburleson/stardog

Next you need to set the STARDOG_HOME environment variable. You can do this by adding an export line to your .bash_profile.

cd ~
sudo nano .bash_profile

Add the following line:

Add to .bash_profile
export STARDOG_HOME=/Users/cburleson/stardog

Save changes made to .bash_profile by hitting Control+o (that’s an o as in otter), ENTER, then exit out of nano by hitting Control+X.

Note that changes made .bash_profile will require the shell to be restarted or a new shell to spawn.

Copy stardog-license-key.bin into the STARDOG_HOME location. Then you can start the Stardog server to test your installation.

Start the Stardog server
/Users/cburleson/stardog/bin/stardog-admin server start

If everything is working properly, you should get the following response.

Stardog server startup response
ERROR 2017-05-09 14:34:56,823 [main] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:createService(161): Unable to create an instance of HttpService class com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService, missing compatible constructor

Stardog server 5.0-beta started on Tue May 09 14:34:57 CDT 2017.

Stardog server is listening on all network interfaces.
HTTP server available at http://localhost:5820.

STARDOG_HOME=/Users/cburleson/stardog

Note that there is an ERROR in this response, but I think it just has to do with the fact that I'm using the Community edition and not an enterprise edition (see: this support issue)

Still, the server is running and can be accessed in a web browser at  http://localhost:5820/


Login with:


Usernameadmin
Passwordadmin


You can also check the server status with the following command:

Check Stardog server status
/Users/cburleson/stardog/bin/stardog-admin server status

Now, that you've tested the installation, you can stop the server with the following command.

/Users/cburleson/stardog/bin/stardog-admin server stop


Add the Stardog Maven Repo to pom.xml

In order to get the required dependencies, you need to add the Stardog public maven repository to your repositories defined in the Maven POM (pom.xml). Here's how that section looks in my file:

Stardog Maven repo in pom.xml
<repositories>

    <repository>
        <id>spring-releases</id>
        <url>https://repo.spring.io/libs-release</url>
    </repository>

    <repository>
        <id>stardog-public</id>
        <url>http://maven.stardog.com</url>
    </repository>

</repositories>

Add Stardog Dependencies to pom.xml

Now, we can add the required dependencies. Notice that even though I installed Stardog 5 BETA, I'm using a different version number for various dependencies (still, it works).

Stardog dependencies in pom.xml
<dependency>
    <groupId>com.complexible.stardog</groupId>
    <artifactId>client-snarl</artifactId>
    <version>4.2.4</version>
    <type>pom</type>
</dependency>


<dependency>
    <groupId>com.complexible.stardog</groupId>
    <artifactId>client-http</artifactId>
    <version>4.2.4</version>
    <type>pom</type>
</dependency>


<dependency>
    <groupId>com.complexible.stardog</groupId>
    <artifactId>server</artifactId>
    <version>4.2.4</version>
    <type>pom</type>
</dependency>

<!--
<dependency>
    <groupId>com.complexible.stardog.sesame</groupId>
    <artifactId>stardog-sesame-core</artifactId>
    <version>4.2.4</version>
    <type>jar</type>
</dependency>
-->
<!--
<dependency>
  <groupId>com.complexible.stardog.jena</groupId>
  <artifactId>stardog-jena</artifactId>
  <version>4.2.4</version>
  <type>jar</type>
</dependency>
-->

<!--
<dependency>
    <groupId>com.complexible.stardog.gremlin</groupId>
    <artifactId>stardog-gremlin</artifactId>
    <version>4.2.4</version>
    <type>jar</type>
</dependency>
-->


<dependency>
    <groupId>com.complexible.stardog</groupId>
    <artifactId>stardog-spring</artifactId>
    <version>2.1.3</version>
    <type>jar</type>
</dependency>


<!--
<dependency>
    <groupId>com.complexible.stardog</groupId>
    <artifactId>stardog-spring-batch</artifactId>
    <version>2.1.3</version>
    <type>jar</type>
</dependency>
-->

<!-- https://mvnrepository.com/artifact/org.apache.lucene/lucene-core -->
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-core</artifactId>
    <version>6.5.1</version>
</dependency>

Notice that I've got stardog-spring-batch commented in the file, but commented out. I put it in the file incase I decide to use it in the future, but for now, I don't need it.

Create or Edit Spring Application Context File

I prefer using pure Java only configuration for Spring, but I had trouble with this one, so opted to use the XML configuration. I created the following file inside of src/main/resources...

applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean name="embeddedProvider" class="com.base22.rdfx.config.EmbeddedProvider"></bean>

    <bean name="dataSource" class="com.complexible.stardog.ext.spring.DataSourceFactoryBean">
        <property name="to" value="testdb"/>
        <property name="provider" ref="embeddedProvider"/>
        <property name="username" value="admin"/>
        <property name="password" value="admin"/>
    </bean>

    <bean name="template" class="com.complexible.stardog.ext.spring.SnarlTemplate">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean name="importer" class="com.complexible.stardog.ext.spring.DataImporter">
        <property name="snarlTemplate" ref="template"/>
        <property name="format" value="N3"/>
        <property name="inputFiles">
            <list>
                <value>classpath:data/sp2b_10k.n3</value>
            </list>
        </property>
    </bean>

</beans>

Notice that the data importer bean is going to look for an RDF file in the classpath, which should exist in src/main/resources/data.

I got that file from the source project for stardog-spring, which you can find on GitHub at:  https://github.com/stardog-union/stardog-spring

You could use any RDF file that you want to have auto-loaded into the Stardog repository.

Make the applicationContext.xml Available to Your Spring Boot App

In order for your Spring Boot app to recognize and load the applicationContext.xml, you'll need to add an annotation to the main application class (the one with a Java main() method)...

The annotation you'll need to add is:

@ImportResource("classpath:applicationContext.xml")

My main application class looks like this:

Platform.java
package com.base22.rdfx;
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
 
@SpringBootApplication
@ImportResource("classpath:applicationContext.xml")
public class Platform {
 
    public static void main(String[] args) throws Exception {
        SpringApplication.run(Platform.class, args);
    }
 
}


Create an EmbeddedProvider Java Class

The applicationContext.xml file references an EmbeddedProvider class. There is no EmbeddedProvider exposed by the stardog-spring library, but I found one in the stardog-spring source code at src/main/test/java/com/complexible/stardog/ext/spring.

You'll need to create this class in your project and make sure that you reference the package and class properly for the embeddedProvider bean in your applicationContext.xml file.

EmbeddedProvider.java
package com.base22.rdfx.config;

import com.complexible.common.protocols.server.ServerException;
import com.complexible.stardog.Stardog;
import com.complexible.stardog.StardogException;
import com.complexible.stardog.api.admin.AdminConnection;
import com.complexible.stardog.api.admin.AdminConnectionConfiguration;
import com.complexible.stardog.ext.spring.Provider;
import com.complexible.stardog.protocols.snarl.SNARLProtocolConstants;

public class EmbeddedProvider implements Provider {

   @Override
   public void execute(String to, String url, String user, String pass) {

      try {
         Stardog.builder()
               .create()
               .newServer()
               .bind(SNARLProtocolConstants.EMBEDDED_ADDRESS)
               .start();
         AdminConnection dbms = AdminConnectionConfiguration.toEmbeddedServer().credentials(user, pass).connect();
         if (dbms.list().contains(to)) {
            dbms.drop(to);
            dbms.createMemory(to);
         } else {
            dbms.createMemory(to);
         }
         dbms.close();
      } catch (StardogException e) {

      } catch (ServerException e) {

      } finally {

      }

   }
}


Use the Spring for Stardog SnarlTemplate in a Controller

For a quick acid test, I created a simple Spring Controller that gets executed when you hit the path /test in a web browser.

Here's the simple test controller I created, which logs output from a SPARQL query to the console.

TestController.java
package com.base22.rdfx.controllers;

import com.complexible.stardog.ext.spring.SnarlTemplate;
import com.complexible.stardog.ext.spring.mapper.SimpleRowMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

@RestController
public class TestController {

   private static final Logger log = LoggerFactory.getLogger( TestController.class);

   @Autowired
   private SnarlTemplate template;

   //private static final String template = "Hello, %s!";
   //private final AtomicLong counter = new AtomicLong();

   @RequestMapping("/test")
   public void test(@RequestParam(value="name", defaultValue="World") String name) {

      log.trace(">> test()");

      String sparql = "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 5";

      List<Map<String,String>> results = template.query(sparql, new SimpleRowMapper());

      for ( Map<String, String> result : results ) {

         log.trace( "-- test() > --------------------------");

         Set keys = result.keySet();

         for ( Iterator i = keys.iterator(); i.hasNext(); ) {
            String key = (String) i.next();
            String value = result.get(key);
            log.trace("-- test() > " + key + " | " + value);
         }

      }

   }

}

How to Use the SnarlTemplate

The Spring Programming section of the documentation on the Stardog website provides some good information. However, if you want to see some actual code examples, you might want to refer to the TestDataSourceFactory.java class on GitHub. That's where I learned how to execute the query shown in my TestController using a SimpleRowMapper.

Test the App

Now you should be able to run your Spring Boot application and hit the TestController (/test in your browser). When you hit the URL, you should see the following output logged to the console, which shows that you've successfully configured and used Spring for Stardog. As you can see, five triples were returned from the given LIMIT 5 SPARQL query...

14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > --------------------------
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > p | http://www.w3.org/2000/01/rdf-schema#subClassOf
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > s | http://localhost/vocabulary/bench/Journal
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > o | http://xmlns.com/foaf/0.1/Document
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > --------------------------
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > p | http://www.w3.org/2000/01/rdf-schema#subClassOf
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > s | http://localhost/vocabulary/bench/Proceedings
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > o | http://xmlns.com/foaf/0.1/Document
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > --------------------------
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > p | http://www.w3.org/2000/01/rdf-schema#subClassOf
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > s | http://localhost/vocabulary/bench/Inproceedings
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > o | http://xmlns.com/foaf/0.1/Document
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > --------------------------
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > p | http://www.w3.org/2000/01/rdf-schema#subClassOf
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > s | http://localhost/vocabulary/bench/Article
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > o | http://xmlns.com/foaf/0.1/Document
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > --------------------------
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > p | http://www.w3.org/2000/01/rdf-schema#subClassOf
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > s | http://localhost/vocabulary/bench/Www
14:40:36.903 [http-nio-8080-exec-1] TRACE com.base22.rdfx.controllers.TestController - -- test() > o | http://xmlns.com/foaf/0.1/Document

Conclusion

In this post, I showed how I used Spring for Stardog in a Spring Boot web app. With some minor variation, these instructions could probably be useful for any Spring app and not just a Spring Boot web app. 

There is also some useful information in the QUICKSTART.txt file on GitHub that you might find useful, so be sure to check it out.




Some very rough notes I took while learning to create an Atlassian Confluence plugin. Perhaps, I'm in the process of cleaning these notes up now, while building another plugin. Please consider this a somewhat sloppy WORK-IN-PROGRESS for now.


Contents

Install the Atlassian SDK

See: Set up the Atlassian Plugin SDK and Build a Project

Create the Plugin Skeleton

Navigate to the directory on your system where you'd like to create your plugin.  The command we are about to run will create a folder with the plugin directories inside.

mkdir confluence-code-mojo

Change into the directory...

cd confluence-code-mojo

Execute the following command to generate the plugin skeleton...

atlas-create-confluence-plugin

The first time, Maven will download a bunch of packages.

Now you need to define some things:

Define value for groupId: : com.codyburleson.confluence
Define value for artifactId: : codemojo
Define value for version: 1.0.0-SNAPSHOT: (press ENTER)
Define value for package: com.codyburleson.test: : com.codyburleson.confluence.codemojo

You will then be prompted to confirm

Confirm properties configuration:
groupId: com.codyburleson.confluence
artifactId: codemojo
version: 1.0.0-SNAPSHOT
package: com.codyburleson.confluence.codemojo
 Y: : (press ENTER)

Maven will do its thing. If everything goes well, you should then get a BUILD SUCCESS message...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:23 min
[INFO] Finished at: 2017-06-23T14:55:21-06:00
[INFO] Final Memory: 13M/160M
[INFO] ------------------------------------------------------------------------

Now, we should have the basic plugin skeleton within the initial directory as follows:

  • confluence-code-mojo/
    • codemojo/
      • LICENSE
      • pom.xml
      • README
      • src/
        • etc...

I'm using IntelliJ IDEA as my IDE, so, at this point, I can choose to import the project in IntelliJ (selecting the pom.xml file within the codemojo/ directory.)

It's a good idea to establish this starting point as a baseline from which to build a source code history. I'll track with Git, so cd into the confluence-code-mojo folder and execute the following command to initialize the containing directory as a Git repository.

git init

Now, you can open the local repository in Atlassian SourceTree (Git client) or use the command line; whatever you prefer to manage and track your source code changes. Personally, I prefer to use SourceTree. In SourceTree, I select  New... > Add Existing Local Repository and then choose the confluence-code-mojo folder. I select all files in the File status view, enter the Commit message, "Initial commit" and then press Commit and OK.

Now we're ready to start customizing the plugin, but before we do that, let's just do a little acid test.

Install and test the plugin skeleton

Change into the plugin directory (in my case, codemojo) and enter the following command: 

atlas-run

The Atlas CLI and Maven will do their thing - bringing down required dependencies and then firing up developer instance of Confluence with your plugin installed for testing purposes.

Wait patiently, this process takes quite a while to complete.

When it's ready, you should see something like the following in the terminal:

[INFO] [talledLocalContainer] Jun 23, 2017 3:21:35 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
[INFO] [talledLocalContainer] INFO: Initiating Jersey application, version 'Jersey: 1.8-atlassian-16 03/23/2015 10:20 PM'


Navigate to:

http://localhost:1990/confluence

Login with admin | admin

Go find your plugin in the manage page...

http://localhost:1990/confluence/plugins/servlet/upm/manage/all


Note

After executing the atlas-run command, use CTRL + D in the console to shut down gracefully! But, let's not shut it down just yet. We need to make changes to the plugin and redeploy.

Customize the plugin


Open the src/main/resources/atlassian-plugin.xml file in your editor. It should look something like this:

atlassian-plugin.xml
<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>
    </plugin-info>

    <!-- add our i18n resource -->
    <resource type="i18n" name="i18n" location="codemojo"/>
    
    <!-- add our web resources -->
    <web-resource key="codemojo-resources" name="codemojo Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
        
        <resource type="download" name="codemojo.css" location="/css/codemojo.css"/>
        <resource type="download" name="codemojo.js" location="/js/codemojo.js"/>
        <resource type="download" name="images/" location="/images"/>

        <context>codemojo</context>
    </web-resource>
    
</atlassian-plugin>


After the <web-resource>...</web-resource> section in the file, enter the following to setup macro plugin type.


<xhtml-macro name="codemojo" class="com.codyburleson.confluence.codemojo.macro.Plugin" key='codemojo'>
    <description key="my.plugin.desc"/>
    <category name="formatting"/>
    <parameters/>
</xhtml-macro>

Open the file /src/main/resources/codemojo.properties and add edit similar to the following:

#put any key/value pairs here
my.plugin.name=CodeMojo Macro
my.plugin.desc=A source code formatting macro that uses Codemirror for advanced formatting.

Also, change the <description> item in the pom.xml; this is what will display as a description in the Add-ons management area of Confluence. For example:


<name>codemojo</name>
<description>Macro and formatters for pretty-printing source code in a wiki page using Codemirror.</description>
<packaging>atlassian-plugin</packaging>


Create the com.codyburleson.confluence.codemojo.macro java package.

Next, create the Java class file, Plugin.java, in that package...

Panel.java
package com.codyburleson.confluence.macro;

import com.atlassian.confluence.content.render.xhtml.ConversionContext;
import com.atlassian.confluence.macro.Macro;
import com.atlassian.confluence.macro.MacroExecutionException;

import java.util.Map;

public class Panel implements Macro {

    public String execute(Map<String, String> map, String s, ConversionContext conversionContext) throws MacroExecutionException {
        return "<h1>Hello World</h1>";
    }

    public BodyType getBodyType() { return BodyType.NONE; }

    public OutputType getOutputType() { return OutputType.BLOCK; }
}

This is the minimum skeleton your Macro will require to implement the confluence Macro class and display a Macro object in Confluence. 

In your terminal window, change directory back to the top directory for your plugin (eg cd /Users/cburleson/repos/confluence-code-mojo/codemojo)

Run the command:

atlas-mvn package

You should see a confirmation message 

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.656 s
[INFO] Finished at: 2016-10-10T18:33:09+10:00
[INFO] Final Memory: 37M/433M
[INFO] ------------------------------------------------------------------------

I, on the other hand, got an error message on the attempt to redeploy in the atlas-run session:

[INFO] [talledLocalContainer] Caused by: com.atlassian.plugin.IllegalPluginStateException: Cannot getResourceAsStream(codemojo_en_GB.properties): This operation must occur before the plugin 'com.codyburleson.confluence.codemojo' is uninstalled

I created a codemojo_en_GB.properties file right next to the codemojo.properties file. But since the file wasn't there initially, I need to stop the atlas-run session and restart it. From then on, redeploying with the atlas-mvn package command should work. 

That is, press CTRL + D to shut down the former atlas-run session. 

Run atlas-mvn package to build the plugin.


Typically, when you run the atlas-mvn package command, you can monitor the terminal where confluence was run originally using atlas-run and confirm that QuickReload finished loading. You should see a confirmation message. That's what we'll do to keep deploying changes to our plugin (once passing the above little quirk).


TO DO

I should consult with Atlassian about this little quirk.

Now you can try adding the Macro to a test page in Confluence (you'll need to make a new Confluence Space and Page before you can test it out so go ahead and do that first).


Now, we will continue to customize the plugin. We'll add a macro parameter to learn about how parameters can be set, and used.

Note to Self (and potential readers)

In my second plugin development, through which I am editing this page to try to make it more accurate and useful, I left off here. Going forward from this point, it could get confusing; sorry. I'll be back to finish up soon!


Open the atlassian-plugin.xml file in your editor.

Locate the <parameters/> element within the <xhtml-macro> element you created.  

Replace the <parameters/> element with the following:

<parameters>
    <parameter name="Title" type="string" />
</parameters>

This specifies that the parameter is called 'Title' and is of type 'string'.  You can find the full list of types under the Parameters heading in the macro module documentation

Now modify the execute method in the Java class so it looks like this:

public String execute(Map<String, String> map, String s, ConversionContext conversionContext) throws MacroExecutionException {
    if (map.get("Title") != null) {


		StringBuilder sb = new StringBuilder();
   		sb.append("<div class=\"codemojo\">");
   		sb.append(map.get("Title"));
   		sb.append("</div>");
   		return sb.toString();
	} else {
   		return "<h1>Hello World!<h1>";
	}

}

Execute atlas-mvn package.



Linux and Unix Commands

A cheatsheet for common Linux / Unix commands.


Contents

Change File Permissions

CommandUsage
chmod +x filename.extGive execute access to a file.
sudo chmod -R 777 workspace-R means RECURSIVE
sudo chown -R basejump workspaceTake ownership of a file.
basejump (user) and workspace (directory) 

Compress or Extract Files


CommandUsage
tar -zxvf file.tar.gzTo extract one or more members from an archive:
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Compress an entire directory or single file.

Note: Be sure to add the .tar.gz in the archive file name yourself; the command doesn't do it for you. 


Here’s what the switches mean:

-c: Create an archive.
-z: Compress the archive with gzip.
-v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
-f: Allows you to specify the filename of the archive.


Create an Alias for a Common Command

CommandUsage
alias p=<command>Create shortcut aliases to common commands.
For example:
alias p="open /x/yx/z" to open a particular directory in Finder

Execute Command as Root User

CommandUsage
sudo <command>Execute command as the root user.
sudo !!Execute the last command as root user.
(!!) represents the last command you just tried to run, but couldn't because of permission issues.

Execute Task in Background

CommandUsage
./startTest.sh &Start the execution in the background, which will allow you to kill your SSH terminal without killing the process itself.

Find Large Files

CommandUsage
cd /
find . -size +10000000c -print
Prints out the names of all files with size > 10mb.
cd /
sudo du -sm * 
Examine the size of the directories under /.
You can then navigate into any given subdirectory and execute dm -sm * again to see which subdirectories are the largest. 

Inspect Disk Space and Usage

CommandUsage
df -hInspect disk space and usage (in MB or GB)


Work with Environment Variables

CommandUsage
printenvPrints all currently set environment variables and values.

Remove a File


CommandUsage
mvRename a file 
rmRemove a file 
rm -fForcefully remove a file
rm -iInteractively remove a file

If you are not certain about removing files that match a pattern you supply, it is always good to run rm interactively (rm –i) to prompt before every removal.

Directory Commands


CommandUsage
mv <oldDirName> <newDirName>Rename a directory. Be aware: this is actually a move command. So, you're just moving the directory from one name to another in the same path.
rmdirRemove an empty directory
rm -rf <dirName>

Forcefully remove a directory recursively.

Remove the f switch to be prompted for each sub-directory and file inside.

cp -rf present/directory /desire/directory

Copy an entire directory, its subdirectories, and files.

Remove the f switch to be prompted for each sub-directory and file inside.


Switch User

CommandUsage
su - <username>Switch to the given user, loading their profile.
You may have to use sudo su - <username>. 
suWithout a username means to just switch to root user.
whoami"Who Am I?" Prints the current user. 


View a File

CommandUsage
catUsed for viewing files that are not very long; it does not provide any scroll-back.
tacUsed to look at a file backwards, starting with the last line.
lessUsed to view larger files because it is a paging program; it pauses at each screenful of text, provides scroll-back capabilities, and lets you search and navigate within the file. Note: Use / to search for a pattern in the forward direction and ? for a pattern in the backward direction. Press Q to quit.
tailUsed to print the last 10 lines of a file by default. You can change the number of lines by doing -n 15 or just -15 if you wanted to look at the last 15 lines instead of the default.
headThe opposite of tail; by default it prints the first 10 lines of a file.


Use Pipes

The UNIX/Linux philosophy is to have many simple and short programs (or commands) cooperate together to produce quite complex results, rather than have one complex program with many possible options and modes of operation. In order to accomplish this, extensive use of pipes is made; you can pipe the output of one command or program into another as its input.

In order to do this we use the vertical-bar, |, (pipe symbol) between commands as in:
$ command1 | command2 | command3


The above represents what we often call a pipeline and allows Linux to combine the actions of several commands into one. This is extraordinarily efficient because command2 and command3 do not have to wait for the previous pipeline commands to complete before they can begin hacking at the data in their input streams; on multiple CPU or core systems the available computing power is much better utilized and things get done quicker. In addition there is no need to save output in (temporary) files between the stages in the pipeline, which saves disk space and reduces reading and writing from disk, which is often the slowest bottleneck in getting something done.


An example SPARQL query filtering for resources within a given date range (between two given dates).

PREFIX c: <https://carbonldp.com/ns/v1/platform#>

SELECT ?document ?createdDate WHERE {
    ?document c:created ?createdDate
	FILTER (?createdDate < "2017-04-18T22:29:33.667Z"^^xsd:dateTime && ?createdDate > "2017-04-18T21:37:37.708Z"^^xsd:dateTime)
} LIMIT 100

To automatically serve static resources with Spring Boot (e.g. when using spring-boot-starter-web), you can simply place the static resources in one of several paths that Spring Boot automatically recognizes as a static file paths.


Following are paths that will are recognized as static file paths:

  • src/main/resources/META-INF/resources/index.html
  • src/main/resources/resources/index.html
  • src/main/resources/static/index.html
  • src/main/resources/public/index.html

You can then access the resources at:

http://host/index.html

So, for example, given the following resource at the following location...

  • src/main/resources/static/css/bootstrap.min.css

You could fetch the file with the following URL:

http://host/css/bootstrap.min.css


What are the most popular database management systems? DB-Engines Ranking provides a list that's updated monthly. You can look at the complete ranking or filter by types like Relational DBMS, Key-value stores, Document stores, Graph DBMS, RDF stores, Search engines, and more.

For a ranked list of popular databases, check out the DB-Engines Ranking page on the DB-Engines site, a knowledge base of relational and NoSQL database management systems.

Most Popular RDF Stores as of April 2017

Following, for example, is a list of popular RDF Stores as calculated in April 2017.

The site calculates popularity monthly using the following general parameters (see also: Method of calculating the scores of the DB-Engines Ranking):

  • Number of mentions on websites, measured as number of results in search engines queries on Google, Bing and Yandex (searching for <system name> together with the term database, e.g. "Oracle" and "database").
  • General interest in the system, as determined by the frequency of searches in Google Trends.
  • Frequency of technical discussions about the system, as determined by the number of related questions and the number of interested users on Stack Overflow and DBA Stack Exchange.
  • Number of job offers, in which the system is mentioned on leading job search engines Indeed and Simply Hired.
  • Number of profiles in professional networks, in which the system is mentioned in popular professional networks LinkedIn and Upwork.
  • Relevance in social networks, as per a count of the number of Twitter tweets, in which the system is mentioned.






Logging with Spring Boot is dead simple. Everything's pretty much setup and ready to go. In this post, I provide some quick and simple tips to get your Spring Boot logs rolling.

About Logging Dependencies

If you use the ‘Starters’, Logback will be used with appropriate routing included to ensure that dependent libraries that use Java Util Logging, Commons Logging, Log4J or SLF4J will all work correctly. Let's suppose, for example, that you're using the web starter in your Maven pom.xml file, as shown below.

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
</dependency>

Generally you won’t need to change any logging dependencies and the Spring Boot defaults will work just fine. That is to say, you don't need to add any additional dependencies to the POM for logging. You can verify this by printing a tree representation of your project dependencies. On the command line, change to your project directory and executing the following command.

Print Maven Dependency Tree
mvn dependency:tree

Notice that the Spring Boot starter already includes dependencies for logging...

[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.2.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.24:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.24:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.24:compile

Configure Log Levels

The easiest way to configure logging levels is in the application.properties file. If you don't already have one, create an application.properties file in the root of the resources folder. Then, simply prefix Java packages and classes with logging.level as shown below. Notice that you can configure the root logger at a specific level first, then get more specific with other loggers.

application.properties
logging.level.root=INFO
logging.level.com.cburleson.rdfx=TRACE

Put Logging Code in Your Classes

Now, we can use SLF4J for logging. Here's how.

Add the following to the imports section of your java code:


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Add the following at the top of your class in the global section (just under the line that declares your class public class Whatever extends Whatever). Change the name of the class (MyClassName) in the getLogger method call, of course. Name it the same as the class you're dropping this code into.


static final Logger LOG = LoggerFactory.getLogger(MyClassName.class);

To test quickly, you can throw some logging statements in your code somewhere where you know they'll be fired right away when you run your app. For example:


LOG.trace("Hello World!");
LOG.debug("How are you today?");
LOG.info("I am fine.");
LOG.warn("I love programming.");
LOG.error("I am programming.");

The default log configuration will echo messages to the console as they are written. If your terminal supports ANSI, color output will be used to aid readability.

Log to a File

If you want to write log files in addition to the console, you can set a logging.file or logging.path property in your application.properties. For example...

logging.level.root=INFO
logging.level.com.cburleson.rdfx=TRACE


#output to a temp_folder/file
logging.file=${java.io.tmpdir}/myapp.log

#output to a file
#logging.file=/Users/cburleson/myapp.log


#output to a file called spring.log in the specified path
#logging.path=/var/log

Using SLF4J over Log4j

Now, if you want to use SLF4 over Log4j 2, and a log4j configuration file, the setup is a little different. In your Maven, POM, you must exclude spring-boot-starter-logging and then add a dependency for spring-boot-starter-log4j2 as shown below.


  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <exclusions>
          <exclusion>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-logging</artifactId>
          </exclusion>
      </exclusions>
  </dependency>

  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-log4j2</artifactId>
  </dependency>

Then you need to have a log4j2.xml file on the classpath; for example - in src/main/resources. Here's a simple log4j2.xml file example.

log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
        </Console>
        <File name="MyFile" fileName="all.log" immediateFlush="false" append="false">
            <PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </File>
    </Appenders>
    <Loggers>
        <Root level="debug">
            <AppenderRef ref="Console" />
            <!-- AppenderRef ref="MyFile"/ -->
        </Root>

        <Logger name="com.base22" level="trace" additivity="false">
            <AppenderRef ref="Console"/>
        </Logger>

    </Loggers>
</Configuration>


Conclusion

As you can see, logging from your Spring Boot application is piece of cake. Of course, there's a lot more that you can do as your requirements dictate. For more information, take a look at Logging, in the Spring Boot Reference Guide.

References
  • Logging, in the Spring Boot Reference Guide
Confluence Panel Macro

A macro for Atlassian Confluence that mimics a Bootstrap 3 Panel.


Overview

This is a simple macro I developed that mimics the Bootstrap 3 Panel. The macro takes an optional Title, an optional Style, and a rich text macro body. It renders results as shown in the examples section below.

I did this as a learning exercise in preparation to do a more sophisticated plugin for Confluence. You might find the code useful if your doing something similar. You can find the source code in the following public repository on GitHub:

https://github.com/codyburleson/confluence-panel-macro


Tested on:

  • Atlassian Confluence 6.0.5
  • Google Chrome Version 57.0.2987.98 (64-bit) on Mac OS

If you find any issues, please open an issue on GitHub.

Examples


This panel has no title filled out and no style selected. It shows an example of using another macro within the body; the STATUS MACRO .
No Style Selected
 This one has a title, but no style selected. It defaults to the 'default' style.
Default
This panel is configured with the style 'default'.
Primary
 This panel is configured with the style 'primary'.
Success
 This panel is configured with the style 'success'.
Info
 This panel is configured with the style 'info'.
Warning
 This panel is configured with the style 'warning'.
Danger
 This panel is configured with the style 'danger'.

Attachments

The current version of the macro that I've got deployed here in this wiki is attached. If you want to try it out, you can upload the jar through Manage add-ons in the Confluence admin area.

  File Modified
Java Archive panelMacro-1.0.0-SNAPSHOT.jar Mar 25, 2017 by Cody Burleson

License

MIT License

Copyright (c) 2017 Cody Burleson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

This page is a never-ending work-in-progress where I've decided to capture handy little tips for enhancing workflow in WebStorm. Shoot me an email if you know of any other handy little things that I can add to this list.

Auto-Import (TypeScript)

Put cursor at end of red text object name and click CTRL + SPACE (auto-complete) and select the object from the pop-up context menu.

Comment Code

Select code, then CMD + /

Multiple Cursors

ALT + CLICK to set multiple cursors manually on the page. (on mac that includes the function key)
or...
Select a word and press CTRL + G