Setting up minikube and scdf in Mac

Prerequisites: Oracle VirtualBox already installed.

Install minikube in Mac using homebrew:

brew cask install minikube

Start minikube

minikube start

Check to get all pods

kubectl get pods --all-namespaces

SSH to minikube

minikube ssh

Check if kubectl points to right cluster (in this case minikube)

kubectl config current-context

Install helm

brew install kubernetes-helm

Initialize helm (installs tiller in minikube)

helm init --history-max 200

Update helm repo

helm repo update

Install SCDF latest (with kafka as backbone)

helm install --name my-release --set server.service.type=NodePort,kafka.enabled=true,rabbitmq.enabled=false stable/spring cloud-data-flow

Check all pods

kubectl get pods

Sample output:

Screen Shot 2019-08-19 at 6.52.59 AM

Stop minikube

minikube stop

Tip: For better performance, adjust default memory abd cpu configurations for minikube instance in VirtualBox

Git notes – 1

Setting up identity:

git config --global user.name "Anil Sadineni"
git config --global user.email sadinenianil@gmail.com

Configure default text editor to Notepad++

git config --global core.editor "'C:\Program Files\Notepad++\notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

Configure default merge tool to p4merge

git config --global --add merge.tool p4merge
git config --global --add mergetool.p4merge.path "C:\Program Files\Perforce\p4merge.exe"

Configure default diff tool to p4merge

git config --global diff.tool p4merge
git config --global difftool.p4merge.path "C:\Program Files\Perforce\p4merge.exe"

Merge operation

Merges code from a branch to current branch

Switch to branch:

get checkout <branch_name_to_merge>

Initiate merge:

get merge <branch_merge_from>

Use mergetool(to resolve conflicts)

git mergetool

Continue to next steps after merge:

git merge --continue

Create new branch:

Make sure your current branch up-to-date
git pull
Create branch
git checkout -b confluent_kafka_upgrade
Push branch to origin
git push origin confluent_kafka_upgrade
Set upstream branch
git branch --set-upstream-to=origin/master
Pretty print log with author
git log --pretty=format:"%h%x09%an%x09%ad%x09%s

Terminal look and feel

Terminal look change with zsh. https://ohmyz.sh/

Motivation

Needed a nice looking prompt in iterm while working on git (Ex: github) projects. This helps identify which branch you are working on easily. Need nice plug & play themes to stay motivated while working.

Steps:

Prerequisites

iTerm2 already installed. If not, install it from here

Installation

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Settings

Configuration file located in home directory

vi ~/.zshrc

I updated theme to “af-magic”. (set ZSH_THEME variables to “af-magic”)

Before:

Screen Shot 2019-05-20 at 1.44.48 PM

After:

Screen Shot 2019-05-20 at 1.44.57 PMScreen Shot 2019-05-20 at 1.47.11 PM

I have touched only only a theme and features associated with git plugin. There are many community driven themes and plugs are available. Check it out available themes and Plugins.

References

Website link

Github  code link

Available themes and Plugins

 

Milliseconds since epoch

Here is website gives handy tool to get milliseconds since epoch which I find it very handy.

Website:

https://currentmillis.com

Screenshot highlighted with features –
time_millis

Create new user in unix with root permissions

1. Add new user

root@0d9d9ddf04bb:~# useradd anil

2. set password

root@0d9d9ddf04bb:~# passwd anil
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

3. Tye sudo visudo, add below entry at the end

anil ALL=(ALL) NOPASSWD:ALL

Imagination vs Knowledge

Knowledge is limited
Imagination is unlimited

Knowledge takes you from A to B
Imagination takes you everywhere

I’m enough of an artist to draw freely on my imagination, which I think is more important than knowledge. Knowledge is limited. Imagination encircles the world. –Albert Einstein

 

Mac Tricks: Opening hidden directory in Finder

I had this requirement all the time to navigate through ~/.m2 directory from Finder – I found below step is very easy to open hidden directory from finder – 

1) Go to Terminal

2) open ~/.m2

That’s it.

Nice website on making cron expressions

http://www.cronmaker.com/

I liked this website. It allows you to build the cron expressions based on timeline setup and also provides schedule runs for cron expression provided.

Growl kind of message notifications in ZK Framework

In this post, I am trying to share an implementation to get Growl kind of message notifications in ZK based application.

In summary, Idea is to have JQuery for notifications and make javascript calls from java code in ZK.

I chose jquery plug-in developed by Eric from his blog here

Steps:
1)  Download jquery and plugin available here

2) Include plugin in .zul file. I kept this in my template file header area of application

<style src="/resources/css/ui.notify.css"/>
<script type="text/javascript" src="/resources/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="/resources/js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="/resources/js/jquery.notify.js"></script>

3) Create two div tags, one for regular notifications and one for error messages in zul file.
Note: I added only two containers here. One for success messages and another one for both warning and error message. You can create as many as you want to display messages in different styles.

<h:div id="<strong>container</strong>" style="height: 0px;">
...
</h:div>
<h:div id="<strong>errorContainer</strong>" style="height: 0px;">
..
</h:div>

4) Added code to call notify() method on page load (as explained for jquery)

<script type="text/javascript" <strong>defer="true"</strong>>
jQuery("#container").notify();
jQuery("#errorContainer").notify();
</script>

5) Added below javascript code to one of js files

/* Growl message display methods */
function displayNotificationMessage(messageTitle, message) {
jQuery("#container").notify();
jQuery("#container").notify("create", 0, {
title: messageTitle,
text: message
});
}

function displayErrorMessage(messageTitle, message) {
jQuery("#errorContainer").notify();
jQuery("#errorContainer").notify("create", "error-msg-template", {
title: messageTitle,
text: message
});
}

6) Created below java class to call above javascript methods –

This class’s interface exposes below methods –

public void displayNotificationMessage(String summary, String detail); //Displays notification message
public void displayWarningMessage(String summary, String detail); //Displays warning message
public void displayErrorMessage(String summary, String detail); //Displays error message
public void addNotificationMessage(String summary, String detail); //Adds a notification message to session
public void addWarningMessage(String summary, String detail); //Adds a warning message to session
public void addErrorMessage(String summary, String detail); //Adds a error message to session
public void displayPendingMessages(); //Displays all messages stored in session and clean them up.

Implementaiton

import org.zkoss.zk.ui.Executions;

import org.zkoss.zk.ui.util.Clients;

import java.util.ArrayList;
import java.util.List;

/**
* JQuery based grawl message display handler.
*
* @author Anil
*/
public class GrowlJQMessageHandler implements MessageHandler {

@Override
public void displayNotificationMessage(String summary, String detail) {
Clients.evalJavaScript("displayNotificationMessage('" + summary + "', '" + detail + "')");
}

@Override
public void displayWarningMessage(String summary, String detail) {
Clients.evalJavaScript("displayErrorMessage('" + summary + "', '" + detail + "')");
}

@Override
public void displayErrorMessage(String summary, String detail) {
Clients.evalJavaScript("displayErrorMessage('" + summary + "', '" + detail + "')");
}

@Override
public void addNotificationMessage(String summary, String detail) {
ZKMessage message = new ZKMessage(ZKMessage.INFO_MSG, summary, detail);
addMessage(message);
}

@Override
public void addWarningMessage(String summary, String detail) {
ZKMessage message = new ZKMessage(ZKMessage.WARNING_MSG, summary, detail);
addMessage(message);
}

@Override
public void addErrorMessage(String summary, String detail) {
ZKMessage message = new ZKMessage(ZKMessage.ERROR_MSG, summary, detail);
addMessage(message);
}

@Override
public void displayPendingMessages() {
List zkMessages = (List) Executions.getCurrent().getSession().getAttribute(SkillSessionScopeKey.PENDING_MESSAGE_LIST.getValue());
if(zkMessages != null) {
for (ZKMessage message : zkMessages) {
if (message.getSeverity() == ZKMessage.INFO_MSG) {
displayNotificationMessage(message.getSummary(), message.getDetails());
} else if (message.getSeverity() == ZKMessage.WARNING_MSG) {
displayWarningMessage(message.getSummary(), message.getDetails());
} else if (message.getSeverity() == ZKMessage.ERROR_MSG) {
displayErrorMessage(message.getSummary(), message.getDetails());
}
}
zkMessages.clear();
Executions.getCurrent().getSession().setAttribute(SkillSessionScopeKey.PENDING_MESSAGE_LIST.getValue(), zkMessages);
}
}

private void addMessage(ZKMessage message) {
List zkMessages = null;
if (Executions.getCurrent().getSession().getAttribute(SkillSessionScopeKey.PENDING_MESSAGE_LIST.getValue()) != null) {
zkMessages = (List) Executions.getCurrent().getSession().getAttribute(SkillSessionScopeKey.PENDING_MESSAGE_LIST.getValue());
zkMessages.add(message);
} else {
zkMessages = new ArrayList();
zkMessages.add(message);
}
Executions.getCurrent().getSession().setAttribute(SkillSessionScopeKey.PENDING_MESSAGE_LIST.getValue(), zkMessages);
}
}

Usage:

Below code can be called from one of the composite right after particular action

1) To display success message immediately after the action (On same page) –

messageHandler.displayNotificationMessage("Success", "Session cancelled successfully!!!");

2) To display warning message immediately after the action (On same page) –

messageHandler.displayWarningMessage("Invalid Session ID", "Session ID entry is invalid, Please try again");

3) To display success message in redirected page after the action (On redirected page) –

messageHandler.addNotificationMessage("Success", "Session cancelled successfully!!!");

Below are screen shots of success and warning messages

Hope this post helps!!!

Command to change apache user password for SVN repo access

It took a while for me to figure out this command. I thought of sharing this one here –

Syntax:

sudo htpasswd -b <.passwd file> <username> <pass>

Ex:

sudo htpasswd -b svn.passwd  anil <pass>

Documentation link here – http://httpd.apache.org/docs/2.0/programs/htpasswd.html

Posted in apache, svn. Tags: , . 1 Comment »