Posts

Java 9 Parallelism

Image
A current computer programming paradigm is not object-oriented anymore; it is about parallelism 1 . In the programming perspective, concurrency is the composition of independently executing processes. Parallelism is the simultaneous execution of computations. Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once. Concurrency is about structure , parallelism is about execution . Introduction Executor CompletableFuture Fig.1: Threading vs parallel tasking Java Futures are the way to support asynchronous operations. The Java fork/join framework and parallel streams divide a task into multiple subtasks and perform those subtasks parallelly on different cores in a single machine. This will avoid blocking a thread and wasting CPU resources. Introduction The key goal of parallelism is to efficiently partition tasks into sub-tasks(fork) and combine results(join). That will improve the performance in the way...

Python my workflow

Image
My Flow I combined two softwares using pyenv-virtualenv : pyenv manages multiple versions of Python itself virtualenv ( Python Virtual Environments: A Primer ) manages virtual environments for a specific Python version. pyenv-virtualenv manages virtual environments for across varying versions of Python. Here the way to create virtualenv pyenv virtualenv 3.7.2 p3 To activate the environment pyenv activate p3 To deactivate anytime pyenv deactivate To uninstall the virtualenv pyenv uninstall my-virtual-env Create a project Now we have virtual env p3 for example. Now need to create auto activating environment for the project myproject as follows mkdir myproject cd muproject pyenv local p3 Here the complete story Python 3 use of venv If you want to setup project with venv, then first you have to set the python version to 3 using pyenv pyenv global 3.8.0 Then create your project python -m venv project To activate the environment, move to the project directory s...

Structured data meaning

Google uses structured data such as RDFa, Microdata or JSON-LD to understand the contents of the page. RDFa is based on the RDF and HTML5 extension. JOSN-LD can be created from the same RDF Turtle. Learn RDF Turtle to create structured data for SEO. RDFa 1 (Resource Description Framework in Attributes) is attribute-based, for example, a , href in the HTML/XHTML. RDFa does not affect the HTML code which appears in the HTML. If you violate General structured data guidelines 2 ; as a result, your page ranked lower, therefore, it is important to know how to use structured data properly. You can use Google Rich Result test 3 to test and verify your page. Valid structured data can be eligible to visible in graphical search results. RDFa can have the number of vocabularies (as I show in this blog), but currently, Google support only schema.org 4 . ⚠️ Currently google permits only to use the schema.org vocabulary for the structured data. Google has recommended to use JSON-LD. Turtle is...

Apache Jena to learn RDF and SPARQL

RDF is one of the semantic web technology as well as the foundation for Turtle, N-Triples including JSON-LD. SPARQL is the query language for RDF. Use Apache Jena tools to learn RDF. For example, if you see the web page, that is human readable, because the end-user is human. However, there are search engines who choose the page on behalf of the consumer. Therefore, a search engine is a machine who wants to read the web page metadata. There should be well-structured data in the web page to be understood by the search engines by semantic parsing. GitHub Introduction to RDF Triples of the Data Model RDF family Embedding Turtle in HTML Some of the machine-readable metadata are: meta tag Microsdta Microformats RDFa JSON-LD It is necessary to know where the Resource Description Framework(RDF) 1 and SPARQL fit in the semantic web 2 . The semantic web is Web of data. RDF provides a foundation for publishing and linking data of all OWL 3 , SKOS, RDFS 4 and so on. If t...

JSF and RichFaces

Image
Recently, I got a project to work on JSF RichFaces 1 . RichFaces project reached end-of-life in June 2016. Thanks to Java backward compatibility I managed to run the RichFaces application on TomEE 7 using Intellij Idea as IDE. Run the following maven archytype in your command prompt as explained in the JBoss Community guide 2 : mvn archetype:generate -DarchetypeGroupId=org.richfaces.archetypes -DarchetypeArtifactId=richfaces-archetype-simpleapp -DarchetypeVersion=4.5.17.Final -DgroupId=au.com.blogspot.ojitha.jsf.ex1 -DartifactId=JSFEx1 Import the project into IntelliJ IDEA (I am using Ultimate 2020.2) Download and install TomEE 3 7.0.81: nothing more than unzip. As shown in the following screenshot, you have to configure TomEE First, open the configuration configure TomEE After configuring the TomEE home directory, goto the deployment tab and add the exploded project because development is easy: changes reflected without redeployment. Add exploded web project to TomE...

Mac keyboard shortcut to copy file path as markdown

Image
The macOS productivity 1 shortcut to Copy file/folder markdown path. How to create macOS Automator Quick Action to copy the file/folder markdown path using shortcut keys as the same way you copy the path name of the file/folder. I give you an idea of how to use JXA in the Automator . As additional information, I introduce how to use macOS Cocoa that will help you to make better logging using macOS Console application. Why is this blog ? JXA support Cocoa support Logging support Create Quick Action Testing using macOS Automator Reference If you are macOS Automation 2 fan to self-improvement of your productivity, the first book to read is Cognitive Productivity with macOS®: 7 Principles for Getting Smarter with Knowledge . This adopt the concepts from the Summary: The 7 Habits Of Highly Effective People by Stephen R.Covey - More knowledge in less time to macOS 👍🏼. Why is this blog ? Almost all of my blogs are now written in Markdown format. And...

How to create step guides

Image
Flow to create step guide Screen annotation in Mac Flow to create step guide Most of the bloggers need to add stories to their blog posts. For tech bloggers, that is most probably the journey of clicks over browser, application and so on. However, the blogger has to capture the screen and record with the annotations. In this blog, I explain how to create step by step guide: graph TD A[Start walk through] --> B(Take screenshot) B --> C{more to go ?} C -->|Yes| B C -->|No| D[Annotate Screenshot] D --> E{more to annotate ?} E -->|Yes| D E -->|No| F[Create Guide] As shown in the above Flow chart, you have to annotate all the screenshots first, as explained in the below section. In the end, you have to add those screenshot to the editor like Typora Typora . You can use uPic integration of Typora to auto-upload pictures to cloud. You can write a complete step by step guide in the Typora. Screen annotation in Mac Step 1: Press Cmd...