<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7593231870645654249</atom:id><lastBuildDate>Thu, 10 Sep 2026 16:49:47 +0000</lastBuildDate><category>WSO2</category><category>git</category><category>Linux</category><category>Python</category><category>Governance</category><category>C</category><category>C++</category><category>ESB</category><category>Governance Registry</category><category>IS</category><category>Identity Server</category><category>Registry</category><category>SOA</category><category>API Manager</category><category>BAM</category><category>GREG</category><category>Java</category><category>Kerberos</category><category>MySQL</category><category>WSO2 CEP</category><category>branching</category><category>editor</category><category>permission tree</category><category>vi</category><category>API</category><category>Accounting</category><category>Active Directory</category><category>Apache</category><category>Audi</category><category>Bills</category><category>Bjarne</category><category>C#</category><category>C++11</category><category>C11</category><category>Certificate</category><category>Certificates</category><category>Client Server</category><category>Cluster</category><category>Connectors</category><category>DB</category><category>DOM</category><category>Database</category><category>Dennis Richie</category><category>Developer tools</category><category>Django</category><category>G-Reg</category><category>H2</category><category>HA</category><category>HTML5</category><category>High Availability</category><category>Integration</category><category>Linus Torvalds</category><category>MSF4J</category><category>MSS</category><category>Microservices</category><category>Microsoft</category><category>Multimedia</category><category>Notification</category><category>POS</category><category>POSIX</category><category>Partitions</category><category>Performence</category><category>Perl</category><category>Permission</category><category>Point of Sale</category><category>Proxies</category><category>Publisher</category><category>Python extension</category><category>Regular Expressions</category><category>Roles</category><category>Ruby</category><category>Runtime Governance</category><category>SUSv3</category><category>Sale Software</category><category>Sharepoint</category><category>Software</category><category>Stallman</category><category>Store</category><category>Ubuntu</category><category>Unix</category><category>Video</category><category>WCF</category><category>WSO2 ESB</category><category>WSO2 Identity Server</category><category>WSRegistryServiceClient</category><category>WiFi disconnection</category><category>Windows</category><category>Windows Communication Foundation</category><category>Wireless</category><category>XML</category><category>boost</category><category>branch</category><category>building. compiling</category><category>cherry-pick</category><category>command</category><category>commands</category><category>core dumps</category><category>email</category><category>g++</category><category>gcc</category><category>git blame</category><category>git diff</category><category>git log</category><category>git stat</category><category>javac</category><category>merge</category><category>modules</category><category>parsing</category><category>phpMyAdmin</category><category>regexp</category><category>remotes</category><category>repositories</category><category>smtplib</category><category>source control</category><category>stash</category><category>tag</category><category>tagging</category><category>version control</category><title>Shazni&#39;s Scripts</title><description></description><link>http://shazninazeer.blogspot.com/</link><managingEditor>noreply@blogger.com (Shazni)</managingEditor><generator>Blogger</generator><openSearch:totalResults>45</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-1704012959249025790</guid><pubDate>Tue, 13 Jun 2017 19:13:00 +0000</pubDate><atom:updated>2017-06-13T12:17:33.462-07:00</atom:updated><title>Moved to medium.com - https://medium.com/@mshazninazeer</title><description>Hi all,&lt;br /&gt;
&lt;br /&gt;
I have moved to medium.com&lt;br /&gt;
&lt;br /&gt;
I&#39;ll be writing more in medium.com. Please find my blog location below.&lt;br /&gt;
&lt;a href=&quot;https://medium.com/@mshazninazeer&quot;&gt;&lt;span style=&quot;color: #4581a8;&quot;&gt;https://medium.com/@mshazninazeer&lt;/span&gt;&lt;/a&gt;</description><link>http://shazninazeer.blogspot.com/2017/06/moved-to-mediumcom-httpsmediumcommshazn.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-4910555235005806540</guid><pubDate>Mon, 26 Dec 2016 04:37:00 +0000</pubDate><atom:updated>2023-01-04T04:27:07.065-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">command</category><category domain="http://www.blogger.com/atom/ns#">editor</category><category domain="http://www.blogger.com/atom/ns#">vi</category><title>Essentials of Vi editor - part 3</title><description>In my previous two posts (1 and 2 below) we looked at vi basic and editing.&lt;br /&gt;
&lt;br /&gt;
1. &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;http://shazninazeer.blogspot.com/2016/12/essentials-of-vi-editor-part-1.html&quot;&gt;Essentials of Vi editor - part 1&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
2. &lt;span style=&quot;color: #6fa8dc;&quot;&gt;&lt;a href=&quot;http://shazninazeer.blogspot.com/2016/12/essentials-of-vi-editor-part-2.html&quot;&gt;Essentials of Vi editor - part 2&lt;/a&gt; &lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In this post let&#39;s look at few advanced commands and techniques we can use in vi editor&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Indentation and work wrapping&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;-----------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;gt;&amp;gt; indent the current line. e.g 3&amp;gt;&amp;gt; indents 3 lines, &amp;gt;} indents a paragraph&lt;br /&gt;&amp;lt;&amp;lt; outdents the current line&lt;br /&gt;:se ai // Enables auto indent&lt;br /&gt;:se noai // Disables auto indentation&lt;br /&gt;:se wm=8 // Sets the wrap margin to 8. As soon as you enter 8 columns it wraps the cursor&lt;br /&gt;:se wm=0 // Auto wrap set off&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Filtering&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;-----------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;!! - applies the filter to the current line&lt;br /&gt;n!! - applies the filter to n number of lines from current line&lt;br /&gt;!} - filters the next paragraph&lt;br /&gt;!{ - filter the previous paragraph&lt;br /&gt;!% - applies the filter from current location to next parranthesis, brace or bracket&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
These filters can be can be applied to shell commands like tr (transformation), fmt (formatting), grep (search), sed (advanced editing) or awk (a complete programming language). This would mean like sending the filtered text through these commands and getting the output of it and searching or placing back in file as applicable.&lt;br /&gt;
&lt;br /&gt;
e.g In command mode uf you type&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;!!tr a-z A-z&lt;/span&gt; // And enter. Turns the current line into uppercase. Note however your lower command shows :.!tr a-z A-Z. It converts into a format that vi understands it. &lt;br /&gt;
5 &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Advanced examples with : command&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;b&gt;-----------------------------------------------------&lt;/b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;: 1,. d&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Delete all the lines from the first line (indicated by 1) to current line (indicated by .)&lt;br /&gt;: .,$ s/test/text/g&amp;nbsp;&amp;nbsp; // From current line (indicated by .) to end of line (indicated by $) search and replace all &#39;test&#39; occurrences to &#39;text&#39;&lt;br /&gt;: /first/,/last/ ! tr a-z A-Z // Find first line that matches &#39;first&#39; regexp to the first match following &#39;last&#39; regex and filter it (indicated by !) using the unix command tr from a-z to A-Z (means convert to upper case)&lt;br /&gt;&lt;br /&gt;ma // marks a line by character &#39;a&#39;&lt;br /&gt;mb // marks a line by character &#39;b&#39;&lt;br /&gt;!a // jump to the line marked by a&lt;br /&gt;: &#39;a,&#39;b d // Delete all the lines marked by a through b&amp;nbsp; &lt;/span&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;------- Update - Youtube tutorial of the above (04/01/2023) ---------&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=fgJ2696QmFw&quot; target=&quot;_blank&quot;&gt;Youtube Video&lt;/a&gt;</description><link>http://shazninazeer.blogspot.com/2016/12/essentials-of-vi-editor-part-3.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-632392964843943090</guid><pubDate>Mon, 26 Dec 2016 04:31:00 +0000</pubDate><atom:updated>2023-01-04T04:26:38.775-08:00</atom:updated><title>Essentials of Vi editor - part 2</title><description>In the previous &lt;span style=&quot;color: #6fa8dc;&quot;&gt;&lt;a href=&quot;http://shazninazeer.blogspot.com/2016/12/essentials-of-vi-editor-part-1.html&quot;&gt;post&lt;/a&gt;&lt;/span&gt; we looked at some of the basics of the vi editor. In this post let&#39;s walk through searching, replacing and undoing.&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Search and Replace&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;------------------------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/text - searches the text.&lt;br /&gt;?text - searches backward&lt;br /&gt;n - repeats the previous search&lt;br /&gt;N - repeats the previous search in backward direction &lt;br /&gt;&lt;br /&gt;. matches any single character e.g - /a.c matches both abc, adc etc. Doesn&#39;t match &#39;ac&#39;&lt;br /&gt;\ has special meaning. e.g - /a\.c matches a.c exactly&lt;br /&gt;&amp;nbsp;&amp;nbsp; e.g - /a\\c matches a\c, /a\/c matches a/c&lt;br /&gt;^ - matches line beginning. e.g - /^abc matches lines beginning with abc&lt;br /&gt;$ - matches line ending e.g - /xyz$ matches lines ending with xyz&lt;br /&gt;[] - matches single character in a set. e.g - /x[abc]y matches xay, xby and xcy&lt;br /&gt;e.g - /x[a-z]y matches xzy, xay etc&lt;br /&gt;e.g - /x[a-zA-Z]y matches xay, xAy etc&lt;br /&gt;e.g - /x[^a-z]y // matches x followed by anything other than a lowercase letter followed by y. Therefore &#39;xay&#39; doesn&#39;t match, but xBy matches.&lt;br /&gt;* - zero or more matches. e.g - xy*z matches xyz, xyyyyz and also xz&lt;br /&gt;\( \) - e.g - /\(xy\)*z matches xyz, xyxyx, xyxyxyz etc&lt;br /&gt;/&amp;lt;.*&amp;gt; - matches &amp;lt;iwhewoip&amp;gt; and &amp;lt;my_name&amp;gt; etc&lt;br /&gt;/&amp;lt;[^&amp;gt;]*&amp;gt; - matches anything in between &amp;lt;&amp;gt;&lt;br /&gt;&lt;br /&gt;:s/old/new/&amp;nbsp;&amp;nbsp; - replaces the first occurrences of old to new on current line&lt;br /&gt;:s/old/new/g - replaces all in the current line&lt;br /&gt;&lt;br /&gt;:%s/old/new/&amp;nbsp;&amp;nbsp; - replaces the first occurrences of old to new of every line in the document&lt;br /&gt;:%s/old/new/g - globally replace all occurrences in the document&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You may use any special character other than / for delimitation. For example you may use | or ;&lt;br /&gt;
&lt;br /&gt;
Few special examples.&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;:%s/test/(&amp;amp;)/g&lt;/span&gt; - Here the replacement string is (&amp;amp;), Here the &amp;amp; says the current match. Therefore whatever test words in the document will be put into parenthesis as in (test)&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Undoing&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;------------------------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;u - undoing the last change in command mode&lt;br /&gt;Ctrl + r - Redo the last change&lt;br /&gt;U - undo all fhe changes in the current line&lt;br /&gt;. (period) - Repeats last change in your cursor locations&lt;br /&gt;&lt;br /&gt;yy - yanks (copy) a line (Similar to dd like delete equivalents) - the yanked texts goes to vi&#39;s buffer not to the OS clip-board&lt;br /&gt;yw - yanks a word (just like dw deletes a word)&lt;br /&gt;p - pastes the yanked text after the cursor&lt;br /&gt;P - pastes the yanked text before the cursor&lt;/span&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;------- Update - Youtube tutorial of the above (04/01/2023) ---------&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=1y7OURo9UY4&quot; target=&quot;_blank&quot;&gt;Youtube Video&lt;/a&gt;</description><link>http://shazninazeer.blogspot.com/2016/12/essentials-of-vi-editor-part-2.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-90620538472561266</guid><pubDate>Mon, 26 Dec 2016 04:27:00 +0000</pubDate><atom:updated>2023-01-04T04:25:36.309-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">commands</category><category domain="http://www.blogger.com/atom/ns#">editor</category><category domain="http://www.blogger.com/atom/ns#">vi</category><title>Essentials of Vi editor - part 1</title><description>I&#39;m sure if you are a serious programmer that you would agree vi is a programmers editor. Knowing vi&#39;s commands and usage helps you a lot with your programming tasks and undoubtedly it&#39;s a light weight powerful toolkit in your arsenal. In this post I would like to refresh your know-how on vi commands and usage, although there are hundreds of posts and cheat sheets available online. Some commands are extremely common whereas there are few I think which is not so common but extremely powerful. I cover these using three posts.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Moving around the files&lt;br /&gt;--------------------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;H (left) , J (down), K (up) , L (right)&lt;br /&gt;w (move forward by one word), b (move backward by one word)&lt;br /&gt;e (move forward till end of current word)&lt;br /&gt;) (Forward a sentence), ( (Bacward a sentence)&lt;br /&gt;} (Forward a full paragraph), { (Backward a full paragraph)&lt;br /&gt;&lt;br /&gt;^ (Move to beginning of a line)&lt;br /&gt;$ (Move to end of a line)&lt;br /&gt;% (Matching bracket or brace)&lt;br /&gt;&lt;br /&gt;Shift+g (Jump to end of file)&lt;br /&gt;1 and then Shift+g (Jump to beginning of the file)&lt;br /&gt;&lt;br /&gt;This works to jump on to a line as well.&lt;br /&gt;e.g: 23 and then Shift+g (Jump to line 23)&lt;br /&gt;&lt;br /&gt;Ctrl+e // scroll down one line&lt;br /&gt;Ctrl+y // Scroll up one line&lt;br /&gt;Ctrl+d // Scroll down half a screen&lt;br /&gt;Ctrl+u // Scroll up half a screen&lt;br /&gt;Ctrl+f // Scroll down a full screen&lt;br /&gt;Ctrl+b // Scroll up a full screen&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Getting the status of the file&lt;br /&gt;--------------------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;Ctrl+g&amp;nbsp;&amp;nbsp;&amp;nbsp; // Shows if the file is modified, the number of lines and the percentage the current line is from the beginning)&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;Saving and quitting&lt;br /&gt;--------------------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;:w (Saves the file into the disk and keeps it open)&lt;br /&gt;:wq (Save and close the file) // Equivalent to Shift + ZZ&lt;br /&gt;:q (Quit without saving an unedited file. Warns you if edited)&lt;br /&gt;:q! (Quite without saving even if the file is edited)&lt;br /&gt;:vi &amp;lt;filename&amp;gt; // Closes the current file and open the &amp;lt;filename&amp;gt;. Equivalent to :q and then issuing vi &amp;lt;filename&amp;gt;. If the current file is edited as :q does, a warning will be given&lt;br /&gt;:vi! &amp;lt;filename&amp;gt; // Does the same as above but doesn&#39;t warn you. Equivalent to :q! and then issuing vi &amp;lt;filename&amp;gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
e.g:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;vi file1.txt file2.txt&amp;nbsp; // loads both file into memory and shows the file1.txt&lt;br /&gt;&lt;br /&gt;:n // Shift to the next file&lt;br /&gt;:N // Shift back to the previous file&lt;br /&gt;:rew&amp;nbsp; // Rewind to first file if you have multiple files open&lt;br /&gt;&lt;br /&gt;:r // read a file and insert into the current file you are editing&lt;br /&gt;Ctrl + g&amp;nbsp; // shows line number and file status&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Text Editing&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;--------------------------------------------------------------&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;a - append at the end of the cursor&lt;br /&gt;A - append at the end of the line&lt;br /&gt;i - insert before the cursor&lt;br /&gt;I - insert at the beginning of the line&lt;br /&gt;o - Open a new line below&lt;br /&gt;O - open a new line above the current line&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
All above commands switch the file to insert mode&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;r - change the current character and be in command mode&lt;br /&gt;s - change the current character and switch to insert mode&lt;br /&gt;cc - delete the current line and switch to insert mode for editing&lt;br /&gt;cw - Edit the current word&lt;br /&gt;c$ - Delete from current position to end of line and keep editing&lt;br /&gt;c^ - Delete all from beginning of the line to current location and keep editing&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;x - deletes the current character e.g - 5x to delete 5 character&lt;br /&gt;dd - deletes the current line - e.g - 5dd to delete 5 lines&lt;br /&gt;dw - deletes the current word&lt;br /&gt;de - deletes till the end of current word including a whitespace&lt;br /&gt;d^ - deletes from beginning of the line to current caret position&lt;br /&gt;d$ - deletes from current caret position to end of the line (Shift + d does the same)&lt;br /&gt;&lt;br /&gt;R - enters to overwrite mode. Whatever character you type will replace the character under the caret&lt;br /&gt;~ - Changes the case of the character under the caret&lt;br /&gt;J - join the next line to the current line&lt;/span&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;------- Update - Youtube tutorial of the above (04/01/2023) ---------&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=wv9ZKPqmX7g&quot; target=&quot;_blank&quot;&gt;Youtube Video&lt;/a&gt;</description><link>http://shazninazeer.blogspot.com/2016/12/essentials-of-vi-editor-part-1.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-459091601328842899</guid><pubDate>Thu, 18 Aug 2016 16:29:00 +0000</pubDate><atom:updated>2016-08-18T09:29:31.474-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">branching</category><category domain="http://www.blogger.com/atom/ns#">cherry-pick</category><category domain="http://www.blogger.com/atom/ns#">git</category><title>Unleashing the Git - part 7 - Cherry picking commits</title><description>We looked at git branching in one of my previous &lt;a href=&quot;http://shazninazeer.blogspot.com/2016/07/unleashing-git-part-6-git-branching.html&quot;&gt;post&lt;/a&gt;. In this post let&#39;s look at git&#39;s on of the unique and powerful features that ties with branching; cherry-picking. &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
You might need to merge only a specific commit in a branch to your local branch, rather than merging an entire branch. Opt to cherry pick only if merging is not an option. One use case where you want to cherry pick is to back port a bug fix you have done in another branch.&lt;br /&gt;
&lt;br /&gt;
Since we covered some branching concepts in the previous post, let&#39;s remind a few commands first.&lt;br /&gt;
&lt;br /&gt;
To see all the available branches&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git branch
&lt;/pre&gt;
To switch to another branch&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git checkout &amp;lt;branch name&amp;gt;&lt;/pre&gt;
Cherry picking a branch, tag or a specific commit could be done using the following command.
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git cherry-pick &amp;lt;branch name, tag name or commit id&amp;gt;&amp;nbsp;&amp;nbsp; // In case of branch or tag name, only the latest commit will be picked.

&lt;/pre&gt;
Cherry picking also does the commit. You can avoid the commit with the following. This is important when you want to cherry pick multiple commits and commit all stages at once to commit in the current branch.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git cherry-pick --no-commit release_branch_v1 // Or same as $ git cherry-pick --n release_branch_v1
$ git cherry-pick --edit &amp;lt;commit id&amp;gt;&amp;nbsp;&amp;nbsp; // launches the editor to change te commit message. Same as $ git cherry-pick -e &amp;lt;commit id&amp;gt;
$ git cherry-pick --signoff release_branch_v1&amp;nbsp;&amp;nbsp; // Adds a “Signed-off-by” line followed by your name and email taken from configuration to the commit message. Same as $ git cherry-pick -s release_branch_v1&lt;branch name=&quot;&quot;&gt;&lt;branch commit=&quot;&quot; id=&quot;&quot; name=&quot;&quot; or=&quot;&quot; tag=&quot;&quot;&gt;&lt;commit id=&quot;&quot;&gt;&lt;commit id=&quot;&quot;&gt;&lt;/commit&gt;&lt;/commit&gt;&lt;/branch&gt;&lt;/branch&gt;&lt;/pre&gt;
</description><link>http://shazninazeer.blogspot.com/2016/08/unleashing-git-part-7-cherry-picking.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-7838407531888108167</guid><pubDate>Sun, 14 Aug 2016 04:29:00 +0000</pubDate><atom:updated>2016-08-13T21:29:41.785-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Audi</category><category domain="http://www.blogger.com/atom/ns#">HTML5</category><category domain="http://www.blogger.com/atom/ns#">Multimedia</category><category domain="http://www.blogger.com/atom/ns#">Video</category><title>Multimedia in HTML5</title><description>Playing audio and video in a web page has not been very straight forward in the past. One reason for that is due to the fact that there are various audio and video containers and encoding formats. Some popular video formats are .avi, .mp4, .ogg, .flv, and .mkv. There is also a new format called WebM, which is likely to get popular. These formats are not encoding formats. These are containers of the encoded content.&lt;br /&gt;
&lt;br /&gt;
When a person making an audio or a video, chooses a format to encode their multimedia content. To view this encoded content, the viewer should have a corresponding decoder installed in their system. This encoder and decoder software is often referred to as a codec (meaning; &lt;b&gt;co&lt;/b&gt;der/&lt;b&gt;dec&lt;/b&gt;oder or &lt;b&gt;co&lt;/b&gt;mpressor/&lt;b&gt;dec&lt;/b&gt;ompressor). Some video encoding formats are H.264, VP8, DivX, Theora, etc. Some audio codecs are MPEG-4 Audio, Layer 3, which you might recognize 
as MP3, and AAC, which is mostly used by Apple. Vorbis is another 
audio format, mosly used with an Ogg container. Earlier mentioned WebM is meant to be used exclusively with the VP8 video codec and the Vorbis audio codec. &lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, to view audio/video files, browsers should either support those formats or use a plugin program to decipher these formats. Luckily all popular browsers support or have some plugin program for it (mostly 3rd party programs - e.g: Adobe flash). With HTML5 however, the need for such 3rd party plugin is expected to diminish.&lt;br /&gt;
&lt;br /&gt;
The most common way of including multimedia content into a web page 
has been to embed an audio/video file and making the user click a button
 and make the content play within the page. For this to happen, the 
browser that you are using should support the format of the media. 
Otherwise you&#39;ll have to install a plugin (helper program) to support 
those formats.&lt;br /&gt;
&lt;br /&gt;
In older browsers the way to include multimedia has been to use the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;object&amp;gt;&lt;/span&gt; or &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;embed&amp;gt;&lt;/span&gt; tag.&lt;br /&gt;
&lt;br /&gt;
In HTML5, there are new tags for these. &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;audio&amp;gt;&lt;/span&gt; and &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;video&amp;gt;&lt;/span&gt;&lt;br /&gt;
So how to cope up with all these formats in new HTML5. It&#39;s indeed complex. Answer is to use multiple formats and let your web page in clients browser try to use all those formats, so that there&#39;s high chance of making your web page viewer view or listen to the content. So to have multiple formats of your audio/video content, you&#39;ll have to use some Software that can convert your main data file to those needed formats. Popular VLC media player can be used for basic usages. You can still include flash formats since flash plugin support is still widely used.&lt;br /&gt;
&lt;br /&gt;
To include a video content, in HTML5 we may use the following format for example.
&lt;br /&gt;
&lt;pre class=&quot;brush: html&quot;&gt;&amp;lt;video src=&quot;myvideo.mp4&quot; width=&quot;360&quot; height=&quot;240&quot; controls&amp;gt;&amp;lt;/video&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 

&lt;/pre&gt;
Some possible attributes of &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;video&amp;gt;&lt;/span&gt; are - &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;autoplay&lt;/span&gt; - Plays the video when the page loads. generally not a good idea in usability perspective&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;preload&lt;/span&gt; - This attribute will pre-load the video. This is good if the video is the central part of your page. Not good if it&#39;s not since it&#39;ll be a wastage of the bandwidth&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;controls&lt;/span&gt; - Controls attribute determine if a default set of control buttons should appear. Highly recommended to include this&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;loop&lt;/span&gt; - Restarts playing the video once it finishes playing&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;width - &lt;/span&gt;Sets the width of the media box &lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;height &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- &lt;/span&gt;Sets the height of the media box &lt;/li&gt;
&lt;/ul&gt;
As mentioned earlier, it&#39;s good to include many format of the content so that there&#39;s a high chance your views browser supports one of those. Otherwise they&#39;ll have to install necessary plugin programs.&lt;br /&gt;
&lt;pre class=&quot;brush: html&quot;&gt;&amp;lt;video width=&quot;360&quot; height=&quot;240&quot; controls&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source src=&quot;yourvideo.mp4&quot; type=&quot;video/mp4&quot;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- Helps in IE and Safari --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source src=&quot;yourvideo.ogg&quot; type=&quot;video/ogg&quot;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- Helps in Chrome and Firefox --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source src=&quot;yourvideo.webm&quot; type=&quot;video/webm&quot;&amp;gt;
&amp;lt;/video&amp;gt;

&lt;/pre&gt;
What if someone visits your site with browser that still doesn&#39;t support HTML5, we may use the older &amp;lt;embed&amp;gt; tag and use the flash application/x-shockwave-flash type to work with the flash plugin.&lt;br /&gt;
&lt;pre class=&quot;brush: html&quot;&gt;&amp;lt;video width=&quot;320&quot; height=&quot;240&quot; controls&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source src=&quot;yourvideo.mp4&quot; type=&quot;video/mp4&quot;&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source src=&quot;yourvideo.ogg&quot; type=&quot;video/ogg&quot;&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source src=&quot;yourvideo.webm&quot; type=&quot;video/webm&quot;&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;embed src=&quot;yourvideo.mp4&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;320&quot; height=&quot;240&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot;&amp;gt;
&amp;lt;/video&amp;gt;

&lt;/pre&gt;
Similarly &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;lt;audio&amp;gt;&lt;/span&gt; tag supports all the parameters as the &amp;lt;video&amp;gt; and the syntax is very similar.</description><link>http://shazninazeer.blogspot.com/2016/08/multimedia-in-html5.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-2883203427117770112</guid><pubDate>Sun, 31 Jul 2016 05:50:00 +0000</pubDate><atom:updated>2016-07-30T22:57:32.143-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Active Directory</category><category domain="http://www.blogger.com/atom/ns#">Certificate</category><category domain="http://www.blogger.com/atom/ns#">ESB</category><category domain="http://www.blogger.com/atom/ns#">Kerberos</category><category domain="http://www.blogger.com/atom/ns#">Proxies</category><category domain="http://www.blogger.com/atom/ns#">WCF</category><category domain="http://www.blogger.com/atom/ns#">Windows Communication Foundation</category><category domain="http://www.blogger.com/atom/ns#">WSO2</category><title>Securing WSO2 ESB proxies with Kerberos - part 2 (Active directory (AD) as the KDC)</title><description>In a previous &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;http://shazninazeer.blogspot.com/2016/07/securing-wso2-esb-proxies-with-kerberos_23.html&quot;&gt;post&lt;/a&gt;&lt;/span&gt;, we looked at how to secure a WSO2 ESB proxy services using kerberos in which&amp;nbsp; Key Distribution Center (KDC) is the WSO2 identity server. In this post we&#39;ll look at securing WSO2 ESB proxy services when the KDC is the Active Directory (AD).&lt;br /&gt;
&lt;br /&gt;
When the Key Distribution Center (KDC) is the Active Directory (AD), the SPN is usually attached with a service account. Contact your Windows Administrators to create an SPN and a service account and generate a key tab file against that. The main difference from WSO2 IS and AD based KDC is that, in AD the SPN doesn’t provide a text password, rather it’s in the keyTab file.&lt;br /&gt;
&lt;br /&gt;
To create an SPN for a related service account, use the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;setspn -s HTTP/USESB.your.domain.com us\us-wso2esb
setspn -s HTTP/USESB us\us-wso2esb
&lt;/pre&gt;
Change the SPN and service account accordingly.&lt;br /&gt;
&lt;br /&gt;
Ask the administrators to create the keytab using the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;ktpass /out wso2.keytab /princ HTTP/USESB@YOUR.DOMAIN.COM /mapuser us\us-wso2esb /pass password /crypto All /ptype KRB5_NT_PRINCIPAL

&lt;/pre&gt;
This will create a keyTab file named wso2.keytab&lt;br /&gt;
&lt;br /&gt;
Get the keytab file and place it in a location accessible by the WSO2 ESB.&lt;br /&gt;
&lt;br /&gt;
In our case the KDC hostname is us.your.domain.com. The ESB configuration is same as like the previous case. But make the following changes in the krb5.conf&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;[libdefaults]

        default_realm = US.YOUR.DOMAIN.COM
        default_tgs_enctypes = rc4-hmac des-cbc-crc des-cbc-md5 aes256-sha1 aes128-aha1
        default_tkt_enctypes = rc4-hmac des-cbc-crc des-cbc-md5 aes256-sha1 aes128-aha1
        permitted_enctypes = rc4-hmac des-cbc-crc des-cbc-md5 aes256-sha1 aes128-aha1
        allow_weak_crypto = true 

[realms]
                US.YOUR.DOMAIN.COM = {
                        kdc = us.your.domain.com
                        default_domain = US.YOUR.DOMAIN.COM
}

[domain_realm]
        .us.YOUR.DOMAIN.COM = US.YOUR.DOMAIN.COM
        us.YOUR.DOMAIN.COM = US.YOUR.DOMAIN.COM

[login]
        krb4_convert = true
        krb4_get_tickets = false
&lt;/pre&gt;
Have the jaas.conf contents be like the below.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;Server {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
storeKey=true
useTicketCache=false
isInitiator=false
keyTab=&quot;/carbon/wso2/esb/keytab/wso2.keytab&quot;
principal=&quot;HTTP/USESB@US.YOUR.DOMAIN.COM&quot;;
};
&lt;/pre&gt;
Note the useKeyTab and the keyTab property, which is different from the WSO2 IS as a KDC scenario. Provide the path of the keyTab file location to the keyTab parameter.&lt;br /&gt;
&lt;br /&gt;
Next when you secure the proxy, you have to provide the SPN name as the AD configured SPN. In our case the SPN is &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;HTTP/USESB@US.YOUR.DOMAIN.COM&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Also note since you have no password for the SPN, you can provide the service account password which was created at the AD end. In fact that won’t be used in this case, since the password will get resolved from the keyTab file. Once the proxy is secured, we need to do one more change for Java 7. Go to the proxy dashboard and click Policies. In both, Binding echoSoap11Binding and Binding echoSoap12Binding policies add the following line below the service principal name. &lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;rampart:property name=&quot;kdc.ticket.decoder&quot;&amp;gt;org.wso2.carbon.krb.Java7.TicketDecoder&amp;lt;/rampart:property&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
This is required to be added due to a bug that was identified in the 
implementation and require a patch from WSO2. If you are a support 
customer of WSO2, you may open a support ticket to request the patch &lt;span style=&quot;background-color: whitesmoke; color: #333333; display: inline; float: none; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;WSO2-CARBON-PATCH-4.2.0-1811. &lt;/span&gt;&lt;br /&gt;
If you are not a support customer, you can run the ESB using JRE 1.6. &lt;br /&gt;
&lt;br /&gt;
That’s it in ESB end.&lt;br /&gt;
&lt;br /&gt;
When you start the server, start the ESB with the following system property,&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;./wso2server.sh -Djava.security.krb5.conf= /carbon/wso2/esb/wso2esb-4.8.1/repository/resources/security/krb5.conf start&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You may insert that property in the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;wso2server.sh&lt;/span&gt; file as well.&lt;br /&gt;
&lt;br /&gt;
Now you can try invoking the echo proxy using soap ui and it should fail saying “security header does not found”. This is because the request didn’t contain any security information, such as the kerberos ticket etc. In fact it’s difficult to create a soap ui project to work with kerberos, as the WS-Security spec demands a format for the soap request, such as signing the message payload from kerberos ticket and so on.&lt;br /&gt;
&lt;br /&gt;
We have written a java client to cater this. Clients need to incorporate same mechanism to call a kerberos secured proxy. Please find the Java client &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;https://github.com/shazni/PublicResources/tree/master/kerberosJavaClient&quot;&gt;here&lt;/a&gt;&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Note: however the Java client should be running in a machine where it can connect to the AD based KDC. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Testing with a Java client&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Change the krb5.conf of the java client as the following in the java client. &lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;[libdefaults]
        default_realm = US.YOUR.DOMAIN.COM
        default_tgs_enctypes = rc4-hmac
        default_tkt_enctypes = rc4-hmac
        permitted_enctypes = rc4-hmac
        allow_weak_crypto = true

[realms]
      US.YOUR.DOMAIN.COM = {
         kdc = us.your.domain.com
}
&lt;/pre&gt;
Note the KDC ip address. Change accordingly. Also change the config.properties to match the windows server.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;keyStorePath=C:\\Users\\smohamednazeer\\Desktop\\DevKeyTab\\wso2carbon.jks
keyStorePassword=wso2carbon
axis2ClientPath=C:\\Users\\smohamednazeer\\Documents\\codes\\kerberospocsolution\\kerberosJavaClient\\repo\\conf\\client.axis2.xml
policyFilePath=C:\\Users\\smohamednazeer\\Documents\\codes\\kerberospocsolution\\kerberosJavaClient\\repo\\conf\\policy.xml
serviceEndpoint=https://&amp;lt;ip-address or domain name&amp;gt;:9443/services/echo
&lt;/pre&gt;
If you are using a custom keystore, use that keystore path and password instead.&lt;br /&gt;
&lt;br /&gt;
The rampart configuration of policy should be changed. Client principal name in this case would be the logged in user. In our case we have the following configurations.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;rampart:RampartConfig xmlns:rampart=&quot;http://ws.apache.org/rampart/policy&quot;&amp;gt;

  &amp;lt;rampart:timestampPrecisionInMilliseconds&amp;gt;true&amp;lt;/rampart:timestampPrecisionInMilliseconds&amp;gt;
  &amp;lt;rampart:timestampTTL&amp;gt;300&amp;lt;/rampart:timestampTTL&amp;gt;
  &amp;lt;rampart:timestampMaxSkew&amp;gt;300&amp;lt;/rampart:timestampMaxSkew&amp;gt;
  &amp;lt;rampart:timestampStrict&amp;gt;false&amp;lt;/rampart:timestampStrict&amp;gt;
  &amp;lt;rampart:nonceLifeTime&amp;gt;300&amp;lt;/rampart:nonceLifeTime&amp;gt;

  &amp;lt;rampart:kerberosConfig&amp;gt;
    &amp;lt;rampart:property name=&quot;client.principal.name&quot;&amp;gt;smohamednazeer@US.YOUR.DOMAIN.COM&amp;lt;/rampart:property    &amp;lt;rampart:property name=&quot;client.principal.password&quot;&amp;gt;xxxxxxxxxxxx&amp;lt;/rampart:property&amp;gt;
    &amp;lt;rampart:property name=&quot;service.principal.name&quot;&amp;gt;HTTP/USESB@US.YOUR.DOMAIN.COM&amp;lt;/rampart:property&amp;gt;
    &amp;lt;rampart:property name=&quot;java.security.krb5.conf&quot;&amp;gt;C:\Users\smohamednazeer\Documents\codes\kerberospocsolution\kerberosJavaClient\repo\conf\krb5.conf&amp;lt;/rampart:property&amp;gt;
    &amp;lt;rampart:property name=&quot;java.security.auth.login.config&quot;&amp;gt;C:\Users\smohamednazeer\Documents\codes\kerberospocsolution\kerberosJavaClient\repo\conf\jaas.conf&amp;lt;/rampart:property&amp;gt;
    &amp;lt;rampart:property name=&quot;javax.security.auth.useSubjectCredsOnly&quot;&amp;gt;true&amp;lt;/rampart:property&amp;gt;
    &amp;lt;rampart:property name=&quot;kdc.ticket.decoder&quot;&amp;gt;org.wso2.carbon.krb.Java7.TicketDecoder&amp;lt;/rampart:property&amp;gt;
  &amp;lt;/rampart:kerberosConfig&amp;gt;

&amp;lt;/rampart:RampartConfig&amp;gt;
&lt;/pre&gt;
Enter the username you use to login to Windows machine as the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;client.principal.name&lt;/span&gt;, or you have to enter a username that exists in your AD. Enter the password that you use to login to the Windows machine for the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;client.principal.password&lt;/span&gt;, or enter the password of the respective AD user.&lt;br /&gt;
&lt;br /&gt;
Note the Java7.TicketDecoder property, if you are running the ESB in Java 7 (Note: To use with Java 7, you&#39;ll need to have above mentioned patch applied in the ESB 4.8.1 and ESB 4.9.0) If you are running in Java 6, you may remove that line. &lt;br /&gt;
&lt;br /&gt;
If your server is using a custom keystore (which is normally the case), following needs to be done.&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp; Use the same keystore, its alias and password of primary keystore for RegistryKeyStore. This is due to a known issue in the system (see [1]). This will get fixed in the future releases.&lt;br /&gt;
&lt;br /&gt;
[1] &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;https://wso2.org/jira/browse/CARBON-15786&quot;&gt;https://wso2.org/jira/browse/CARBON-15786&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
2.&amp;nbsp; Change the config.property of the Java client to use the new keystore and the password&lt;br /&gt;
&lt;br /&gt;
To build this project you have to point the project to the plugins directory of the WSO2 ESB 4.8.1. You may copy the plugins directory somewhere else and point the project to that and build. If you are running the server in Java 7, make sure the plugins directory also contain the patched jars of the above mentioned issue; wss4j, rampart and TicketDecoder.&lt;br /&gt;
&lt;br /&gt;
Now if you run the client you should see the response of the echo service. You should see an output like the following in the console.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;Calling service with parameter - Hello Shazni!!!!!!!

Request = &amp;lt;p:echoString xmlns:p=&quot;http://echo.services.core.carbon.wso2.org&quot;&amp;gt;&amp;lt;in&amp;gt;Hello Shazni!!!!!!!&amp;lt;/in&amp;gt;&amp;lt;/p:echoString&amp;gt;

The response is : &amp;lt;ns:echoStringResponse xmlns:ns=&quot;http://echo.services.core.carbon.wso2.org&quot;&amp;gt;&amp;lt;return&amp;gt;Hello Shazni!!!!!!!&amp;lt;/return&amp;gt;&amp;lt;/ns:echoStringResponse&amp;gt;

&lt;/pre&gt;
&lt;b&gt;Testing with a Windows Communication Foundation (WCF) client&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The WCF client used to test the echo proxy is located &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;https://github.com/shazni/PublicResources/tree/master/EchoWcfClientServiceVisualStudio&quot;&gt;here&lt;/a&gt;&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
The WCF client creates a form with a button, when clicked it calls the echo proxy. Open App.Config in the Visual Studio.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;      &amp;lt;endpoint address=&quot;http://&amp;lt;ip address or domain name&amp;gt;:8280/services/echo&quot; behaviorConfiguration=&quot;&quot;
        binding=&quot;customBinding&quot; bindingConfiguration=&quot;customTextMessageEncoding&quot;
        contract=&quot;WSO2.Echo.echoPortType&quot;&amp;gt;
        &amp;lt;identity&amp;gt;
          &amp;lt;servicePrincipalName value=&quot;HTTP/USESB@US.YOUR.DOMAIN.COM&quot; /&amp;gt;
        &amp;lt;/identity&amp;gt;
      &amp;lt;/endpoint&amp;gt; 
&lt;/pre&gt;
Note the endpoint address and the servicePrincipalName.&lt;br /&gt;
&lt;br /&gt;
The client executable is located in &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;EchoWcfClientServiceVisualStudio\EchoClient\bin\Debug&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
If the executable is not found, you’ll have to build the project in Visual Studio. &lt;br /&gt;
&lt;br /&gt;
Either run the executable or run the client within Visual Studio. This should bring up a form. Click the echo button. The response should be shown in the message box.&lt;br /&gt;
&lt;br /&gt;
You might have noticed that we used the http address. If you want to use the https endpoint for SSL, you have to add the following element in the app.config.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;httpsTransport authenticationScheme=&quot;Anonymous&quot; bypassProxyOnLocal=&quot;false&quot;
           hostNameComparisonMode=&quot;StrongWildcard&quot; proxyAuthenticationScheme=&quot;Anonymous&quot;
           realm=&quot;&quot; useDefaultWebProxy=&quot;true&quot; /&amp;gt;
&lt;/pre&gt;
instead of the following http binding,&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;httpTransport authenticationScheme=&quot;Anonymous&quot; bypassProxyOnLocal=&quot;false&quot;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;hostNameComparisonMode=&quot;StrongWildcard&quot; proxyAuthenticationScheme=&quot;Anonymous&quot;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;realm=&quot;&quot; useDefaultWebProxy=&quot;true&quot; /&amp;gt;
&lt;/pre&gt;
And when you run the WCF client in the Windows machine, you would get an SSL error if you haven’t imported the ESB servers&#39; primary keystore’s certificate to the Windows trusted certificates. Assuming you have generated your keystores and exported the certificate out of it, follow the steps &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;http://shazninazeer.blogspot.com/2016/07/importing-certificate-in-windows.html&quot;&gt;here&lt;/a&gt;&lt;/span&gt; to import the certificate file to the Windows server.&lt;br /&gt;
&lt;br /&gt;
Once the certificates are imported, you should be able to call the proxy with the https endpoint.&lt;br /&gt;
&lt;br /&gt;</description><link>http://shazninazeer.blogspot.com/2016/07/securing-wso2-esb-proxies-with-kerberos.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-4670890979454351719</guid><pubDate>Tue, 26 Jul 2016 11:44:00 +0000</pubDate><atom:updated>2016-07-26T04:44:07.003-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Certificates</category><category domain="http://www.blogger.com/atom/ns#">Windows</category><title>Importing a certificate in Windows</title><description>In Windows start menu,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;open the run window and type “mmc” (without 
quotes). This will open a console window.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Click File -&amp;gt; Add/Remove 
Snap-in.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Click “Certficates” and click Add.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Select “Computer account” 
and click next.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Click Finish.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Click certificates and click ok.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Click “Certificates (Local Computer)”&lt;/li&gt;
&lt;li&gt;Click “Trusted 
RootCertification Authorities” and then certificates&lt;/li&gt;
&lt;/ul&gt;
&amp;nbsp;his should show 
all the trusted certificates of the system. Assuming that you have the certificate with you in .cer format. To import the certificate,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Right click Certificates of the Trusted Root Certification Authorities 
in the left pane and All Tasks -&amp;gt; Import&lt;/li&gt;
&lt;li&gt;Click next and browse your 
certificate file in the file system and complete the import&lt;/li&gt;
&lt;/ul&gt;
</description><link>http://shazninazeer.blogspot.com/2016/07/importing-certificate-in-windows.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-7059704029556722512</guid><pubDate>Sun, 24 Jul 2016 06:24:00 +0000</pubDate><atom:updated>2016-07-23T23:40:16.970-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ESB</category><category domain="http://www.blogger.com/atom/ns#">Identity Server</category><category domain="http://www.blogger.com/atom/ns#">Kerberos</category><category domain="http://www.blogger.com/atom/ns#">WSO2</category><title>Securing WSO2 ESB proxies with Kerberos - part 1 (WSO2 Identity Server as a KDC)</title><description>WSO2 Enterprise Service Bus proxies can be secured in various security mechanisms. There are around 20 out of the box security schemes that we can use to secure proxies. Kerberos is one of them. In this post and next we go through the setup and configuration of the Kerberos with two options. &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;WSO2 Identity Server (IS) as Key Distribution Center (KDC) &lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Active directory (AD) as the KDC&lt;/li&gt;
&lt;/ul&gt;
In this post we shall look into the first option and see how we can invoke a secured proxy using a Java client. This post is a supplementary to some awesome posts that WSO2 folks have written in the past. Notable posts are the [1], [2] and [3]. I wanted to write this post to show the steps in the latest (or recent) versions of the products. Some configurations and locations have been changed and I encountered few issues setting this up. So I wanted to compile them up in one location. Hope this would be helpful for anyone wanting to know how to use Kerberos security with WSO2 Enterprise Service Bus (ESB) for proxies, hence for SOAP calls. In the next post I&#39;ll show you how to use a Java and a .Net [Windows Communication Foundation (WCF) ] client to invoke a secured proxy.&lt;br /&gt;
&lt;br /&gt;
I would like to thank Prabath for permitting me to copy and modify some of the code he used to demonstrate in his posts.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;WSO2 Identity Server (IS) as the Key Distribution Center (KDC)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In this procedure we need to have WSO2 IS and WSO2 ESB setup in two server machines. (You may try this with the same server with two different port offsets for WSO2 IS and WSO2 ESB). It’s assumed that you have configured the two servers beyond this point. Look at ESB and IS documentation for reference at [4] and [5]. WSO2 IS can be used in a standalone mode (without any external database setup) for you to work on this.&lt;br /&gt;
&lt;br /&gt;
In WSO2 IS (here we used IS version 5.0.0), let’s setup the KDC.&lt;br /&gt;
&lt;br /&gt;
First we have to enable the KDC. Open &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;embedded-ldap.xml&lt;/span&gt; and enable KDC as below.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;  &amp;lt;KDCServer&amp;gt;
    &amp;lt;Property name=&quot;name&quot;&amp;gt;defaultKDC&amp;lt;/Property&amp;gt;
    &amp;lt;Property name=&quot;enabled&quot;&amp;gt;true&amp;lt;/Property&amp;gt;
    &amp;lt;Property name=&quot;protocol&quot;&amp;gt;UDP&amp;lt;/Property&amp;gt;
    &amp;lt;Property name=&quot;host&quot;&amp;gt;localhost&amp;lt;/Property&amp;gt;
    &amp;lt;Property name=&quot;port&quot;&amp;gt;${Ports.EmbeddedLDAP.KDCServerPort}&amp;lt;/Property&amp;gt;
    &amp;lt;Property name=&quot;maximumTicketLifeTime&quot;&amp;gt;8640000&amp;lt;/Property&amp;gt;
    &amp;lt;Property name=&quot;maximumRenewableLifeTime&quot;&amp;gt;604800000&amp;lt;/Property&amp;gt;
    &amp;lt;Property name=&quot;preAuthenticationTimeStampEnabled&quot;&amp;gt;false&amp;lt;/Property&amp;gt;
  &amp;lt;/KDCServer&amp;gt; 
&lt;/pre&gt;
If you want to change the default realm of the KDC, change the “realm” property. By default it’s WSO2.ORG. We’ll keep it as it’s in this case for simplicity.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;Property name=&quot;realm&quot;&amp;gt;WSO2.ORG&amp;lt;/Property&amp;gt;
&lt;/pre&gt;
We can also enable the KDC setting in the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;user-mgt.xml&lt;/span&gt;. Enable the following property in the UserStoreManager.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;Property name=&quot;kdcEnabled&quot;&amp;gt;true&amp;lt;/Property&amp;gt;

&lt;/pre&gt;
Create a file named &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;jaas.conf&lt;/span&gt; with following contents and place inside &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;IS_HOME&amp;gt;/repository/conf/security&lt;/span&gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;Server {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=false
storeKey=true
useTicketCache=false
isInitiator=false;
};

Client {
com.sun.security.auth.module.Krb5LoginModule required
useTicketCache=false;
};

&lt;/pre&gt;
Create a file name &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;krb5.conf&lt;/span&gt; with following contents and place it in &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;IS_HOME&amp;gt;/repository/conf/security&lt;/span&gt; directory. This says your KDC locates in the current machine.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;[libdefaults]
        default_realm = WSO2.ORG
        default_tkt_enctypes = rc4-hmac des-cbc-md5
        default_tgs_enctypes = rc4-hmac des-cbc-md5
        dns_lookup_kdc = true
        dns_lookup_realm = false

[realms]
        WSO2.ORG = {
            kdc = 127.0.0.1
   }

&lt;/pre&gt;
Now let’s start the WSO2 IS Server.&lt;br /&gt;
&lt;br /&gt;
Once started the server, we have to create a Service Principal (SPN) and a client principal to use with kerberos ticket granting system (TGS). Once the server is started, navigate to &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Configure -&amp;gt; Kerberos KDC -&amp;gt; Service Principals &lt;/span&gt;and click &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;“Add new Service Principal”&lt;/span&gt;. Provide a service principal name, description and a password. In this case we used the following service principal name.&lt;br /&gt;
&lt;br /&gt;
SPN Name : esb/localhost@WSO2.ORG&lt;br /&gt;
&lt;br /&gt;
Now create a new user by navigating to &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Configure -&amp;gt; Users and Roles -&amp;gt; Users -&amp;gt; Add User&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
In our case I have added a user name “test” with a password. This will be the client principal.&lt;br /&gt;
&lt;br /&gt;
That’s all with WSO2 IS KDC configuration.&lt;br /&gt;
&lt;br /&gt;
Let’s now configure security in a sample proxy in WSO2 ESB (We used WSO2 ESB 4.8.1). In my case I’ve secured the default echo proxy. You may do the same for any other proxy.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Configuring ESB for kerberos.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Add the following into &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;jass.conf&lt;/span&gt; file and place it in &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;ESB_HOME&amp;gt;/repository/conf/security&lt;/span&gt; directory. Note the principal name configuration&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;Server {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=false
storeKey=true
useTicketCache=true
isInitiator=false
principal=&quot;esb/localhost@WSO2.ORG&quot;;
};
&lt;/pre&gt;
Add the following to the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;krb5.conf&lt;/span&gt; and place it in in &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;ESB_HOME&amp;gt;/repository/conf/security&lt;/span&gt; directory. Configure the ip address of the WSO2 IS in kdc section. If the WSO2 IS is running in the same server as WSO2 ESB, this is the loop back address 127.0.0.1, which is the case in my scenario. Remember to use all caps for the default_realm.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;[libdefaults]
        default_realm = WSO2.ORG
        default_tgs_enctypes = des-cbc-md5
        default_tkt_enctypes = des-cbc-md5
        permitted_enctypes = des-cbc-md5
        allow_weak_crypto = true

[realms]
        WSO2.ORG = {
                kdc = 127.0.0.1:8000
        }

[domain_realm]
        .wso2.ORG = WSO2.ORG
        wso2.ORG = WSO2.ORG

[login]
        krb4_convert = true
        krb4_get_tickets = false&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;Start the ESB server and navigate to the proxy list.&lt;/li&gt;
&lt;li&gt;Click the echo proxy to navigate into the dashboard&lt;/li&gt;
&lt;li&gt;Click the security button&lt;/li&gt;
&lt;li&gt;Select ‘yes’ in the security section&lt;/li&gt;
&lt;li&gt;Select the kerberos security mechanism (Item number 16) and click next&lt;/li&gt;
&lt;li&gt;Provide the SPN name you configured in the WSO2 IS together with its password and click Finish&lt;/li&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can try invoking the echo proxy using soap ui and it should fail saying “security header does not found”. This is because the request didn’t contain any security information, such as the kerberos ticket etc. In fact it’s difficult to create a soap ui project to work with kerberos, as the specification requires a format for the soap request, such as signing the message payload from kerberos ticket, having a time stamp and so on.&lt;br /&gt;
&lt;br /&gt;
We have written a java client to cater this (Thanks Prabath, once again for permitting me to use and modify your client). Clients need to incorporate same mechanism to call a kerberos secured proxy in the Java code. Please find the client &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;https://github.com/shazni/PublicResources/tree/master/kerberosJavaClient&quot;&gt;here&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;. We shall discuss about a .Net client in the next post.&lt;br /&gt;
&lt;br /&gt;
Open this project in IntelliJIDEA or your favorite IDE.&lt;br /&gt;
&lt;br /&gt;
Navigate to the config.properties and configure the keyStorePath, keyStorePassword, axis2ClientPath, policyFilePath and servicEndpoint according to your setup. We are using the default keystore in this setup and the configuration is like the following.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;# Kerberos configs
keyStorePath=/home/shazni/ProjectFiles/kerberosJavaClient/repo/resources/wso2carbon.jks
keyStorePassword=wso2carbon
axis2ClientPath=/home/shazni/ProjectFiles/kerberosJavaClient/repo/conf/client.axis2.xml
policyFilePath=/home/shazni/ProjectFiles/kerberosJavaClient/repo/conf/policy.xml
serviceEndpoint=https://localhost:9448/services/KerberosTestReg

&lt;/pre&gt;
Note my ESB run on port offset of 5 hence the port 9448.&lt;br /&gt;
&lt;br /&gt;
Next, open up the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;policy.xml&lt;/span&gt; file and make the rampart configuration changes for &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;client.principal.name&lt;/span&gt;, &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;client.principal.password&lt;/span&gt; (This should be the user you created in the WSO2 IS), &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;service.principal.name, java.security.krb5.conf, java.security.auth.login.config&lt;/span&gt; and &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;javax.security.auth.useSubjectCredsOnly&lt;/span&gt;. In my case it’s like the following.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;rampart:RampartConfig xmlns:rampart=&quot;http://ws.apache.org/rampart/policy&quot;&amp;gt;        

      &amp;lt;rampart:timestampPrecisionInMilliseconds&amp;gt;true&amp;lt;/rampart:timestampPrecisionInMilliseconds&amp;gt;
      &amp;lt;rampart:timestampTTL&amp;gt;300&amp;lt;/rampart:timestampTTL&amp;gt;
      &amp;lt;rampart:timestampMaxSkew&amp;gt;300&amp;lt;/rampart:timestampMaxSkew&amp;gt;
      &amp;lt;rampart:timestampStrict&amp;gt;false&amp;lt;/rampart:timestampStrict&amp;gt;
      &amp;lt;rampart:nonceLifeTime&amp;gt;300&amp;lt;/rampart:nonceLifeTime&amp;gt;

      &amp;lt;rampart:kerberosConfig&amp;gt;
           &amp;lt;rampart:property name=&quot;client.principal.name&quot;&amp;gt;test_carbon.super&amp;lt;/rampart:property&amp;gt;
           &amp;lt;rampart:property name=&quot;client.principal.password&quot;&amp;gt;test123&amp;lt;/rampart:property&amp;gt;
           &amp;lt;rampart:property name=&quot;service.principal.name&quot;&amp;gt;esb/localhost@WSO2.ORG&amp;lt;/rampart:property&amp;gt;
           &amp;lt;rampart:property name=&quot;java.security.krb5.conf&quot;&amp;gt;repo/conf/krb5.conf&amp;lt;/rampart:property&amp;gt;
           &amp;lt;rampart:property name=&quot;java.security.auth.login.config&quot;&amp;gt;repo/conf/jaas.conf&amp;lt;/rampart:property&amp;gt;
           &amp;lt;rampart:property name=&quot;javax.security.auth.useSubjectCredsOnly&quot;&amp;gt;true&amp;lt;/rampart:property&amp;gt;
      &amp;lt;/rampart:kerberosConfig&amp;gt;

    &amp;lt;/rampart:RampartConfig&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Also open up the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;krb5.conf&lt;/span&gt; file located in the client code and configure your kdc ip address. In this case the ip address of the WSO2 IS server.&lt;br /&gt;
&lt;br /&gt;
Now if you run the client you should see the response of the echo service. You should see an output like the following in the console.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;Calling service with parameter - Hello Shazni!!!!!!!
Request = &amp;lt;p:echoString xmlns:p=&quot;http://echo.services.core.carbon.wso2.org&quot;&amp;gt;&amp;lt;in&amp;gt;Hello Shazni!!!!!!!&amp;lt;/in&amp;gt;&amp;lt;/p:echoString&amp;gt;
The response is : &amp;lt;ns:echoStringResponse xmlns:ns=&quot;http://echo.services.core.carbon.wso2.org&quot;&amp;gt;&amp;lt;return&amp;gt;Hello Shazni!!!!!
&lt;/pre&gt;
&lt;br /&gt;
This client contacts the WSO2 IS KDC to get a kerberos ticket and then uses the rampart library to build the request as compliant to the WS-Security specification and send the request to the proxy. At the ESB server end, the rampart resolves the request and wss4j validates the ticket by decryption and validating the signature of the request payload and call the backend service, if those validation passes. Subsequently gets the response and sign it back with the kerberos key and send the response back, once again in compliance with the WS-Security.&lt;br /&gt;
&lt;br /&gt;
That&#39;s all the configurations you got to do. This is a very simple example on how to use keberos security scheme in WSO2 ESB with WSO2 IS.&lt;br /&gt;
&lt;br /&gt;
In the next post I&#39;ll show how to configure the ESB with AD based KDC (specifically with a keyTab file, instead of using the SPN and it&#39;s password as used in this post)&lt;br /&gt;
&lt;br /&gt;
[1] &lt;a href=&quot;http://wso2.com/library/articles/2012/07/kerberos-authentication-using-wso2-products/&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;http://wso2.com/library/articles/2012/07/kerberos-authentication-using-wso2-products/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
[2] &lt;a href=&quot;http://blog.facilelogin.com/2010/12/kerberos-authentication-with-wso2-esb.html&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;http://blog.facilelogin.com/2010/12/kerberos-authentication-with-wso2-esb.html&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
[3] &lt;a href=&quot;https://malalanayake.wordpress.com/2012/12/13/how-to-invoke-the-echo-service-secured-by-kerberos-in-wso2-esb/&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;https://malalanayake.wordpress.com/2012/12/13/how-to-invoke-the-echo-service-secured-by-kerberos-in-wso2-esb/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
[4] &lt;a href=&quot;https://docs.wso2.com/display/ESB490/WSO2+Enterprise+Service+Bus+Documentation&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;https://docs.wso2.com/display/ESB490/WSO2+Enterprise+Service+Bus+Documentation&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
[5] &lt;a href=&quot;https://docs.wso2.com/display/IS510/WSO2+Identity+Server+Documentation&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;https://docs.wso2.com/display/IS510/WSO2+Identity+Server+Documentation&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;</description><link>http://shazninazeer.blogspot.com/2016/07/securing-wso2-esb-proxies-with-kerberos_23.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-192927527754814548</guid><pubDate>Tue, 05 Jul 2016 11:09:00 +0000</pubDate><atom:updated>2016-07-28T23:16:36.827-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">branch</category><category domain="http://www.blogger.com/atom/ns#">branching</category><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">merge</category><title>Unleashing the Git - part 6 - git branching</title><description>Branching is a function to launch separate, similar copy of the present workspace for different usage requirements. It&#39;s a line of development which exists independent of another, where both share a commom history.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s understand branching related commands with an example.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git init&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Execute on a preferred location
&lt;/pre&gt;
Add a file list.txt and add the following content&lt;br /&gt;
&lt;br /&gt;
abc&lt;br /&gt;
123&lt;br /&gt;
def&lt;br /&gt;
456&lt;br /&gt;
&lt;br /&gt;
then,&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git add .
$ git add -m &quot;Initial commit of list.txt&quot;
$ git checkout -b mybranch&amp;nbsp; // Create a new branch called mybranch with exact level of master.
$ git checkout -b 64868c9&amp;nbsp;&amp;nbsp; // Create a new branch called mybranch from the point of the given commit id
&lt;/pre&gt;
Above is equivalent to following two commands.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git branch mybranch
$ git checkout mybranch
$ git branch&amp;nbsp;&amp;nbsp; // Shows available branches with the current branch with an *. Now you&#39;ll be in mybranch
$ git branch -r // Shows only remote branches.
$ git branch -a // Shows all available branches
$ git branch --merged // Shows all branches merges into the current branch
$ git branch --no-merged // Shows available branches that are not merged with the current branch
$ git branch --contains &amp;lt;commit id&amp;gt; // Shows the branch that contains the commit id
&lt;/pre&gt;
Now suppose you openned list.txt and modified it by adding a new line, making it&lt;br /&gt;
&lt;br /&gt;
abc&lt;br /&gt;
123&lt;br /&gt;
def&lt;br /&gt;
456&lt;br /&gt;
ghi&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git add .
$ git commit -m &quot;Adding a new line in the mybranch&quot;
$ git checkout master&amp;nbsp; // Switch back to master. Now list.txt won&#39;t have your new line&lt;/pre&gt;
$ git merge mybranch&amp;nbsp; // merges mybranch with the master branch. This would succeed as there was no conflict in lines. We just added a new line, so git would have no problem in merging. Updating 53a7908..3fd44bc
Fast-forward
&amp;nbsp;list.txt | 1 +
&amp;nbsp;1 file changed, 1 insertion(+)

Also git automatically commit while merging. If you do not want the commit to happen, you can use the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git merge --no-commit master
&lt;/pre&gt;
// Now in the master branch remove the first line and commit it. Then switch to mybranch and open list.txt. You would still see the initial first line we removed in the master. Now modify that line in mybranch to change it to xyz from abc and commit it. Say now you want to merge the files in this branch from master. Issue the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git merge master
Auto-merging list.txt
CONFLICT (content): Merge conflict in list.txt
Automatic merge failed; fix conflicts and then commit the result.
&lt;/pre&gt;
There will be a conflict as both branches have modified the first line. &lt;br /&gt;
&lt;br /&gt;
// Now if you try to switch to master, you won&#39;t be allowed until you fix the conflicts.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git checkout master
list.txt: needs merge
error: you need to resolve your current index first
&lt;/pre&gt;
Now open the list.txt in mybranch. You would see following.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; HEAD
xyz
=======
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; master
123
def
456
ghi
&lt;/pre&gt;
What does this say? HEAD is pointing to your current branch. i.e. mybranch. Whatever you have between &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; HEAD to ======= is the the contents of the mybranch offending to the conflict. i.e. your xyz modification. Whatever between ======= and &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; master is what master has for the offending conflict. In this case it&#39;s empty meaning there&#39;s an empty line. &lt;br /&gt;
&lt;br /&gt;
Now you may decide to keep the xyz change and commit it. What needs to exist, what needs to remove is all up to you. You may even choose remove both. So once you switch to master branch, you won&#39;t see the line. Issue the following command in master branch.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git merge mybranch
Updating a64cb6d..87fd36d
Fast-forward
&amp;nbsp;list.txt | 1 +
&amp;nbsp;1 file changed, 1 insertion(+) 
&lt;/pre&gt;
Now you should see the xyz line in the master branch as well.&lt;br /&gt;
&lt;br /&gt;
Following are few additional commands that is are useful.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git merge --log development // Adding a one line log message from each merge commit to the merge message
$ git merge --no-ff development // Force creation of a merge commit
$ git merge -m &quot;Forced commit message that from the merging branch&quot; mybranch
&lt;/pre&gt;
You can use git commit --amend to modify the commit message after the fact too. Here’s an example:&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git merge --log --no-ff development
$ git commit --amend -c HEAD&amp;nbsp; // Editor launches
$ git branch -d mybranch&amp;nbsp; // Deletes the mybranch. If there are unmerged files, git will warn you about it.
$ git branch -D mybranch // Git doesn&#39;t warn you about unmerged files. It just deletes the branch
$ git push origin :beta // Remove a remote origin&#39;s branch named beta
&lt;/pre&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git push &amp;lt;remote name&amp;gt; &amp;lt;branch name&amp;gt;
$ git push origin master:production&amp;nbsp; // Push changes from local master branch to remote origin&#39;s production branch
$ git push --force or git push -f&amp;nbsp;&amp;nbsp; // To push changes even&amp;nbsp; if you don&#39;t have ceratin changes from the remote. Warning: Use this with extreme caution because it can cause others to get&lt;/pre&gt;
out of sync with the repository to which you are pushing.&lt;br /&gt;
&lt;br /&gt;
As an alternative to &#39;git pull&#39;, we can also use &#39;git fetch&#39; followed by &#39;git merge @{u}&#39;&lt;br /&gt;
&lt;br /&gt;
Some more useful commands &lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git checkout -b &amp;lt;branch&amp;gt; --track &amp;lt;remote&amp;gt;/&amp;lt;branch&amp;gt; // Checkout a remote branch to your local filesystem
$ git pull &amp;lt;remote name&amp;gt; &amp;lt;remote branch&amp;gt;&amp;nbsp;&amp;nbsp; // Pulls changes from the &amp;lt;remote branch&amp;gt; of &amp;lt;remote name&amp;gt; into the current local branch
$ git pull &amp;lt;remote name&amp;gt; &amp;lt;remote branch&amp;gt;:&amp;lt;local branch&amp;gt; // Pulls changes from the &amp;lt;remote branch&amp;gt; of &amp;lt;remote name&amp;gt; into the &amp;lt;local branch&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // e.g: git pull origin development:team-dev
$ git pull --rebase origin master // rebasing the current locak branch on top of remote origin&#39;s master branch
&lt;/pre&gt;
</description><link>http://shazninazeer.blogspot.com/2016/07/unleashing-git-part-6-git-branching.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-6690981055082444421</guid><pubDate>Sat, 25 Jun 2016 10:26:00 +0000</pubDate><atom:updated>2016-06-25T03:30:06.291-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">stash</category><title>Unleashing the Git - part 5 - git stashing</title><description>More often than not, there can be situations where you have done some changes and you need to temporarily hide those from the working tree since those changes are not completely ready yet. Stashing comes into play in such situations. May be when you have done some changes in a branch and you want to switch to another branch without committing your changes in the current branch. Stash is the easiest option for that.&lt;br /&gt;
&lt;br /&gt;
Say you have changed some files. Issuing the git status would show what has changed.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git stash // Temporarily hide your changes. Now issue git status. You won&#39;t see the modifications. Equivalent to $ git stash save
$ git stash save --patch // Opens the text editor to choose what portion to stash
$ git stash apply // Apply the last stashed change and keep the stash in stack. But this is normally not done. Instead following is done
$ git stash pop // Apply the last stashed change and remove it from stack
$ git stash list // Shows available stashes.
&lt;/pre&gt;
Stashes have name in the format of stash@{#} where # is 0 for most recent one and 1 for the second recent and so on.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git stash drop &amp;lt;stash name&amp;gt;&amp;nbsp;&amp;nbsp; // e.g: git stash drop stash@{0} to remove the first stash
$ git stash clear // Remove all the stashed changes
$ git stash branch &amp;lt;stash name&amp;gt;&amp;nbsp; // Create a branch from an existing stash
&lt;/pre&gt;

In the next part of this series we&#39;ll discuss git branching in detail.
</description><link>http://shazninazeer.blogspot.com/2016/06/unleashing-git-part-5-git-stashing.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-2634740863663306709</guid><pubDate>Fri, 24 Jun 2016 17:07:00 +0000</pubDate><atom:updated>2016-06-24T10:07:46.673-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">tag</category><category domain="http://www.blogger.com/atom/ns#">tagging</category><title>Unleashing the Git - part 4 - Git Tagging</title><description>Tagging comes very handy in managing a repository. Tags and branches are similar concepts. But tags are read only. There are two types of tags. 1) Lightweight 2) Annotated&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git tag Basic_Features&amp;nbsp;&amp;nbsp;&amp;nbsp; // Creates a Basic_Features tag.
$ git tag&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Shows available tags
Basic_Features
$ git show Basic_Features&amp;nbsp;&amp;nbsp; // Which show the details of the commit on which Basic_Feature tag is added
$ git tag beta1 HEAD^ // Creates a tag from next to last commit
&lt;/pre&gt;
Earlier I showed how to check out code with commit id. We can also use the tags to checkout code of a particular stage using the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git checkout Basic_Feature
&lt;/pre&gt;
All of the above are lightweight/unannotated tag. Creating an annotated tag is as simple as creating lightweight tag as below,&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git tag -a Basic_Messaging_Annotated -m &quot;Annotated tag at Messaging&quot;
$ git show Basic_Messaging_Annotated&amp;nbsp;&amp;nbsp; // this will provide the details of the tagger as well.
&lt;/pre&gt;
Deleting a tag is same for both tag types.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git tag -d Basic_Messaging_Annotated&amp;nbsp; // Deletes the annotated tag we created.
$ git push origin v1.0 // Push local tag v1.0 to remote origin.
$ git push --tags origin // Push all the local tags to remote origin
$ git fetch --tags origin // fetches all the remote origins tags to local repository. Note: If you have a local tag with same name as a remote tag, it&#39;ll be overwritten
&lt;/pre&gt;
</description><link>http://shazninazeer.blogspot.com/2016/06/unleashing-git-part-4-git-tagging.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-4353116812331216895</guid><pubDate>Sat, 18 Jun 2016 17:45:00 +0000</pubDate><atom:updated>2016-06-24T10:12:23.901-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">remotes</category><category domain="http://www.blogger.com/atom/ns#">repositories</category><title>Unleashing the Git - part 3 - Working with remote repositories</title><description>More often we need to share the files that we modify and make it available for other users. This is typically the case in Software development projects, where several people work on a set of files and all needs to modify and do changes. The solution is to have the repository in a centralised place and each and every one work with there own copies before they commit it to the central place. There are many online git repository providers. Examples are GitHub, BitBucket etc. &lt;br /&gt;
&lt;br /&gt;
Choose, whatever best suites for you and sign up for an account. Most online repositories provide free accounts. I&#39;ve a created a one in bitbucket and have created a repository named online_workbench. &lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git remote add origin https://shazni@bitbucket.org/shazni/online_workbench.git  // Syntax is git remote add &amp;lt;name&amp;gt; &amp;lt;repository URL&amp;gt;
$ git remote rm &amp;lt;name&amp;gt; // To remove a remote from your local repository
$ git push -u origin master
Password for &#39;https://shazni@bitbucket.org&#39;:
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 88.01 KiB, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://shazni@bitbucket.org/shazni/online_workbench.git
&amp;nbsp;* [new branch]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; master -&amp;gt; master&lt;/pre&gt;
Branch master set up to track remote branch master from origin.&lt;br /&gt;
&lt;br /&gt;
After you entered your password, you&#39;ll have your repository online and its local location is your local &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$HOME/example&lt;/span&gt; directory.&lt;br /&gt;
&lt;br /&gt;
&#39;git push -u origin master&#39; is to make the git aware, that all the pull and push operations to default to the master branch. If in case &#39;-u origin master&#39; is not specified, each and every time you issue a &#39;pull&#39; or &#39;push&#39; command, you will have to specify the origin.&lt;br /&gt;
&lt;br /&gt;
Ok.. Now if someone needs to get a local copy and work on this remote repository, what he/she needs to do? Only few steps are involved.&lt;br /&gt;
&lt;br /&gt;
First we need to clone the repository into a directory. Navigate or create a new directory where you need the local clone of the repository and issue the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git clone &amp;lt;remote repository location&amp;gt; &amp;lt;Path you want the clone to be&amp;gt;
&lt;/pre&gt;
If you omit the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;Path you want the clone to be&amp;gt;&lt;/span&gt;, it will be in the current directory.&lt;br /&gt;
&lt;br /&gt;
Depending on how the firewall on your computer or local area network (LAN) is configured, you might get an error trying to clone a remote repository over the network. Git uses SSH by default to transfer changes&lt;br /&gt;
over the network, but it also uses the Git protocol (signified by having git:// at the beginning of the URI) on port 9418. Check with your local network administrator to make sure communication on ports 22—the port SSH communicates on—and 9418 are open if you have trouble communicating with a remote repository.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git clone --depth 50 &amp;lt;remote repository location&amp;gt;&amp;nbsp; // Create a shallow clone with the last fifty commits

&lt;/pre&gt;
Then, if we do the modification to the files or added files, next we need to stage it for commits. Issue the following commands.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git add *&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Stages and add all your changes, This is similar to git add -A 
// If you specify git add -u will only previously added and updated files will be staged. -p parameter will present you with sections so that you are given option to include a change or not.
$ git commit –m &#39;My commit comment&#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Commit the changes to the local repository
$ git pull&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // checks whether there are any unsinced updates in the remote location and if exist syncs local and the server
$ git push&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Add the changes made by you to the server
&lt;/pre&gt;
</description><link>http://shazninazeer.blogspot.com/2016/06/unleashing-git-part-3-working-with.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-5277107868294245759</guid><pubDate>Sun, 28 Feb 2016 22:51:00 +0000</pubDate><atom:updated>2016-02-28T14:57:26.578-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">boost</category><category domain="http://www.blogger.com/atom/ns#">building. compiling</category><category domain="http://www.blogger.com/atom/ns#">C++</category><title>Building boost C++ library</title><description>Boost is a well written portable C++ source library. It&#39;s a very popular and flexible library set to use in you C++ applications. It has a huge set of libraries spanning across many utilities and uses. Good thing about Boost is that, the libraries available in Boost are either already available in C++ standard or likely to end up in it one day. Note however, not all libraries are accepted. Nevertheless, all the libraries are proven and well tested.  &lt;br /&gt;
&lt;br /&gt;
Download the latest boost library from&amp;nbsp;&lt;a href=&quot;http://www.boost.org/&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;http://www.boost.org/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In this short guide I&#39;ll walk you through the process to easily build boost for you to generate the header and library files for you to use in your C++ application.&lt;br /&gt;
&lt;br /&gt;
Once you download the boost, extract it into a directory. Navigate into the extracted directory and issue the following commands. Make sure you have a C++ compiler available in your system (e.g: g++ in GNU/Linux). Look &lt;a href=&quot;http://shazninazeer.blogspot.com/2013/10/installing-developer-tools-in-linux.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;here&lt;/span&gt; &lt;/a&gt;(which is a generic post, however) to see how to install C/C++ compilers. &lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ ./bootstrap.sh --prefix=path/to/installation/prefix

$ ./b2 install
&lt;/pre&gt;
Depending on your system tools, you may not have all the libraries built. For example, if you do not have python dev packages installed, boost python library won&#39;t build. But this won&#39;t stop building other libraries. &lt;br /&gt;
&lt;br /&gt;
You are done!!! You should be able to find two directories inside the directory you specified in the PREFIX; namely includes and libs. These contain header files and .so (or .dll in Windows) shared library files to link in your C++ application.</description><link>http://shazninazeer.blogspot.com/2016/02/building-boost-c-library.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-1332369092096586868</guid><pubDate>Thu, 18 Feb 2016 19:27:00 +0000</pubDate><atom:updated>2016-02-18T11:48:51.602-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Microservices</category><category domain="http://www.blogger.com/atom/ns#">MSF4J</category><category domain="http://www.blogger.com/atom/ns#">MSS</category><category domain="http://www.blogger.com/atom/ns#">WSO2</category><title>WSO2 Microservices Framework for Java (MSF4J) 1.0.0 is released</title><description>WSO2 is pleased to announce that it has released the very first version 1.0.0 of the WSO2 Microservices Framework for Java (MSF4J). You can get more details from the following location.&lt;br /&gt;
&lt;br /&gt;
[1] &lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;a href=&quot;http://wso2.com/products/microservices-framework-for-java/&quot;&gt;http://wso2.com/products/microservices-framework-for-java/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It gives you a lightweight fast runtime together with an annotation based programming model to create your micro services. Browse the following location for a quick start guide.&lt;br /&gt;
&lt;br /&gt;
[2] &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;https://docs.wso2.com/display/MSF4J100/Quick+Start+Guide&quot;&gt;https://docs.wso2.com/display/MSF4J100/Quick+Start+Guide&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Enjoy creating your microservices!!!</description><link>http://shazninazeer.blogspot.com/2016/02/wso2-microservices-framework-for-java.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-2067956973845955264</guid><pubDate>Sat, 30 Jan 2016 19:31:00 +0000</pubDate><atom:updated>2016-02-19T09:45:20.459-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">git blame</category><category domain="http://www.blogger.com/atom/ns#">git diff</category><category domain="http://www.blogger.com/atom/ns#">git log</category><category domain="http://www.blogger.com/atom/ns#">git stat</category><title>Unleashing the Git - part 2 - git log and git stat</title><description>This is the 2nd part of the Git posts I&#39;m currently blogging on. You can find the fist part &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;a href=&quot;http://shazninazeer.blogspot.com/2015/11/unleashing-git-part-1.html&quot;&gt;here&lt;/a&gt;&lt;/span&gt;. This part focuses on the git logging and its various outputs and statistics generation in git. These information are vital for developers. Some of the uses are to see the recent changes, diffs in recent commits, who made what change etc. Let&#39;s dive into these commands and see what they have to offer us.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git shortlog

Shazni Nazeer (10):
      First commit
      Removing compliled files
      Removing log files
      Verifying folder existence
      create directory called logs
      Data loading from DB
      More logging configurations and message parsing
      adding MessageProcessor.py
      Handling of few user requests
      Bug fixes and Items ID is changed to VARCHAR from INT
&lt;/pre&gt;
Above command arranges all the users who were involved in 
building the repository data in alphabetical order, showing number of 
commits they have made along with descriptions. Of course if you have 
only one user contributing, only that users information is listed. If 
you specify a -n parameter to the same command it will order the users 
by number of commits. &lt;br /&gt;
&lt;br /&gt;
With -e parameter we can get the email address of the user, whereas the -s parameter gives a summary of each users stages/commits.&lt;br /&gt;
&lt;br /&gt;
git log command as I stated earlier gives git commit ID and other meta information. If you specify &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;--skip=&amp;lt;number&amp;gt;&lt;/span&gt; it will omit last &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;number&amp;gt;&lt;/span&gt; of commits and show only others. Following are handful of git log examples that you may find useful in your day to day development work.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git log -p // Shows the commit changes
$ git log -1 -p HEAD   // To see the latest commit
$ git log -p -2 // Limit the output to only last two commits, also shows the diffs
$ git log -5 // Shows only the last 5 commit without diffs.
$ git log HEAD^^..HEAD   // Same as git log -2
$ git log --skip=4   // Skips the last 4 commit details
$ git log --since=2014-02-27 --until=2014-03-10   // Only get commit details between the specified dates
$ git log --since=2.days // Find commit of last 2 days - If 3.months - Since three month before
$ git log --since=&quot;1 week&quot; == git log --after=&quot;7 days&quot; == git log --since=&quot;168 hours&quot;
$ git log --before=&quot;1 week&quot; == git log --until=&quot;7 days&quot; == git log --before=&quot;168 hours&quot;
$ git log --author=&quot;some user&quot;
$ git log --grep=&quot;user&quot; // Finds all the commits with a descrpition having the word user. -i paramter at the end ensures case insensitive search
$ git log --stat  // Gives details with files changed
$ git log --pretty=oneline
$ git log --pretty=format:&quot;%h - %an, %ar : %s&quot;
$ git log --pretty=format:&quot;%h %s&quot; --graph
$ git log --oneline // first seven characters of the commit id and the commit message shown
$ git log -- some/path/
$ git log -- somefile
&lt;/pre&gt;
&lt;br /&gt;
It&#39;s often the case while developing that you add few files to your repository mistakenly or for testing which you never intent to commit. You can use 
git clean command to remove those. Let&#39;s assume we need to remove all the 
text file with extension .txt&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
Following two commands will do it.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git clean -f -e*.txt
$ git clean -f
&lt;/pre&gt;
Getting information in git is not limited to git log command. We often need to know more information on individual files changes and other useful information. git diff command have plethora of options to provide you with required information about your repository. Let&#39;s check some of the commands that you might find useful.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git diff // The diff between the working tree and the staged area
$ git diff --staged // View the difference between staged changes and the repository
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
View the differences between the working tree and a commit in the repository&lt;/div&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git diff HEAD
$ git diff &amp;lt;Commit ID&amp;gt;
$ git diff &amp;lt;first commit id&amp;gt; &amp;lt;second commit id&amp;gt;    or $ git diff &amp;lt;first commit id&amp;gt;..&amp;lt;second commit if&amp;gt;  // View the differences between two commits.
$ git diff -- path/ // Limit the diff output to a specific path
$ git diff-tree -p COMMIT // Where COMMIT is your commit number to see what was changed in that commit
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Generating stats&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
git diff can also be used to get some statistics output in addition to differences in the source code. Some of the examples are as shown below.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git diff --stat HEAD~5  or git diff --stat HEAD~5 HEAD  // Show change stats between last 5 commits
$ git diff --stat &amp;lt;first_commit_id&amp;gt; &amp;lt;second_commit_id&amp;gt; // Stats between two commits 
$ git diff --shortstat HEAD~5 // Shows number of files changed, insertions and deletions.
$ git diff --numstat HEAD~5 // Shaows the stat in more 
$ git diff --stat -p HEAD^  // also shows the oatch in addion to stats
$ git log --stat  // Shows full stats along with logs
$ git log --shortstat // Shows Cumulative stats only along with usual log
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div&gt;
There is a command that can used to give information on invidividual user responsible for changes in source file by line number. git blame displays all or a portion of a file with annotations showing when&lt;/div&gt;
&lt;div&gt;
the change was made, by whom, and, more importantly, in what revision the&lt;/div&gt;
&lt;div&gt;
change was made.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
git blame outputs the following information:&lt;/div&gt;
&lt;div&gt;
• Short commit ID&lt;/div&gt;
&lt;div&gt;
• Author’s name&lt;/div&gt;
&lt;div&gt;
• Date and time of commit&lt;/div&gt;
&lt;div&gt;
• Line number&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git blame &amp;lt;some_file&amp;gt; // To show the entire file with line by line info on above
$ git blame -L 20 &amp;lt;some_file&amp;gt;  // Starts blaming of the beginning from line 20
$ git blame -L 100,120 &amp;lt;some_file&amp;gt;  // Limit the blame to lines 100 to 120 
$ git blame -L 5,+20 &amp;lt;some_file&amp;gt;   // Limit the blame starting from line number 5 to 20 lines
$ git blame -L 30,-13 &amp;lt;some_file&amp;gt;  // Get the blame of the file from line number 30 to 13 lines behind
$ git blame -L &quot;&amp;lt;POSIX Reg Ex&amp;gt;&quot;,+20 &amp;lt;some_file&amp;gt; // Get the blame of the specified file from the line matching to regex to 20 lines ahead
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
Git can track content that moves around in a file or is copied from one file to&lt;/div&gt;
&lt;div&gt;
another. You can use git blame to show content that has moved around by&lt;/div&gt;
&lt;div&gt;
adding the -M parameter.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git blame -M &amp;lt;some_file&amp;gt;     // To see which part has got moved around in the specified file
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can also track changes copied from another file by using the -C&lt;/div&gt;
&lt;div&gt;
parameter. It checks the changes in the file against other changes in the&lt;/div&gt;
&lt;div&gt;
repository to see whether it was copied from somewhere else.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git blame -C &amp;lt;some_file&amp;gt;     // To see which part has got copied from another file in the specified file
&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://shazninazeer.blogspot.com/2016/01/unleashing-git-part-2-git-log-and-git.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-169426016132115025</guid><pubDate>Wed, 04 Nov 2015 11:39:00 +0000</pubDate><atom:updated>2015-11-09T10:10:38.925-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">source control</category><category domain="http://www.blogger.com/atom/ns#">version control</category><title>Unleashing the Git - part 1 - Fundamentals</title><description>Git is a distributed version control system. It has become extremely popular and replacing other version control systems in the industry very fast. Hence, knowing some day to day uses of git is very essential for all developers. I thought of writing some series of posts to cover some very useful git usages along with an example for you to grasp it easily. This is the first post of that series.&lt;br /&gt;
&lt;br /&gt;
Before we delve into details on using the git, make sure you have git installed. If not, you can find details of git installation in the following location.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://git-scm.com/book/en/v2/Getting-Started-Installing-Git&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;https://git-scm.com/book/en/v2/Getting-Started-Installing-Git&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Ok. Assuming you have git installed, let&#39;s dive into using it.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Go into a directory where you want to monitor for changes. Let&#39;s create an empty directory called &#39;example&#39; in &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;$HOME&lt;/span&gt;. I&#39;ll refer the directory as &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;$HOME/example&lt;/span&gt; from this point.&lt;br /&gt;
&lt;br /&gt;
Most of the commands and examples are in par with the following two books related to Git. It&#39;s really worth the time to read these two books if you are working with git on day to day basis.&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/Pragmatic-Guide-Git-Guides/dp/1934356727http://www.amazon.com/Git-Version-everyone-Ravishankar-Somasundaram/dp/1849517525/ref=pd_sim_14_8?ie=UTF8&amp;amp;amp;refRID=074JXE8848BTDMJE2GQ4&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.amazon.com/Pragmatic-Guide-Git-Guides/dp/1934356727http://www.amazon.com/Git-Version-everyone-Ravishankar-Somasundaram/dp/1849517525/ref=pd_sim_14_8?ie=UTF8&amp;amp;amp;refRID=074JXE8848BTDMJE2GQ4&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Git: Version control for everyone&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/Pragmatic-Guide-Git-Guides/dp/1934356727/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1446637434&amp;amp;sr=1-1&amp;amp;keywords=pragmatic+guide+to+git&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;Pragmatic Guide to Git&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ cd $HOME/example
&lt;/pre&gt;
First, let&#39;s find out some initial git commands you might come across when initializing a git repository.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git init
&lt;/pre&gt;
Initializes empty Git repository in /home/shazni/example&lt;br /&gt;
&lt;br /&gt;
To configure Git, you can use the following commands:&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git config --global user.name &quot;your full name&quot;
$ git config --local user.name &quot;your full name&quot;
$ git config --global user.email &quot;your email id&quot;
$ git config --local user.email &quot;your email id&quot;
$ git config -l // lists all the configuration variables
$ git config --global color.ui auto&amp;amp;nbsp; // Optional
$ git config --global core.editor /path/to/editor&amp;amp;nbsp; // Optional
$ git config --global merge.tool &quot;gvimdiff&quot;&amp;amp;nbsp;&amp;amp;nbsp; // Setting the diff tool for git mergetool command
&lt;/pre&gt;
Before we proceed, if you need any help on git, issue the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git help
&lt;/pre&gt;
If you need to see the built-in documentation of a particular command, you may issue&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git help &amp;lt;command name=&quot;&quot;&amp;gt;&amp;lt;/command&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // e.g. git help init&amp;nbsp; 
&lt;/pre&gt;
Now copy a file called &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;abc.doc&lt;/span&gt; to the directory. This file is still not being monitored by git. Hence, it is referred to be in unstaged state. To make it into staged state, i.e. to make it available for git to monitor it, we have to issue the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git add abc.doc
&lt;/pre&gt;
Issue the following command to see the status of all the files.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git status
&lt;/pre&gt;
To add multiple files, we may use the following commands,&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git add .
$ git add *.docx
&lt;/pre&gt;
Remember these commands would add all the files and all the .docx files to the staged state respectively. This includes all the temporary files of the original files, which is often named after ~ with it&#39;s original name to save state of the files for disaster recovery. For example when abc.doc is open there can be another file name ~abc.doc. When we use &#39;git add&#39; even this file is staged. This is at times troublesome. Git has a workaround for this. We can create a file named .gitignore and specify what files and what types of files we need to ignore from &#39;git add&#39;. Create a file named .gitignore and type the following.&lt;br /&gt;
&lt;br /&gt;
~*.*&lt;br /&gt;
&lt;br /&gt;
This is a pattern. This says to avoid all temporary files like ~abc.doc&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;&lt;b&gt;Undoing Uncommitted Changes&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;git reset abc.doc // To make from staged to unstaged before commiting or more specifically

git reset HEAD -- abc.doc // Here -- says Git that everything follows are file names, not commands
&lt;/pre&gt;
With git reset you are telling Git, “Change the index— the staging area — to the latest version of this file.”. Normally git reset is used when you want to unstage already tracked files&lt;br /&gt;
&lt;br /&gt;
Following is normally used to un-stage new files that you staged but still not in git&#39;s control. The file will still be in the local working tree&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;git rm --cached abc.doc // git rm is usually done to rm files from remote repository. Adding --cached options tells to leave the working tree alone.

git checkout -- abc.doc // Caution : Be careful with this command. This will completely wipe out all your current changes and brings back the old file you committed
&lt;/pre&gt;
Though the files can be staged/unstaged it&#39;s still not under version control until we commit the files. Only then Git will look for changes of the current version with the last saved version.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git commit -m &quot;Initial commit&quot;
$ git status // There won&#39;t be any unstaged or even staged files. All are commited now
&lt;/pre&gt;
Now if you modify a file and issue a &#39;git status&#39; command. It should show that your file is modified. To include it for next commit, let&#39;s add it.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git add abc.doc&lt;/pre&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git commit -m &quot;Second commit with changes&quot;&lt;/pre&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git log&amp;nbsp;&amp;nbsp;&amp;nbsp; // Provides history of the repository. The ouput will be as follows.
commit ca8da1d78daa8453dd478da7610e3c375ae917db
Author: Shazni Nazeer &amp;lt;mshazninazeer gmail.com=&quot;&quot;&amp;gt;
Date:&amp;nbsp;&amp;nbsp; Tue Dec 3 12:37:24 2013 +0530

&amp;nbsp;&amp;nbsp;&amp;nbsp; More changes to Refactor doc

commit 93c1e9296a901bee38806e216d72abd74509a18f
Author: Shazni Nazeer &amp;lt;mshazninazeer gmail.com=&quot;&quot;&amp;gt;
Date:&amp;nbsp;&amp;nbsp; Tue Dec 3 12:30:05 2013 +0530

&amp;nbsp;&amp;nbsp;&amp;nbsp; Initial commit
&lt;/pre&gt;
We need the commit id (the 40 character id in front of the commit word). If we need to checkout the files at the first commit.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git checkout 93c1e&amp;nbsp;&amp;nbsp;&amp;nbsp; // Note only the first 5 character is enough to checkout. 
&lt;/pre&gt;
Now when you checkout, the directory would contain the file before you modified. If you want to checkout a previous commit with latest intact, we need to do branching. Will come back to that shortly. But let&#39;s get our latest.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git checkout master

Previous HEAD position was 93c1e92... Initial commit
Switched to branch &#39;master&#39;
&lt;/pre&gt;
If you want to permanently move back to the previous state and throw away the latest changes, you can issue the following command. This will revert all the commits you have done after this commit.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git reset --hard 93c1e&amp;nbsp;&amp;nbsp; // What happens is that you have changed the master branch to previous commit
&lt;/pre&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;&lt;b&gt;Moving files in git&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
If you need to rename or mv a file in git we perform the following.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git mv abc.doc xyz.doc
$ git commit -m &quot;Renaming abc.doc to xyz.doc&quot;
&lt;/pre&gt;
Now say we have a directory called docs in the repository.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git mv xyz.doc docs/
$ git commit -m &quot;Moving xyz.doc to abc.doc&quot;
&lt;/pre&gt;
If a file completely be removed from the repository, you issue the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git rm -- abc.doc
$ git rm -r -- docs/
$ git commit -m &quot;Removing abc.doc and the docs directory from git&quot;
&lt;/pre&gt;
Say you issued a git rm command, but didn&#39;t commit yet. You need the removed file or directory; as previously mentioned&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ git reset HEAD -- abc.doc docs/
&lt;/pre&gt;
</description><link>http://shazninazeer.blogspot.com/2015/11/unleashing-git-part-1.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-2515971133765055948</guid><pubDate>Mon, 19 Oct 2015 18:12:00 +0000</pubDate><atom:updated>2015-10-19T11:24:40.842-07:00</atom:updated><title>Accessing local H2 database of WSO2 products </title><description>All WSO2 products internally use the H2 database by default. H2 is a light weight file based database system. By using H2 WSO2 products can readily be used for experimentation without configuring an industry ready RDBMS. Though, H2 is not recommended for any production systems, it&#39;s often the case that many try out WSO2 products with H2 initially thereby frequently needing to view the contents of the tables.&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
This short tutorial gives you a guide to view WSO2 database tables in H2.&lt;br /&gt;
&lt;br /&gt;
The process is simple.

Add the following configuration to the repository/conf/carbon.xml and restart the server.

&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
    &amp;lt;H2DatabaseConfiguration&amp;gt;
        &amp;lt;property name=&amp;quot;web&amp;quot; /&amp;gt;
        &amp;lt;property name=&amp;quot;webPort&amp;quot;&amp;gt;8082&amp;lt;/property&amp;gt;
        &amp;lt;property name=&amp;quot;webAllowOthers&amp;quot; /&amp;gt;
    &amp;lt;/H2DatabaseConfiguration&amp;gt;
&lt;/pre&gt;
Once the server is restarted, navigate to &lt;a href=&quot;http:&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;http://localhost:8082/&lt;/span&gt;&lt;/a&gt;. You&#39;ll be redirected to a view like following.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFr6qAC1lWtI5svV7kb8rYFQSKNGf7EyzS4CHosRzc7GECUMk1soGqal4W8IMX8vfQyEl-AnHl9Tdh7rAzwlVDlcYBRKULMOpRlwcoY_maeUlUQ9SLhedlRu_4CQkeiYS7flL4Z3-5G7aE/s1600/H2.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFr6qAC1lWtI5svV7kb8rYFQSKNGf7EyzS4CHosRzc7GECUMk1soGqal4W8IMX8vfQyEl-AnHl9Tdh7rAzwlVDlcYBRKULMOpRlwcoY_maeUlUQ9SLhedlRu_4CQkeiYS7flL4Z3-5G7aE/s320/H2.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In JDBC URL fill out where the WSO2CARBON_DB is. It&#39;s located in repository/database directory. Assuming the CARBON_HOME is you product home directory, JDBC URL would be, jdbc:h2:CARBON_HOME/repository/database/WSO2CARBON_DB 

(make sure to replace the CARBON_HOME with your actual path)

Click connect to see the tables and you are good to try out executing some SQL. </description><link>http://shazninazeer.blogspot.com/2015/10/accessing-local-h2-database-of-wso2.html</link><author>noreply@blogger.com (Shazni)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFr6qAC1lWtI5svV7kb8rYFQSKNGf7EyzS4CHosRzc7GECUMk1soGqal4W8IMX8vfQyEl-AnHl9Tdh7rAzwlVDlcYBRKULMOpRlwcoY_maeUlUQ9SLhedlRu_4CQkeiYS7flL4Z3-5G7aE/s72-c/H2.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-5657311852804633854</guid><pubDate>Wed, 01 Apr 2015 14:45:00 +0000</pubDate><atom:updated>2015-04-01T07:50:08.872-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Django</category><category domain="http://www.blogger.com/atom/ns#">Python</category><title>Installing and testing Django</title><description>Django is a web development framework for python. It eases your development time and makes web development a real joy. In this article I&#39;ll show you how to install Django and test it, given you already have python installed in Linux. Installing Django is a simple step and it&#39;s a single command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ sudo pip install django
&lt;/pre&gt;
It assumes you have python-pip module installed. If not install it using the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;sudo apt-get install python-pip        // In Debian Linux/Ubuntu

sudo yum install python-pip         // In Red Hat and Fedora
&lt;/pre&gt;
After installing you can check whether everything is setup properly. Use the following commands.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ python
Python 2.7.8 (default, Nov 10 2014, 08:19:18)
[GCC 4.9.2 20141101 (Red Hat 4.9.2-1)] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&amp;gt;&amp;gt;&amp;gt; import django
&amp;gt;&amp;gt;&amp;gt; print django.VERSION
(1, 7, 7, &#39;final&#39;, 0)
&lt;/pre&gt;
Let&#39;s start off with setting up a default project to see the Django in work.&lt;br /&gt;
&lt;br /&gt;
Create a directory of your choice. Say &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$HOME/DjangoProjects.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Navigate to that directory and issue the following command.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ django-admin.py startproject mysite &amp;nbsp; &amp;nbsp; // Here &#39;mysite&#39; is your project name
&lt;/pre&gt;
This will create a directory called mysite, inside which you&#39;ll find a file named manage.py and another directory named &#39;mysite&#39; which in turn contains four files; namely, __init__.py, setting.py, urls,py and wsgi.py.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s not bog down into details of what these files are all about. You can find detailed information in the Django web site &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;https://www.djangoproject.com/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start the Django&#39;s test server for this default site. (This server is merely for testing and not recommended to use in production). Type the following to start the server.&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;$ python manage.py runserver 9876

&lt;/pre&gt;
This should start run the server on port 9876. To see the welcome page, open a browser and navigate to &lt;a href=&quot;http://127.0.0.1:9876/&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;http://127.0.0.1:9876/&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Hope this was a good starting point for you to learn Django. Enjoy working with Django.</description><link>http://shazninazeer.blogspot.com/2015/04/installing-and-testing-django.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-8678525309867956612</guid><pubDate>Fri, 14 Nov 2014 09:14:00 +0000</pubDate><atom:updated>2014-11-14T01:16:51.710-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BAM</category><category domain="http://www.blogger.com/atom/ns#">G-Reg</category><category domain="http://www.blogger.com/atom/ns#">Governance</category><category domain="http://www.blogger.com/atom/ns#">Notification</category><category domain="http://www.blogger.com/atom/ns#">Runtime Governance</category><title>Connecting and Publishing Stats and Notification to WSO2 BAM from WSO2 GREG</title><description>The article that I wrote on the subject can be accessed in the following location.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://wso2.com/library/tutorials/2014/11/tutorial-connecting-and-publishing-stats-and-notification-to-wso2-bam-from-wso2-greg/&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;http://wso2.com/library/tutorials/2014/11/tutorial-connecting-and-publishing-stats-and-notification-to-wso2-bam-from-wso2-greg/&lt;/span&gt;&lt;/a&gt;</description><link>http://shazninazeer.blogspot.com/2014/11/connecting-and-publishing-stats-and.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-7311197866099365009</guid><pubDate>Tue, 28 Oct 2014 18:15:00 +0000</pubDate><atom:updated>2014-10-28T11:20:37.822-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Identity Server</category><category domain="http://www.blogger.com/atom/ns#">IS</category><category domain="http://www.blogger.com/atom/ns#">Permission</category><category domain="http://www.blogger.com/atom/ns#">permission tree</category><category domain="http://www.blogger.com/atom/ns#">Roles</category><category domain="http://www.blogger.com/atom/ns#">WSO2</category><title>Creating Roles and Assigning Permissions in WSO2 IS</title><description>In this article I will try to explain the ways to create and assign roles in WSO2 Identity Server. I&#39;ll walk you through on creating and assigning roles in the Management console UI and then outline the ways to do the same using an API and using a Java client programmatically.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start the WSO2 Identity Server (IS) first. To download and run the WSO2 IS, look &lt;a href=&quot;http://shazninazeer.blogspot.com/2014/10/downloading-and-running-wso2-identity.html&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Once started login to management console. First let&#39;s look at how we can create a role named &#39;TestRole&#39; and assign some permissions in the permission tree to it. This involves only a very few steps. Navigate to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Configure -&amp;gt; Users and Roles -&amp;gt; Roles -&amp;gt; &amp;nbsp;Add New Role&lt;/span&gt;. Enter the role name as &#39;TestRole&#39; and click next. The permission tree would be shown and you need to select the the relevant permission in the tree for this role. If you need to assign certain existing users to this role, click next and select those users. Otherwise click finish. That&#39;s it. You have successfully create a a new role named &#39;TestRole&#39; and assigned permission for that. You can see the existing roles by navigating to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Home -&amp;gt; Configure -&amp;gt; Users and Roles -&amp;gt; Roles&lt;/span&gt;. At this place you can view the permission, delete the role, assign user and also rename the role.&lt;br /&gt;
&lt;br /&gt;
Next we shall see how to create roles and assign any permission in the permission tree to those roles using a programmatic way, without using the UI. You can do that by calling an admin service as an API or using a Java client. I&#39;ll outline both the methods here.&lt;br /&gt;
&lt;br /&gt;
There is a web service API called &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;RemoteUserStoreManagerService&lt;/span&gt; that can be used to manage users and roles. This is an Admin Service in the WSO2 carbon platform. Admin services in the WSO2 products are hidden by default. To see the wsdl of this web service you need to unhide the Admin service WSDLs. To do that, first, open up &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;CARBON_HOME/repository/conf/carbon.xml&lt;/span&gt; and look for the following line.&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;&amp;lt;HideAdminServiceWSDLs&amp;gt;true&amp;lt;/HideAdminServiceWSDLs&amp;gt;&lt;/pre&gt;
Make it to &#39;false&#39; and restart the server.&lt;br /&gt;
&lt;br /&gt;
After the server is successfully started, you can access the wsdl of the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;RemoteUserStoreManagerService&lt;/span&gt; by navigating to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;https://localhost:9443/services/RemoteUserStoreManagerService?wsdl&lt;/span&gt; (Replace &#39;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;localhost&lt;/span&gt;&#39; part as applicable).&lt;br /&gt;
&lt;br /&gt;
Following are the two methods I mentioned&lt;br /&gt;
&lt;br /&gt;
1. You can create a SOAP UI project with this wsdl. You can use the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;addRole&lt;/span&gt; method to add the role. A sample SOAP call is given below to add a role named &#39;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ValidRole&lt;/span&gt;&#39; and assign permission under &#39;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/permission/admin/login/EmailLogin&lt;/span&gt;&#39; where &#39;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;EmailLogin&lt;/span&gt;&#39; being a new permission I created under &#39;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/permission/admin/login/&lt;/span&gt;&#39;

&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;&amp;lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ser=&quot;http://service.ws.um.carbon.wso2.org&quot; xmlns:xsd=&quot;http://dao.service.ws.um.carbon.wso2.org/xsd&quot;&amp;gt;
   &amp;lt;soapenv:Header/&amp;gt;
   &amp;lt;soapenv:Body&amp;gt;
      &amp;lt;ser:addRole&amp;gt;
         &amp;lt;ser:roleName&amp;gt;ValidRole&amp;lt;/ser:roleName&amp;gt;
         &amp;lt;ser:permissions&amp;gt;
            &amp;lt;xsd:action&amp;gt;ui.execute&amp;lt;/xsd:action&amp;gt;
            &amp;lt;xsd:resourceId&amp;gt;/permission/admin/login/EmailLogin&amp;lt;/xsd:resourceId&amp;gt;
         &amp;lt;/ser:permissions&amp;gt;
      &amp;lt;/ser:addRole&amp;gt;
   &amp;lt;/soapenv:Body&amp;gt;
&amp;lt;/soapenv:Envelope&amp;gt;
&lt;/pre&gt;
2. You can write a Java client instead and invoke the methods in the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;RemoteUserStoreManagerService&lt;/span&gt;. A sample Java program is shown below to achieve this. The very self explanatory. Note: you need to add the plugins directory of a IS product to the classpath of the program to build and run this.&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.um.ws.api.stub.PermissionDTO;
import org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub;

public class ISClient {

    private static final String CARBON_HOME = &quot;/home/shazni/Downloads/WSO2/wso2is-5.0.0&quot;;
    private static final String SEVER_URL = &quot;https://localhost:9443/services/&quot;;
    private static final String USER_NAME = &quot;admin&quot;;
    private static final String PASSWORD = &quot;admin&quot;;
    private static final String ROLE_NAME = &quot;permissionRole&quot;;

    public static void main(String args[]){

        String trustStore = CARBON_HOME + &quot;/repository/resources/security/wso2carbon.jks&quot;;
        System.setProperty(&quot;javax.net.ssl.trustStore&quot;,  trustStore );
        System.setProperty(&quot;javax.net.ssl.trustStorePassword&quot;, &quot;wso2carbon&quot;);

        ConfigurationContext configContext;

        try {
            configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem( null, null);
            String serviceEndPoint = SEVER_URL + &quot;RemoteUserStoreManagerService&quot;;

            RemoteUserStoreManagerServiceStub adminStub = new RemoteUserStoreManagerServiceStub(configContext, serviceEndPoint);
            ServiceClient client = adminStub._getServiceClient();
            Options option = client.getOptions();

            option.setProperty(HTTPConstants.COOKIE_STRING, null);

            HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
            auth.setUsername(USER_NAME);
            auth.setPassword(PASSWORD);
            auth.setPreemptiveAuthentication(true);
            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
            option.setManageSession(true);

            boolean  authenticate = false;

            try{
                authenticate = adminStub.authenticate(USER_NAME, PASSWORD);
            } catch (Exception e){
                e.printStackTrace();
            }

            if(authenticate){
                System.out.println(&quot;User is authenticated successfully&quot;);
            } else {
                System.err.println(&quot;User is authentication failed&quot;);
            }

            try{
                PermissionDTO permissionDTO = new PermissionDTO();
                permissionDTO.setAction(CarbonConstants.UI_PERMISSION_ACTION);
                permissionDTO.setResourceId(&quot;/permission/admin/login/WebLogin&quot;);

                PermissionDTO[] permissionDTOs = new PermissionDTO[1];
                permissionDTOs[0] = permissionDTO ;

                adminStub.addRole(ROLE_NAME, null, permissionDTOs);
                System.out.println(&quot;Role is created successfully&quot;);
            } catch (Exception e){
                System.err.println(&quot;Role creation is failed&quot;);
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
&lt;/pre&gt;
Well that&#39;s it. Hope this article has been informative to you.</description><link>http://shazninazeer.blogspot.com/2014/10/creating-roles-and-assigning.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-6212749095310405517</guid><pubDate>Sat, 18 Oct 2014 05:59:00 +0000</pubDate><atom:updated>2014-10-17T23:01:28.934-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Identity Server</category><category domain="http://www.blogger.com/atom/ns#">IS</category><category domain="http://www.blogger.com/atom/ns#">permission tree</category><category domain="http://www.blogger.com/atom/ns#">WSO2</category><category domain="http://www.blogger.com/atom/ns#">WSRegistryServiceClient</category><title>Adding new permissions to permission tree in WSO2 Identity Server programmatically</title><description>Let&#39;s start the WSO2 Identity Server (IS) first. To download and run the WSO2 IS, look &lt;a href=&quot;http://shazninazeer.blogspot.com/2014/10/downloading-and-running-wso2-identity.html&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The permission tree in WSO2 identity Server is simply, &amp;nbsp;a few collections stored in the underlying registry. Therefore adding new permissions to the permission tree involves adding a meaningful collection underneath a needed permission (collection). All these resources are stored in the registry path;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; /_system/governance/permission/admin&lt;/span&gt;. You can view this permission tree by navigating to an existing roles permission. To do that, navigate to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Configure -&amp;gt; Users and Roles -&amp;gt; Roles -&amp;gt; Internal/everyone (Permissions)&amp;nbsp;&lt;/span&gt;in the WSO2 IS. In this article I&#39;m gonna write a sample Registry Client to add collections under &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/_system/governance/permission/admin&lt;/span&gt; to add new permissions to the permission tree. There&#39;s a permission named &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/_system/governance/permission/admin/login&lt;/span&gt;. We are going to add a permission named &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;WebLogin&lt;/span&gt; under this. What needs to happen is simply creating a collection under this collection and assign a property called &#39;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;name&lt;/span&gt;&#39; with its value being the name that needs to get displayed in the permission tree. This can be easily done using the management console of the WSO2 IS. What if someone needs to do this programmatically? Read further down to see how to!!&lt;br /&gt;
&lt;br /&gt;
Adding a resource or collection under another collection in a product like WSO2 IS involves few works. We can obtain some registry based services from a service client named &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;WSRegistryServiceClient&lt;/span&gt;. Retrieving this service and performing operations like get and put on top of Registry instance is the easiest way to manipulate the resources in the registry tree. But this service feature is not shipped with some of the WSO2 products including WSO2 IS by default. Therefore it&#39;s required to add this feature to WSO2 IS. Following URL explains how to add a feature to any WSO2 product.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.wso2.com/display/Carbon420/Installing+Features+via+the+UI&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;https://docs.wso2.com/display/Carbon420/Installing+Features+via+the+UI&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Look for WS API feature under the category of Governance Registry section. Once installed you can use the Registry API&#39;s to add collections under the above collection &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/_system/governance/permission/admin&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Following sample client java program adds the said collection.&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.wso2.carbon.registry.core.Collection;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.ws.client.registry.WSRegistryServiceClient;

import java.io.File;

public class RegistryClient {
    private static final String CARBON_HOME = &quot;/home/shazni/Downloads/WSO2/wso2is-5.0.0&quot;;
    private static final String axis2Repo = CARBON_HOME + File.separator + &quot;repository&quot; + File.separator + &quot;deployment&quot; + File.separator + &quot;client&quot;;
    private static final String axis2Conf = CARBON_HOME + &quot;/repository/conf/axis2/axis2_client.xml&quot;;
    private static final String username = &quot;admin&quot;;
    private static final String password = &quot;admin&quot;;
    private static final String serverURL = &quot;https://localhost:9443/services/&quot;;

    private static WSRegistryServiceClient initialize() throws Exception {
        System.setProperty(&quot;javax.net.ssl.trustStore&quot;, CARBON_HOME + File.separator + &quot;repository&quot; +
                File.separator + &quot;resources&quot; + File.separator + &quot;security&quot; + File.separator +
                &quot;wso2carbon.jks&quot;);
        System.setProperty(&quot;javax.net.ssl.trustStorePassword&quot;, &quot;wso2carbon&quot;);
        System.setProperty(&quot;javax.net.ssl.trustStoreType&quot;, &quot;JKS&quot;);
        System.setProperty(&quot;carbon.repo.write.mode&quot;, &quot;true&quot;);
        ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(axis2Repo, axis2Conf);
        return new WSRegistryServiceClient(serverURL, username, password, configContext);
    }

    public static void main(String[] args) throws Exception {
        Registry registry = initialize();

        Collection newCol = registry.newCollection();
        newCol.setProperty(&quot;name&quot;, &quot;WebLogin&quot;);

        registry.put(&quot;/_system/governance/permission/admin/login/WebLogin/&quot;, newCol);
    }
}
&lt;/pre&gt;
Change the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;CARBON_HOME&lt;/span&gt; variable path to the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;IS_HOME&lt;/span&gt; of your server. Further, to build this you need to add the plugins directory of a Governance Registry product to the class path. Then if you run this code, you get a collection called &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;WebLogin&lt;/span&gt; created under&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; /_system/governance/permission/admin&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Hope this article was useful for any WSO2 product user.</description><link>http://shazninazeer.blogspot.com/2014/10/adding-new-permissions-to-permission.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-2682486118793230465</guid><pubDate>Fri, 17 Oct 2014 11:53:00 +0000</pubDate><atom:updated>2014-10-20T04:15:22.811-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">email</category><category domain="http://www.blogger.com/atom/ns#">Python</category><category domain="http://www.blogger.com/atom/ns#">smtplib</category><title>Sending email from a gmail account using python</title><description>In this guide I&#39;ll walk you through the python commands that you can use to send an email to someone from your gmail account. If you don&#39;t have python set it up in your environment look &lt;a href=&quot;http://shazninazeer.blogspot.com/2013/10/installing-developer-tools-in-linux.html&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;here&lt;/span&gt;&lt;/a&gt; for detail. Enter the commands step by step.&lt;br /&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;[shazni@shazniInWSO2 bin]$ python
Python 2.7.5 (default, Jun 25 2014, 10:19:55)
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&amp;gt;&amp;gt;&amp;gt; fromAddress=&quot;aaaaaaaaaaaa@gmail.com&quot;
&amp;gt;&amp;gt;&amp;gt; toAddress=&quot;bbbbbbbbbbbb@yahoo.com&quot;
&amp;gt;&amp;gt;&amp;gt; msg=&quot;Subject: Hello\n\nHi!! How are you&quot;
&amp;gt;&amp;gt;&amp;gt; import smtplib
&amp;gt;&amp;gt;&amp;gt; server=smtplib.SMTP(&quot;smtp.gmail.com&quot;, 587)
&amp;gt;&amp;gt;&amp;gt; server.starttls()
(220, &#39;2.0.0 Ready to start TLS&#39;)
&amp;gt;&amp;gt;&amp;gt; password=&quot;xxxxxxxxxxxxxx&quot;
&amp;gt;&amp;gt;&amp;gt; server.login(fromAddress, password)
(235, &#39;2.7.0 Accepted&#39;)
&amp;gt;&amp;gt;&amp;gt; server.sendmail(fromAddress, toAddress, msg)
{}
&lt;/pre&gt;
Replace &#39;aaaaaaaaaaaa&#39;, &#39;bbbbbbbbbbbb&#39; and &#39;xxxxxxxxxxxxxx&#39; accordingly.&lt;br /&gt;
&lt;br /&gt;
You can easily put this into a python script and invoke it and send a quick email to someone from the command line without ever opening your email account in a browser. Following is a sample script which does the same as above.&lt;br /&gt;
&lt;pre class=&quot;brush: python&quot;&gt;#!/usr/bin/python

import smtplib
import getpass

fromAddress = raw_input(&quot;Enter your gmail address: &quot;)
toAddress = raw_input(&quot;Enter the recipients email address: &quot;)
subject = raw_input(&#39;Enter the subject of email: &#39;)
bodyText = raw_input(&#39;Enter the body text: &#39;)

msg = &quot;Subject: &quot; + subject + &quot;\n\n&quot; + bodyText

#msg=&quot;Subject: Hello\n\nHi!! How are you&quot;

server=smtplib.SMTP(&quot;smtp.gmail.com&quot;, 587)
server.starttls()

password = getpass.getpass(&#39;Gmail Password: &#39;)
server.login(fromAddress, password)
server.sendmail(fromAddress, toAddress, msg)
&lt;/pre&gt;
A sample run of the script is shown below.&lt;br /&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;[shazni@shazniInWSO2 Python]$ python sendEmail.py
Enter your gmail address: mshazninazeer@gmail.com
Enter the recipients email address: mshazninazeer@yahoo.com   
Enter the subject of email: Hello
Enter the body text: This is a sample text sent to you by python!!!
Gmail Password:
[shazni@shazniInWSO2 Python]$
&lt;/pre&gt;
Enjoy using python script to send emails</description><link>http://shazninazeer.blogspot.com/2014/10/sending-email-from-gmail-account-using.html</link><author>noreply@blogger.com (Shazni)</author><thr:total>22</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-7268106754424128295</guid><pubDate>Sat, 11 Oct 2014 05:11:00 +0000</pubDate><atom:updated>2014-10-12T21:44:30.452-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">IS</category><category domain="http://www.blogger.com/atom/ns#">WSO2</category><category domain="http://www.blogger.com/atom/ns#">WSO2 Identity Server</category><title>Downloading and running WSO2 Identity Server</title><description>WSO2 Identity Server (IS) provide means for security and identity management for your web applications, services and API&#39;s. In it&#39;s latest version (5.0.0) it acts like an Enterprise Identity Bus (an idea of centrally managing the identity regardless of the standards being used). It&#39;s a versatile product to manage you application users security, entitle management and many more. See more information about the WSO2 identity server at http://wso2.com/products/identity-server/&lt;br /&gt;
&lt;br /&gt;
How to run WSO2 IS&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Download WSO2 IS from above URL itself.&lt;/li&gt;
&lt;li&gt;Extract the zip archive into a directory. Say the extracted dircetory is IS_HOME&lt;/li&gt;
&lt;li&gt;Navigate to the IS_HOME/bin in the console (terminal)&lt;/li&gt;
&lt;li&gt;Enter the following command&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;$ ./wso2server.sh                       in Linux
or
$ ./wso2server.bat                 in Windows&lt;/pre&gt;
Once started you can access the management console by navigating the following URL&lt;br /&gt;
&lt;br /&gt;
http://localhost:9443/carbon&lt;br /&gt;
&lt;br /&gt;
You may login with default username (admin) and password (admin). When logged in you would see the management console as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEGZIL-DV1ZC3LMdQcwr8uDKO7b-VBNSL_ifprIORBRtApyWgL76lv8mxGf6gr2xFB58v0sH6FS1Z3yVIP4r-608snmigylNfUVcah89V1Hw_A2ICvhBtwKtU_eakQ32TGvg2hTBTpZjEX/s1600/Screenshot+from+2014-10-10+15:01:35.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEGZIL-DV1ZC3LMdQcwr8uDKO7b-VBNSL_ifprIORBRtApyWgL76lv8mxGf6gr2xFB58v0sH6FS1Z3yVIP4r-608snmigylNfUVcah89V1Hw_A2ICvhBtwKtU_eakQ32TGvg2hTBTpZjEX/s1600/Screenshot+from+2014-10-10+15:01:35.png&quot; height=&quot;158&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</description><link>http://shazninazeer.blogspot.com/2014/10/downloading-and-running-wso2-identity.html</link><author>noreply@blogger.com (Shazni)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEGZIL-DV1ZC3LMdQcwr8uDKO7b-VBNSL_ifprIORBRtApyWgL76lv8mxGf6gr2xFB58v0sH6FS1Z3yVIP4r-608snmigylNfUVcah89V1Hw_A2ICvhBtwKtU_eakQ32TGvg2hTBTpZjEX/s72-c/Screenshot+from+2014-10-10+15:01:35.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7593231870645654249.post-6597100679786610146</guid><pubDate>Tue, 16 Sep 2014 11:28:00 +0000</pubDate><atom:updated>2014-09-16T23:59:07.956-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Accounting</category><category domain="http://www.blogger.com/atom/ns#">Bills</category><category domain="http://www.blogger.com/atom/ns#">Client Server</category><category domain="http://www.blogger.com/atom/ns#">Point of Sale</category><category domain="http://www.blogger.com/atom/ns#">POS</category><category domain="http://www.blogger.com/atom/ns#">Python</category><category domain="http://www.blogger.com/atom/ns#">Sale Software</category><category domain="http://www.blogger.com/atom/ns#">Software</category><title>StoreKeeper 1.0.0 Released</title><description>In the current world, lot of things are being sold and bought. The items sold are of various types; be it a consumer good, a service rendered to a client, the providers (sellers) need to keep track of details of their accounting. They, most often also need to provide a bill to the customer. Traditionally, this was a manual process. The provider writes a manual bill and write down the total price with all the items sold with details of quantity, unit price, name etc. In the end of the day he&#39;ll calculate his revenue. And also he keeps an eye on the available items to get more items to sell when the items run out of the stock.&lt;br /&gt;
&lt;br /&gt;
What if there is a multipurpose point of sale software, which could do all of the above things in a snap of a time? In the modern world, time is valuable and efficiency in trading to serve more customers is vital for a successful business. Point of sale software are just created for that.&lt;br /&gt;
&lt;br /&gt;
StoreKeeper is a software tool which you can use at the point of sale to add things to transactions and in the end print a bill on a printer (usually using a dot matrix printer). StoreKeeper just makes this process extremely streamlined and is very easy to use. It&#39;s a light weight, portable software, which needs a bare minimum of system requirements.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Currently following features are supported.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Add an item&lt;/li&gt;
&lt;li&gt;Update an item&lt;/li&gt;
&lt;li&gt;Query an item or all items to view&lt;/li&gt;
&lt;li&gt;Add users&lt;/li&gt;
&lt;li&gt;Update a user&lt;/li&gt;
&lt;li&gt;Query users&lt;/li&gt;
&lt;li&gt;Add items to transaction&lt;/li&gt;
&lt;li&gt;Delete item from transaction&lt;/li&gt;
&lt;li&gt;Cancel the transaction&lt;/li&gt;
&lt;li&gt;End a transaction&lt;/li&gt;
&lt;li&gt;Print a bill (with a configured printer) together with a pdf copy in the computer&lt;/li&gt;
&lt;li&gt;Get the total sales on a day&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;Features to be added in the future&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Query current days transactions&lt;/li&gt;
&lt;li&gt;Query current days transaction on a given item/service&lt;/li&gt;
&lt;li&gt;View the history of an item sale&lt;/li&gt;
&lt;li&gt;View the history of total sales&lt;/li&gt;
&lt;li&gt;Notification of different events via email&lt;/li&gt;
&lt;li&gt;Graphs to view the stats&lt;/li&gt;
&lt;li&gt;Different access to different users with different credentials&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Following is a screenshot of the StoreKeeper taken from a Linux desktop. It&#39;s currently tested to be working in both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwaDlidaGoNm47BGkgJFEOsak_8hSrRPo1C_Vz5ihneh41JIGJCRXVwe2rViNlioXE4qSaNRmj1e4NHZQni43UYHax4OsZvfeIR27sLGuUHUW2s5Ez5CgAljeBKFXjTTq1uaBa1VJDuSWj/s1600/StoreScreenShot.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwaDlidaGoNm47BGkgJFEOsak_8hSrRPo1C_Vz5ihneh41JIGJCRXVwe2rViNlioXE4qSaNRmj1e4NHZQni43UYHax4OsZvfeIR27sLGuUHUW2s5Ez5CgAljeBKFXjTTq1uaBa1VJDuSWj/s1600/StoreScreenShot.png&quot; height=&quot;180&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
To give you a small technical idea of StoreKeeper, it&#39;s a classic client server application. The server serves request from a Graphical front end GUI client. This means, the StoreKeeper would support multiple clients to use the Software at the same time (This scenario is not yet completely tested).&lt;br /&gt;
&lt;br /&gt;
Following is a sample bill (Sorry for hiding few information) printed using a dot matrix printer.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirO6wLVBDcgJQvggDEBL1VA5LfFE3V1LhLIhH-RFntWQjjppcr0_0iMI1szEAozl2sQMEKSFmri_Tocyc4JAaCSvvK7kj6OkN0mbWGL1pZbz-d2GZ82s4roBR0eItuy1F0Vr2x5PdTMH06/s1600/Bill+(copy).jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirO6wLVBDcgJQvggDEBL1VA5LfFE3V1LhLIhH-RFntWQjjppcr0_0iMI1szEAozl2sQMEKSFmri_Tocyc4JAaCSvvK7kj6OkN0mbWGL1pZbz-d2GZ82s4roBR0eItuy1F0Vr2x5PdTMH06/s1600/Bill+(copy).jpg&quot; height=&quot;217&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Like our facebook page for StoreKeeper &lt;a href=&quot;https://www.facebook.com/StoreKeeperService&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;https://www.facebook.com/StoreKeeperService&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Please feel free to contact us if you wish to purchase this product or if you need to provide your feedback to us via our facebook page&amp;nbsp;&lt;a href=&quot;https://www.facebook.com/StoreKeeperService&quot;&gt;&lt;span style=&quot;color: #6fa8dc;&quot;&gt;https://www.facebook.com/StoreKeeperService&lt;/span&gt;&lt;/a&gt;.</description><link>http://shazninazeer.blogspot.com/2014/09/storekeeper-100-released.html</link><author>noreply@blogger.com (Shazni)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwaDlidaGoNm47BGkgJFEOsak_8hSrRPo1C_Vz5ihneh41JIGJCRXVwe2rViNlioXE4qSaNRmj1e4NHZQni43UYHax4OsZvfeIR27sLGuUHUW2s5Ez5CgAljeBKFXjTTq1uaBa1VJDuSWj/s72-c/StoreScreenShot.png" height="72" width="72"/><thr:total>0</thr:total></item></channel></rss>