Menu

What is experience fragment in AEM?


  • Experience fragment is a kind of page or content.
  • Experience fragment is reusable content, we could use same content in multiple pages.
  • Experience fragment is fully responsive, and support and fit in almost all the screen size.
  • Experience fragment have variations for omni-channel delivery.
  • Experience fragment is based on template design, we have to create a template of the content before creating a experience fragment. In template we specify the layout of our content.
  • We can use experience fragment as a page.
  • Using experience fragment we can create a post or page for social media and other channels(using template) and feed or publish your post or page directly on those channels from AEM (adobe experience manager).
  • Experience fragment is more innovative version of  content fragment in AEM.
  • Experience fragment feature comes in AEM 6.3.
  • Experience fragment can have content fragment into it.

See also:

What is content fragment in AEM?


  • Content fragment is only content without any styling, or you could say it is pure text without formatting.
  • Content fragment is simple, and have only structure of the content. This structure could be paragraph, input field; which separate the multiple copy of text and input parameters at one place.
  • Structure of the content fragment is define in the model.
  • Create a content fragment model to create a new structure of your content fragment.
  • Content fragment is just only a component.
  • Using content fragment you can design undecided content, and use later on according to your requirement.
  • Content fragment is stored as an asset in DAM (digital asset management).
  • Content fragment will be always implemented as an asset.
  • Content fragment can have variation, which means you can create different variation of the same content for different platform.
  • Content fragment summarize your content at one place, so you can access the complete content in just one go.

See also:

Mohsin Naqvi - Tumhe jab ru baru dekha karenge

‏تمہیں جب رُوبرو دیکھا کریں گے
یہ سوچا ہے،بہت سوچا کریں گے

نظر میں چودھویں کا چاند ہوگا
سمندر کی زباں بولا کریں گے

نہ آئے گا کوئی الزام تجھ پر
ہم اپنے آپ کو رسوا کریں گے

اس الجھن میں کٹی ہے عمر محسنؔ
کہ پل دو پل میں ہم کیا کیا کریں گے ؟

محسن نقوی--

Create JS Object from JSON text

How to traverse on JSON (JavaScript object notation) object using JavaScript and how to traverse JSON array using JavaScript?

Below is the simple HTML and JavaScript based program, which have a JSON data object and further that json object have json array. Using JavaScript we will read that json data one by one and generate output for end user, and later that output we will show on html page.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<html>
<body>
<h2>Create JS Object from JSON String</h2>
 <p id="output">
 </p>
<script>
var txt = '{"employees":[' +
'{"firstName":"Rashid","lastName":"Jorvee" },' +
'{"firstName":"Java","lastName":"Script" },' +
'{"firstName":"Node","lastName":"JS" }]}';


var jsonData = JSON.parse(txt);
var output="";
for (var i = 0; i < jsonData.employees.length; i++) {
    var counter = jsonData.employees[i];
    console.log(counter.firstName);
    output += "First name: " +  counter.firstName +  ", Last Name: " +counter.lastName +"<br />";
 document.getElementById("output").innerHTML = output;
   
}

</script>
</body>
</html>

Output:

Create JS Object from JSON String

First name: Rashid, Last Name: Jorvee
First name: Java, Last Name: Script
First name: Node, Last Name: JS

Output on browser console: 

console output on browser debugger console
console output on browser debugger console

Rights of an arrested person

Protection against arrest and detention

The Supreme Court has laid down guidelines that the police must follow at the time of arrest, detention and interrogation. The police are not allowed to torture or beat or shoot anyone during investigation. They cannot inflict any form of punishment on a person even for petty offences. 
Article 22 (protection against arrest and detention) of the Indian constitution and criminal law guarantee to every arrested person the following Fundamental Rights: 

  • The Right to be informed at the time of arrest of the offence for which the person is being arrested. 
  • The Right to be presented before a magistrate within 24 hours of arrest. 
  • The Right not to be ill treated or tortured during arrest or in custody. 
  • A person who is arrested cannot be denied to be defended by a legal practitioner of his choice. This means that the arrested person has right to hire a legal practitioner to defend himself/ herself.
  • The custody of a detained person cannot be beyond the said period by the authority of magistrate and cannot be extended without magistrate permission.
  • Article 22 (3) says that above clause doesn't apply on following:
    • To any person who for the time being is an enemy alien; or
    • To any person who is arrested or detained under any law providing for preventive detention.
The first condition above is justified, because when India is in war, the citizen of the enemy country may be arrested. But the second clause was not easy to justify by the constituent assembly.
  • Confessions made in police custody cannot be used as evidence against the accused.     


Confessions made during police custody cannot be used as evidence against the accused? 

The Supreme Court of India has laid down specific requirements and procedures that the police and other agencies have to follow for the arrest, detention and interrogation of any person. These are known as the D.K. Basu Guidelines and some of these include: 

  • The police officials who carry out the arrest or interrogation should wear clear, accurate and visible identification and name tags with their designations; 
  • A memo of arrest should be prepared at the time of arrest and should include the time and date of arrest. It should also be attested by at least one witness who could include a family member of the person arrested. The arrest memo should be counter-signed by the person arrested. 
  • The person arrested, detained or being interrogated has a right to inform a relative, friend or well-wisher. 
  • When a friend or relative lives outside the district, the time, place of arrest and venue of custody must be notified by police within 8 to 12 hours after arrest.

References:

Send Muslims to Pakistan

Supreme court of India received a worst ever petition from Mr. Sangat Singh Chauhan. Mr. Chauhan register a public interest litigation(PIL) in which he wants and demanded from government and court to send all Indian Muslims to Pakistan. No body now the intention of petitioner but it is the impact and effect of hates and violence created and supported in our society by currently ruling NDA government.
Somehow petition reached to hearing in apex court and assign to bench of  Justice Rohinton Nariman and Vineet Saran.

The bench got this plea and in its very first hearing on Friday, 15th March 2019, this case has been dismissed by the Supreme court.

Here is the conversation happen between the petitioner and honorable Justices.

According to Bar and Bench, Justice Rohinton Nariman appeared visibly upset at the plea and asked the petitioner to read it aloud in the courtroom. Once petitioner completed the reading.

Justice Nariman: “What's this? Do you really, really want to argue this case? Are you sure?” We will hear you but we will pass strictures against you.”

Petitioner: No my lord

Justice Nariman: OK, dismissed!

This petition get dismissed from bench just only in two sentences of conversation.


References:

  1. Livelaw.in | SC Dismisses PIL Seeking Direction To Send Muslims To Pakistan
  2. The News Minute | sure you want argue? SC dismisses PIL send Indian Muslims Pakistan
  3. Indiatimes | Someone Wanted To Send All Indian Muslims To Pakistan, Supreme Court Taught Him A Lesson For Life
  4. Business Standard | SC slams petitioner who wants Muslims sent to Pakistan
  5. Moneycontrol | Petition to send Indian Muslims to Pakistan gets fitting response in Supreme Court
  6. Greater Kashmir | SC slams petitioner who wants Muslims sent to Pakistan
  7. The Lallantop | YouTube

How to create an OSGi fragment project?

Hello readers, today we are going to explain how to create an OSGi fragment project using Eclipse IDE.

The first step to create OSGi fragment is to understand the need of the OSGi fragment and select a host bundle using which this OSGi fragment is going to access and resolved within your application. To understand the OSGi fragment please go through by our previous OSGi fragment posts.

Once we have the clear picture about fragment and you have opted the host bundle to register the fragment then, follow the below steps to create OSGi fragment project. For example we have a sample OSGi bundle with name "OSGitestBundle" and for this bundle we will create an OSGi fragment which helps this bundle to work as an extension of host bundle and provide additional information to host bundle. 

Step 1: Go to File >> New >> Other >> Plug-in Development >> Fragment Project and then click on the next button. 

Select OSGi fragment project from other project section in Eclipse
Select OSGi fragment project from other project section in Eclipse

Step 2: Now put a valid name OSGi fragment name in Project name text-box, and click on the next button. for example we have given project  name OSGiFragment

OSGI fragment project name
OSGi fragment project name


Step 3: In this step you will see, few fields are auto filled with the name of your OSGi fragment project, as you have given the project name in the previous step. In this step you have to add the plug-in ID information or host name information of this fragment, so this get merge with host bundle. here we will put the project name OSGitestBundle and then click on the finish button.

Plug in or host name information OSGi fragment
Plug in or host name information OSGi fragment

Step 4: Now open the project explorer in your Eclipse and open the manifest file "MANIFEST.MF" at location [Fragment-PROJECT-NAME] >> META-INF >> MANIFEST.MF
Manifest file stored at directory
Manifest file location


In manifest file you will see the following entries:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: OSGiFragmen
Bundle-SymbolicName: OSGiFragmen
Bundle-Version: 1.0.0.qualifier
Fragment-Host: OSGitestBundle
Automatic-Module-Name: OSGiFragment
Bundle-RequiredExecutionEnvironment: JavaSE-1.8

Here Fragment-Host will hold the host bundle name.

OSGi fragment bundle

What is OSGi fragment?

OSGi fragment is the java archive file or jar file or bundle, which have some classes, resource and header. The purpose of fragment to develop an extension of a bundle, which add on additional functionality and merge those functionality with host bundle at the time of host bundle is getting resolve. Before host bundle get resolved fragment appended to host. Following are the key points which we need to keep in mind while working with OSGi fragment.


  • Fragment is treated as part of the host bundles. 
  • A fragment cannot have its own class loader or bundle activator. 
  • Fragment bundle cannot override the information present in the host bundles. 
  • Both host and fragment share the same class loader from host bundle. 
  • An OSGi fragment doesn't have it life-cycle and that means we can't activate, start, stop a fragment. 
  • All classes and definition of fragment are merged with host definition when the host bundle get resolved. If the fragment dependencies cannot be resolved, the fragment does not attach to the host bundle. 
  • If any information from host and fragment conflicts then fragment will not attach and merge with host bundle. 
  • Fragments extend host bundles with resources, classes, and permitted headers. 
  • Fragments can only add new files, and does not replace or override existing files from host. 
  • OSGi fragment JAR file contains manifest file which have host bundle information. 
  • Fragment jar cannot be use independently. 
  • Fragments bundles could you attached with one or many host bundles. 


Why do we have fragments and what is the role of fragments and why we use? 


  • To provide the extra classes or additional functionality to host bundle. 
  • Add configuration files and properties.

You can create a fragment project using eclipse.

To create an OSGi fragment project in Eclipse follow the below steps:
  1. Go to File >> New >> Other >> Plug-in Development >> Fragment Project
  2. Select Fragment project and click on the next.
  3. Put a valid project name for your fragment and then click on next button.
  4. Now under the Host plun-in section, put the host bundle name in plug-in ID field.

Here is the complete step by step guide to create an OSGi fragment project using Eclipse. >> https://rashidjorvee.blogspot.com/2019/03/how-to-create-osgi-fragment-project.html

Find minimum and maximum number from a given array

This is an example code snippet to find the minimum and maximum number in a given Array using Java programming. 


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import java.util.Scanner;

public class FindMinMaxInArray {

    public static void main(String[] args) {
        int nums[]=new int[]{3, 5, 6, 2, 4, 15, 120};
        int max = 0, min= 0;
        max = min = nums[0]; 
        for (int i = 1; i < nums.length; i++) {
            if(nums[i]>max) max = nums[i];
            if(nums[i]<min) min = nums[i];
        }
        System.out.println("Minimum number is "+min + "\nMaximum number is "+max);
       
    }
}

Output:

Minimum number is 2
Maximum number is 120

Related articles:

Convert date-time from 12 to 24 hours of format

Today we are going to see, how we can convert a 12 hour time format into 24 hour(military) time format.
For example we have date like 12 Aug, 2018 07:05 PM or 04/03/1965 02:06:45 AM or just only have time 07:15:00 AM or 08:50:25 PM which we want to convert in 24 hours format and remove the AM and PM from the date.

Here I have written a simple program which help us to understand the process and what steps do we need to perform to convert a string time into 24 hours of time format. 
Below are the code snippet.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package jorvee;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class timeFormet {

 public static void main(String[] args) throws ParseException {
  String time="07:05:45 PM";
  /*
   * This dateFormat will help you to first convert your string time into DateTime format.
   */
  DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss aa");
  Date date24=dateFormat.parse(time);
  /*
   * Convert your time into 24 hours date format
   */
  DateFormat outFormat = new SimpleDateFormat( "HH:mm:ss");
  System.out.println(outFormat.format(date24));

 }
}

Output:

19:05:45