Menu

Building blocks in AEM

Building blocks is the feature associated with experience fragment in which we group two or more experience fragment together.
To understand it better we have to first understand the experience fragment. Experience fragment is a page or post, which we create using multiple small contents or grouping multiple content together in a template so we can easily reuse and publish that content. Experience fragment can have CTA(cal to action), images, text and inputs.

Why building blocks required?

Suppose we have a requirement where we need to show two or more experience fragment together as a single experience fragment, then using the building blocks we can group those experience fragment and  drop and show that building blocks as a single experience fragment in your post and page.

To make it more simple, building blocks is for combining two or more experience fragment into a single experience fragment.

How to create building blocks?





Failure authenticating with BASIC 'Sling (Development)'

Issue: When we try to replicate anything from author to publisher I am getting below error. and not even on any replication it keep printing the log in error.log file automatically after an interval. What could be the cause of this? 


24.10.2019 11:31:05.942 *INFO* [oak-repository-executor-1] com.adobe.granite.repository Service [34344, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED
24.10.2019 11:31:20.180 *INFO* [sling-default-2812-com.day.cq.replication.impl.ReverseReplicator.22529] org.apache.commons.httpclient.auth.AuthChallengeProcessor basic authentication scheme selected
24.10.2019 11:31:20.180 *INFO* [sling-default-2812-com.day.cq.replication.impl.ReverseReplicator.22529] org.apache.commons.httpclient.HttpMethodDirector Failure authenticating with BASIC 'Sling (Development)'@localhost:4503
24.10.2019 11:31:24.323 *INFO* [oak-repository-executor-1] com.adobe.granite.repository Service [34345, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED


Resolution: This error message you are getting because, AEM author replication agent is unable to communicate with publisher instance due to bad credential (username and password). You might change the password of admin user in publisher and forget to update the password on default author agent. Once you will update the valid authentication credential in default author replication agent this error will be no more logged in the error.log file.

By default AEM system keep generating events and try to transport the same to publisher instance, every time it send the replication request to replication agent the authentication get failed thats why this log is get printed after a certain interval. 

Reference:

  1. https://helpx.adobe.com/in/experience-manager/6-3/sites/deploying/using/replication.html

How to put escape character in SQL query


SELECT * FROM SQL_TUTORIAL WHERE SQL_NAME like UPPER('%'||vSearchItem||'%')

Koi toh hai jo nizam-e-hasti chala raha hai

Koi toh hai, Koi toh hai jo nizam-e-hasti chala raha hai, 
Wahi khuda hai, wahi khuda hai


Dikhayi bhi na de jo nazar bhi, woh aa raha hai

Wahi khuda hai, wahi khuda hai


Nazar bhi rakhe sma'atein bhi,

Woh jan leta hain neeyatein bhi,
Jo khana-e-la Shaoor mein, 
Jagmagaa raha hai,
Wahi khuda hai, wohi khuda hai


Talash usko na kar buton mein, 

Woh hai badalti ruton mein


Jo din ko raat aur raat ko din banaa raha hai

Wahi khuda hai, wahi khuda hai


Koi hai toh hai jo nizame hasti chala raha hai

Wahi khuda hai, wohi khuda hai


Dikhayi bhi na de jo nazar bhi, woh aa raha hai

Wahi khuda hai, wahi khuda hai


Kisi ko tajo wakar bakshe,

Kisi ko zillat ke khar bakhshe,


Woh sab ke haathon pe,

Mohar-e-Qudrat laga raha hai
Wahi khuda hai, wohi khuda hai


Koi toh hai jo nizam-e - hasti chalaa raha hai

Khuda hai


Yeh chand taare hain noor usi ka

Hai har jagah pe zahoor usi ka
Yeh phool kaliyan 
Yeh sabze patte sajaa raha hai
Wahi khuda hai, wahi khuda hai


Koi toh hai jo nizam-e-hasti chala raha hai

Wahi khuda hai, wohi khuda hai


Koi toh hai jo nizame hasti chala raha hai



Kyun mangta hai tu is jahan se?

Tujhe milega khuda ke ghar se


Nabi sadqe jo apne haathon loota raha hai

Wahi khuda hai, wohi khuda hai


Dikhayi bhi na de jo nazar bhi woh aa raha hai

Wahi khuda hai


Koi toh hai jo nizame hasti chalaa raha hai 

Wahi khuda hai, Wohi khuda hai


Allahhumma salli ala muhammadin, 

Wa ala aalihi wa sahbihi wa sallim


Allahhumma salli ala muhammadin, 

Wa ala aalihi wa sahbihi wa sallim


Written by - Muzafar Warsi


-------------------------------------------------------
کوئی تو ہے جو نظام ہستی چلا رہا ہے، وہی خدا ہے
دکھائی بھی جو نہ دے نظر بھی جو آ رہا ہے، وہی خدا ہے 


تلاش اس کو نہ بتوں مے وہ ہے بدلتی ہوئی رتوں میں 
جو دن کو رات اور رات کو دن بنا رہا ہے، وہی خدا ہے


نظر بھی رکھے سماعتیں بھی وہ جان بھی لیتا ہے نیتیں بھی 
جو خانہ لاشعور میں جگمگا رہا ہے، وہی خدا ہے 


کسی کو تاج وقار بخشے کسی کو ذلّت کے غار بخشے
جو سب کے ماتھوں پہ مہر قدرت لگا رہا ہے، وہی خدا ہے 


سفید اس کا سیاہ اس کا نفس نفس ہے گواہ اس کا 
جو شعلہ جان جلا رہا ہے بجھا رہا ہے، وہی خدا ہے 


کوئی تو ہے جو نظام ہستی چلا رہا ہے، وہی خدا ہے 

- مظفر وارثی -
------------------------------------------------------
कोई तो है जो निज़ाम हस्ती चला रहा है वही खुदा है 
दिखाई भी जो न दे नज़र भी जो आ रहा है वही खुदा है 

तलाश उसको न कर बुतों रूतों वो है बदलती हुवे रूतों में 
जो दिन को रात और रात को दिन बना रहा है वही खुदा है 

नज़र भी रखे समाअतें भी वह जान भी लेता है नियतें भी 
जो खाना ला शऊर में जगमगा रहा है वही खुदा है 

किसी को ताज वक़ार बख्से किसी को ज़िल्लत के गार बख्से 
जो सब के माथों पे मेहर कुदरत लगा रहा है वही खुदा है 

सफ़ेद उसका सियाह उसका नफ़्स है गवाह उसका 
जो शोलाये जान जला रहा है बुझा रहा है वही खुदा है 


कोई तो है जो निज़ाम हस्ती चला रहा है वही खुदा है 

Create a calculator using JavaScript callback function.

In this post we are going to create a calculator using simple HTML and JavaScript callback function. Using callback functions we have to write less code in compare to writing huge line of code using simple JavaScript functions. Callback and promises are the very useful and fastest way to write the code.

Without any further delay, lets start the coding to create a web based simple calculator using the javaScript callback functions. We will discuss the theory part of callback function and promises other article.

Create a html page with name calculator.html. copy the below code snippet and paste in calculator.html file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<html>
<title>Calculator</title>
    <head>
        <script src="js/calculator.js"></script>
    </head>
<body>
<h3>Calculator</h3>
Number 1: <input id="number1" type="number"/><br /><br />
Number 2: <input id="number2" type="number"/><br /><br />
<input type="button" onclick="calc(addNum)" value="Add" id="add" />
<input type="button" value="Multiply" onclick="calc(multiplyNum)" id="multiply" />
<input type="button" value="Divide" id="divide" onclick="calc(divideNum)" />
<br /><br />
Result: <input id="result" type="number"/><br />
</body>

</html>

Now create a folder with name js in the same directory where you have created your html page, this js folder is to separate the js file from other files.

Now open the js folder and create a calculator.js file.

Copy the below js code snippet the paste it in your calculator.js file.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
function calc(callback) {
    var n1 = parseFloat(document.getElementById("number1").value);
    var n2 = parseFloat(document.getElementById("number2").value);
    var result = callback(n1, n2);
    document.getElementById("result").value = result;
}

function multiplyNum(n1, n2) {
    return n1 * n2;
}
function divideNum(n1, n2) {
    return n1 / n2;
}
function addNum(n1, n2) {
    return n1 + n2;
}

Now open your calculator.html file in browser and see the result. below is the screen shot of the calculator.

callback function calculator-rashidjorvee
callback function calculator

You may download the complete exercise from GitHub https://github.com/RashidJorvee/callbackFunctionJS

ORA-12170: TNS:Connect timeout occurred

When we face "ORA-12170: TNS Connect timeout occurred", then immediately check the following 

  • TNS_ADMIN environment variable is defined or not
  • ORACLE_HOME environment variable is defined as "C:\oraclexe\app\oracle\product\11.2.0\server". 
  • "C:\oraclexe\app\oracle\product\11.2.0\server\Network\Admin\sqlnet.ora" was located NAMES.DIRECTORY_PATH specifies EZCONNECT in the sqlnet.ora file
  • EZCONNECT is not the first naming method in NAMES.DIRECTORY_PATH which may conflict with other naming methods specified

Steps need to follow to fix the issue

  • Try moving EZCONNECT to the first position in NAMES.DIRECTORY_PATH in the sqlnet.ora file
  • Verify that the database server is running
  • The following profile parameters may need to be set to larger values in the sqlnet.ora file on the database server: SQLNET.INBOUND_CONNECT_TIMEOUT, SQLNET.SEND_TIMEOUT, and SQLNET.RECV_TIMEOUT
  • Try to TNSPing (DESCRIPTION=(ADDRESS=(PORT=<port number> e.g. 1521)(HOST=<IP address> e.g. 10.20.30.40)(PROTOCOL=TCP))) using the TNS Ping button on the toolbar

Consider defining a bean of type in your configuration

A compile-time error thrown by Spring application as following "Consider defining a bean of type 'org.sling.service.ServiceClass' in your configuration". This means we have created a class or interface and trying to use it as a service or bean, but your class or interface doesn't have the feature of bean. 
So, to fix this with a service class use annotation @Service [org.springframework.stereotype.Service] on top of your class declaration will fix this error.

How to push any PDF or word file to Kindle?

Login to Amazon and go to manage your content and device section from your account.
Click on the device tab, after clicking on device tab you will see the below screen. This screen will show you all your kindle apps and at the last your Kindle email address. Using this kindle email address you can push your document to Kindle. For that you have to also set the authorized sender so that email with attachment only with those email address will be get pushed into your Kindle app.

Kindle-email-address rashid jorvee
Kindle email address screen


References: