<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>TechD of Computer World</title><description>TechD is a Technical blog to help everyone. You can find help related to Liferay, HTML, PHP, Java, Javascript over here.</description><managingEditor>noreply@blogger.com (۩ Ravi Kumar Gupta  ~A.K.A~ "D'Maverick" ۩)</managingEditor><pubDate>Tue, 17 Jun 2025 19:01:03 +0530</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">128</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>http://techdc.blogspot.com/</link><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle>TechD is a Technical blog to help everyone. You can find help related to Liferay, HTML, PHP, Java, Javascript over here.</itunes:subtitle><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><title>New Book - Building Scalable Web Apps with Node.js and Express</title><link>http://techdc.blogspot.com/2024/10/new-book-building-scalable-web-apps.html</link><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Sun, 20 Oct 2024 11:59:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-2268570842830528213</guid><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&#128640; I’m excited to announce the launch of my new book, &lt;b&gt;Building Scalable Web Apps with Node.js and Express&lt;/b&gt;, now available on &lt;a href="https://www.amazon.in/Building-Scalable-Apps-Node-js-Express/dp/8197223815/ref=sr_1_1?crid=3RM38F6MYEPCT" rel="noopener" target="_new"&gt;&lt;span&gt;Amazon&lt;/span&gt;&lt;span&gt; India&lt;/span&gt;&lt;/a&gt;!&lt;/p&gt;&lt;p&gt;&lt;img alt="https://m.media-amazon.com/images/S/aplus-media-library-service-media/13a77388-6cad-4282-bfaf-9a141720c45c.__CR0,0,970,600_PT0_SX970_V1___.jpg" height="317" src="https://m.media-amazon.com/images/S/aplus-media-library-service-media/13a77388-6cad-4282-bfaf-9a141720c45c.__CR0,0,970,600_PT0_SX970_V1___.jpg" width="513" /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Co-authored with &lt;b&gt;Yamini Panchal&lt;/b&gt;, this book is designed for developers, architects, and tech enthusiasts who want to master the craft of building fast, efficient, and scalable web applications using Node.js and Express.&lt;/p&gt;&lt;h2&gt;&#128216; What You'll Learn:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Architectural Best Practices&lt;/b&gt;: Dive deep into the design of scalable systems with real-world examples and practical insights.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Efficient Coding with Express&lt;/b&gt;: Discover how to leverage Express for creating robust, maintainable applications.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Advanced Topics&lt;/b&gt;: Covering everything from load balancing and distributed systems to caching and microservices.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Hands-on Projects&lt;/b&gt;: Build practical, hands-on projects that reinforce each concept as you progress through the book.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Whether you’re just starting out or looking to advance your skills, this book offers something for everyone on the journey to mastering scalable web development.&lt;/p&gt;&lt;p&gt;&#127919; Grab your copy today and start building scalable web apps with ease!&lt;/p&gt;&lt;p&gt;&#128073; &lt;a href="https://www.amazon.in/Building-Scalable-Apps-Node-js-Express/dp/8197223815/ref=sr_1_1?crid=3RM38F6MYEPCT" rel="noopener" target="_new"&gt;&lt;span&gt;Order&lt;/span&gt;&lt;span&gt; Now&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;#Nodejs #Express #WebDevelopment #ScalableApps #TechBooks&lt;/p&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] Multiple Service Builders in one Liferay Project</title><link>http://techdc.blogspot.com/2016/09/liferay-multiple-service-builders-in.html</link><category>liferay</category><category>multiple service.xml</category><category>service.xml</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 21 Sep 2016 11:52:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7234844506642328462</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
While working on liferay projects and portlets, sometimes we have a huge amount of service entities and we can logically group them and divide into multiple files and then import into main service.xml file.&lt;br /&gt;
&lt;br /&gt;
Lets take an example of a company intranet where several modules are to be designed to support employee information, leaves, timesheet, projects, performance evaluations, trainings, meeting room booking etc. Our main service.xml will look like&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/574e7a072bcc520291e976dcfdf50e92.js"&gt;&lt;/script&gt;

This service.xml file can include any number of entities just like we add in usual way. For specific modules, we have imported children xxx-service.xml files.&lt;br /&gt;
&lt;br /&gt;
The name of the files need not to be in xxx-service.xml, it can be anything that suits you.&lt;br /&gt;
&lt;br /&gt;
The child xml files will contain entities related to a specific module. For example leave management system related service lms-service.xml will be like -&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/6cc3ceddc1e6d47a4606d588195e65ce.js"&gt;&lt;/script&gt;

Our performance management system related service pms-service.xml will be like -&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/cb011e7f941837dbbeba2a457b2ca21e.js"&gt;&lt;/script&gt;

Hope this helps you to manage your long entities into smaller xml files and set you up with a short, readable, and organized service.xml. :)&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[ELK] An introduction to ELK Stack - Elasticsearch, Logstash, Kibana </title><link>http://techdc.blogspot.com/2016/01/elk-introduction-to-elk-stack.html</link><category>elasticsearch</category><category>elk</category><category>elk stack</category><category>kibana</category><category>logstash</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Sun, 24 Jan 2016 00:55:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-2545573034051059575</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
... I had more than 5 servers continuously running on my computer when I was in college. My interest in PHP led me to install Apache, MySQL, and a mail server so that I could host multiple sites from my machine. Apart from these there were ftp, vnc etc. Whenever there was a problem with a server, I would go and check logs of that server. Even till 2 years back, I used to do same for other servers also. This time the list added app servers for Liferay.&lt;br /&gt;
&lt;br /&gt;
I used to check logs for each servers individually, until I got to know about Splunk, a tool which my client was using to see all of the logs at one place. It was providing way more than just view, I could search logs for a defined time range etc. It was not collecting logs from just one server machine but almost 20 machines and for few machines, multiple servers. Troubleshooting was easy this way. I was not logging in to 20 different machines to check logs and look for possible problems. Honestly, I had no access to most of them. But I had access to Splunk, and I could query logs already indexed and could diagnose which server had problems.&lt;br /&gt;
&lt;br /&gt;
But, Splunk (full features) is not free.&lt;br /&gt;
&lt;br /&gt;
Then, what are the other options. Let me give you a hint in the image below..&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuXsJrJQXrh5XuvywTduS5o3AU0BFS35rewDL5NaePusPdPvkNIR-76m-_solPIksaHnMxYWujUg4Kp_G__NhP1miyxktw80beO9-oNQSWZxSELUFpSozq2E6Q_u9vTUp3lURjpHzmEWk/s1600/splunk-vs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="402" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuXsJrJQXrh5XuvywTduS5o3AU0BFS35rewDL5NaePusPdPvkNIR-76m-_solPIksaHnMxYWujUg4Kp_G__NhP1miyxktw80beO9-oNQSWZxSELUFpSozq2E6Q_u9vTUp3lURjpHzmEWk/s640/splunk-vs.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Google (GOD) gave a hint : Look at ELK, once!&lt;br /&gt;
&lt;br /&gt;
Out of curiosity, I just jumped to knowing ELK Stack rather than checking any search results. Instant, Google said once. :P&lt;br /&gt;
&lt;br /&gt;
ELK = Elasticsearch, Logstash, Kibana.&lt;br /&gt;
&lt;br /&gt;
Below image would tell you how this stack works.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwE5bEGRR6bRZOnVawV15YOxk7wfZYV2Yunc_zrOeVcPnxmYP4xVx_5a0bRpbDbe224P6H38JOgFykZMB_wBylF0vVr1I_w00cTQolZXvsW36NmiAmvdHiza8m7ckY1sBV2l272zOBiis/s1600/elk-basics.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwE5bEGRR6bRZOnVawV15YOxk7wfZYV2Yunc_zrOeVcPnxmYP4xVx_5a0bRpbDbe224P6H38JOgFykZMB_wBylF0vVr1I_w00cTQolZXvsW36NmiAmvdHiza8m7ckY1sBV2l272zOBiis/s640/elk-basics.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&amp;nbsp;The above is a very very simplified representation of ELK stack.&lt;br /&gt;
&lt;br /&gt;
Elasticsearch - Indexes the data sent to it. The core of elasticsearch is lucene.&lt;br /&gt;
&lt;br /&gt;
Logstash - Its a data pipeline which can read data from a number of sources. There are more than 200 plugins available for logstash classified in four categories - Input, Output, Filter, Codec plugins.&lt;br /&gt;
&lt;br /&gt;
Kibana - Whatever elasticsearch has indexed, Kibana gives opportunity to visualize that data in different forms. The data can be queried, be listed, be drawn as charts.&lt;br /&gt;
&lt;br /&gt;
This was just a very basic introduction to these components. These components offer a lot more than just these. We will get to learn more about these components in future posts.&lt;br /&gt;
&lt;br /&gt;
Until next time :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuXsJrJQXrh5XuvywTduS5o3AU0BFS35rewDL5NaePusPdPvkNIR-76m-_solPIksaHnMxYWujUg4Kp_G__NhP1miyxktw80beO9-oNQSWZxSELUFpSozq2E6Q_u9vTUp3lURjpHzmEWk/s72-c/splunk-vs.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[ELK] Reading, Indexing and Visualizing Windows logs with ELK Stack</title><link>http://techdc.blogspot.com/2016/01/elk-reading-indexing-and-visualizing.html</link><category>elasticsearch</category><category>elk</category><category>elk stack</category><category>indexer</category><category>indexing</category><category>kibana</category><category>logstash</category><category>windows events</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Sat, 23 Jan 2016 17:49:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-6477371068329273415</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hello Friends,&lt;br /&gt;
&lt;br /&gt;
A system administrator knows how much system logs can help to troubleshoot critical problems. And what if those logs are indexed at one place and can be visualized in charts etc. Fun, isn't it?&lt;br /&gt;
&lt;br /&gt;
Let's see what can help us to set it up..&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp;Nothing special to be done at Elasticsearch just run it by executing &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;elasticsearch.bat&lt;/span&gt; from bin directory.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/4f6dd3faa3dd142380cdb2cc4d8c9c8f.js"&gt;&lt;/script&gt;

2. Prepare a config so that Logstash can read windows logs. We need to add config in &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;input&lt;/span&gt; plugin.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/f835c02c0f1ef31ef40b1126f27d1f34.js"&gt;&lt;/script&gt;

This eventlog plugin helps logstash to read windows logs. Windows logs are stored in binary format and can be accessed using only Win32 API. This plugin takes several configuration options but all of those are optional. These config options are &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;codec&lt;/span&gt;, &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;add_field&lt;/span&gt;, &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;logfile&lt;/span&gt;, &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;interval&lt;/span&gt;, &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;tags&lt;/span&gt;, &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;type&lt;/span&gt; out of which we are using &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;logfile&lt;/span&gt; and &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;type&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
a) &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;type&lt;/span&gt; has no default value and used for filter activation. The given type is stored as part of event and we can search events in Kibana using this.&lt;br /&gt;
b) &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;logfile&lt;/span&gt; is an array of String and contains Application, Security, System as default values in array. In the config we have used only System.&lt;br /&gt;
&lt;br /&gt;
3. Store this config to a custom file in &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;conf&lt;/span&gt; in Logstash with name&amp;nbsp;&lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;logstash-windowslogs.conf&lt;/span&gt;&lt;br /&gt;
and run logstash using&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/fff255b3c452dd7ad8c4dd2263cbb766.js"&gt;&lt;/script&gt;

where complete config file will be as -&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/53cb45a004b226a22ec10b793e010329.js"&gt;&lt;/script&gt;

4. We're done with configuration of Logstash. Next is to read this in kibana. Here is our config to connect Kibana to Elasticsearch to read indices.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/fe4f6d604cb824a3f81c1b3601461581.js"&gt;&lt;/script&gt;

&lt;br /&gt;
5. As soon as we start Logstash, it will start collecting all the events and index them to elasticsearch. Now lets run Kibana by executing &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;kibana.bat&lt;/span&gt; in bin directory.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/9ed11e89ed37f93bce5f2d0ccb4561f1.js"&gt;&lt;/script&gt;

6. Once Kibana is started, we can open its interface in browser using&amp;nbsp;&lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;http://localhost:5601/&lt;/span&gt;. We need to configure index pattern. By default, it shows &lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;logstash-*&lt;/span&gt; in index name or pattern field and&amp;nbsp;&lt;span style="font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;"&gt;@timestamp&lt;/span&gt; in Time-Field name. Hit create by keeping defaults.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUlkZREp6_ZBaDpsVxfGNbTZbkDKrTPQjcVO1obMgLkyecXRqz1SB9atpEhs816SfIUR6TcE1-4iui56btcKeBBhU5TzXSgq3CHPzAXiIn98C7oSQJANZupWq1ktVHHrRFH7KDu1KOcyk/s1600/kibana-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="334" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUlkZREp6_ZBaDpsVxfGNbTZbkDKrTPQjcVO1obMgLkyecXRqz1SB9atpEhs816SfIUR6TcE1-4iui56btcKeBBhU5TzXSgq3CHPzAXiIn98C7oSQJANZupWq1ktVHHrRFH7KDu1KOcyk/s640/kibana-1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
7. Now click Discover on the top menu to see the results. It will show histogram of counts of event.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsXg0wrkt4oEVQg2q8XQ8Tz-nWBobWpsjbE5YQ_xehvBAPjQEkV4KMyE0qoi6CcXesmhKj8CsA8dr5hiYut0AOcokBpDEPafIc-two5uhtXt1K5S8nUxf33c6i3rxOywcqIVIWPOBtZ4k/s1600/kibana-dashboard.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsXg0wrkt4oEVQg2q8XQ8Tz-nWBobWpsjbE5YQ_xehvBAPjQEkV4KMyE0qoi6CcXesmhKj8CsA8dr5hiYut0AOcokBpDEPafIc-two5uhtXt1K5S8nUxf33c6i3rxOywcqIVIWPOBtZ4k/s640/kibana-dashboard.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
All the results are also listed below histogram but for security reasons, I have not shown them here..&lt;br /&gt;
&lt;br /&gt;
That's it. Pretty clean, what you say?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUlkZREp6_ZBaDpsVxfGNbTZbkDKrTPQjcVO1obMgLkyecXRqz1SB9atpEhs816SfIUR6TcE1-4iui56btcKeBBhU5TzXSgq3CHPzAXiIn98C7oSQJANZupWq1ktVHHrRFH7KDu1KOcyk/s72-c/kibana-1.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Forms] Detect enter key pressed using javascript/JQuery</title><link>http://techdc.blogspot.com/2015/07/forms-detect-enter-key-pressed-using.html</link><category>detect</category><category>enter key</category><category>form</category><category>jquery</category><category>search</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Thu, 30 Jul 2015 12:02:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-4555861078308932043</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
Sometimes, we need to detect when&amp;nbsp;&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;Enter&amp;nbsp;&lt;/span&gt;&lt;/b&gt;key was pressed or some other key as per the requirement. I had a use&amp;nbsp;case where I had a search box and it was not a form. User could put some content in search input text box and when user hits&amp;nbsp;&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;Enter&lt;/span&gt;&lt;/b&gt;, it should fetch data using ajax call. The code below detects when &lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;Enter&amp;nbsp;&lt;/span&gt;&lt;/b&gt;key&amp;nbsp;was&amp;nbsp;pressed.&lt;br /&gt;
&lt;br /&gt;
We will add a keypress handler to the document which will capture all events whenever a key is pressed. We need to check which one is&amp;nbsp;&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;Enter&lt;/span&gt;&lt;/b&gt;. The code for &lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;Enter &lt;/span&gt;&lt;/b&gt;is 13.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/1f4f2428b8c9853ad3bd.js"&gt;&lt;/script&gt;
&lt;br /&gt;
We also need to check if the focus was actually the&amp;nbsp;search&amp;nbsp;input text.&lt;br /&gt;
&lt;br /&gt;
That's all what we need.&lt;br /&gt;
&lt;br /&gt;
Until next time :)&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Apache] Creating virtual hosts with Apache Httpd web server.</title><link>http://techdc.blogspot.com/2015/07/apache-creating-virtual-hosts-with.html</link><category>apache</category><category>domians</category><category>httpd.conf</category><category>multiple domains.</category><category>vhost</category><category>virtual host</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Fri, 3 Jul 2015 12:51:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-4366057498835319725</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Its common to see multiple project running on one machine. Sometimes, it looks great if every web application runs with its own domain name. I usually keep my hostname as rkg.test, and for projects xxxx.proj. If I have multiple projects lets say blog, forum etc. so I can keep them as blog.proj, forum.proj etc. Neat, isn't it.&lt;br /&gt;
&lt;br /&gt;
Here are simple steps to make it work.&lt;br /&gt;
1. Open your &lt;b&gt;hosts&lt;/b&gt; file - in&amp;nbsp;&lt;b&gt;C:\Windows\System32\drivers\etc\hosts&lt;/b&gt; and add your domain to it. Add the lines at the end of file like this.&lt;br /&gt;
&lt;span style="background-color: white; color: orange; font-family: Courier New, Courier, monospace;"&gt;127.0.0.1&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;blog.proj&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; color: orange; font-family: Courier New, Courier, monospace;"&gt;127.0.0.1&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;forum.proj&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
2. Make sure &lt;b&gt;httpd.conf&lt;/b&gt; file has virtual hosting enabled. Either add virtual hosts in the same httpd.conf file or put them in a different file and use that. Lets keep them separate in another file and keep this line in httpd.conf&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;Include conf/extra/httpd-vhosts.conf&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
3. If already not present, create a folder in conf/ named extra and create a &lt;b&gt;httpd-vhosts.conf&lt;/b&gt; file.&lt;br /&gt;
&lt;br /&gt;
4. Add a line for enabling&amp;nbsp;&lt;span style="background-color: #f3f3f3; color: orange; font-family: Courier New, Courier, monospace;"&gt;NameVirtualHost&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;NameVirtualHost *:80&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
5. &amp;nbsp;Add a virtual host by adding these lines in httpd-vhosts.conf file&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; ServerAdmin webmaster@blog.proj&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; DocumentRoot "D:/pFiles/xampp/htdocs/blog.proj"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; ServerName blog.proj&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; ErrorLog "logs/blog.proj-error.log"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; CustomLog "logs/blog.proj.log" common&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;/VirtualHost&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
6. Similarly add one more for forum.proj&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; ServerAdmin webmaster@forum.proj&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; DocumentRoot "D:/pFiles/xampp/htdocs/forum.proj"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; ServerName forum.proj&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; ErrorLog "logs/forum.proj-error.log"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; CustomLog "logs/forum.proj.log" common&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;/VirtualHost&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
7. Restart your apache. And open blog.proj and forum.proj in your browser.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Simple enough. Isn't it?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Until next time, C ya. Enjoy.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Tomcat][Debug] Start tomcat in debug mode and remote debug java code in eclipse</title><link>http://techdc.blogspot.com/2015/07/tomcatdebug-start-tomcat-in-debug-mode.html</link><category>debug</category><category>eclipse</category><category>liferay</category><category>tomcat</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Thu, 2 Jul 2015 12:46:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-3358618347452708235</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
More often, we need to debug our applications irrespective of the programming language. I need to debug liferay portlets, hooks etc for troubleshooting issues.&lt;br /&gt;
&lt;br /&gt;
Lets see how we can start our tomcat in debug mode and debug with eclipse. Follow the simple steps.&lt;br /&gt;
&lt;br /&gt;
1. Open catalina.bat in tomcat/bin folder.&lt;br /&gt;
&lt;br /&gt;
2. Search for the line starting with&amp;nbsp;&lt;span style="background-color: #f3f3f3; color: orange; font-family: Courier New, Courier, monospace;"&gt;set DEBUG_OPTS=&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
3. Replace the line with&lt;br /&gt;
&lt;span style="background-color: #f3f3f3; color: orange; font-family: Courier New, Courier, monospace;"&gt;set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
4. Port number given here is 1044, you can choose any port as per the availability.&lt;br /&gt;
&lt;br /&gt;
5. Now start your tomcat by running catalina.bat. Tomcat logs should print this line at the start&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;Listening for transport dt_socket at address: 1044&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
6. In the eclipse, you can do remote debugging, Go to Run &amp;gt; Debug Configurations, under Remote Java Application, create a new node and make sure to change port number for debugging.&lt;br /&gt;
&lt;br /&gt;
All done. Your application is ready for debugging.&lt;br /&gt;
&lt;br /&gt;
Until next time, C ya.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>[Liferay][JSTL] Adding JSTL support for liferay portlet.</title><link>http://techdc.blogspot.com/2015/07/liferayjstl-adding-jstl-support-for.html</link><category>jstl</category><category>liferay</category><category>portlet</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 1 Jul 2015 12:20:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7851776487739259537</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
It a good practice to use JSTL for your portlets jsp rather than using scriptlets. This blog will show how to add support of jstl for your portlets. Follow these simple steps -&lt;br /&gt;
&lt;br /&gt;
1. Add portal-dependency jars to lifeary-plugin-package.properties file&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;portal-dependency-jars=\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; jstl-api.jar,\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; jstl-impl.jar,\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
2. Add portal-dependency tlds to liferay-plugin-package.properties file.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;portal-dependency-tlds=\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; liferay-portlet_2_0.tld,\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; liferay-ui.tld,\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; fn.tld,\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; c.tld,\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; fmt.tld&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
3. In the JSP add taglibs.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
4. And now you can use &lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;c:xx /&amp;gt;&lt;/span&gt;&lt;/span&gt;, &lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;fn:xx/&amp;gt;&lt;/span&gt;&lt;/span&gt; and &lt;span style="background-color: #f3f3f3;"&gt;&lt;span style="color: orange; font-family: Courier New, Courier, monospace;"&gt;&amp;lt;fmt:xx&amp;gt;&lt;/span&gt;&lt;/span&gt; and similarly other taglibs.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;
Until next time. C Ya&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[PHP] PHP not working | Code not being executed by apache.</title><link>http://techdc.blogspot.com/2015/07/php-php-not-working-code-not-being.html</link><category>addtype</category><category>apache</category><category>load module</category><category>php</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 1 Jul 2015 12:01:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7321520977975787789</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
I had this problem yet to be resolved. I tried easyphp, zpanel but php did not work for me. I could see my php code in page source in browser. My apache was actually not executing php code as php, rather it was taking as simple html.&lt;br /&gt;
&lt;br /&gt;
To solve this problem, follow the steps below.&lt;br /&gt;
1. Check if php is really installed and available. Open command prompt anywhere and execute &lt;span style="background-color: #f3f3f3; font-family: Courier New, Courier, monospace;"&gt;php -version&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This should return something like this.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd7BBZFrOpHEMm2vRovZrdgzCafEMM001dhMZgY5PNRASXPnRBg4gOmrzOnJR9UNo0LKR9reYLnPP597Emyzb1Oc3fjhgZ_5pYC27lCwXj2xvWStFCTmsowzW2hhWIA41LWfm01vW1pzA/s1600/php-version-cmd.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd7BBZFrOpHEMm2vRovZrdgzCafEMM001dhMZgY5PNRASXPnRBg4gOmrzOnJR9UNo0LKR9reYLnPP597Emyzb1Oc3fjhgZ_5pYC27lCwXj2xvWStFCTmsowzW2hhWIA41LWfm01vW1pzA/s1600/php-version-cmd.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
If you're unable to see, add php to path.&lt;br /&gt;
&lt;br /&gt;
2. Check if php module is added in httpd.conf of your apache. Something like this should be present&lt;br /&gt;
&lt;span style="background-color: #f3f3f3; font-family: Courier New, Courier, monospace;"&gt;LoadModule php5_module "C:/zpanel/bin/php/php5apache2_4.dll"&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: #f3f3f3; font-family: Courier New, Courier, monospace;"&gt;PHPIniDir "c:/zpanel/bin/php"&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
3. Check if AddType is added and uncommented in httpd.conf. If this is not present, add it.&lt;br /&gt;
&lt;span style="background-color: #f3f3f3; font-family: Courier New, Courier, monospace;"&gt;AddType application/x-httpd-php .php&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Apart from these, just check the file extension, it should not .php and not accidently saved as .php.txt. And if you're using short tags &amp;lt;? then short tags should be allowed. &lt;a href="http://techdc.blogspot.in/2013/04/how-to-enable-php-short-tags-with.html" target="_blank"&gt;To allow php short tags follow this post&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;
Until next time. C ya.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd7BBZFrOpHEMm2vRovZrdgzCafEMM001dhMZgY5PNRASXPnRBg4gOmrzOnJR9UNo0LKR9reYLnPP597Emyzb1Oc3fjhgZ_5pYC27lCwXj2xvWStFCTmsowzW2hhWIA41LWfm01vW1pzA/s72-c/php-version-cmd.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[MySql] Importing Data to Mysql From SQL file</title><link>http://techdc.blogspot.com/2015/06/mysql-importing-data-to-mysql-from-sql.html</link><category>database</category><category>import</category><category>mysql</category><category>sql</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Tue, 2 Jun 2015 12:53:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-2467648474078199528</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
Its very often that we need to import data to mysql. Sometimes we have database already created, sometimes does not.&lt;br /&gt;
&lt;br /&gt;
Below is the syntax to import data. When we do have a database already created and want to use that.&lt;br /&gt;
mysql -u ravi -p mydatabasename &amp;lt; databasefile.sql&lt;br /&gt;
&lt;br /&gt;
This will prompt for password and import data to mydatabasename.&lt;br /&gt;
&lt;br /&gt;
When we do not have a database already but create database command is written in the file and the same database is used.&lt;br /&gt;
mysql -u ravi -p &amp;lt; databasefile.sql&lt;br /&gt;
&lt;br /&gt;
This will also prompt for password because we used -p option which is for password. For username we used -u. Remember that if we want to create a database then user should have appropriate permissions.&lt;br /&gt;
&lt;br /&gt;
That's it.&lt;br /&gt;
&lt;br /&gt;
Hope this helps someone.&amp;nbsp;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] Writing Custom Sql for multiple tables in Liferay</title><link>http://techdc.blogspot.com/2015/05/lifera-writing-custom-sql-for-multiple.html</link><category>custom sql</category><category>finder</category><category>query</category><category>service</category><category>service builder</category><category>sql</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 6 May 2015 14:46:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-2263265903938377507</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi Friends,&lt;br /&gt;
&lt;br /&gt;
There were a number of times you might have faced a situation when you need data from multiple tables. Sometimes you would have got the data from one service, extract some data and then call another service, extract some more data and do the processing by writing some logic. Well, this has a major impact on performance and that's not good.&lt;br /&gt;
&lt;br /&gt;
That's not good choice because you can write your own custom SQL query and get the desired result. The query we are writing, we always have a chance to optimize it and boost/improve performance. Alright, enough of the lecture.. lets get to work.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
We're going to take a very simple example of a Library system. We have an entity Book as below.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/1600ef2806251958036f.js"&gt;&lt;/script&gt;

We have another entity Author as well.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/66012b40a65effe881c0.js"&gt;&lt;/script&gt;

Now we need all the books and authors (combined) by author name and title of the book. There can be multiple authors for multiple books. Many to many relationships. Don't you worry about relationships for now, that's not our topic of concentration here.. is that? So the SQL we want is like this.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/464272c6734085d6e39f.js"&gt;&lt;/script&gt;

RKG_Book, RKG_Author are our table names generated by Liferay. For reference, complete service.xml file is as below.
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/9b728550df6e7c987737.js"&gt;&lt;/script&gt;

Now when we have required things in place, lets build-service. If you're using maven, run&lt;br /&gt;
&lt;b&gt;&lt;span style="color: orange;"&gt;mvn clean liferay:build-service&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Or if you're using plugins-sdk, run&lt;br /&gt;
&lt;span style="color: orange;"&gt;&lt;b&gt;ant clean build-service&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now when you're finished building your service, lets go step by step for writing the other classes and code required to perform custom SQL.&lt;br /&gt;
&lt;br /&gt;
Step 1. Add one more entity to your service.xml&lt;br /&gt;
&lt;span style="color: orange;"&gt;&lt;b&gt;&amp;lt;entity name="Library" local-service="true" remote-service="true"&amp;gt;&amp;lt;/entity&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This is a blank entity, this will create service classes for us but there won't be any fields, methods etc. We will use this service to provide our finder methods. After adding the entity, build service again.&lt;br /&gt;
&lt;br /&gt;
Step 2. Create a LibraryFinderImpl class in service/persistence. If you used the service xml mentioned above, the package for this class would be&amp;nbsp;me.rkg.plugins.service.persistence.&lt;br /&gt;
&lt;br /&gt;
Your class would be like this.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/76a00f8316ee18ecc0fd.js"&gt;&lt;/script&gt;

Now run build-service again. Remember if you do not have a method in finderImpl, a finder interface would not be created. A finder would be created only for entities. We created an empty entity which we are using for our custom finders.&lt;br /&gt;
&lt;br /&gt;
After the service is built, check in LibraryLocalServiceImpl,&amp;nbsp;libraryFinder variable must be present. If yes, lets move to next step.&lt;br /&gt;
&lt;br /&gt;
Step 3. Create a folder named custom-sql in src folder and create a default.xml file inside. We need to put our sql in this file and Finder will use it to get data later on. So this is how our default.xml file looks like.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/42437fb63da2c661113e.js"&gt;&lt;/script&gt;

Step 4. Update the finderImpl to implement LibraryFinder interface generated by Liferay service builder. Also add the required code to run the query. See the final finderImpl below.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/c6369eeb768075617276.js"&gt;&lt;/script&gt;

Step 5. CustomSQLUtil will get the right query by id provided. This is the same id we used in default.xml for our sql query. This is needed, because there can be multiple sql queries.&lt;br /&gt;
&lt;br /&gt;
Step 6. Now after all this, you can call the finder in your serviceImpl. See one sample method below in LibraryLocalServiceImpl to get details. Remember to use libraryFinder variable only to access finder in your service.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/3cffc222d3472932acbe.js"&gt;&lt;/script&gt;

Some Explanations:&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;We use&amp;nbsp;q.addEntity(..) method for all the entities which will participate in output after running query. In our case, firstName, lastName of author and title from book. This makes us adding both Book and Author entities in the SQLQuery. If we had more entities participating, we would have added them as well.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;We have added, % in QueryPos.add(..) methods because we need a like search on the fields. Simple SQL, right?&lt;/li&gt;
&lt;li&gt;QueryUtil.list(..) will always return the List&amp;lt;Object[]&amp;gt; or List&amp;lt;Object&amp;gt;. When we have more than one entity participating in output, we will get List&amp;lt;Object[]&amp;gt; and the Object[] array will have length exactly as the number of entities. In case there was only one entity, the List&amp;lt;Object&amp;gt; will be returned.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;We can loop through the List&amp;lt;Object[]&amp;gt; and check which object is of what type and extract the desired result. Just like we did in LocalServiceImpl.&lt;/li&gt;
&lt;/ul&gt;
Hope you enjoyed the long post.. :)&lt;br /&gt;
&lt;br /&gt;
Until next time..&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay][iPad][iPhone] Safari turns numbers into links</title><link>http://techdc.blogspot.com/2015/05/liferayipadiphone-safari-turns-numbers.html</link><category>format-detection</category><category>ipad</category><category>iphone</category><category>liferay</category><category>meta tags</category><category>portal_normal.vm</category><category>safari</category><category>telephone</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Fri, 1 May 2015 12:32:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-2858473388425332138</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
There are many calling applications which install some kind of plugin to turn numbers to links on which if you click will offer you to call. Skype's click to call is one of such application.&lt;br /&gt;
&lt;br /&gt;
Well Safari, by default does this. We did not like it. You also don't, probably that's why you're here.. Here is the solution.&lt;br /&gt;
&lt;br /&gt;
Open the theme or template or html file and add this meta tag.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;lt;meta name="format-detection" content="telephone=no"&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
This will leave all numbers as it is. Now, you may also want to show some phone numbers as link which were actually phone numbers. In this case use like this.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;lt;p&amp;gt;My phone number: &amp;lt;a href="tel:1-203-203-2020"&amp;gt;1-203-203-2020&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
This will show the phone number as link.&lt;br /&gt;
&lt;br /&gt;
In case of liferay, open your theme's portal_normal.vm file and add the meta tag as mentioned above.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] Access Liferay Services in Theme or Web Content using Velocity</title><link>http://techdc.blogspot.com/2015/04/liferay-access-liferay-services-in.html</link><category>companyid</category><category>grouplocalservice</category><category>namespace</category><category>organization</category><category>service</category><category>userlocalservice</category><category>variables</category><category>velocity</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Tue, 7 Apr 2015 17:52:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7463478923267826681</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Sometime, we need to get some data in our web contents. Well, using velocity, we can get the data we want. Create a simple structure and a template. You can assign that structure to some web content later.&lt;br /&gt;
&lt;br /&gt;
Make sure your template script is VM. The below lines of code are for reference, they should help you to get the actual requirement done.&lt;br /&gt;
&lt;br /&gt;
To get namespace of the portlet,&lt;br /&gt;
&lt;span style="color: orange;"&gt;#set ($namespace = $request.get('portlet-namespace'))&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
To get company id&lt;br /&gt;
&lt;span style="color: orange;"&gt;#set($companyId = $getterUtil.getLong($request.get("theme-display").get("company-id")))&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In the line above you also get themeDisplay which can get you many more things. We have $request object here.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To get user service we can use $serviceLocator.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style="color: orange;"&gt;#set($userLocalService = $serviceLocator.findService("com.liferay.portal.service.UserLocalService"))&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
If you're unable to get $serviceLocator check portal-ext.properties for the property below and set accordingly.&lt;br /&gt;
&lt;br /&gt;
# Set a comma delimited list of variables the Velocity engine cannot&lt;br /&gt;
# have access to. This will affect Dynamic Data List templates, Journal&lt;br /&gt;
# templates, and Portlet Display templates.&lt;br /&gt;
#&lt;br /&gt;
velocity.engine.restricted.variables=serviceLocator&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Get user from the service&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: orange;"&gt;#set($user = $userLocalService.getUserByScreenName($companyId, "kravigupta"))&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Get phone service&lt;br /&gt;
&lt;span style="color: orange;"&gt;#set($phoneLocalService = $serviceLocator.findService("com.liferay.portal.service.PhoneLocalService"))&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Get all phone numbers of user&lt;br /&gt;
&lt;span style="color: orange;"&gt;#set($userPhones = $phoneLocalService.getPhones($companyId, "com.liferay.portal.model.Contact", $user.getContact().getContactId()))&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You can even use validator&lt;br /&gt;
&lt;span style="color: orange;"&gt;#if($validator.isNull($user))&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;div&amp;gt;The user is null.&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: orange;"&gt;#end&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Iframe] X-Frame-Options : website does not permit framing </title><link>http://techdc.blogspot.com/2015/04/iframe-x-frame-options-website-does-not.html</link><category>apache</category><category>headers</category><category>iframe</category><category>meta tags</category><category>xframe</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Thu, 2 Apr 2015 17:38:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-1422824326425257002</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
One of my friends, working on a project wanted to load another website in an iframe. But kept getting error similar to&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Load denied by X-Frame-Options: http://some-website.com/dashboard/home does not permit framing.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
There is a meta tag for HTML that you can include which prevents embedding your site on other sites. For example Someone might use this blog on their own site using iframe. If I want that anyone can embed this site, I could use the meta tag below.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;lt;meta http-equiv="X-Frame-Options" content="allow"&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
As explained by Mozilla.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span style="color: orange;"&gt;&lt;span style="line-height: 1.5;"&gt;The X-Frame-Options &lt;/span&gt;&lt;a href="https://developer.mozilla.org/en/HTTP" style="line-height: 1.5;" title="en/HTTP"&gt;HTTP&lt;/a&gt;&lt;span style="line-height: 1.5;"&gt; response header can be used to indicate whether or not a browser should be allowed to render a page in a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frame" title="&amp;lt;frame&amp;gt; is an HTML element which defines a particular area in which another HTML document can be displayed. A frame should be used within a &amp;lt;frameset&amp;gt;."&gt;&lt;code&gt;&amp;lt;frame&amp;gt;&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe" title="The HTML &amp;lt;iframe&amp;gt; Element (or HTML inline frame element) represents a nested browsing context, effectively embedding another HTML page into the current page. In HTML 4.01, a document may contain a head and a body or a head and a frame-set, but not both a body and a frame-set. However, an &amp;lt;iframe&amp;gt; can be used within a normal document body. Each browsing context has its own session history and active document. The browsing context that contains the embedded content is called the parent browsing context. The top-level browsing context (which has no parent) is typically the browser window."&gt;&lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt;&lt;/a&gt; or &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object" title="The HTML &amp;lt;object&amp;gt; Element (or HTML Embedded Object Element) represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin."&gt;&lt;code&gt;&amp;lt;object&amp;gt;&lt;/code&gt;&lt;/a&gt;&amp;nbsp;. Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style="line-height: 1.5;"&gt;&lt;br /&gt;&lt;/span&gt;
X-Frame-Options can have three values - DENY, SAMEORIGIN, ALLOW-FROM uri. The values explain themselves very well.&lt;br /&gt;
&lt;br /&gt;
To configure this on Apache modify configuration ( httpd.conf )as below -&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Header always append X-Frame-Options SAMEORIGIN&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
In case you do not have access to httpd.conf file.. you can also use .htaccess as below-&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Header append X-FRAME-OPTIONS "SAMEORIGIN"&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Well, that was fun :) we'll learn more on clickjacking more in another post.. stay tuned.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Until next time.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ref :&amp;nbsp;https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] Get HTTPServletRequest in portlet</title><link>http://techdc.blogspot.com/2015/03/liferay-get-httpservletrequest-in.html</link><category>getOriginalServletRequest</category><category>httpservletrequest</category><category>liferay</category><category>portalutil</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 18 Mar 2015 16:39:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-4815458315822129040</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hello Friends,&lt;br /&gt;
&lt;br /&gt;
In case you submitted need HttpServletRequest in your portlet, here is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;HttpServletRequest request = PortalUtil.getHttpServletRequest(renderRequest);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;HttpServletRequest&amp;nbsp;originalServletRequest= PortalUtil.getOriginalServletRequest(request);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
This goes all the way from your custom code to &amp;nbsp;PortalImpl &amp;nbsp;and then&amp;nbsp;PortletRequestImpl to get the request.&lt;br /&gt;
&lt;br /&gt;
After getting request object it goes to find originalServletRequest.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/ed5a8b4739749d91eeb3.js"&gt;&lt;/script&gt;
&lt;br /&gt;
This will be useful when you submitted your form or link without a proper portlet request or want to read a parameter from url.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] Get URL using Portlet ID</title><link>http://techdc.blogspot.com/2015/03/liferay-get-url-using-portlet-id.html</link><category>plid</category><category>portletid</category><category>PortletRequest.RENDER_PHASE</category><category>portleturl</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 4 Mar 2015 16:24:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-4128530219922518818</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
Sometimes, we need to get url based on portlet id. All we have is a portlet, we can easily get portlet id and then find the page where it is added.&lt;br /&gt;
&lt;br /&gt;
To generate a url like this, we need PortletRequest, portletId, plid, and phase of the portlet.&lt;br /&gt;
&lt;br /&gt;
plid is layout id which can be get like this..&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), true, portletId);&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't know how to get themeDisplay,&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Second argument to method is true which shows that this is private layout. In case of public layoue make it false. We already have portletId.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We now have plid. Phase of the portlet is as per the requirement, assuming it is render phase for us. So once we have all the things. We call&amp;nbsp;PortletURLFactoryUtil and create the url ( &lt;b&gt;PortletURL&lt;/b&gt;&amp;nbsp;)-&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;PortletURLFactoryUtil.create(request, portletId, plid,&amp;nbsp;PortletRequest.RENDER_PHASE);&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
That's it. Hope this helps.&lt;/div&gt;
&lt;div&gt;
Until next time.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>[Liferay] Model Listener hook in 6.2</title><link>http://techdc.blogspot.com/2015/03/liferay-model-listener-hook-in-62.html</link><category>hook</category><category>journal article</category><category>JournalArticle</category><category>liferay</category><category>liferay 6.2</category><category>model listener hook</category><category>ModelListener</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 4 Mar 2015 15:47:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7550787548553917921</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
If you are looking for help to create a model listener hook in Liferay 6.2 here are the simple steps to walk you through.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1&lt;/b&gt;. Create a simple hook in plugins sdk. Go to plugins-sdk &amp;gt; hooks directory and run the command below.&lt;br /&gt;
&lt;br /&gt;
create journal-article "Journal Article hook"&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 2.&lt;/b&gt; Once the hook is created you should be able to see the default directory structure created for a hook. Now we need to add a portal.properties file to our hook and make an entry to liferay-hook.xml.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/520d78347b5353a8b4e3.js"&gt;&lt;/script&gt;&lt;b&gt;Step 3.&lt;/b&gt; And we create a portal.properties file in&amp;nbsp;\docroot\WEB-INF\src and put the line below.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/feaad42ac38be28a038e.js"&gt;&lt;/script&gt;

If you are creating for another model, change the file accordingly. You can also add multiple entries in case you are implementing for multiple models.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 4.&lt;/b&gt; Now we create the file we mentioned in portal.properties. In our case the package is&amp;nbsp;me.rkg.hooks.model and class name is &amp;nbsp;JournalArticleListener.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/7d77159da33b88d26fc1.js"&gt;&lt;/script&gt;

This class implements&amp;nbsp;ModelListener&amp;lt;T&amp;gt; as you can see in the gist above. All methods above are stub implementation of&amp;nbsp;ModelListener interface methods.&lt;br /&gt;
&lt;br /&gt;
Assuming that you knew what is the use of Model Listner hook, not covering that here. Implement the logic in methods you need to use.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;
Until next time.. :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] Can't access request parameters in v6.2 which worked in v6.1</title><link>http://techdc.blogspot.com/2015/02/liferay-cant-access-request-parameters.html</link><category>liferay</category><category>liferay 6.2</category><category>requires-namespaced-parameters</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Tue, 17 Feb 2015 20:05:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-6123485987908789298</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi Friends,&lt;br /&gt;
&lt;br /&gt;
I recently had to migrate a portlet from v6.1 to v6.2 of Liferay. Few regular steps and everything showed up in UI. But whenever I submitted a form, nothing was received at processAction. Like if I submit cityName, it can't be received using request.getParameter("cityName") which was working fine till 6.1&lt;br /&gt;
&lt;br /&gt;
But if I change cityName in form to &amp;lt;portlet:namespace/&amp;gt;cityName then it worked.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
But, there is good news so we don't have to change all the forms. We leave the forms as they are and change liferay-portlet.xml.&lt;br /&gt;
&lt;br /&gt;
After &amp;lt;instanceable&amp;gt;true&amp;lt;/instanceable&amp;gt; just add the line below.&lt;br /&gt;
&amp;lt;requires-namespaced-parameters&amp;gt;false&amp;lt;/requires-namespaced-parameters&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The line we just added will let liferay know that portlet namespace will not be there with fields and all the parameters should work as they were.. :)&lt;br /&gt;
&lt;br /&gt;
Hope this helps someone in need.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] Cover Flow portlet is now available on Liferay Marketplace</title><link>http://techdc.blogspot.com/2015/02/liferay-cover-flow-portlet-is-now.html</link><category>cover flow</category><category>coverflow</category><category>liferay</category><category>marketplace</category><category>portlet</category><category>slider</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Thu, 12 Feb 2015 11:27:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-1464121844935156336</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
Cover flow portlet is now available on &lt;a href="https://www.liferay.com/" target="_blank"&gt;Liferay&lt;/a&gt; marketplace.&lt;br /&gt;
&lt;br /&gt;
Here is the link of &lt;a href="https://www.liferay.com/marketplace" target="_blank"&gt;Liferay Marketplace&lt;/a&gt;. &lt;a href="https://www.liferay.com/web/guest/marketplace/-/mp/application/46006479" target="_blank"&gt;Cover Flow Portlet&lt;/a&gt;.&lt;br /&gt;
Github URL for this portlet, &lt;a href="https://github.com/kravigupta/coverflow-portlet" target="_blank"&gt;Cover Flow Portlet at Github&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Below is the configuration screen, its pretty simple. Just add a folder in Document Library, put images in it, and select in config. Also, you have liberty to choose a number upto which the images should appear in cover flow.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJt4x8e9QTJ-5uanpx3ARNPQc6V5iAXr61hgNjCzBB6DeF13GsfTJthVi6uQVUj5iubnO6tCg2Zoi3GC77OlSZ4uBnqujP9tjt8Tbm4VNluVZdy5nspSYD2jdRQVQRn6PXli6vzwMzids/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJt4x8e9QTJ-5uanpx3ARNPQc6V5iAXr61hgNjCzBB6DeF13GsfTJthVi6uQVUj5iubnO6tCg2Zoi3GC77OlSZ4uBnqujP9tjt8Tbm4VNluVZdy5nspSYD2jdRQVQRn6PXli6vzwMzids/s1600/3.png" height="337" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Once you are done with configuration, you should get the images in cover flow.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVOnWkr-5FPomj4VQGim56KVvvwU1yNVkgmbb8CP5bOerzCbxgMwkR94J0mfKy6jEcpznxSkKODQaQuJAuwgvRO9vfSN9BLoxKpQmeZfqTLImpQm7igKX3q7iI0Mre8136ZmGt9RaCv1M/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVOnWkr-5FPomj4VQGim56KVvvwU1yNVkgmbb8CP5bOerzCbxgMwkR94J0mfKy6jEcpznxSkKODQaQuJAuwgvRO9vfSN9BLoxKpQmeZfqTLImpQm7igKX3q7iI0Mre8136ZmGt9RaCv1M/s1600/1.png" height="264" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoXIJDo7y3KErShxZNdOnYI6HU_PzDIv59S4dC9Z_Q77G253yXa2X6yOUQw3OGHuMSi-ip90co0g-N2zdf8rFF5dtLjzs6NvzADRslqWCEgr_IkV9h-6RmRGqck4bPR2AxCBbLJkIjAHA/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoXIJDo7y3KErShxZNdOnYI6HU_PzDIv59S4dC9Z_Q77G253yXa2X6yOUQw3OGHuMSi-ip90co0g-N2zdf8rFF5dtLjzs6NvzADRslqWCEgr_IkV9h-6RmRGqck4bPR2AxCBbLJkIjAHA/s1600/2.png" height="264" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Hope this helps someone in need. :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJt4x8e9QTJ-5uanpx3ARNPQc6V5iAXr61hgNjCzBB6DeF13GsfTJthVi6uQVUj5iubnO6tCg2Zoi3GC77OlSZ4uBnqujP9tjt8Tbm4VNluVZdy5nspSYD2jdRQVQRn6PXli6vzwMzids/s72-c/3.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[OSGi][Service] Creating a service and calling it from other bundle</title><link>http://techdc.blogspot.com/2015/01/osgiservice-creating-service-and.html</link><category>bundle</category><category>osgi</category><category>service</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Sat, 31 Jan 2015 10:50:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-8333405029510374976</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
We are going to create a service, export it and import in another bundle. If you did not create a simple bundle yet, follow the post&amp;nbsp;&lt;a href="http://techdc.blogspot.in/2015/01/osgi-hello-world-from-osgi.html" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; text-decoration: none;"&gt;[OSGi] Hello World from OSGi | Create your first OSGi Bundle&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We are going to create a classic ECHO service. Whatever is given to the service is ECHOed back to us.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
After you are done creating a simple bundle HelloFromOSGi. Follow the steps below.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Step 1. Create a new bundle following the same steps to create HelloFromOSGi. Lets name that as EchoService. So the project name is me.rkg.osgi.EchoService. At this point, both bundles are same except names.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Step 2. Create an EchoService interface and EchoServiceImpl class. Lets keep them in me.rkg.osgi.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
EchoService Interface&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/6f3b9e249edcadc85c6f.js"&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;div&gt;
EchoServiceImpl&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/5f501ffeaf9ccf62cf5e.js"&gt;&lt;/script&gt;
&lt;/div&gt;
Step 3. Updating Activator to register service. We will use org.osgi.framework.ServiceRegistration. We can register service with help of&amp;nbsp;&lt;span class="pl-stj"&gt;BundleContext which is passed to start() method.&lt;/span&gt;&lt;br /&gt;
&lt;pre class="line-pre"&gt;&lt;span class="pl-v"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;script src="https://gist.github.com/kravigupta/0ec1fae660825d000914.js"&gt;&lt;/script&gt;

Step 4. Updating MANIFEST.MF. We need to export the service using&lt;br /&gt;
&lt;pre class="line-pre"&gt;&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Export-Package: me.rkg.osgi.echoservice.service &lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;script src="https://gist.github.com/kravigupta/988614d9c4f606e3783d.js"&gt;&lt;/script&gt;

Step 5. See that we export only interface not our implementations in the last step.&lt;br /&gt;
&lt;br /&gt;
Step 6. Now when service is exposed, we can import into HelloFromOSGi bundle and use it. Lets modify MANIFEST.MF for HelloFromOSGi to add&lt;br /&gt;
&lt;pre class="line-pre"&gt;&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Import-Package: me.rkg.osgi.echoservice.service, org.osgi.framework;version="1.3.0"&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;script src="https://gist.github.com/kravigupta/f41458049d2a5c57ba55.js"&gt;&lt;/script&gt;
Step 7. Now we can use this service in any of the files in HelloFromOSGi. We will use org.osgi.framework.ServiceReference. We can get this reference from&amp;nbsp;BundleContext passed to start() method.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/04a299d419476891b11e.js"&gt;&lt;/script&gt;

Step 8. Running the bundles. You would be able to see the message.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1FMCAGeUesMKFWnhyODgLy8iP2wKK-y2-rFO6Bzl6fuLfHjNmnjDMMWmrnovaGI_Id-VSGgCndfTFG7MOm9l4AuTiBPim6Vh1IF1Vw6sTE5IBaZQ8pcGUfuBn9_6y9mUa8WWOWnLIHZE/s1600/running-osgi-service.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1FMCAGeUesMKFWnhyODgLy8iP2wKK-y2-rFO6Bzl6fuLfHjNmnjDMMWmrnovaGI_Id-VSGgCndfTFG7MOm9l4AuTiBPim6Vh1IF1Vw6sTE5IBaZQ8pcGUfuBn9_6y9mUa8WWOWnLIHZE/s1600/running-osgi-service.png" height="432" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
That's it. Hope this gets you a clear idea.&lt;br /&gt;
&lt;br /&gt;
Until next time :)&lt;br /&gt;
&lt;br /&gt;
&lt;div class="post-header" style="background-color: white; color: #a8a8a8; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.5px; line-height: 1.6; margin: 0px 0px 1.5em;"&gt;
&lt;div class="post-header-line-1"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="post-body entry-content" id="post-body-7027700438025160675" itemprop="description articleBody" style="background-color: white; color: #6d6d6d; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.8500003814697px; line-height: 1.4; position: relative; width: 728px;"&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1FMCAGeUesMKFWnhyODgLy8iP2wKK-y2-rFO6Bzl6fuLfHjNmnjDMMWmrnovaGI_Id-VSGgCndfTFG7MOm9l4AuTiBPim6Vh1IF1Vw6sTE5IBaZQ8pcGUfuBn9_6y9mUa8WWOWnLIHZE/s72-c/running-osgi-service.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay][Tomcat] Permission Denied Errors in Catalina.out</title><link>http://techdc.blogspot.com/2015/01/liferaytomcat-permission-denied-errors.html</link><category>chown</category><category>command</category><category>linux</category><category>permission</category><category>permission denied</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Thu, 29 Jan 2015 13:34:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7114516585387044712</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
I have seen some people struggling with permission errors when running Liferay. Errors like below..&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/db37ad3814e622767aba.js"&gt;&lt;/script&gt;

&lt;br /&gt;
The main cause for these errors is that server was started with a user lets say A having permissions(like root) and then server was stopped and started by a user lets say B with limited permissions. Now entries in temp and several other places are owned by A and when B tries to start/restart server B is unable to access those files and get permission denied errors.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Other causes can also be that server files were copied by A,&lt;br /&gt;
&lt;br /&gt;
Solution is simple, we know that we need to change the file permissions to the level of B. In linux, the command is : chown.&lt;br /&gt;
&lt;br /&gt;
I could run the command to change owner of all the files at once.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: left;"&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;chown -R ravi:ravi *&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
That's it. This command will modify the owner for all users.&lt;br /&gt;
&lt;br /&gt;
Just in case, you want to know if any file is owned by a user, try this command. The command below will give you a list of all files owned by user root.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;ls -laR | grep root&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Hope this helps someone in need. :)&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[OSGi] Hello World from OSGi | Create your first OSGi Bundle</title><link>http://techdc.blogspot.com/2015/01/osgi-hello-world-from-osgi.html</link><category>activator</category><category>bundle</category><category>hello world</category><category>manifest.mf</category><category>osgi</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Tue, 27 Jan 2015 11:43:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7027700438025160675</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi Friends,&lt;br /&gt;
&lt;br /&gt;
This post will guide you to create a very very simple Hello World bundle using OSGi. We will use Eclipse for this purpose.&lt;br /&gt;
&lt;br /&gt;
Few simple steps to follow.&lt;br /&gt;
&lt;br /&gt;
Step 1. Create a new project in Eclipse. Open New &amp;gt; Project&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-ChCBd4HJ2k3lVAasFumW6z9COpxfHZybQ5RSDPjoOvVF4rLr7nQXZSkg05novc-BNS214HzZ6N8O9xXmJ9hMln3y4aoGefypMwkA5hn1VWvtu5PG2CAfmXQHuzFGSmGzXrXZYgtmL7o/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-ChCBd4HJ2k3lVAasFumW6z9COpxfHZybQ5RSDPjoOvVF4rLr7nQXZSkg05novc-BNS214HzZ6N8O9xXmJ9hMln3y4aoGefypMwkA5hn1VWvtu5PG2CAfmXQHuzFGSmGzXrXZYgtmL7o/s1600/1.png" height="464" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 2. Select Plug in project&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbdjuvSujf3FAXA75o3uFWUFyneCRIJjFR6REXIgipWXwRxItlnIjDyt5rPxNnfUTBMMJ91wYpkVFuWgxorY-YC0Cd1UCCDC6EWYxMdPrNmH-8QA-KUFky2lfSRcRBmlMIbjKmsoBee0U/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbdjuvSujf3FAXA75o3uFWUFyneCRIJjFR6REXIgipWXwRxItlnIjDyt5rPxNnfUTBMMJ91wYpkVFuWgxorY-YC0Cd1UCCDC6EWYxMdPrNmH-8QA-KUFky2lfSRcRBmlMIbjKmsoBee0U/s1600/2.png" height="608" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 3. Enter the name of your bundle and OSGi framework as Standard. Leave rest of the things as they are. After that, Press next.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZgJvGkD17_tsuMFQ-azNEnznAJ_Nw94Lf8L6_dg_QfSUDtwwFdU9GMK2jr8LnlbiiqhU382lnbyYEIEHvbC1II9qcnHyyhJVeyacVxiLkHYugZC5a4iyj6PyD342ekIS8ZcwVOhw6Dko/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZgJvGkD17_tsuMFQ-azNEnznAJ_Nw94Lf8L6_dg_QfSUDtwwFdU9GMK2jr8LnlbiiqhU382lnbyYEIEHvbC1II9qcnHyyhJVeyacVxiLkHYugZC5a4iyj6PyD342ekIS8ZcwVOhw6Dko/s1600/3.png" height="640" width="522" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 4. You will find details about your project in this screen, you can change bundle name, id, version, vendor. This screen also gives an option to create an Activator class by default which is responsible to run operations on start and stop of your module.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKVlb5pbiPWx2YZnAzVBdaqf9muYnBaRWg-g9r54HXc3lKG1lKXR3l-T9bre_lS5zkGzFyQ9ozDzY9SAeJW9xWqeRjf_3rQZsBfEnKhLRWlYA4M0KqMuy1lbgXt9njp5BAhIXLIewAByY/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKVlb5pbiPWx2YZnAzVBdaqf9muYnBaRWg-g9r54HXc3lKG1lKXR3l-T9bre_lS5zkGzFyQ9ozDzY9SAeJW9xWqeRjf_3rQZsBfEnKhLRWlYA4M0KqMuy1lbgXt9njp5BAhIXLIewAByY/s1600/4.png" height="640" width="522" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 5. From next screen select Hello OSGi Bundle Template and press next.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLJxn3nH-_xV2UPQc8C4pQE6SEIxsSHvhi2QnKuRQ-dS-EsVjbbcCwQbA2DYUcFgmnjXKh-dJUOtw-v99wAUsz0eOGQnp6bK8evHNv34ipmKMcZ4We6uwyciJDx4K0eppCkWQxoKIjNA0/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLJxn3nH-_xV2UPQc8C4pQE6SEIxsSHvhi2QnKuRQ-dS-EsVjbbcCwQbA2DYUcFgmnjXKh-dJUOtw-v99wAUsz0eOGQnp6bK8evHNv34ipmKMcZ4We6uwyciJDx4K0eppCkWQxoKIjNA0/s1600/5.png" height="640" width="522" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 6. You can configure what message to be printed at start and stop of your bundle. You can change these later as well. Once you customize, press finish.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5eKasuQYgRnaQ5-fQ-5wsSzT_m44bASa3SebOEu0IUa5OwWlcqLhxdhfRN2iLHQrPjPMx-89jjw2FpHfjC3BQuvvthXZdmBX9cSx-XSMen_ujKngcU84kblanEZqlfhYFAbQ33N7oX7Q/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5eKasuQYgRnaQ5-fQ-5wsSzT_m44bASa3SebOEu0IUa5OwWlcqLhxdhfRN2iLHQrPjPMx-89jjw2FpHfjC3BQuvvthXZdmBX9cSx-XSMen_ujKngcU84kblanEZqlfhYFAbQ33N7oX7Q/s1600/6.png" height="640" width="522" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 7. Now your project should appear in the project list. As screen below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE81tVzlIzdakO4hJUI6_Xd4T2xLO5LWqj0wzVsHsquPXZcUcP2yi2QjX4FxX_rUwgdGJbWo-FhkJJCU6o9IMJ1Vg1lP8TROxk1Y2XB4gT-Ox_p5d1KqakS13Sx0fm2EPycO5l3-pRhrc/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE81tVzlIzdakO4hJUI6_Xd4T2xLO5LWqj0wzVsHsquPXZcUcP2yi2QjX4FxX_rUwgdGJbWo-FhkJJCU6o9IMJ1Vg1lP8TROxk1Y2XB4gT-Ox_p5d1KqakS13Sx0fm2EPycO5l3-pRhrc/s1600/7.png" height="384" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Note 1. Two important files are created by default. MANIFEST.MF and Activator.java. Below is the MANIFEST.MF file&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/aacf32e0cd51fb620dcd.js"&gt;&lt;/script&gt;

Note 2. And Activator.java looks like this.&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/eadcead10e745920d2d4.js"&gt;&lt;/script&gt;

Activator.java implements&amp;nbsp;BundleActivator. There are two methods which get BundleContext. These methods are called at start and stop of your bundle. At the start, you can write code for init purpose like database initialization, any object creation etc.And at the stop, you can write code for clean up. Of course, there are other several purpose those can be fulfilled with these methods. Depends on the requirements, isn't it?&lt;br /&gt;
&lt;br /&gt;
Step 8. Now lets run the bundle we just created. Go to Run &amp;gt; Run. You should see the output.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic8wZj7QJXpGlx3T66xIsHtMolcnQq1RKbb_MtxBr-xmGzUGIAuTyVGtDDocjcFBLf_Nw76LCg4l7hO4UGbGuecFHq5l3mFrEO059F6ml8pscpYFsD09SUD-EcdoIUexlXfIzE9Azx-U4/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic8wZj7QJXpGlx3T66xIsHtMolcnQq1RKbb_MtxBr-xmGzUGIAuTyVGtDDocjcFBLf_Nw76LCg4l7hO4UGbGuecFHq5l3mFrEO059F6ml8pscpYFsD09SUD-EcdoIUexlXfIzE9Azx-U4/s1600/8.png" height="384" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
So this is how we create an OSGi bundle with help of eclipse and run it. We will learn more about OSGi in next posts. We will also take a closer look at MANIFEST.MF soon enough. Stay Tuned.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-ChCBd4HJ2k3lVAasFumW6z9COpxfHZybQ5RSDPjoOvVF4rLr7nQXZSkg05novc-BNS214HzZ6N8O9xXmJ9hMln3y4aoGefypMwkA5hn1VWvtu5PG2CAfmXQHuzFGSmGzXrXZYgtmL7o/s72-c/1.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Eclipse] Workbench has not been created yet. Error while creating OSGi modules.</title><link>http://techdc.blogspot.com/2015/01/eclipse-workbench-has-not-been-created.html</link><category>configuration</category><category>eclipse</category><category>osgi</category><category>workbench</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Sun, 25 Jan 2015 13:42:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7442049638306028417</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
It was my first day with OSGi bundles and I got an error..&amp;nbsp;Workbench has not been created yet. If you have the same error, please follow the steps below to resolve it.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/22d2e561dae403287763.js"&gt;&lt;/script&gt;

Step 1. Go to &lt;b&gt;MANIFEST.MF&lt;/b&gt; and right click on it and then navigate to &lt;b&gt;Run As &amp;gt; Run Configuration&lt;/b&gt;.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDQQoazGDQ96vYawws27CMjPNlsUasjCab4TwfVPPb2f27Zs5S0nUm6t5i34xoAW0s2BrWnL2c_OweykJhu9ixvegUGbs1wC5UQvJ5aLyuJ6AKjt0_rhUtXuA1IX2YAJCxhn70pGePr_c/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDQQoazGDQ96vYawws27CMjPNlsUasjCab4TwfVPPb2f27Zs5S0nUm6t5i34xoAW0s2BrWnL2c_OweykJhu9ixvegUGbs1wC5UQvJ5aLyuJ6AKjt0_rhUtXuA1IX2YAJCxhn70pGePr_c/s1600/1.png" height="384" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 2. Open &lt;b&gt;Run Configuration&lt;/b&gt;.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBeOAMKC5ofumFfYZBTiXS_KaYWdC7XVDHVxezWwzyQow_lvcoKRW2YTYJyqRxr4RZ7jul1-1H-6J9d808Oz_7OGxwE5TY-VgL8GSJMeWlQOd2ZM5cnwfD4YlSpgJeTwvzZuhqpUQ8s1s/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBeOAMKC5ofumFfYZBTiXS_KaYWdC7XVDHVxezWwzyQow_lvcoKRW2YTYJyqRxr4RZ7jul1-1H-6J9d808Oz_7OGxwE5TY-VgL8GSJMeWlQOd2ZM5cnwfD4YlSpgJeTwvzZuhqpUQ8s1s/s1600/2.png" height="400" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 3. Uncheck All &lt;b&gt;Target Platform&lt;/b&gt; jars. See the screenshot below.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg86TxO5UmZ6WtUHzGvPf7_ngrZYdNkpF8yXyI5bNaMBC1jIAyPr7tb7rDCHdjyD0tvpgHOZ7z34rZdCLxCJXZ-N3BXu9NfMvFRuW4i8WI5lqk-iE5_qo2bLQRKJc1s4LlfugN2CwsI4ic/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg86TxO5UmZ6WtUHzGvPf7_ngrZYdNkpF8yXyI5bNaMBC1jIAyPr7tb7rDCHdjyD0tvpgHOZ7z34rZdCLxCJXZ-N3BXu9NfMvFRuW4i8WI5lqk-iE5_qo2bLQRKJc1s4LlfugN2CwsI4ic/s1600/3.png" height="400" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 4. Now click "&lt;b&gt;Add Required Bundles&lt;/b&gt;". Check "&lt;b&gt;Only show selected&lt;/b&gt;" to see which jars are now selected.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi2UW0Q2uDKRNhYRHbT26I8-2ps2iAr6NBNo3Vb30DbRmItOBsrXMABRg9U5lNQHBjuFVLzCsOKE0umid-DatvUglpv-u80OHTZM_440YqS_NTEX9d6MpMq-xfszKoQn83F52aQ6QBjes/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi2UW0Q2uDKRNhYRHbT26I8-2ps2iAr6NBNo3Vb30DbRmItOBsrXMABRg9U5lNQHBjuFVLzCsOKE0umid-DatvUglpv-u80OHTZM_440YqS_NTEX9d6MpMq-xfszKoQn83F52aQ6QBjes/s1600/4.png" height="400" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 5. Uncheck "&lt;b&gt;Only show selected&lt;/b&gt;"&amp;nbsp;and now select the jars listed below. You can use filter to shorten the list.&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/497e3adef5add70495da.js"&gt;&lt;/script&gt;

Configurations after selecting jars and checking "&lt;b&gt;Only show selected&lt;/b&gt;", should be like this .&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFZ2x25koCvv7h9fU5f2pyVHjoaU9kvyIFHagSRFkCrM5rAsHcuaom83kdNB3wO_V2dMJ1X34XmFs6L0JYflqr6yotHSL3-Qqif_hSTheAPKRnR4R48I3WYA-GKf4Q2YobEfyw4ZEAk8M/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFZ2x25koCvv7h9fU5f2pyVHjoaU9kvyIFHagSRFkCrM5rAsHcuaom83kdNB3wO_V2dMJ1X34XmFs6L0JYflqr6yotHSL3-Qqif_hSTheAPKRnR4R48I3WYA-GKf4Q2YobEfyw4ZEAk8M/s1600/5.png" height="400" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 6 Now open &lt;b&gt;Settings&lt;/b&gt; tab and check "&lt;b&gt;Clear the configuration area before launching&lt;/b&gt;".&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFSzyuF9pEdSSpz6TWgkcfLjjAKpib7kxmXkIxt7B8F7xRZ4AbEfMkh586Pm-cxtilAdzchqWn9zuQTEj2olqM-CrL4TRRlvv7HlVoSdVTX_DwLNNWEpZMGEyV9hJ2MyMc3hS50hcozr4/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFSzyuF9pEdSSpz6TWgkcfLjjAKpib7kxmXkIxt7B8F7xRZ4AbEfMkh586Pm-cxtilAdzchqWn9zuQTEj2olqM-CrL4TRRlvv7HlVoSdVTX_DwLNNWEpZMGEyV9hJ2MyMc3hS50hcozr4/s1600/6.png" height="400" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 7. Now Click &lt;b&gt;Apply &lt;/b&gt;and &lt;b&gt;Run. &lt;/b&gt;You should see the output.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8L2J1DMyCLWrIPFOzyIidYuQYGp7ADC1Z597982yd-DygI019-n4VeM4u8ISxC8xJIBWp0JkJH6ibsETWps-4ETZy_vr6DNB2BkvUfl8MBmUxrfFV0aQY9QO6pDZXdG41MtcaIof_j7c/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8L2J1DMyCLWrIPFOzyIidYuQYGp7ADC1Z597982yd-DygI019-n4VeM4u8ISxC8xJIBWp0JkJH6ibsETWps-4ETZy_vr6DNB2BkvUfl8MBmUxrfFV0aQY9QO6pDZXdG41MtcaIof_j7c/s1600/7.png" height="436" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
That's it. Hope this helps.&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDQQoazGDQ96vYawws27CMjPNlsUasjCab4TwfVPPb2f27Zs5S0nUm6t5i34xoAW0s2BrWnL2c_OweykJhu9ixvegUGbs1wC5UQvJ5aLyuJ6AKjt0_rhUtXuA1IX2YAJCxhn70pGePr_c/s72-c/1.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></item><item><title>[Liferay] java.net.UnknownHostException | Unknown Host Exception Liferay</title><link>http://techdc.blogspot.com/2015/01/liferay-javanetunknownhostexception.html</link><category>exception</category><category>host</category><category>hosts</category><category>liferay</category><category>linux</category><category>unknown</category><category>unknownhostexception</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Fri, 23 Jan 2015 16:28:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-7603922707766900795</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
I got this exception on a fresh Linux machine. It was clear that Liferay was not able to find the hostname entries properly. Solution was simple. Just needed to add hostname in hosts file. Here is the exception log.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/21f3e938cd2175a6ebe9.js"&gt;&lt;/script&gt;

And the solution here.. On linux open /etc/hosts file and make an entry.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; sudo vim /etc/hosts&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/f74aa28256e9f8ced16f.js"&gt;&lt;/script&gt;
&lt;br /&gt;
That's it. Pretty easy. :) Hope this helps someone.&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>[Liferay] How to use Liferay Caching Mechanism using MultiVMPoolUtil</title><link>http://techdc.blogspot.com/2014/12/liferay-how-to-use-liferay-caching.html</link><category>cache</category><category>liferay</category><category>multivmpoolutil</category><author>noreply@blogger.com (Ravi Kumar Gupta)</author><pubDate>Wed, 3 Dec 2014 16:56:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2644048739359535204.post-583012084621879934</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Most often, we need to use some kind of caching for our portlets. Whether it is weather data or stocks or some news feed we get from other sites. For each user who loads the web page we don't want to go to weather/stocks/news services and get new data each time. We rather cache the data for some time lets say 10 minutes and then renew whenever a user requests after 10 minutes.&lt;br /&gt;
&lt;br /&gt;
So, how we should use the cache.&lt;br /&gt;
&lt;br /&gt;
We have&amp;nbsp;MultiVMPoolUtil which is a utility class to access&amp;nbsp;MultiVMPool.&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/3491975a4896d776fcbd.js"&gt;&lt;/script&gt;

We need the above two methods (either one of them) to store our data.&lt;br /&gt;
All we need is a &lt;b&gt;name&lt;/b&gt;&amp;nbsp;under which the data should be stored, a &lt;b&gt;key &lt;/b&gt;to store data and &lt;b&gt;value&lt;/b&gt;&amp;nbsp;which holds the actual data. So it is just a name, and a key-value pair. &lt;b&gt;value&lt;/b&gt; is usually an object and &lt;b&gt;name&lt;/b&gt; and &lt;b&gt;key&lt;/b&gt; are strings.&lt;br /&gt;
&lt;br /&gt;
How can we form name and key and How should we.. ?&lt;br /&gt;
We store data for some context it can be for portlet or spread over multiple portlets. Suppose my project short name is &lt;b&gt;RE&lt;/b&gt; (short for Reporting Engine) and I need to store data for 5 reports objects which I collected from some other place. That some other place may be can named as &lt;b&gt;ABC. &lt;/b&gt;I might keep &lt;b&gt;name&lt;/b&gt; as reReportDataABC. I might be collecting finance report for &lt;b&gt;ABC &lt;/b&gt;so I can choose key as &lt;b&gt;ABC-finance &lt;/b&gt;or &lt;b&gt;ABC:finance &lt;/b&gt;assuming there might be other types as well. ABC:staff, ABC:annual etc.. purely depends on your requirements. Last, the value would be just the object whatever holds the data. It can be a list or just an object.&lt;br /&gt;
&lt;br /&gt;
So, we would need to make a call as -&lt;br /&gt;
&lt;br /&gt;
public static final String RE_REPORT_DATA_ABC = 'reReportDataABC';&lt;br /&gt;
MultiVMPoolUtil.put(RE_REPORT_DATA_ABC, 'ABC:finance', reportsDataList);&lt;br /&gt;
&lt;br /&gt;
And to get the data again&lt;br /&gt;
Object reportsObject = MultiVMPoolUtil.get(RE_REPORT_DATA_ABC&amp;nbsp;, 'ABC:finance');&lt;br /&gt;
&lt;br /&gt;
So the final code would be like this-&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/1e25ece77b11193e809b.js"&gt;&lt;/script&gt;

Now there is a catch -&lt;br /&gt;
The approach above will work just fine if there is just one user and user sits idle for 10 minutes and cache gets clear in the time defined (time to live : ttl), suppose that was 10 minutes. But what if there are 1000 users and cache does not get clear. The code above is not going to get live data because it was being access regularly and no idle time reaches 10 minutes. &lt;br /&gt;
&lt;br /&gt;
In this case, we could just add one more key for time. See the code below.&lt;br /&gt;
&lt;script src="https://gist.github.com/kravigupta/0f7875dc9157b1e3abc6.js"&gt;&lt;/script&gt;

I hope its clear now and works fine as expected.&lt;br /&gt;
&lt;br /&gt;
Until next time, keep caching.. :P :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item></channel></rss>