Skip to main content

Featured

Adobe Experience Manager - Create an OSGI Configuration

 In this article, let's create an OSGi configuration, configure it and use it in AEM code. So now let's get started with the creation of an OSGi configuration. Technical details and Assumptions: All the following details are tested in AEM version 6.5.8, Java version 11.0.2 Creation of OSGi configuration: To create an OSGi configuration we need to create an ObjectClassDefinition. I have included a sample OCD configuration, which can be used as a reference to create one. The next step would be to create an interface and an implementation that can help fetch the OSGi configurations.  Interface: Implementation: Let's try to use the OSGi configuration created so far in Models/Servlets. For demonstration purposes, I used AEM Models here, but the same can be implemented in Servlets too. Now that we have created the OSGi configuration. Once building the code, we should be able to see the OSGi configuration in the web console (http://localhost:4502/system/console/configMgr) C...

C program to implement the Stack ADT using Singly Linked List (SLL) with Push, Pop, Peek and Traversal Operations.

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>

struct node{
int n;
struct node *next;
};
struct node *top=NULL;

void push()
{
struct node *k;
k=(struct node*)malloc(sizeof(struct node));
if(top==NULL)
{
printf("\nEnter the element:");
scanf("%d",&k->n);
k->next=NULL;
top=k;
}
else
{
printf("\nEnter the element:");
scanf("%d",&k->n);
k->next=top;
top=k;
}
}

void pop()
{
if(top==NULL)
printf("\nThe stack is empty!!");
else
{
printf("\nThe element popped is %d",top->n);
top=top->next;
}
}

void display()
{
struct node *k;
k=(struct node*)malloc(sizeof(struct node));
printf("\nThe stack is\n");
k=top;
while(k!=NULL)
{
printf("%d\n",k->n);
k=k->next;
}
}
void isempty()
{
if(top==NULL)
printf("\nThe stack is empty!!");
}

void peek()
{
printf("\nThe peak element in the stack is %d",top->n);
}

int main()
{
int o;
while(o!=0)
{
printf("\nMENU");
printf("\n1 for PUSH");
printf("\n2 for POP");
printf("\n3 for DISPLAY");
printf("\n4 for CHECKING EMPTY");
printf("\n5 for PEEK");
printf("\n0 for EXIT");
printf("\nEnter ur choice");
scanf("%d",&o);
switch(o)
{
case 1:push();break;
case 2:pop();break;
case 3:display();break;
case 4:isempty();break;
case 5:peek();break;
case 0:exit(0);break;
default:printf("\nYou have entered a wrong choice!!!");
}
}
getch();
}

Comments

Popular Posts