<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gandharv Dalal on Medium]]></title>
        <description><![CDATA[Stories by Gandharv Dalal on Medium]]></description>
        <link>https://medium.com/@gandharvdalal123?source=rss-9244def9d457------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DreqPnKKh9F4vmnph56eEw.jpeg</url>
            <title>Stories by Gandharv Dalal on Medium</title>
            <link>https://medium.com/@gandharvdalal123?source=rss-9244def9d457------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 19 May 2026 12:22:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gandharvdalal123/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[functional calling]]></title>
            <link>https://medium.com/@gandharvdalal123/functional-calling-7c36a9aa5247?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c36a9aa5247</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 04:22:57 GMT</pubDate>
            <atom:updated>2025-06-05T04:22:57.458Z</atom:updated>
            <content:encoded><![CDATA[<p>functional calling</p><pre>package com.ukg.bi.conversationalreporting.service;<br><br>import com.google.cloud.vertexai.api.*;<br>import com.google.cloud.vertexai.generativeai.*;<br>import com.ukg.bi.conversationalreporting.configuration.ConversationalReportingConfigProperties;<br>import com.ukg.bi.conversationalreporting.configuration.SpringConfig;<br>import com.ukg.bi.conversationalreporting.constant.ConversationalReportingConstants;<br>import com.ukg.bi.conversationalreporting.dto.SummaryStreaming;<br>import com.ukg.bi.conversationalreporting.entity.AuditEntity;<br>import com.ukg.bi.conversationalreporting.sse.ResponseEmitter;<br>import com.ukg.bi.conversationalreporting.util.DateTimeUtil;<br>import com.ukg.bi.conversationalreporting.util.JsonParsingUtil;<br>import com.ultimatesoftware.bi.lookerdatatestframework.data.collection.DataCollection;<br>import lombok.extern.slf4j.Slf4j;<br>import net.logstash.logback.encoder.org.apache.commons.lang.StringEscapeUtils;<br>import org.springframework.cloud.sleuth.annotation.NewSpan;<br>import org.springframework.scheduling.annotation.Async;<br>import org.springframework.scheduling.annotation.AsyncResult;<br>import org.springframework.stereotype.Service;<br><br>import java.util.*;<br>import java.util.concurrent.CompletableFuture;<br><br>@Slf4j<br>@Service<br>public class FunctionalCallingServiceImpl implements FunctionalCallingService {<br><br>    private final ConversationalReportingConfigProperties config;<br>    private final PredictionService predictionService;<br>    private final SpringConfig springConfig;<br>    private final SummaryStreamingService summaryStreamingService;<br>    private final LocalizationService localizationService;<br>    private final FeatureFlagService featureFlagService;<br><br>    public FunctionalCallingServiceImpl(ConversationalReportingConfigProperties config,<br>                                        PredictionService predictionService,<br>                                        SpringConfig springConfig,<br>                                        SummaryStreamingService summaryStreamingService,<br>                                        LocalizationService localizationService,<br>                                        FeatureFlagService featureFlagService) {<br>        this.config = config;<br>        this.predictionService = predictionService;<br>        this.springConfig = springConfig;<br>        this.summaryStreamingService = summaryStreamingService;<br>        this.localizationService = localizationService;<br>        this.featureFlagService = featureFlagService;<br>    }<br><br>    @Async<br>    @NewSpan(&quot;functional-calling-ai-predict-summary&quot;)<br>    @Override<br>    public CompletableFuture&lt;String&gt; generateSummary(String question, DataCollection dataCollection,<br>                                                     AuditEntity auditEntity, ResponseEmitter emitter,<br>                                                     SummaryStreaming summaryStreaming, String localeCode) {<br>        auditEntity.setSummarizationStartDateTime(DateTimeUtil.getCurrentLocalDateTime());<br>        String noDataMessage = localizationService.isLocalizationEnabled()<br>                ? localizationService.getNoDataMessage(Objects.toString(localeCode, &quot;&quot;))<br>                : ConversationalReportingConstants.NO_DATA_ERROR_MESSAGE;<br><br>        if (dataCollection.getRows().isEmpty()) {<br>            auditEntity.setCfEndDateTime(DateTimeUtil.getCurrentLocalDateTime());<br>            return AsyncResult.forValue(noDataMessage).completable();<br>        }<br><br>        try {<br>            String systemInstruction = ConversationalReportingConstants.SUMMARIZATION_SYSTEM_INSTRUCTION;<br><br>            GenerativeModel model= new GenerativeModelFactory(config, springConfig, predictionService).createModel(systemInstruction);<br><br><br>            FunctionDeclaration functionDeclaration = FunctionDeclaration.newBuilder()<br>                    .setName(ConversationalReportingConstants.GENERATE_SUMMARY)<br>                    .setDescription(ConversationalReportingConstants.FUNCTION_CALLING_DESCRIPTION)<br>                    .setParameters(<br>                            Schema.newBuilder()<br>                                    .setType(Type.OBJECT)<br>                                    .putProperties(ConversationalReportingConstants.FUNCTION_CALLING_SUMMARY, Schema.newBuilder()<br>                                            .setType(Type.ARRAY)<br>                                            .setDescription(ConversationalReportingConstants.FUNCTION_CALLING_SUMMARY_DESCRIPTION)<br>                                            .setItems(Schema.newBuilder()<br>                                                    .setType(Type.STRING)<br>                                                    .build())<br>                                            .build())<br>                                    .putProperties(ConversationalReportingConstants.FUNCTION_CALLING_AREA_TO_EXPLORE, Schema.newBuilder()<br>                                            .setType(Type.ARRAY)<br>                                            .setDescription(ConversationalReportingConstants.FUNCTION_CALLING_AREA_TO_EXPLORE_DESCRIPTION)<br>                                            .setItems(Schema.newBuilder()<br>                                                    .setType(Type.STRING)<br>                                                    .build())<br>                                            .build())<br>                                    .addRequired(ConversationalReportingConstants.FUNCTION_CALLING_SUMMARY)<br>                                    .addRequired(ConversationalReportingConstants.FUNCTION_CALLING_AREA_TO_EXPLORE)<br>                                    .build())<br>                    .build();<br><br>            Tool tool = Tool.newBuilder()<br>                    .addFunctionDeclarations(functionDeclaration)<br>                    .build();<br><br>            GenerativeModel modelWithTools = model.withTools(Collections.singletonList(tool));<br>            ChatSession chat = modelWithTools.startChat();<br><br>            StringBuilder summaryPrompt = createInstance(dataCollection,localeCode,question);<br>            ResponseStream&lt;GenerateContentResponse&gt; responseStream = chat.sendMessageStream(summaryPrompt.toString());<br><br>            if (summaryStreaming.isSummaryStreamingEnabled()) {<br>                summaryStreamingService.startSummaryStreaming(responseStream, emitter, summaryStreaming);<br>            } else {<br>                responseStream.stream().forEach(response -&gt; summaryStreaming.getSummaryBuilder().append(response.getCandidates(0).getContent().getParts(0).getText()));<br>            }<br><br><br>            return AsyncResult.forValue(summaryStreaming.getSummaryBuilder().toString()).completable();<br><br><br>        } catch (Exception e) {<br>            auditEntity.setSummarizationError(ConversationalReportingConstants.VERTEX_AI_SUMMARIZATION_API_EXCEPTION + e);<br>            log.error(ConversationalReportingConstants.VERTEX_AI_SUMMARIZATION_API_EXCEPTION, e);<br>            return AsyncResult.forValue(ConversationalReportingConstants.SUMMARIZATION_NOT_FETCHED).completable();<br>        } finally {<br>            auditEntity.setSummarizationEnddateTime(DateTimeUtil.getCurrentLocalDateTime());<br>        }<br>    }<br><br>    private StringBuilder createInstance(DataCollection dataCollection, String localeCode, String question) {<br><br>        StringBuilder instance = new StringBuilder();<br><br>        if (localizationService.isLocalizationEnabled()) {<br>            instance.append(String.format(ConversationalReportingConstants.SUMMARIZATION_LOCALIZATION_PREFIX, localeCode, localeCode))<br>                    .append(&quot;\n\n&quot;);<br>        }<br>        instance.append(ConversationalReportingConstants.SUMMARIZATION_QUESTION_PROMPT)<br>                .append(question)<br>                .append(&quot;\n\n&quot;)<br>                .append(ConversationalReportingConstants.SUMMARIZATION_INSTANCE_PREFIX)<br>                .append(formatData(dataCollection))<br>                .append(ConversationalReportingConstants.CLOSED_CURLY_BRACE)<br>                .append(&quot;\n&quot;);<br><br>        return instance.append(dataCollection.getRows().size());<br>    }<br><br><br>    private static String formatData(DataCollection dataCollection) {<br>        return StringEscapeUtils.escapeJava(StringEscapeUtils.escapeJava(<br>                JsonParsingUtil.getJSONString(dataCollection)));<br>    }<br>}</pre><p>interface</p><pre>package com.ukg.bi.conversationalreporting.service;<br>import com.ukg.bi.conversationalreporting.dto.SummaryStreaming;<br>import com.ukg.bi.conversationalreporting.entity.AuditEntity;<br>import com.ukg.bi.conversationalreporting.sse.ResponseEmitter;<br>import com.ultimatesoftware.bi.lookerdatatestframework.data.collection.DataCollection;<br><br>import java.util.concurrent.CompletableFuture;<br>public interface FunctionalCallingService {<br>    CompletableFuture&lt;String&gt; generateSummary(String question, DataCollection dataCollection, AuditEntity auditEntity, ResponseEmitter emitter, SummaryStreaming summaryStreaming, String localeCode);<br><br>}</pre><p>generative model</p><pre>package com.ukg.bi.conversationalreporting.service;<br><br>import com.google.cloud.vertexai.generativeai.GenerativeModel;<br>import com.ukg.bi.conversationalreporting.configuration.ConversationalReportingConfigProperties;<br>import com.ukg.bi.conversationalreporting.configuration.SpringConfig;<br><br>import org.springframework.stereotype.Component;<br><br>@Component<br>public class GenerativeModelFactory {<br><br>    private final ConversationalReportingConfigProperties config;<br>    private final SpringConfig springConfig;<br>    private final PredictionService predictionService;<br><br>    public GenerativeModelFactory(ConversationalReportingConfigProperties config, SpringConfig springConfig,PredictionService predictionService) {<br>        this.config = config;<br>        this.springConfig = springConfig;<br>        this.predictionService = predictionService;<br>    }<br><br>    public GenerativeModel createModel(String systemInstruction) {<br>        return predictionService.generativeModel(<br>                config.getVertex().getModel(),<br>                springConfig.vertexAI(),<br>                systemInstruction<br>        );<br>    }<br>}</pre><p>constant</p><pre>// Functional calling<br>    public static final String GENERATE_SUMMARY = &quot;generateSummary&quot;;<br>    public static final String FUNCTION_CALLING_DESCRIPTION = &quot;Generate a structured summary with key points and exploration areas&quot;;<br>    public static final String FUNCTION_CALLING_SUMMARY = &quot;summary&quot;;<br>    public static final String FUNCTION_CALLING_SUMMARY_DESCRIPTION = &quot;3 key summary bullet points&quot;;<br>    public static final String FUNCTION_CALLING_AREA_TO_EXPLORE = &quot;areas_to_explore&quot;;<br>    public static final String FUNCTION_CALLING_AREA_TO_EXPLORE_DESCRIPTION = &quot;3 follow-up questions/topics in form of bullet points&quot;;<br><br><br><br><br>public static final String SUMMARIZATION_SYSTEM_INSTRUCTION = &quot;Please summarize the data in three concise points that are easy for a non-technical audience, such as a manager or CEO, to understand. &quot;<br>            + &quot;Additionally, identify three relevant areas to explore that may be important for decision-making. Be detailed and relevant to the data being summarized .\n&quot;<br>            + &quot;And make area to explore are not in the form of questions&quot;<br>            + &quot;Ensure that all numerical counts and figures are accurately reflected. Do not round or estimate numbers.\n&quot;<br>            + &quot;Use only the total records provided in the input as the definitive count for the list data question, without recalculating or adjusting.\n\n&quot;<br>            + &quot;Please follow this format exactly:\n\n&quot; +<br>            &quot;## Summary:\n&quot; +<br>            &quot;1) ...\n&quot; +<br>            &quot;2) ...\n&quot; +<br>            &quot;3) ...\n&quot; +<br>            &quot;\n&quot; +<br>            &quot;## Areas to Explore:\n&quot; +<br>            &quot;1) ...\n&quot; +<br>            &quot;2) ...\n&quot; +<br>            &quot;3) ...\n&quot;;</pre><p>Async</p><pre>package com.ukg.bi.conversationalreporting.service;<br><br>import com.ukg.bi.conversationalreporting.constant.ConversationalReportingConstants;<br>import com.ukg.bi.conversationalreporting.dto.EmbedLookResponse;<br>import com.ukg.bi.conversationalreporting.dto.SummaryStreaming;<br>import com.ukg.bi.conversationalreporting.dto.UserContextDto;<br>import com.ukg.bi.conversationalreporting.entity.AuditEntity;<br>import com.ukg.bi.conversationalreporting.exception.AsyncThreadException;<br>import com.ultimatesoftware.bi.lookerdatatestframework.data.collection.DataCollection;<br>import lombok.extern.slf4j.Slf4j;<br>import org.openapitools.client.model.Query;<br>import org.springframework.cloud.sleuth.annotation.NewSpan;<br>import org.springframework.scheduling.annotation.Async;<br>import org.springframework.scheduling.annotation.AsyncResult;<br>import org.springframework.stereotype.Service;<br><br>import java.util.Arrays;<br>import java.util.List;<br>import java.util.Map;<br>import java.util.concurrent.CompletableFuture;<br><br>@Slf4j<br>@Service<br>public class AsyncServiceImpl implements AsyncService {<br>    private final LookerAPIService lookerAPIService;<br>    private final EmbedLookService embedLookService;<br>    private final SummarizationService summarizationService;<br>    private final UserContextService userContextService;<br>    private final ExploreQueryFacade exploreQueryFacade;<br>    private final FunctionalCallingServiceImpl functionalCallingServiceImpl;<br><br>    public AsyncServiceImpl(LookerAPIService lookerAPIService, EmbedLookService embedLookService,<br>                            SummarizationService summarizationService, UserContextService userContextService, ExploreQueryFacade exploreQueryFacade, FunctionalCallingServiceImpl functionalCallingServiceImpl) {<br>        this.lookerAPIService = lookerAPIService;<br>        this.embedLookService = embedLookService;<br>        this.summarizationService = summarizationService;<br>        this.userContextService = userContextService;<br>        this.exploreQueryFacade = exploreQueryFacade;<br>        this.functionalCallingServiceImpl = functionalCallingServiceImpl;<br>    }<br><br>    @Async<br>    @NewSpan(&quot;retrieve-summary&quot;)<br>    @Override<br>    public CompletableFuture&lt;String&gt; getSummary(String nlQuestion, Query lookerQuery, AuditEntity auditEntity, DataCollection dataCollection, String localeCode) {<br>        try {<br>            String summarization = functionalCallingServiceImpl.generateSummary(nlQuestion, dataCollection, auditEntity, null, new SummaryStreaming(), localeCode).get();<br>            return AsyncResult.forValue(summarization).completable();<br>        } catch (Exception e) {<br>            log.error(&quot;Exception occurred while executing the async thread for summary.&quot;, e);<br>            throw new AsyncThreadException(ConversationalReportingConstants.ASYNC_THREAD_EXCEPTION, e);<br>        }<br>    }<br><br>    @Async<br>    @NewSpan(&quot;retrieve-looker-data-and-summary&quot;)<br>    @Override<br>    public CompletableFuture&lt;List&lt;Object&gt;&gt; retrieveLookerDataAndSummary(String nlQuestion, Query lookerQuery, Long userId, AuditEntity auditEntity, UserContextDto userContext) {<br>        try {<br>            DataCollection dataCollection = lookerAPIService.runInlineQuery(lookerQuery, userId, auditEntity).get();<br><br>            String summarization = functionalCallingServiceImpl.generateSummary(nlQuestion, dataCollection, auditEntity, null, new SummaryStreaming(), userContext.getLocaleCode()).get();<br><br>            return AsyncResult.forValue(Arrays.asList(dataCollection, summarization)).completable();<br>        } catch (Exception e) {<br>            log.error(&quot;Exception occurred while executing the async thread for looker data and summary.&quot;, e);<br>            throw new AsyncThreadException(ConversationalReportingConstants.ASYNC_THREAD_EXCEPTION, e);<br>        }<br>    }<br><br>    @Async<br>    @NewSpan(&quot;get-embed-look-response&quot;)<br>    @Override<br>    public CompletableFuture&lt;EmbedLookResponse&gt; getEmbedLookResponse(Map&lt;String, String&gt; requestHeaders, AuditEntity auditEntity, Query lookerQuery,<br>                                                                     UserContextDto userContext, Long userId) {<br>        try {<br>            return embedLookService.embedLook(requestHeaders, lookerQuery, userContext, userId, auditEntity);<br>        } catch (Exception e) {<br>            log.error(&quot;Exception occurred while executing the async thread for embed look response&quot;, e);<br>            throw new AsyncThreadException(ConversationalReportingConstants.ASYNC_THREAD_EXCEPTION, e);<br>        }<br>    }<br><br>    @Async<br>    @NewSpan(&quot;get-user-id&quot;)<br>    @Override<br>    public CompletableFuture&lt;Long&gt; getUserId(UserContextDto userContext, AuditEntity auditEntity) {<br>        try {<br>            return userContextService.getUserIdFromImpersonatedUserContext(userContext, auditEntity);<br>        } catch (Exception e) {<br>            log.error(&quot;Exception occurred while executing the async thread for user id&quot;, e);<br>            throw new AsyncThreadException(ConversationalReportingConstants.ASYNC_THREAD_EXCEPTION, e);<br>        }<br>    }<br><br>    @Async<br>    @NewSpan(&quot;get-predicted-explore-query&quot;)<br>    @Override<br>    public CompletableFuture&lt;Query&gt; getPredictedExploreQuery(String nlQuestion, String predictedExplore, String tmsTenantId, AuditEntity auditEntity) {<br>        try {<br>            return exploreQueryFacade.getExploreQueryPredictionService().predictExploreQuery(nlQuestion, auditEntity, predictedExplore, tmsTenantId);<br>        } catch (Exception e) {<br>            log.error(&quot;Exception occurred while executing the async thread for predicted explore query&quot;, e);<br>            throw new AsyncThreadException(ConversationalReportingConstants.ASYNC_THREAD_EXCEPTION, e);<br>        }<br>    }<br><br>}</pre><p>SSE</p><pre>package com.ukg.bi.conversationalreporting.service;<br><br>import com.ukg.bi.conversationalreporting.constant.ConversationalReportingConstants;<br>import com.ukg.bi.conversationalreporting.constant.FeatureFlags;<br>import com.ukg.bi.conversationalreporting.dto.ConversationalReportingResponse;<br>import com.ukg.bi.conversationalreporting.dto.ConversationalReportingResponseComponent;<br>import com.ukg.bi.conversationalreporting.dto.ConversationalReportingResponseMarkdown;<br>import com.ukg.bi.conversationalreporting.dto.ExpandableResultItem;<br>import com.ukg.bi.conversationalreporting.dto.SummaryStreaming;<br>import com.ukg.bi.conversationalreporting.dto.UserContextDto;<br>import com.ukg.bi.conversationalreporting.entity.AuditEntity;<br>import com.ukg.bi.conversationalreporting.enumeration.ExploreType;<br>import com.ukg.bi.conversationalreporting.enumeration.LaunchDarklyUserContextAttribute;<br>import com.ukg.bi.conversationalreporting.exception.StreamingException;<br>import com.ukg.bi.conversationalreporting.sse.ResponseEmitter;<br>import com.ukg.bi.conversationalreporting.util.ExploreUtils;<br>import com.ukg.bi.conversationalreporting.util.JsonParsingUtil;<br>import com.ultimatesoftware.bi.lookerdatatestframework.data.collection.DataCollection;<br>import lombok.extern.slf4j.Slf4j;<br>import org.apache.commons.lang.StringUtils;<br>import org.openapitools.client.model.Query;<br>import org.springframework.stereotype.Service;<br><br>import java.io.IOException;<br>import java.util.ArrayList;<br>import java.util.Collections;<br>import java.util.List;<br>import java.util.Map;<br>import java.util.Objects;<br>import java.util.concurrent.CompletableFuture;<br>import java.util.concurrent.CompletionException;<br>import java.util.concurrent.atomic.AtomicReference;<br>import java.util.function.Function;<br><br>@Slf4j<br>@Service<br>public class ConversationalReportingSseServiceImpl implements ConversationalReportingSseService {<br>    private final ConversationalReportingResponseService responseService;<br>    private final UserContextService userContextService;<br>    private final SummarizationService summarizationService;<br>    private final FeatureFlagService featureFlagService;<br>    private final LookerFacade lookerFacade;<br>    private final ExploreQueryFacade exploreQueryFacade;<br>    private final VertexExploreClassifierService vertexExploreClassifierService;<br>    private final LocalizationService localizationService;<br>    private final ShowCalculationService showCalculationService;<br>    private final FunctionalCallingServiceImpl functionalCallingServiceImpl;<br><br>    public ConversationalReportingSseServiceImpl(ConversationalReportingResponseService responseService, UserContextService userContextService, SummarizationService summarizationService, FeatureFlagService featureFlagService, LocalizationService localizationService, LookerFacade lookerFacade, ExploreQueryFacade exploreQueryFacade, VertexExploreClassifierService vertexExploreClassifierService, ShowCalculationService showCalculationService, FunctionalCallingServiceImpl functionalCallingServiceImpl) {<br>        this.responseService = responseService;<br>        this.lookerFacade = lookerFacade;<br>        this.userContextService = userContextService;<br>        this.summarizationService = summarizationService;<br>        this.featureFlagService = featureFlagService;<br>        this.localizationService = localizationService;<br>        this.exploreQueryFacade = exploreQueryFacade;<br>        this.vertexExploreClassifierService = vertexExploreClassifierService;<br>        this.showCalculationService = showCalculationService;<br>        this.functionalCallingServiceImpl = functionalCallingServiceImpl;<br>    }<br><br>    @Override<br>    public void process(String nlQuestion, Map&lt;String, String&gt; requestHeaders, UserContextDto userContext, AuditEntity auditEntity, ResponseEmitter emitter) {<br>        String originalNlQuestion = nlQuestion;<br>        String tmsTenantId = userContext.getTmsTenantId();<br><br>        String predictedExplore = vertexExploreClassifierService.classifyExplore(nlQuestion, auditEntity);<br>        predictedExplore = ExploreUtils.getCleanPredictedExplore(predictedExplore);<br><br>        if (predictedExplore.equals(ExploreType.REPORTING_CAPABILITIES.getValue())) {<br>            String reportingCapabilitiesExplore = localizationService.isLocalizationEnabled() ? localizationService.getReportingCapabilitiesExplore(Objects.toString(userContext.getLocaleCode(), StringUtils.EMPTY)) : ConversationalReportingConstants.REPORTING_CAPABILITIES_MESSAGE;<br>            emitter.sendData(responseService.getSummaryOnlyResponse(reportingCapabilitiesExplore));<br>            return;<br>        }<br><br>        if (predictedExplore.equals(ExploreType.OUT_OF_SCOPE.getValue())) {<br>            String outOfScopeExplore = localizationService.isLocalizationEnabled() ? localizationService.getOutOfScopeExplore(Objects.toString(userContext.getLocaleCode(), StringUtils.EMPTY)) : ConversationalReportingConstants.OUT_OF_SCOPE_ERROR_MESSAGE;<br>            emitter.sendData(responseService.getSummaryOnlyResponse(outOfScopeExplore));<br>            return;<br>        }<br><br>        auditEntity.setExploreUsed(predictedExplore);<br><br>        if (featureFlagService.isFeatureEnabled(FeatureFlags.USER_INTEGRATION_KEY_ENABLED, LaunchDarklyUserContextAttribute.TENANT_ID.getValue(), userContext.getTmsTenantId())) {<br>            userContext.setAttributes(userContextService.populateUserAttributes(userContext.getTmsTenantId(), userContext.getUserIntegrationKey(), userContext.getLocaleCode()));<br>            nlQuestion = exploreQueryFacade.getDynamicNERService().dynamicNER(userContext.getTmsTenantId(), userContext.getUserIntegrationKey(), nlQuestion, auditEntity, userContext);<br>        } else {<br>            userContext.setAttributes(userContextService.populateUserAttributes(userContext.getTmsTenantId(), userContext.getUserEeId(), userContext.getLocaleCode()));<br>            nlQuestion = exploreQueryFacade.getDynamicNERService().dynamicNER(userContext.getTmsTenantId(), userContext.getUserEeId(), nlQuestion, auditEntity, userContext);<br>        }<br>        emitter.sendProgress(ConversationalReportingConstants.DYNAMIC_NER_WEIGHTAGE);<br><br>        CompletableFuture&lt;Query&gt; queryCompletableFuture = exploreQueryFacade.getExploreQueryPredictionService().predictExploreQuery(nlQuestion, auditEntity, predictedExplore, tmsTenantId);<br><br>        CompletableFuture&lt;Long&gt; userIdCompletableFuture = userContextService.getUserIdFromImpersonatedUserContext(userContext, auditEntity);<br><br>        CompletableFuture.allOf(queryCompletableFuture, userIdCompletableFuture).join();<br><br>        Query lookerQuery = queryCompletableFuture.join();<br>        emitter.sendProgress(ConversationalReportingConstants.PREDICT_EXPLORE_QUERY_WEIGHTAGE);<br><br>        Long userId = userIdCompletableFuture.join();<br>        log.debug(&quot;NL Question: {}, Explore Query : {}, User ID : {}&quot;, nlQuestion, lookerQuery, userId);<br>        emitter.sendProgress(ConversationalReportingConstants.IMPERSONATED_USER_CONTEXT_WEIGHTAGE);<br><br>        CompletableFuture&lt;DataCollection&gt; serializedLookerResponse = null;<br><br>        boolean noDataMessageFlag = isNoDataMessageEnabled(tmsTenantId);<br>        boolean showCalculationFlag = isShowCalculationEnabled(tmsTenantId);<br>        if (noDataMessageFlag) {<br>            serializedLookerResponse = lookerFacade.getLookerAPIService().runInlineQuery(lookerQuery, userId, auditEntity);<br>        }<br><br>        SummaryStreaming summaryStreaming = new SummaryStreaming();<br>        summaryStreaming.setSummaryStreamingEnabled(featureFlagService.isFeatureEnabled(FeatureFlags.SUMMARY_STREAMING_ENABLED, LaunchDarklyUserContextAttribute.TENANT_ID.getValue(), tmsTenantId));<br><br>        CompletableFuture&lt;ConversationalReportingResponse&gt; embedFuture = embedLook(requestHeaders, auditEntity, lookerQuery, userContext, userId);<br><br>        CompletableFuture&lt;ConversationalReportingResponse&gt; summaryFuture = summarize(serializedLookerResponse, lookerQuery, userId, auditEntity, originalNlQuestion, emitter, summaryStreaming, tmsTenantId, userContext.getLocaleCode());<br><br>        CompletableFuture&lt;String&gt; showCalculationMarkdown;<br>        CompletableFuture&lt;String&gt; updatedCalculationMarkdown;<br><br>        if (showCalculationFlag &amp;&amp; !Objects.isNull(showCalculationService)) {<br>            showCalculationMarkdown = showCalculationService.predictShowCalculation(lookerQuery, userContext.getLocaleCode());<br>            updatedCalculationMarkdown = showCalculationMarkdown.thenApply(existingMarkdown -&gt;<br>                    existingMarkdown + localizationService.getCRDocuments(Objects.toString(userContext.getLocaleCode(), &quot;&quot;))<br>            );<br>        } else {<br>            updatedCalculationMarkdown = null;<br>        }<br>        if (noDataMessageFlag &amp;&amp; serializedLookerResponse.join().getRows().isEmpty()) {<br>            String noDataMessage = isLocalizationEnabled() ? localizationService.getNoDataMessage(Objects.toString(userContext.getLocaleCode(), &quot;&quot;)) : ConversationalReportingConstants.NO_DATA_ERROR_MESSAGE;<br>            emitter.sendData(responseService.getSummaryOnlyResponse(noDataMessage));<br>            if (showCalculationFlag) {<br>                sendShowCalculation(emitter, null, null, updatedCalculationMarkdown, userContext.getLocaleCode(), true);<br>                emitter.sendProgress(ConversationalReportingConstants.SHOW_CALC_WEIGHTAGE);<br>            }<br>            return;<br>        }<br>        //send the embed and summary responses in correct order<br>        AtomicReference&lt;Throwable&gt; finalExceptionRef = new AtomicReference&lt;&gt;();<br>        sendEmbedData(emitter, embedFuture, finalExceptionRef);<br>        emitter.sendProgress(ConversationalReportingConstants.EMBED_LOOK_WEIGHTAGE);<br>        sendSummaryData(emitter, embedFuture, summaryFuture, finalExceptionRef, summaryStreaming);<br>        emitter.sendProgress(ConversationalReportingConstants.SUMMARIZATION_WEIGHTAGE);<br>        if (showCalculationFlag) {<br>            sendShowCalculation(emitter, summaryFuture, finalExceptionRef, updatedCalculationMarkdown, userContext.getLocaleCode(), false);<br>            emitter.sendProgress(ConversationalReportingConstants.SHOW_CALC_WEIGHTAGE);<br>        }<br>        Throwable finalException = finalExceptionRef.get();<br>        if (finalException != null) {<br>            throw new StreamingException(&quot;Error while processing NL question&quot;, finalException);<br>        }<br>    }<br><br>    private CompletableFuture&lt;ConversationalReportingResponse&gt; summarize(CompletableFuture&lt;DataCollection&gt; serializedLookerResponse, Query lookerQuery, Long userId, AuditEntity auditEntity, String originalNlQuestion, ResponseEmitter emitter, SummaryStreaming summaryStreaming, String tmsTenantId, String localeCode) {<br>        if (isNoDataMessageEnabled(tmsTenantId)) {<br>            return functionalCallingServiceImpl.generateSummary(originalNlQuestion, serializedLookerResponse.join(), auditEntity, emitter, summaryStreaming, localeCode).thenApply(responseService::getSummaryOnlyResponse);<br>        }<br><br>        // When noDataMessageEnabled is false then this block will be executed.<br>        // Later we will remove this block when we will remove noDataMessageEnabled flag.<br>        return lookerFacade.getLookerAPIService().runInlineQuery(lookerQuery, userId, auditEntity).thenCompose(dataCollection -&gt; functionalCallingServiceImpl.generateSummary(originalNlQuestion, dataCollection, auditEntity, emitter, summaryStreaming, localeCode)).thenApply(responseService::getSummaryOnlyResponse);<br>    }<br><br>    private CompletableFuture&lt;ConversationalReportingResponse&gt; embedLook(Map&lt;String, String&gt; requestHeaders, AuditEntity auditEntity, Query lookerQuery, UserContextDto userContext, Long userId) {<br>        return lookerFacade.getEmbedLookService().embedLook(requestHeaders, lookerQuery, userContext, userId, auditEntity).thenApply(embedResponse -&gt; new ConversationalReportingResponse(Collections.singletonList(embedResponse)));<br>    }<br><br>    private static void sendEmbedData(ResponseEmitter emitter, CompletableFuture&lt;ConversationalReportingResponse&gt; embedFuture, AtomicReference&lt;Throwable&gt; finalException) {<br>        embedFuture.thenAccept(emitter::sendData).exceptionally(handleException(finalException)).join();<br>    }<br><br>    private static &lt;T&gt; Function&lt;Throwable, ? extends T&gt; handleException(AtomicReference&lt;Throwable&gt; finalException) {<br>        return e -&gt; {<br>            finalException.getAndAccumulate(e, (current, newException) -&gt; {<br>                //removing unnecessary wrapper<br>                Throwable actualNewException = newException instanceof CompletionException ? newException.getCause() : newException;<br><br>                //composing exceptions<br>                if (current == null) {<br>                    return actualNewException;<br>                } else {<br>                    current.addSuppressed(actualNewException);<br>                    return current;<br>                }<br>            });<br>            return null;<br>        };<br>    }<br><br>    private void sendSummaryData(ResponseEmitter emitter, CompletableFuture&lt;ConversationalReportingResponse&gt; embedFuture, CompletableFuture&lt;ConversationalReportingResponse&gt; summaryFuture, AtomicReference&lt;Throwable&gt; finalException, SummaryStreaming summaryStreaming) {<br><br>        if (summaryStreaming.isSummaryStreamingEnabled()) {<br>            embedFuture.whenComplete((embedResponse, e) -&gt; {<br><br>                summaryStreaming.setStartEmitting(true);<br>                summaryFuture.thenAccept((summaryResponse) -&gt; {<br>                    if (!summaryStreaming.isEmitted()) {<br>                        emitter.sendData(summaryResponse);<br>                    }<br>                }).exceptionally(handleException(finalException)).join();<br>            });<br>        } else {<br>            embedFuture.whenComplete((embedResponse, e) -&gt; summaryFuture.thenAccept(emitter::sendData).exceptionally(handleException(finalException)).join());<br>        }<br>    }<br><br>    private void sendShowCalculation(ResponseEmitter emitter, CompletableFuture&lt;ConversationalReportingResponse&gt; summaryFuture, AtomicReference&lt;Throwable&gt; finalException, CompletableFuture&lt;String&gt; showCalculationMarkdown, String localeCode, boolean isLookerResponseEmpty) {<br><br>        if (Objects.isNull(showCalculationMarkdown)) {<br>            log.debug(&quot;Calculation result is null, skipping show calculation&quot;);<br>            return;<br>        }<br><br>        try {<br>            if (isLookerResponseEmpty) {<br>                handleShowCalcFuture(emitter, showCalculationMarkdown, localeCode);<br>            } else {<br>                handleSummaryFuture(emitter, summaryFuture, finalException, showCalculationMarkdown, localeCode);<br>            }<br>        } catch (Exception e) {<br>            log.error(&quot;Error in sendShowCalculation: {}&quot;, e.getMessage(), e);<br>            finalException.compareAndSet(null, e);<br>        }<br>    }<br><br>    private void handleShowCalcFuture(ResponseEmitter emitter, CompletableFuture&lt;String&gt; showCalculationMarkdown, String localeCode) {<br>        showCalculationMarkdown.thenAccept(response -&gt; {<br>            sendCalcResponse(emitter, localeCode, response);<br>        }).exceptionally(ex -&gt; {<br>            log.error(&quot;Error in calculation result: {}&quot;, ex.getMessage(), ex);<br>            return null;<br>        }).join();<br>    }<br><br>    private void handleSummaryFuture(ResponseEmitter emitter, CompletableFuture&lt;ConversationalReportingResponse&gt; summaryFuture, AtomicReference&lt;Throwable&gt; finalException, CompletableFuture&lt;String&gt; calcResult, String localeCode) {<br><br>        summaryFuture.thenAccept(summaryResponse -&gt; {<br>            try {<br>                handleCalcResult(emitter, calcResult, localeCode);<br>            } catch (Exception e) {<br>                log.error(&quot;Error in summaryFuture.thenAccept: {}&quot;, e.getMessage(), e);<br>            }<br>        }).exceptionally(ex -&gt; {<br>            finalException.compareAndSet(null, ex);<br>            return null;<br>        });<br>    }<br><br>    private void handleCalcResult(ResponseEmitter emitter, CompletableFuture&lt;String&gt; showCalculationMarkdown, String localeCode) {<br>        showCalculationMarkdown.thenAccept(response -&gt; {<br>            sendCalcResponse(emitter, localeCode, response);<br>        }).exceptionally(ex -&gt; {<br>            log.error(&quot;Error in calculation result: {}&quot;, ex.getMessage(), ex);<br>            return null;<br>        });<br>    }<br><br>    private void sendCalcResponse(ResponseEmitter emitter, String localeCode, String response) {<br>        if (!StringUtils.isEmpty(response)) {<br>            try {<br>                List&lt;ConversationalReportingResponseComponent&gt; markdownList = buildExpandableResponse(response, localeCode);<br>                log.debug(&quot;Send Calculation is in progress and data is: {}&quot;, markdownList);<br>                emitter.sendData(new ConversationalReportingResponse(markdownList));<br>            } catch (Exception e) {<br>                log.error(&quot;Error processing calculation result: {}&quot;, e.getMessage(), e);<br>            }<br>        }<br>    }<br><br>    private List&lt;ConversationalReportingResponseComponent&gt; buildExpandableResponse(String calculationResult, String localeCode) throws IOException, IOException {<br>        List&lt;ConversationalReportingResponseComponent&gt; markdownList = new ArrayList&lt;&gt;();<br><br>        String additionalInformation = isLocalizationEnabled()<br>                ? localizationService.getAdditionalInformationHeader(Objects.toString(localeCode, &quot;&quot;))<br>                : ConversationalReportingConstants.EXPANDABLE_TITLE_DATA;<br><br>        ExpandableResultItem expandableResponse = new ExpandableResultItem();<br>        expandableResponse.setInitialState(ConversationalReportingConstants.EXPANDABLE_INITIAL_STATE);<br>        expandableResponse.setTitle(new ConversationalReportingResponseMarkdown&lt;&gt;(ConversationalReportingConstants.EXPANDABLE_TITLE_TYPE,<br>                additionalInformation));<br><br>        List&lt;ConversationalReportingResponseComponent&gt; resultList = new ArrayList&lt;&gt;();<br>        resultList.add(new ConversationalReportingResponseMarkdown&lt;&gt;(ConversationalReportingConstants.EXPANDABLE_RESULT_TYPE, calculationResult));<br>        expandableResponse.setResults(resultList);<br><br>        String jsonString = JsonParsingUtil.writeValueAsString(expandableResponse);<br>        markdownList.add(new ConversationalReportingResponseMarkdown&lt;&gt;(ConversationalReportingConstants.EXPANDABLE_TYPE, JsonParsingUtil.readTree(jsonString)));<br>        return markdownList;<br>    }<br><br>    private boolean isNoDataMessageEnabled(String tmsTenantId) {<br>        return featureFlagService.isFeatureEnabled(FeatureFlags.NO_DATA_MESSAGE_ENABLED, LaunchDarklyUserContextAttribute.TENANT_ID.getValue(), tmsTenantId);<br>    }<br><br>    private boolean isShowCalculationEnabled(String tmsTenantId) {<br>        return featureFlagService.isFeatureEnabled(FeatureFlags.SHOW_CALCULATION_ENABLED, LaunchDarklyUserContextAttribute.TENANT_ID.getValue(), tmsTenantId);<br>    }<br><br>    private boolean isLocalizationEnabled() {<br>        return featureFlagService.isFeatureEnabled(FeatureFlags.LOCALIZATION_ENABLED);<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c36a9aa5247" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managerial Round]]></title>
            <link>https://medium.com/@gandharvdalal123/managerial-round-a330811e14c2?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/a330811e14c2</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Sun, 23 Feb 2025 13:58:07 GMT</pubDate>
            <atom:updated>2025-02-24T10:46:26.102Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Question 1-&gt; Have you ever disagreed with coworkers or management?</strong></p><p>Solution -&gt; Disagreements can sometimes arise between coworkers and management. If the disagreement is with a senior colleague, I try to understand their point of view and identify any flaws in my approach to implementing a feature, as there is a reason they hold a senior position. However, if I still find the outcome unconvincing, I discuss it with my team lead.</p><p>If the issue is with my team lead — for example, if I was not given due credit for my work — I reach out to the dedicated managers responsible for employee well-being.</p><p><strong>Question 2-&gt; Can you please talk about your strengths and weaknesses?</strong></p><p>Strength -&gt; 1) <strong>Self Improvement</strong> -&gt; I am always willing to improve in all aspects by taking constructive criticism and trying to learn new things, professionally and in personal space as well.</p><p>2) <strong>I am self-aware</strong> -&gt; I acknowledge my weaknesses and work on improving them.</p><p>3) <strong>I am highly productive most days </strong>-&gt; I manage to finish my work before the deadline and focus on my physical health and social well-being.</p><p>4) <strong>I am very good at problem-solving skills</strong>.</p><p>Weakness-&gt;</p><ol><li><strong>Delegation</strong>-&gt; I am not very good at delegation work given to me, I try to finish on my own as I want to control all aspects of that feature or enhancement. I am actively improving In it through taking management courses.</li><li><strong>Giving an estimate of how much time will it take.</strong></li></ol><p>Question 3-&gt; What made you want to work for us?</p><ul><li>&gt; JAVA development.</li><li>single person doing all the work</li><li>&gt; learning curve is much better for faster growth.</li><li>&gt; will be able to work with a vast spectrum of technologies.</li></ul><p><strong>Question 4-&gt; What does success mean to you?</strong></p><p>&gt; stable job</p><p>&gt; good work culture.</p><p>&gt;Efforts are recognized.</p><p>&gt; financial, physical and mental satisfaction.</p><p><strong>Question 5-&gt; How do you prioritize work for your team and yourself?</strong></p><p>&gt; The tasks given to us are divided into priority groups.</p><p><strong>Question 6-&gt; Long-term goals?</strong></p><p>&gt; working on a product that we are building from scratch.</p><p>&gt; Learning new high-end and new in-market technologies.</p><p>&gt; leading a team.</p><p>&gt; And becoming a reliable developer, where I have knowledge of full stack , devops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Qg7nGv20ztQGlRm0Zvb3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQb6BXkCiZebY62SXvcyVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1a4G8kJsO9XA4IAtGeGGzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IkyWOuk_1FYlgGItDSnx2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4PdLUQrJOCnU86TKtTba_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNYxbkzVmBB-xT-TOltfaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYx4jmlKW61Ja6D2UWUdzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QAl5MX-2uvHPOIUHcESZ5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GbcMkK53k-KvkKqHvFha-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*rHgUxplMUjmOfKVxsnH4-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMkBfhJ4rZvv7j8INJOKyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ar06jYFzMO7oOjrAnalEBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kM_-Zc5pe265s_cvhjyvQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*C7RjX5S9gt4ZIpz3LETd3Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a330811e14c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices And RestAPI !!]]></title>
            <link>https://medium.com/@gandharvdalal123/microservices-and-restapi-c41ed4b76cd1?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/c41ed4b76cd1</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Sun, 26 Jan 2025 09:07:25 GMT</pubDate>
            <atom:updated>2025-01-26T09:07:25.634Z</atom:updated>
            <content:encoded><![CDATA[<h3>Microservices And RestAPI !!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g9SsuaP8JIvOG3mfLoI-mw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eEfVFuTYJ8ltwoR-atNIkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*1xGqit2v0ONdf2IOFXM5JA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*c_jmSYT3WHC05TvnSeE6jg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*VnxoI4qMJK95I1yMqk0R8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fdPy002tRA9jNc_T-7jfsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmDm8irbyxYxeXSTPfam1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aL9RsPO7HDzsLMTPLKXmxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BrbgLRdofs5mjhGpe-95Qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ESbJ9z3Zii6uFWf6bLUZOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5orV63CUfPX3UQQ86J2QIg.png" /></figure><p>Interview Questions:-</p><ol><li>How are RestAPI Stateless?</li></ol><p>Statefull -&gt; stores Client information on their server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*Xc1QkaIk9m5KJd9-l7OgqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*Dd1uuXDbAfoCBHSG6LupKg.png" /></figure><p>Instead, each request made by the client must have all the required information (like username and pass). This is called Stateless architecture.</p><p>2. Explain HTTP methods:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*Y28U2CvkCpnIaW8jiawUbg.png" /></figure><p>3. Explain the HTTP status code:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*8McqopUPfmVJKj8ghaZwMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*6EQCTnc59SXagwQwAia9uQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*ewAmXjIvU6BJg8BI_ERpfg.png" /></figure><p>4. What is URI?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*LY4IhdfgQMRNjFkggZ8kcQ.png" /></figure><p>5. What are the best practices in making the URI for RESTFul Web Services?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*MwYOK9sQm8APx8_v8TF6Qg.png" /></figure><p>6. What is the difference between Rest and Soap Architecture?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CWZsi6YNJ4kdLC_plsnWiQ.png" /></figure><p>7. What are the tools to test and develop Rest APIs?</p><p>POSTMAN</p><p>8. PROS and CONS of REST APIs:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zy8_MnX_WTGqOw9eSSQtYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SG78lkE8gUII0jEa6N9fg.png" /></figure><p>9. What are the core components of HTTP response?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*uYqbnuIVpdUCk-XDvwzLKQ.png" /></figure><p>Status codes indicate the success or failure of the request like 200 is for success, 400 is for client-side error and 500 is for server-side error.</p><p>HTTP version indicates the version of HTTP we are using.</p><p>The response Header contains response metadata like content type, content length, date etc.</p><p>Response Body which contains the return data.</p><p>The response should always have a response body.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c41ed4b76cd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Low-Level Design]]></title>
            <link>https://medium.com/@gandharvdalal123/low-level-design-a9314a41c8ef?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9314a41c8ef</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Sat, 18 Jan 2025 10:18:50 GMT</pubDate>
            <atom:updated>2025-01-18T10:18:50.484Z</atom:updated>
            <content:encoded><![CDATA[<p>SOLID Principles:-</p><p>S- single responsibility principle</p><p>O- Open/Close Principle</p><p>L- Liskov Substitution Principle</p><p>I- Interface Segmented Principle</p><p>D- Dependency Inversion Principle</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70Sc1s4ZEvEXsVpn0LRktQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SA88LSSxX-nJ5Db02tPXKQ.png" /></figure><p>The invoice class does not follow the single responsibility principle because it has more than reason to change. 3 reasons to change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S4Zu9EZFSAOkt_QHqn3EPg.png" /></figure><p>Correct way is →</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTi08znMvMLRm_tDCGuPBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*7X0bneMHi8_Q6gtp4DyCNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*TGsOUC1kqmB3H2bAZH0EYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AG-CQOo6FdRslwOTKiIQkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y4YMbYXbQrpt7jly3exyvQ.png" /></figure><p>the wrong way to add a feature as we should not modify the live class we should extend it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iEjc6L1g4iGDYENRfC-FBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgorUCP-Ugq24FAwGEfPIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*No7tAgLnkQLyUdAxw0Bfrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HN2P1ffxdqlWZoOyvkE21g.png" /></figure><p>Not behaving according to the Liskov principle as it is breaking the behaviour of the parent class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_qak_7-lG--G4LJFOI3tg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gmJ07Css8V7UhLgaiJL8Q.png" /></figure><p>wrong way</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nreipVtSdcbzrOKN9-V8nw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*NVBlXwJZ9YJles2aOvi_rA.png" /></figure><p>khaali vhi method define kr rha hai jo iske mtlb ke hai.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xrUVo4DZD7zfhgGVOHhu9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ClbY3Wnvwz46Wz-d39fXpg.png" /></figure><p>these are concrete classes (wrong way)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*f9EkJfp7Qj2QM3Fv1dDgdQ.png" /></figure><p>Correct way.</p><p>// how to solve Liskov problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*3ECCryWoi5q6_Wb7EIGCCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W6xumLpmPHLTtmI_S3tSQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*ZpMISuy_oPGj0iC09of_Tw.png" /></figure><p>this will create problem. As the hasEngine() function in parent class is not expecting return type null.</p><p>Solution would be to use function in parent class which are generic and common to all the child classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oq_uq1YvoA0YwMRz60MDbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3y1K7FbEVNvnHXNSRUxZPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*Q25g5-3paBeS-eYEGAmX5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*jImQKLpT-aK1gy7v9mbOSA.png" /></figure><p>Now this will not give us any sort of error.</p><p><strong>Single Responsibility Principle:-</strong></p><p>Wrong way:-</p><pre>class marker{<br><br>        public String color;<br>        public int size;<br>        public int prize;<br>        marker(String color,int size,int prize){<br>            this.color=color;<br>            this.prize=prize;<br>            this.size=size;<br>        }<br>    }<br><br>    class Invoice{<br>        marker mkr;<br>        int quantity;<br>        Invoice(marker mkr,int quantity){<br>            this.mkr=mkr;<br>            this.quantity=quantity;<br>        }<br><br>        public int calculate(marker mkr,int quantity){<br>            return mkr.prize*quantity;<br>        }<br><br>        public void saveToDB(){<br>        // saving to DB -&gt; instead of this create a seperate dao class<br><br>        }<br><br>        public void print(){<br><br>        // printing the Invoice<br><br>        }<br>    }</pre><p>Correct way:-</p><pre>class marker{<br><br>        public String color;<br>        public int size;<br>        public int prize;<br>        marker(String color,int size,int prize){<br>            this.color=color;<br>            this.prize=prize;<br>            this.size=size;<br>        }<br>    }<br><br>    class Invoice{<br>        marker mkr;<br>        int quantity;<br>        Invoice2(marker mkr,int quantity){<br>            this.mkr=mkr;<br>            this.quantity=quantity;<br>        }<br><br>        public int calculate(marker mkr,int quantity){<br>            return mkr.prize*quantity;<br>        }<br>    }<br><br>    class InvoiceDao{<br>        Invoice inv;<br><br>        InvoiceDao(Invoice inv){<br>            this.inv=inv;<br>        }<br><br>        public void saveToDB(){<br><br>        }<br>    }<br><br>    class InvoicePrint{<br>        Invoice inv;<br>        InvoicePrint(Invoice inv){<br>            this.inv=inv;<br>        }<br><br>        public void PrintDB(){<br>            <br>        }<br><br>    }</pre><p>O- Open/Close Principle</p><p>Wrong ways:-</p><pre>// before modification<br><br>class InvoiceDao{<br>        Invoice inv;<br><br>        InvoiceDao(Invoice inv){<br>            this.inv=inv;<br>        }<br><br>        public void saveToDB(){<br><br>        }<br>    }<br><br><br>// after adding new SaveTOfile feature  (modifying same class)<br><br>class InvoiceDao{<br>        Invoice inv;<br><br>        InvoiceDao(Invoice inv){<br>            this.inv=inv;<br>        }<br><br>        public void saveToDB(){<br><br>        }<br>        public void saveToFile(){<br>        }<br>    }</pre><p>Correct way:-</p><pre>// before modification<br>class InvoiceDao{<br>        Invoice inv;<br><br>        InvoiceDao(Invoice inv){<br>            this.inv=inv;<br>        }<br><br>        public void saveToDB(){<br><br>        }<br>    }<br><br><br><br>// after modification<br><br>interface InvoiceDao{<br>        public void save(Invoice2 inv);<br>    }<br><br>    class saveToDB implements InvoiceDao{<br><br>    <br>        @Override<br>        public void save(Invoice2 inv) {<br>            <br>        }<br><br>    }<br><br>    class saveToFile implements InvoiceDao{<br>        @Override<br>        public void save(Invoice2 inv) {<br>            <br>        }<br>    }</pre><p>D- Dependency Inversion Principle</p><p>wrong ways:-</p><pre>class manager{<br><br><br>        public void manageDeveloper(Developer dev){<br><br>        }<br>        public void manageTester(Tester tr){<br>        }<br>    }<br><br><br>    class Developer{<br><br>    }<br>    <br>    class Tester{<br><br>    }</pre><p>If we want to add a new kind of role then we need to update the manager class as well(a new function needs to be written).</p><p>Correct way:-</p><pre>class manager{<br><br><br>        public void manageEmployee(Employee employee){<br><br>        }<br>        <br>    }<br><br>    public interface Employee {<br>    <br>        <br>    }<br>    class Developer implements Employee{<br><br>    }<br>    <br>    class Tester implements Employee{<br><br>    }</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9314a41c8ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MultiThreading Interview Questions:-]]></title>
            <link>https://medium.com/@gandharvdalal123/multithreading-interview-questions-d45e177ca197?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/d45e177ca197</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Sat, 05 Oct 2024 17:35:15 GMT</pubDate>
            <atom:updated>2024-10-05T17:39:23.592Z</atom:updated>
            <content:encoded><![CDATA[<ol><li><strong>What do you mean by Multithreading? Why is it important?</strong></li></ol><p>It is the ability of a CPU to execute multiple threads independently at the same time but share the process resources simultaneously. Its main purpose is to provide simultaneous execution of multiple threads to utilize the CPU time as much as possible. It is a Java feature where one can subdivide the specific program into two or more threads to make the execution of the program fast and easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mDiEq8OzuF7V2CED" /></figure><p><strong>2. What is the difference between run() and start() ?</strong></p><p><strong>start()- &gt; new thread is created + run()</strong></p><p><strong>start()</strong>: In simple words, the start() method is used to start or begin the execution of a newly created thread. When the start() method is called, a new thread is created and this newly created thread executes the task that is kept in the run() method. One can call the start() method only once.</p><p><strong>run()</strong>: In simple words, the run() method is used to start or begin the execution of the same thread. When the run() method is called, no new thread is created as in the case of the start() method. This method is executed by the current thread. One can call the run() method multiple times.</p><p><strong>3. What is Thread in Java?</strong></p><p>Threads are basically the lightweight and smallest unit of processing that can be managed independently by a scheduler. Threads are referred to as parts of a process that simply let a program execute efficiently with other parts or threads of the process at the same time.</p><p>4. <strong>What are the two ways of implementing thread in Java?</strong></p><p>There are basically two ways of implementing thread in java as given below:-</p><p>a. Extending the <strong>Thread</strong> class</p><p>b. Implementing <strong>Runnable</strong> interface in Java</p><p><strong>5. What’s the difference between thread and proces</strong>s?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*qREdMJVE8Qp8gnfoeOgWng.png" /></figure><p><strong>6. What’s the difference between class lock and object lock?</strong></p><p><strong>Object Lock:</strong></p><ul><li><strong>Locks a specific object (instance) of a class.</strong></li><li>When a thread holds the object lock, other threads can’t access synchronized instance methods on the same object.</li></ul><pre>public class MyClass {<br>    public synchronized void instanceMethod() {<br>        // Only one thread can access this method per object<br>    }<br>}</pre><p><strong>Class Lock:</strong></p><ul><li><strong>Locks the entire class, not just one instance.</strong></li><li>When a thread holds the class lock, no thread can access synchronized static methods across all instances.</li></ul><pre>public class MyClass {<br>    public static synchronized void staticMethod() {<br>        // Only one thread can access this method for the entire class<br>    }<br>}</pre><p><strong>Key Difference:</strong></p><ul><li><strong>Object Lock</strong>: For instance methods, locks per object.</li><li><strong>Class Lock</strong>: For static methods, locks the entire class.</li></ul><p><strong>7. What are the wait() and sleep() methods?</strong></p><p><strong>wait()</strong>: As the name suggests, it is a non-static method that causes the current thread to wait and go to sleep until some other threads call the notify () or notifyAll() method for the object’s monitor (lock). It simply releases the lock and is mostly used for inter-thread communication. It is defined in the object class, and should only be called from a synchronized context.</p><p><strong>sleep()</strong>: As the name suggests, it is a static method that pauses or stops the execution of the current thread for some specified period. It doesn’t release the lock while waiting and is mostly used to introduce a pause on execution. It is defined in the thread class, and no need to call from a synchronized context.</p><p><strong>8. Difference between Notify() and NotifyAll();</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*12ulB9406xAPB86Qoh7HJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TRxIkGPo5qFybHTewjQlqA.png" /></figure><p><strong>9. What is Runnable and Callable Interface? Write the difference between them.</strong></p><p>Both interfaces are generally used to encapsulate tasks that are needed to be executed by another thread.</p><p><strong>Running Interface</strong>: This interface is basically available in Java right from the beginning. It is simply used to execute code on a concurrent thread. <br><strong>Callable Interface</strong>: This interface is basically a new one that was introduced as a part of the concurrency package. It addresses the limitation of runnable interfaces along with some major changes like generics, enum, static imports, variable argument methods, etc. It uses generics to define the return type of object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7VITyG3r0wdEkecW6pRwow.png" /></figure><p>10.<strong> Name the method that is used to register a thread in a thread scheduler.</strong></p><p>Ans-&gt; start()</p><p>11.<strong> What is Thread pool ?</strong></p><p>A Thread pool is simply a collection of pre-initialized or worker threads at the start-up that can be used to execute tasks and put back in the pool when completed. It is referred to as pool threads in which a group of fixed-size threads is created. By reducing the number of application threads and managing their lifecycle, one can mitigate the issue of performance using a thread pool. Using threads, performance can be enhanced and better system stability can occur. To create the thread pools, java.util.concurrent.Executors class usually provides factory methods.</p><p><strong>12. DeadLock Example ?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*wMtLdWHaKdCcvlAM" /></figure><p><strong>13. Explain volatile variables in Java?</strong></p><p>This keyword cannot be used with classes and methods, instead can be used with variables. It is simply used to achieve thread-safety. If you mark any variable as volatile, then all the threads can read its value directly from the main memory rather than CPU cache, so that each thread can get an updated value of the variable.</p><p><strong>14. How do threads communicate with each other?</strong></p><p>Threads can communicate using three methods i.e., wait(), notify(), and notifyAll().</p><p><strong>15. Can two threads execute two methods (static and non-static concurrently)?</strong></p><p>Yes, it is possible. If both the threads acquire locks on different objects, then they can execute concurrently without any problem</p><p><strong>16. What is the purpose of the finalize() method?</strong></p><p>The finalize () method is a method of Object class specially used to perform cleanup operations on unmanaged resources just before garbage collection. It is not at all intended to be called a normal method. After the complete execution of the finalize() method, the object gets destroyed automatically.</p><p><strong>17. What is ConcurrentHashMap and Hashtable? In Java, why is ConcurrentHashMap considered faster than Hashtable?</strong></p><p>ConcuurentHashMap:- Does not lock whole map(Avoids read locks)</p><p>HashTable:- Locks whole HashMap.</p><p><strong>ConcurrentHashMap</strong>: it allows concurrent read and write operations to the map. It only locks a certain portion of the map while doing iteration to provide thread safety so that other readers can still have access to the map without waiting for iteration to complete.</p><p><strong>Hashtable</strong>: It does not provide any lock-free read, unlike ConcurrentHashMap. It just locks the entire map while doing iteration.</p><p>ConcurrentHashMap and Hashtable, both are thread-safe but ConcurrentHashMap generally avoids read locks and improves performance, unlike Hashtable. ConcurrentHashMap also provides lock-free reads, unlike Hashtable. Therefore, ConcurrentHashMap is considered faster than Hashtable especially when the number of readers is more as compared to the number of writers.</p><p>18. <strong>What is Thread Starvation?</strong></p><p>Thread starvation is basically a situation or condition where a thread won’t be able to have regular access to shared resources and therefore is unable to proceed or make progress. This is because other threads have high priority and occupy the resources for too long. This usually happens with low-priority threads that do not get CPU for its execution to carry on.</p><p><strong>19. What is Livelock? What happens when it occurs?</strong></p><p>Similar to deadlock, livelock is also another concurrency problem. In this case, the state of threads changes between one another without making any progress. Threads are not blocked but their execution is stopped due to the unavailability of resources.</p><p><strong>20. Can you start a thread twice?</strong></p><p>No, it’s not at all possible to restart a thread once a thread gets started and completes its execution. Thread only runs once and if you try to run it for a second time, then it will throw a runtime exception i.e., java.lang.IllegalThreadStateException.</p><p><strong>21. What is context switching ?</strong></p><p>It is referred to as switching of CPU from one thread or process to another one. It allows multiple processes to share the same CPU. In context switching, the state of thread or process is stored so that the execution of the thread can be resumed later if required.</p><p><strong>22. What are Cyclic Barrier and CountDown Latch?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*llNOMEe_pv_o2kBp" /></figure><p>Both are required for managing multithreaded programming.</p><p><strong>CountDownLatch -</strong></p><p>a. Enables main threads to wait until mandatory operations are performed and completed by other threads.</p><p>b. It makes sure that a thread waits until the execution in another thread is complete before it starts its execution.</p><p>c. One cannot reuse the same CountDownLatch once the count reaches 0.</p><p><strong>Cyclic Barrier-</strong></p><p>a. A <strong>CyclicBarrier</strong> in Java is a synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point. It’s useful when you want to coordinate actions across multiple threads. Once all threads have reached the barrier, they are allowed to proceed.</p><p>b. Unlike CountDownLatch, a CyclicBarrier can be reused after the waiting threads are released.</p><p><strong>23 . What is Thread Scheduler and Time Slicing?</strong></p><p><strong>Thread Scheduler</strong>: It is a component of JVM that is used to decide which thread will execute next if multiple threads are waiting to get the chance of execution. By looking at the priority assigned to each thread that is READY, the thread scheduler selects the next run to execute. To schedule the threads, it mainly uses two mechanisms: Preemptive Scheduling and Time slicing scheduling.</p><p><strong>Time Slicing</strong>: It is especially used to divide CPU time and allocate them to active threads. In this, each thread will get a predefined slice of time to execute. When the time expires, a particular thread has to wait till other threads get their chances to use their time in a round-robin fashion. Every running thread will get executed for a fixed time period.</p><p><strong>24. What is a shutdown hook?</strong></p><p>A shutdown hook is simply a thread that is invoked implicitly before JVM shuts down. It is one of the most important features of JVM because it provides the capacity to do resource cleanup or save the application state when JVM shuts down. By calling the halt(int) method of the Runtime class, the shutdown hook can be stopped. Using the following method, one can add a shutdown hook.</p><p><strong>25. What is busy spinning?</strong></p><p><strong>26 . What will happen if we don’t override the thread class run() method?</strong>Nothing will happen as such if we don’t override the run() method. The compiler will not show any error. It will execute the run() method of the thread class and we will just don’t get any output because the run() method is with an empty implementation.</p><p><strong>27. Is it possible to call the run() method directly to start a new thread?</strong></p><p>No, it’s not possible at all. You need to call the start method to create a new thread otherwise run method won’t create a new thread. Instead, it will execute in the current thread.</p><p><strong>28. Is it possible that each thread can have its stack in multithreaded programming?</strong></p><p>Of course, it is possible. In multithreaded programming, each thread maintains its own separate stack area in memory because of which every thread is independent of each other rather than dependent.</p><p><strong>29. What is the synchronization process? Why use it?</strong></p><p>Synchronization is basically a process in Java that enables a simple strategy for avoiding thread interference and memory consistency errors. This process makes sure that resources will be only used one thread at a time when one thread tries to access a shared resource. It can be achieved in three different ways as given below:</p><ul><li>The synchronized method</li><li>By synchronized block</li><li>By static synchronization</li></ul><p><strong>30. What is the lock interface? Why is it better to use a lock interface rather than a synchronized block.?</strong></p><p>The <strong>Lock</strong> interface in Java, introduced in <strong>Java 5</strong> as part of the java.util.concurrent.locks package, provides a more flexible and sophisticated locking mechanism compared to the traditional synchronized blocks or methods. It offers greater control over lock acquisition and release and allows features that synchronized blocks can&#39;t provide.</p><p><strong>Key Methods of the Lock Interface:</strong></p><ol><li><strong>lock()</strong>: Acquires the lock if it is available. If not, it waits until the lock is released.</li><li><strong>unlock()</strong>: Releases the lock.</li></ol><p><strong>31. What is a semaphore?</strong></p><p>A lock with several permits. A classical lock can give access to the block of code it protects to only one thread at a time. A semaphore can give access to several threads. You can create a semaphore by giving it a number of permits then you can use it to protect a block of code, the thread needs the permit to execute the protected code. And if there is none available, then it blocks until there is one.Dont forget to release your permit in a finally block. Semaphores are useful when you need to limit the number of threads that can excess the external resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*DM-2uBuIBoi4APEsG2vN7g.png" /></figure><p>Semaphore is regarded as a thread synchronization construct that is usually required to control and manage the access to the shared resource using counters. It simply sets the limit of the thread. Can be used to send signals between threads to avoid missed signals or to guard critical sections.</p><p><strong>32. Explain Thread Priority</strong></p><p>Thread priority simply means that threads with the highest priority will get a chance for execution prior to low-priority threads. One can specify the priority but it’s not necessary that the highest priority thread will get executed before the lower-priority thread. The thread scheduler assigns the processor to the thread on the basis of thread priority. The range of priority changes between 1–10 from lowest priority to highest priority.</p><p><strong>33. What is synchronized method and synchronized block? Which one should be preferred?</strong></p><p>In Java, both <strong>synchronized methods</strong> and <strong>synchronized blocks</strong> are used to control access to critical sections of code in a multithreaded environment, ensuring that only one thread can execute a block of code at a time for a specific object or class. However, they differ in terms of granularity, flexibility, and performance.</p><ol><li>Synchronized Method:</li></ol><p>A <strong>synchronized method</strong> locks the entire method, allowing only one thread at a time to execute it on a given object instance (for instance methods) or on the class (for static methods). It can be applied by adding the synchronized keyword to the method declaration.</p><pre>public synchronized void performTask() {<br>    // Critical section: Only one thread can execute this method at a time<br>    System.out.println(Thread.currentThread().getName() + &quot; is performing task.&quot;);<br>}</pre><p>2. Synchronized Block:</p><p>A <strong>synchronized block</strong> provides more fine-grained control over synchronization. Instead of locking the entire method, you can lock only a part of it. This allows more flexibility, as you can synchronize only the critical section of the code that needs protection, leaving other parts of the method to be executed by multiple threads concurrently.</p><pre>public void performTask() {<br>    System.out.println(Thread.currentThread().getName() + &quot; is performing task.&quot;);<br><br>    synchronized (this) { // Only this block is synchronized<br>        // Critical section: Only one thread can execute this block at a time<br>        System.out.println(Thread.currentThread().getName() + &quot; is in synchronized block.&quot;);<br>    }<br><br>    System.out.println(Thread.currentThread().getName() + &quot; is continuing task.&quot;);<br>}</pre><p><strong>34. What is busy spinning?</strong></p><p><strong>Busy spinning</strong> (or busy waiting) is a technique where a thread continuously checks a condition in a loop without releasing the CPU. It wastes CPU resources as the thread consumes cycles while waiting, instead of sleeping or being blocked.</p><p><strong>When to use:</strong></p><ul><li>Low-latency critical sections.</li><li>When the expected wait time is extremely short.</li></ul><p><strong>Downsides:</strong></p><ul><li>Wastes CPU cycles and energy.</li><li>Not scalable, inefficient for longer waits.</li></ul><p><strong>35. Can we Overload run() method?</strong></p><p>Yes, it is possible to overload run() by passing parameters to it and also keeping a check over to comment down @override from the run() method.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d45e177ca197" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MultiThreading]]></title>
            <link>https://medium.com/@gandharvdalal123/multithreading-5a6da5f9b4f6?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a6da5f9b4f6</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Fri, 04 Oct 2024 04:01:49 GMT</pubDate>
            <atom:updated>2024-10-04T04:01:49.506Z</atom:updated>
            <content:encoded><![CDATA[<ol><li><strong>Multithreading is used to achieve multitasking.</strong></li><li><strong>Multitasking is a way to do multiple activities concurrently on a computer.</strong></li><li><strong>Multitasking is of two types(Thread based and Process-based)</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*lWtatUh6LIJH8PzZ.png" /></figure><h3><strong>4. Multiple threads within the same process share the same memory space.</strong></h3><p>Shared Memory Space</p><ul><li><strong>Process and Threads</strong>: A process is an instance of a running program and has its own memory space (address space). Threads, on the other hand, are smaller units of execution that belong to a process.</li><li><strong>Threads within a Process</strong>: All threads within the same process share the same memory space, which includes:</li><li><strong>Heap memory</strong>: Where dynamically allocated objects live. For example, if one thread allocates memory on the heap, another thread can access it.</li><li><strong>Global variables</strong>: Any global variables declared in the program are accessible by all threads.</li><li><strong>Static variables</strong>: Similarly, static variables (variables defined with static keywords) are shared among threads.</li></ul><p>Example:-</p><pre>public class SharedMemoryExample {<br>    private static int count = 0;<br><br>    public static void main(String[] args) {<br>        Thread t1 = new Thread(() -&gt; {<br>            for (int i = 0; i &lt; 1000; i++) {<br>                count++;  // Shared memory access<br>            }<br>        });<br><br>        Thread t2 = new Thread(() -&gt; {<br>            for (int i = 0; i &lt; 1000; i++) {<br>                count++;  // Shared memory access<br>            }<br>        });<br><br>        t1.start();<br>        t2.start();<br><br>        // Wait for both threads to finish<br>        try {<br>            t1.join();<br>            t2.join();<br>        } catch (InterruptedException e) {<br>            e.printStackTrace();<br>        }<br><br>        System.out.println(&quot;Final count is: &quot; + count);<br>    }<br>}</pre><p><strong>Synchronization Needed</strong>: Sharing memory between threads requires careful synchronization, especially when multiple threads modify the same data. Without synchronization, it can lead to race conditions, where the outcome depends on the timing of thread execution.</p><h3><strong>Thread-local Storage (Separate Memory)</strong></h3><p>Even though threads share memory space, they also have their <strong>own private memory.</strong></p><p>ThreadLocal is a class in Java used to create variables that are local to a thread. Each thread accessing such a variable has its own, independent copy. It helps avoid synchronization and can be useful in scenarios where each thread needs its own state or data that is not shared with others.</p><p><strong>Stack</strong>: Each thread has its own stack memory for local variables and method calls. So, two threads can call the same method and have their own local variables without interference.</p><p>For example, two threads may both call a function, but their local variables are stored separately on their respective stacks.</p><p>5. <strong>Why MultiThreading?</strong></p><p>To properly utilize multi-core CPUs.</p><p>6. <strong>What is Thread?</strong></p><p>A thread is an independent sequential path of execution with a program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*-m8oeDGQOjku7jH1.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*3Ex0fjccUB6Gd4Mo.png" /></figure><h3>5.<strong> Daemon thread</strong></h3><p>A <strong>daemon thread</strong> in Java (and in many other programming environments) is a special type of thread that runs in the background and does not prevent the JVM (Java Virtual Machine) from exiting when all the user (non-daemon) threads finish execution.</p><p>Key Characteristics of Daemon Threads:</p><ol><li><strong>Background Threads</strong>: Daemon threads are typically used to perform background tasks that support the running of the program, such as garbage collection, monitoring, or waiting for events to happen.</li><li><strong>No JVM Blocking</strong>: The JVM does not wait for daemon threads to finish before exiting. When all user threads complete, the JVM will terminate, and all daemon threads will be abruptly stopped, even if they are in the middle of execution.</li><li><strong>Examples in Java</strong>:</li></ol><ul><li><strong>Garbage Collector</strong>: The garbage collection thread is a daemon thread. It runs in the background to free memory that is no longer used by the application.</li><li><strong>Other System Tasks</strong>: Any thread that performs maintenance tasks, like cleaning up resources or monitoring, is typically implemented as a daemon thread.</li></ul><p><strong>How to Create a Daemon Thread in Java:-</strong></p><pre>public class DaemonThreadExample {<br>    public static void main(String[] args) {<br>        Thread daemonThread = new Thread(() -&gt; {<br>            while (true) {<br>                System.out.println(&quot;Daemon thread running...&quot;);<br>                try {<br>                    Thread.sleep(1000);<br>                } catch (InterruptedException e) {<br>                    e.printStackTrace();<br>                }<br>            }<br>        });<br><br>        // Set the thread as a daemon<br>        daemonThread.setDaemon(true);<br>        <br>        daemonThread.start();<br>        <br>        // Main thread sleeps for 3 seconds, after which the JVM will exit<br>        // Daemon thread will not prevent the JVM from exiting<br>        try {<br>            Thread.sleep(3000);<br>        } catch (InterruptedException e) {<br>            e.printStackTrace();<br>        }<br>        <br>        System.out.println(&quot;Main thread finished, JVM will exit now.&quot;);<br>    }<br>}</pre><pre>Daemon thread running...<br>Daemon thread running...<br>Daemon thread running...<br>Main thread finished, JVM will exit now.</pre><p><strong>Differences Between User Threads and Daemon Threads:</strong></p><p><strong>JVM Behavior</strong>:</p><ul><li>User threads keep the JVM running until they finish.</li><li>Daemon threads do not prevent the JVM from exiting.</li></ul><p><strong>Lifecycle</strong>:</p><ul><li>Daemon threads can be terminated by the JVM abruptly when no user threads are running.</li><li>User threads complete their execution normally unless explicitly terminated.</li></ul><p><strong>Typical Use Cases</strong>:</p><ul><li>Daemon threads are typically used for background tasks that do not affect the core logic of the application (e.g., logging, system monitoring, garbage collection).</li><li>User threads are meant for the primary logic of the application.</li></ul><p><strong>When to Use Daemon Threads:</strong></p><ul><li>Daemon threads are useful when you need continuous background processing but don’t want those tasks to block the program from exiting. However, you need to be cautious when using them, as they can be terminated abruptly, potentially leaving tasks incomplete.</li></ul><h3>6. Thread Creation.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*M2bjVjBHeh0FSiEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*HypCSr-Wl4W0nPWM.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/0*tPb-GfGhTNkBhhVm.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/0*7Gu_dCgi3bZhaWmd.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*n2CqetjgSTZ5rKUa.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*D4-JEN_8umjEnE4U.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*abNbWnXiOM5KDn1n.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/0*oK0X5YJrXjDoO5ST.png" /></figure><p>7. Synchronization ()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*QXJaO9G4T1zNDTnU.png" /></figure><p>Synchronization is a mechanism that ensures that only one thread can access a shared resource at a time. This is particularly useful when multiple threads try to modify or access shared data concurrently, preventing inconsistent results or corrupted data.</p><p>Java provides various ways to synchronize threads:</p><ol><li><strong>Synchronized Methods</strong> — Synchronize a method so that only one thread can execute it at a time.</li><li><strong>Synchronized Blocks</strong> — Synchronize a block of code within a method.</li><li><strong>Static Synchronization</strong> — Used for static methods.</li></ol><pre>class Counter {<br>    private int count = 0;<br><br>    // Synchronized method to ensure thread safety<br>    public synchronized void increment() {<br>        count++;<br>    }<br><br>    public int getCount() {<br>        return count;<br>    }<br>}<br><br>class MyThread extends Thread {<br>    Counter counter;<br><br>    MyThread(Counter counter) {<br>        this.counter = counter;<br>    }<br><br>    public void run() {<br>        for (int i = 0; i &lt; 1000; i++) {<br>            counter.increment();<br>        }<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) throws InterruptedException {<br>        Counter counter = new Counter();<br><br>        // Creating two threads that will work on the same counter object<br>        MyThread t1 = new MyThread(counter);<br>        MyThread t2 = new MyThread(counter);<br><br>        // Start both threads<br>        t1.start();<br>        t2.start();<br><br>        // Wait for both threads to finish<br>        t1.join();<br>        t2.join();<br><br>        // Output the final count value<br>        System.out.println(&quot;Final count: &quot; + counter.getCount());<br>    }<br>}</pre><p>In the above case instance of a class, it acts as a lock which is the same for all the functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*drY50hAo1GiDeMor.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kwQknxyDTtnEg63f.png" /></figure><p>We can make any object a lock;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*lErHPlq6Q7WfHtM4.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*12kuoHLMoEZvkxk9.png" /></figure><h3>8. Thread Safety</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*dqdbbBwKWl4x3bnl.png" /></figure><p><strong>Thread safety</strong> in Java refers to the concept of ensuring that shared data or resources are accessed by multiple threads without causing concurrency issues, such as race conditions, inconsistent data, or unpredictable results. A class or method is said to be thread-safe if it behaves correctly when accessed by multiple threads simultaneously.</p><pre>ThreadLocal&lt;Integer&gt; threadLocalValue = new ThreadLocal&lt;&gt;();<br>threadLocalValue.set(100);  // Each thread has its own copy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/0*-8Sb6CmBje5gDZBi.png" /></figure><p><strong>9. Wait() and NotifyAll() and Notify()</strong></p><p>wait() and notifyAll() (along with notify()) are methods used to coordinate the execution of threads. These methods are part of the <strong>Object</strong> class and are typically used when multiple threads need to communicate with each other, especially in producer-consumer type problems.</p><p><strong>Concepts of </strong><strong>wait() and </strong><strong>notifyAll():</strong></p><p><strong>wait()</strong>:</p><ul><li>When a thread calls wait() on an object, it enters the <strong>waiting state</strong> and releases the intrinsic lock (monitor) it holds on that object.</li><li>The thread stays in this state until another thread calls notify() or notifyAll() on the same object.</li><li>The wait() method must be called within a synchronized block or method, otherwise, it will throw an IllegalMonitorStateException.</li></ul><p><strong>notifyAll()</strong>:</p><ul><li>When a thread calls notifyAll() on an object, it <strong>wakes up all the threads</strong> that are waiting on that object’s monitor.</li><li>The threads that are notified will not resume until they can reacquire the lock on the object.</li><li>Only one thread will proceed to execute the synchronized block, while the others will continue waiting.</li></ul><p><strong>notify()</strong>:</p><ul><li>Similar to notifyAll(), but only <strong>one</strong> thread waiting on the object’s monitor will be notified.</li></ul><p>Example: Producer-Consumer with wait() and notifyAll()</p><pre>import java.util.LinkedList;<br>import java.util.Queue;<br><br>class Buffer {<br>    private Queue&lt;Integer&gt; queue = new LinkedList&lt;&gt;();<br>    private int capacity = 5; // Maximum capacity of the buffer<br><br>    // Producer adds an item to the buffer<br>    public synchronized void produce(int value) throws InterruptedException {<br>        while (queue.size() == capacity) {<br>            System.out.println(&quot;Buffer is full. Producer is waiting...&quot;);<br>            wait(); // Wait until space is available<br>        }<br>        queue.add(value);<br>        System.out.println(&quot;Produced: &quot; + value);<br>        notifyAll(); // Notify all consumers that new data is available<br>    }<br><br>    // Consumer removes an item from the buffer<br>    public synchronized int consume() throws InterruptedException {<br>        while (queue.isEmpty()) {<br>            System.out.println(&quot;Buffer is empty. Consumer is waiting...&quot;);<br>            wait(); // Wait until data is available<br>        }<br>        int value = queue.poll();<br>        System.out.println(&quot;Consumed: &quot; + value);<br>        notifyAll(); // Notify the producer that space is available<br>        return value;<br>    }<br>}<br><br>class Producer extends Thread {<br>    private Buffer buffer;<br><br>    Producer(Buffer buffer) {<br>        this.buffer = buffer;<br>    }<br><br>    public void run() {<br>        try {<br>            int value = 0;<br>            while (true) {<br>                buffer.produce(value++);<br>                Thread.sleep(1000); // Simulating time taken to produce<br>            }<br>        } catch (InterruptedException e) {<br>            e.printStackTrace();<br>        }<br>    }<br>}<br><br>class Consumer extends Thread {<br>    private Buffer buffer;<br><br>    Consumer(Buffer buffer) {<br>        this.buffer = buffer;<br>    }<br><br>    public void run() {<br>        try {<br>            while (true) {<br>                buffer.consume();<br>                Thread.sleep(1500); // Simulating time taken to consume<br>            }<br>        } catch (InterruptedException e) {<br>            e.printStackTrace();<br>        }<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) {<br>        Buffer buffer = new Buffer();<br><br>        // Create one producer and one consumer thread<br>        Producer producer = new Producer(buffer);<br>        Consumer consumer = new Consumer(buffer);<br><br>        producer.start();<br>        consumer.start();<br>    }<br>}</pre><p>10. Thread States</p><pre>+-------------+<br>|    NEW      |  -- start() --&gt;  +-------------+<br>+-------------+                  |  RUNNABLE   |<br>                                 +-------------+<br>                                    ^      |<br>                                 waiting for resources<br>                                    |      v<br>                               +-------------+<br>                  waiting for  |  BLOCKED    |<br>                    lock       +-------------+<br>                                    |<br>                                    v<br>                                +-------------+<br>          notify() or join()    |   WAITING   |<br>              or timeout        +-------------+<br>                                    |  Timeout or notify()<br>                                    v<br>                                +-------------+<br>                                | TIMED_WAITING|<br>                                +-------------+<br>                                    |<br>                                    v<br>                               +-------------+<br>                               | TERMINATED  |<br>                               +-------------+</pre><p><strong>Explanation of Transitions:</strong></p><ol><li><strong>NEW to RUNNABLE</strong>: When the thread is started using the start() method.</li><li><strong>RUNNABLE to BLOCKED</strong>: When a thread tries to enter a synchronized block or method but another thread is already holding the lock.</li><li><strong>RUNNABLE to WAITING</strong>: When a thread calls Object.wait() or Thread.join() on another thread without a timeout.</li><li><strong>RUNNABLE to TIMED_WAITING</strong>: When a thread calls methods like sleep(), join(long timeout), or wait(long timeout).</li><li><strong>WAITING/TIMED_WAITING to RUNNABLE</strong>: When the waiting time has expired, or another thread calls notify(), notifyAll(), or the join() finishes.</li><li><strong>RUNNABLE to TERMINATED</strong>: When the thread completes its execution, either naturally or due to an uncaught exception.</li></ol><p>11. Yield();</p><ul><li><strong>yield()</strong> is a method in Java’s Thread class that suggests to the thread scheduler that the current thread is willing to yield its current CPU usage to give other threads a chance to run.</li><li>When a thread calls yield(), it transitions from the <strong>Running</strong> state back to the <strong>Runnable</strong> state, allowing other threads of equal or higher priority to execute.</li><li>It’s important to note that yield() <strong>does not guarantee</strong> that the current thread will stop executing immediately. It is merely a hint to the scheduler, and the actual behaviour depends on the thread scheduler (which is platform-dependent).</li></ul><pre>class MyThread extends Thread {<br>    public void run() {<br>        for (int i = 1; i &lt;= 5; i++) {<br>            System.out.println(Thread.currentThread().getName() + &quot; is running: &quot; + i);<br>            Thread.yield(); // Suggests yielding the CPU to other threads<br>        }<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) {<br>        MyThread t1 = new MyThread();<br>        MyThread t2 = new MyThread();<br><br>        t1.start(); // t1 starts and enters the RUNNABLE state<br>        t2.start(); // t2 starts and enters the RUNNABLE state<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*UaQ-WvvTKXWK20x-.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_RGLwpwvRnJcOfJ0.png" /></figure><p><strong>12. TimeOut (wait has two either the condition is met or timeout but In Join only looks for timeout)</strong></p><p><strong>Timeout</strong> refers to setting a maximum waiting time for certain operations or threads.</p><p><strong>Purpose:</strong></p><p>Timeouts help avoid <strong>indefinite blocking</strong>, ensuring that threads or operations don’t wait forever, improving performance and preventing deadlocks.</p><ul><li><strong>Thread Join Timeout (</strong><strong>join(long millis))</strong>:</li><li>A thread waits for another to finish but only for the specified time.</li><li>Example: t.join(1000); // Waits for 1 second.</li><li><strong>Object Wait Timeout (</strong><strong>wait(long timeout))</strong>:</li><li>A thread waits for a condition to be met but stops waiting after the timeout.</li><li>Example: wait(2000); // Waits for 2 seconds.</li></ul><p>13. <strong>Interrupted</strong></p><p><strong>Interruption</strong> refers to a mechanism that allows one thread to signal another thread that it should stop what it’s doing, often used to handle cooperative thread termination or to break out of blocking operations like sleep(), wait(), or join().</p><p>When a thread is interrupted, it doesn’t stop immediately; instead, it sets an internal flag (interrupted status), and it’s up to the thread to check this flag and respond appropriately.</p><pre>Thread t = new Thread(() -&gt; {<br>    try {<br>        Thread.sleep(5000); // Sleeping for 5 seconds<br>    } catch (InterruptedException e) {<br>        System.out.println(&quot;Thread was interrupted during sleep.&quot;);<br>    }<br>});<br><br>t.start();<br>t.interrupt(); // Interrupts the thread while it&#39;s sleeping</pre><p>14. Join and isAlive</p><p>join will make the main method to wait until t1 and t2 are done</p><p>before Join:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*twmPdScqZphGm6DoaaGFRA.png" /></figure><p>After Join:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*r5hnb-uCUiU2CTRwX7RSbA.png" /></figure><p>15. Thread Priority</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*mD3qid-0MX_Or1tU.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/0*FPFhnWFHElKT28Uz.png" /></figure><p>16. Time Scheduler</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*GgXDcMcAWyH475Kj.png" /></figure><p>In Preemptive, priority is given to high-priority threads while scheduling the execution of threads.</p><p>17. Dead Lock:-</p><pre>public class deadlock {<br>    public static void main(String[] args) {<br><br>        String lock1=&quot;Gandharv&quot;;<br>        String lock2=&quot;Dalal&quot;;<br><br>        Thread t1=new Thread(()-&gt;{<br>            synchronized(lock1){<br>                try {<br>                    Thread.sleep(1);<br>                } catch (InterruptedException e) {<br>                    // TODO Auto-generated catch block<br>                    e.printStackTrace();<br>                }<br>                synchronized(lock2){<br>                    System.out.println(&quot;Hey !!&quot;);<br>                }<br>            }<br>        });<br><br>        Thread t2=new Thread(()-&gt;{<br>            synchronized(lock2){<br>                try {<br>                    Thread.sleep(1);<br>                } catch (InterruptedException e) {<br>                    // TODO Auto-generated catch block<br>                    e.printStackTrace();<br>                }<br>                synchronized(lock1){<br>                    System.out.println(&quot;Hey2 !!&quot;);<br>                }<br>            }<br>        });<br><br>        t1.start(); t2.start();<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/0*e3DwQuczWZHrrhcu" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a6da5f9b4f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Stream Interview Sufficient:-]]></title>
            <link>https://medium.com/@gandharvdalal123/java-stream-interview-sufficient-32ec6530e340?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/32ec6530e340</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Thu, 26 Sep 2024 11:29:57 GMT</pubDate>
            <atom:updated>2024-09-26T11:29:57.514Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>Print the Sum of All Numbers.</li></ol><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>Optional&lt;Integer&gt; sum=list.stream().reduce((a,b)-&gt;a+b);<br><br>System.out.println(&quot;Sum of numbers : &quot;+ sum.get());</pre><p>2. Print the Average of All Numbers</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>double avg=list.stream().mapToInt(e-&gt;e).average().getAsDouble();<br><br>System.out.println(&quot;Sum of numbers : &quot;+ avg);</pre><p>3. Print Square, filter and Average of Numbers</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>double avg=list.stream().map(e-&gt;e*e).filter(e-&gt;e&gt;100).mapToInt(e-&gt;e).average().getAsDouble();<br><br>System.out.println(&quot;Sum of numbers : &quot;+ avg);</pre><p>4. Print Even &amp; Odd Numbers Using Stream</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>List&lt;Integer&gt;ans=list.stream().filter(e-&gt;e%2==0).collect(Collectors.toList());<br><br>System.out.println(ans);</pre><p>5. Print Numbers Starts With Prefix 2 using Streams</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>List&lt;Integer&gt;ans=list.stream().map(e-&gt;String.valueOf(e)).filter(e-&gt;e.startsWith(&quot;2&quot;)).map(Integer::valueOf).collect(Collectors.toList());</pre><p>6. Print Duplicate Numbers using Stream</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>Set&lt;Integer&gt;dup= list.stream().filter(e-&gt;Collections.frequency(list,e)&gt;1).collect(Collectors.toSet());<br><br>// methode 2<br><br>Set&lt;Integer&gt;dupNum=new HashSet&lt;Integer&gt;();<br>Set&lt;Integer&gt;dup=list.stream().filter(e-&gt;!dupNum(e)).collect(Collectors.toSet());</pre><p>7. Find Max and Min Numbers using Stream</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>int max=list.stream().max(Comparator.comparing(Integer::valueOf)).get();<br>int min=list.stream().min(Comparator.comparing(Integer::valueOf)).get();</pre><p>8. Sort Numbers</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>// ascending order<br><br>List&lt;Integer&gt;sortedList=list.stream().sorted().collect(Collectors.toList());<br><br>// Descending Order<br><br>List&lt;Integer&gt;sortedList=list.stream().sorted(Collections.reverseOrder()).collect(Collectors.toList()));<br></pre><p>9. Get/ignore the first 5 numbers using Limit &amp; Skip in Streams</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>List&lt;Integer&gt;l=List.stream().limit(5).collect(Collectors.toList());<br><br>int sum=List.stream().limit(5).reduce((p,q)-&gt;p+q).get();<br><br>List&lt;Integer&gt;sk=list.stream().skip(5).collect(Collectors.toList());<br><br>int ans=list.stream().skip(5).reduce((a,b)-&gt;a+b).get();</pre><p>10. Get the Second Highest/Lowest Number using Streams</p><pre>List&lt;Integer&gt;list=Arrays.asList(1,4,5,6,7,8);<br><br>// sec highest<br>int secH=list.stream().sorted(Collections.reverseOrder()).distict().limit(2).skip(1).findFirst().get();<br><br>// sec highest<br><br>int secH=list.stream().sorted(Collections.reverseOrder()).distinct().skip(1).findFirst().get();<br><br><br>// sec Lowest<br><br>int secL=list.stream().sorted().distinct().skip(1).findFirst().get();</pre><pre>Stream&lt;Integer&gt;stream=list.stream();<br><br>String[] str={&quot;abc&quot;,&quot;yobwf&quot;,&quot;iewbc&quot;,&quot;bidwk&quot;};<br>Stream&lt;Integer&gt;stream=Stream.of(str);<br><br>stream.forEach(e-&gt;System.out.println(e));</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32ec6530e340" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Interview Questions:-]]></title>
            <link>https://medium.com/@gandharvdalal123/spring-interview-questions-02b49d80e7a1?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/02b49d80e7a1</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Fri, 13 Sep 2024 05:33:29 GMT</pubDate>
            <atom:updated>2024-09-18T06:43:44.045Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*cNwE5OCNPhwtls4hjMgxkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUzfG7jKIck7igU4aVhZNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIisE2Qm9DfZ96tBEA5AUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*qOr5mQ0Eujq01pN6NIoWqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*WV_YQ-SqE9a4C0b-Tc7Ufg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8D0VU5QBI-jS2Vts0IzuSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XZ4qYz5gSbZVdR-D4hmmug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*savbjt6uMez_7GLZRlbBvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUWs5sqXWPfWO5EnfbTNOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*vXRI-SSC-FadovFSYeQBzQ.png" /></figure><p>What is maven? (Pom.xml)</p><p>Build automation tools and manage dependencies.</p><p>you can find all the libraries and dependencies in the Maven repository.</p><p>Maven has defined the build lifecycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*lnNbgSSEDoJpyu9_i8LIFQ.png" /></figure><pre>mvn verify<br><br>//In a build environment, use the following call to cleanly build and deploy artifacts into the shared repository.<br>mvn clean deploy</pre><p>ye saari commands maven wrapper see chlti hai.</p><p>Mvn compile se src code compile ho jata hai target folder me.</p><p>Mvn install se local repository me .m2 ki folder hoti hai vha iski jar chli jaaygi.</p><p>MVN clean se target folder ki saari cheese ud jaayngi.</p><p><strong>Structure of Spring Boot Application:-</strong></p><p>gitignore is the list of files which we have to ignore while committing to the github.</p><p>Plugin will help you convert your code into jar.</p><p><strong>what is repackaging in spring boot ?</strong></p><p>In Spring Boot, repackaging refers to the process of transforming the built JAR or WAR file into an executable JAR file. This executable JAR contains all the necessary dependencies and can be run directly using the java -jar command.</p><p>Lecture 6:-</p><p>Object c=new Object();</p><p>through this we are creating object on our own. But In spring we can give the control of creating of object to spring . <strong>Hence Inversion of control</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Se5gp80OG9xX6n0T0W4NBQ.png" /></figure><p>Now, the person will go to the IOC container(spring) and the container will bring us the object.</p><p>IOC container is a box that has all the classes (objects ) made in the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*5Hxk4ZV-p39c87f7YLsp9w.png" /></figure><p>Application context is a way to implement an IOC container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*AWiGteFnWc1aMtCcJtf15w.png" /></figure><p>How does IOC container get all the classes ?</p><p>It scans through the project (all classes ) and the classes which have @component annotations</p><p>get stored in the IOC (Not all classes get stored).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*MD4jZae-4ufmn-I3VG5oXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*vVgDYiK51lhOgKkeuFO5lg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*3fclfT70qMMhwqi-KoHPTQ.png" /></figure><p>Bean is just an object in terms of spring. In other words, the object IOC have is called Bean.</p><p>After Bean is created we can use it through IOC without creating it again.</p><p><strong>What is @SpringBootApplication ?</strong></p><p>Only on Main class (only 1 in whole project).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*T3DBaS4HgMKjoOscSwuj-A.png" /></figure><p>@componentScan just scans through whole projects for Components. (This can not scan beyond its base package).</p><p>@EnableAutoConfiguration is an annotation in Spring Boot that helps in the automatic configuration of the Spring application context. It tells Spring Boot to automatically configure the necessary beans and settings based on the dependencies present in the classpath.</p><p>@RestController = @Component + Something else (specialised version of component )</p><p>@Autowired is used for dependency Injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*W0piRjh-_Hg41ErmZKg20g.png" /></figure><p>In this Car is dependent on Dog which we get through IOC. So Autowired is used when we want to use an object of some class in some other class without self-initiating it with a new keyword. And this is called <strong>Dependency Injection</strong>.</p><p>@Configuration:- if we write this on class then it tells the compiler that in this class we provide some configurations. (Meaning we can create Bean in that Class).</p><p>We define @Bean on functions, not on Classes.</p><p>REST API:- Representation State Transfer, Application programming interface.</p><p>REst APi ke through kissi server ke access krte hai.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Njl2yNW658hpTJmTPARMEA.png" /></figure><p>Our phone communicates with the server of netflix through Rest API. Through Request and response.</p><p>Server exposes end points so that we can access them with the help HTTP verbs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cHaIvIOOvjqYAu-SZbB1qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*SU79cCoB7LSU0oGcXOKTkg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7LEsNES1f7dDkS1waNkZ8A.png" /></figure><p>@RestController is a special kind of @component which handles HTTP requests.</p><p>The special thing is here we write endpoints with methods.</p><p>What ever we return from the end points get converted into JSON.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*xF3qif_tnsJPeAhkz0pXYg.png" /></figure><p>@RequestMapping puri class pr mapping krte hai uske bad GETMapping ke baad particular method ki mapping krte hai.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*7Bv2sYm0K8QxOx-5s4CBMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cg6xrXUa7oyGXj4cQURXyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*UJsVhrkbLeqlQHq11RiECg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*56kONbdHxTI3184-0s6tfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*YShBRmR3wHdxTNh-aR0uRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*0hLQ8Fwx-WdgUvka9mMmMw.png" /></figure><p>id is Request Param and {myId} is path variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*WtoA506MVgHiojcrAd-Ufw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*ZGQCrQclONXXk-U7kIQfkQ.png" /></figure><p><strong>Post</strong> is for creating a new Entry and <strong>Put</strong> is for updating the entry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*jxH8mZGjL9tjEmHVYBjsKQ.png" /></figure><p>ORM — Object-relational Mapping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*73GUWe7VI8N_DUpX3QlU4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*VWAy15ZFw69yVcsCYG1PAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*DfAKa9seJUyoohja54wLdg.png" /></figure><p>JPA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*_HuU8tzumJ_dPKFaU0p4Aw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcqyr4S3FIwBUkwymgN-rQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xXe0oj0Dyt_EuUmqy_r8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*96f84LklNNOQNdt2W9Wd-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQ97OeboiTO6pAc5u-s10g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6AvvhPKP_OzCEhcy1-aVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*RUMPyu8H5eq21fWvo_v0aQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*TV5vNLF5cFsdtxK-wQg4_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*I29o-WsQsWu-ShuDe8OIVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFgfEYmeHi9jOyG_TMtcpw.png" /></figure><p>Integrating MongoDB with SpringBoot:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*WannjhysP-5mrjNokBlgMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/1*-LrYSRPxneUTwdDjDFdr4A.png" /></figure><p>The controller will call the service. Service is where all our logical parts are present. The controller is where all our endpoints are present.</p><p>The service will call Repository ,which is just an interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y1fGrt4sIiGHO7tiYyH41Q.png" /></figure><p>This repository will extend the MongoDB Repository. And will be the point of interaction with MongoDB.</p><p>MongoDB Repository is also an Interface given by spring MongoDb. It does standard crud operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*dgFU_hfzrYRsnr-cGI91YQ.png" /></figure><p>Above we have passed the Entity type and the ID type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*c0QbnFec6IfaI1XYEPVkBA.png" /></figure><p>@Document tells the spring that this particular class is Mapped to MongoDb. And this class&#39;s Instance will equal the document(Row of database).</p><p>@Id states this is a unique key of the collection. (Not compulsory to give)</p><p>The Instance of the Repository gets generated and injected into the Service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*brmBr3HhVwBI3Gwe-Y3Y5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*w9EYrgOXnHavk6PSQvQz0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*14yO5DtnkpCUfsb94vqWBA.png" /></figure><p>By default Document searched for Journal Entry.</p><p>In the above, we are mapping to a specific entity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*9oFRv9Mnbr_JIkl8QrDZYg.png" /></figure><p>Now we have injected the Service interface for the controller class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*GpLSLB-Had14aCsi4iW38w.png" /></figure><p>Make it @compent otherwise it will give null in the service class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*msLKn7ZVH8O88vG6pitgyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*EA77LloZY-dOybIkG5KiJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*ZeCyZyUjxWZh_Ijkc_pk_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*EUHw4yNrkWisWJfTV6XDBQ.png" /></figure><p>String ID changed to ObjectID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*wT0OPOgcmcGPqZ6eUNL_4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*fYSqC9GZNxNUbJ2Hco9CGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*QMDNSGft_sDGTq62A6xO7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*Y6_qFvEcWSKeu4MSQp9r1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*SwlCqD9gyC5QfC9qiIsvfg.png" /></figure><p><strong>Response Entity:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gtN9Pd-dWUn33zr3A2jHPg.png" /></figure><p>The client is postman, and Tomat is the server where our application is running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*25QfV91F-q32tDMP8j6PAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h3aniroBND1BYg0dDUooZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*5Wr8TVzMcFmZx-lljp5nyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*TtQObASfFUs04mNPKQXfLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*500qXJ9UWnODAod5PWu9_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ry82i2grsWruGcKQUVDOfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*rjjqLQv0UUHKsFyYpTMpUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*3kX2sSbPZNDZUSae4qh6xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*5ioAeafz9kKrrlgWmzVP0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*AF6bumvVGD3TRHzKtL-gjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*BqVzUVVelaNz28kqCSDv-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_B-26i4mIq52M5xHMfPmTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*EoxjQDQZUXZaZCPlgcS8IA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*nSluz-a0HXh25AwXuXVMVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*Gai4keHc4N6WNNx97nlkww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*yjWdspSyH1YLHaU3gD7DPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XWHRIstTKCu6NIck-au59g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QaCIogO92Kb6ZpITK4PJ4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*2du-pcfA121NQIaeRGIcpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JN5G8GE2Jx8Iy6z2v26Gog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*BjwFSBra976Jl_hNfnRtzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*Y_iyoKlUpWV4baFNGr-34Q.png" /></figure><p>ResponseEntity is Springs inbuild Interface (Generic in nature).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*eZfbpTLDn-Kutd7nJiiGqQ.png" /></figure><p>LOMBOK:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*1AhchqXbJ_oAyUqLSN0hYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LNc3TGKGYapNz3MB7Pk5wA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xvm1EUnNLsZSUKvZXsqlOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*hAUM2P-mwmFBfySUz28nNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*DmRk40Km_rWgO5kFErmanQ.png" /></figure><p>No need to write getters and setters after this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vpt4__OW_vz750mn8cZz1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-wH_-bqt3N6mCLTDF7WAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F7a2PQ3c0d8pkBCBSQAwIw.png" /></figure><p>Mastering MongoDB”-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*l2RMpBFIoTHC4uiIKP4XPQ.png" /></figure><p>Lambok Annotations.</p><p>@DBRef keeps the reference of the journal entries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*SQDw99zxUc7pQawHI-T_nQ.png" /></figure><p>Acting as a foreign key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*YB0kH6HD6jzSNxBz8nLltw.png" /></figure><p>For making do indexing.</p><p>Video 14.</p><p>— — — — — do it again after this point — — — — — — — —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*eBc9ubYbzRy9IfwmemDLXw.png" /></figure><p>@Transaction Annotation makes the method a Transaction Atomic in nature either all the operations will occur or none will happen, it will roll back to the previous state otherwise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCchmkfrTe1K-PoIDVccmw.png" /></figure><p>We have to add @EnableTransactionManagement as well on Main Class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*rPZOO0ZEBvve8FcivSgWiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*6KWwso-xQ2KIS8A9rcQCpg.png" /></figure><p>@Component VS @ <a href="https://medium.com/u/fb1e2c1d6533">services</a></p><p>we can both interchangeably but Service is used in service classes for readability it states to the new developer that here is main logic part of our application is present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*2hN9KAeq4p7nWeKuJy6d0g.png" /></figure><p>@ Value</p><p>put the values is YAML and import that in our Classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*bY79-NCPRmWseuG7ewnJdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*p8mO2rIXl9RdEGIpTRgb5w.png" /></figure><p>Will give us error</p><p>there should not be any static variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Az85vnVohARHTWVdvGhEw.png" /></figure><p>@PostConstruct</p><p>in added onto a method. Which will do is when ever the bean is created of that class that method gets invoked simultaneously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*Ih298Gt35oXTbigMzzSMSw.png" /></figure><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Interview Questions:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*Y40hEHVBjaJ6TYu-chkg6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*mNsBtkvR6rkHQvNrXuVycg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*U85k4-y276e1TZwl9m_RXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*EccOyxzpekSKvUKXAk-PcA.png" /></figure><p>Application Context is just where all the beans are there.</p><p>In Spring, the <strong>ApplicationContext</strong> is a central interface that provides configuration information to the application. It is part of the <strong>Spring IoC (Inversion of Control)</strong> container, which manages the lifecycle and configuration of application components (beans).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*E4QSqiS3vCmeUNoq3O6PQw.png" /></figure><p>@Component Scan is scanning other packages which @SpringBootApplication cant read.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*xHynLWcWsIFGSwRHg9rI-g.png" /></figure><p>@configuration allows us to creat Beans in the class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*BA9T2Cdws912hNZEjWDtPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*SxvCYXttcUDif6sWWRr1SQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*6DanxAIec57lorifC7edGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*JlB8hh33UppysOO6wuKBbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*DG_biKp-MCbT1ODNYTOKHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*tu6bPHR5Ic_Uq6mSDf9D8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*4YuMNMtJSELYOhI4AiYQ9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*Vofwtr4Eo4lgl6KdifZR9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V5sPr7e3kuXC45uTbs0dmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*BwkXGyUDxU1Uk78D058alQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*e9Rz2gIhKy8BxUYW7KvXnw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*DEIz68cNLj6sg7o7XW6Yyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*lBGGdHW0vUUg4O0QI4Jmpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*Ao2uuW_jEXg7GnjEpURNpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*a9DYqfNASBHUqZW_DFwS0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*-LjJNg2olJXnajfenNH97w.png" /></figure><p>XML Bean Factory is not in use anymore. Instead, we use Application Context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*7kEfDaXbt-pfLhfigksfew.png" /></figure><p>In simple terms, Application Context is a child of BeanFactory and gives additional features to BeanFactory.</p><p>ApplicationContext=BeanFactory + Additional Context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*_Xsq4pt9h_iKxz28IDScOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*RhvrfdCIPGnZ8Pc8G10wUA.png" /></figure><p>Laptop will give null because it is just a reference, not an actual object.</p><p>Setter Injection :-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_eQvJjn9LdUUITgY0CsGgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d96Bl06ZdDLHlwcsW8AyIg.png" /></figure><p>Tweaking the values in SpringXML where the beans are present.</p><p>Constructor Injection:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ln1MBmKybneYLChBL_xJjQ.png" /></figure><p>Create a parametrized Constructor And instead of property use constructor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vigOLrRXIp1MJSc1i8xkNw.png" /></figure><p>In the Case of Object references use reference (of that bean) instead of value.</p><p>We are basically wiring the reference bean to the bean where it need to be injected.</p><p>In addition, we need to initialize getters and setters as well in Dev Class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZyXNbtcWs40qMWQydg5rA.png" /></figure><p>It can be done automatically without doing it manually just by enabling auto wiring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*tSoVqU_y0SmDdR4J8c8czg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*K2M_eZB860ENH9DqxcObYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*2y96IS3nlWM7ssERx9hdxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*gLoAjsj_nhiumrIkWx-Wcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*kveHOhli9MpemrLnDoX0zg.png" /></figure><p>Here we, writing our own creation logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*PDAlslcOG5r-L4aFqMiOBQ.png" /></figure><p>Here spring was deciding the logic of creation on its own.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*LgcRvc_2IJqm8P61bRK-_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vuhSXMcaDxkrxJCCy0oj6Q.png" /></figure><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>KAFKA:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*mbd1QQDfxCCdKNfrGcb2OA.png" /></figure><p>This means it can work on different servers, and these machines will be connected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*CBQoQBKVaLETCaF55VOEKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*vQ6kt3trvSEEKlDVs-TEXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOxu5OnWqL5TVZ4ATKSCtg.png" /></figure><p>A Kafka cluster is a group of Kafka brokers (servers where Kafka is running).</p><p>Kafka producer writes new data into the Kafka cluster.</p><p>Zookeeper tracks the health of the Kafka cluster.</p><p>Kafka connect basically is used for bringing or sending data from/to external entities and that too without writing any code.</p><p>kafka stream is the functionalities that we use for data transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ZdXrL1hb4-JK8iRXToZjw.png" /></figure><p>Data topic(container of storing particular kind of data) ke under ata hai vha partition hota hai jo hum topic ko define krte time btata hai ki kitne partition chahiye. Har ek Part. independent hota hai ek dusre see. And In partition there is a OffSet value which increaments as new record comes. And This whole data is stored in distributed log files.</p><p>Agr data bina key ke ata hai to round robin me hota hai .</p><p>Agr data ke saath key bhi bhejte hai to partitoning bhi picture me ajata hai , vo hashing krke dekhte hai kis partition me jata hai.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*gFgPWNGdn3NA8rjG7bzvzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2FbOGVemqirnW9FcudOPXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LrD5MnBJse8B_hCtemgY-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*9Mcmo4kEROtNmXgwSfgUww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*2AvYwQGaT-EY2Wp1Cml6qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*HWANgd-eQ5PXKEoR6glVNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q_WaO6kM-tNDCaTT_vszvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9UJt5h1JLogwUlv27deYig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqoupjEAi5To-HYSwPX32w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7X1b5n4mmAqP4aIWV1-6rw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*om8NH4NcHVw2nmRSFYYCpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlRYv4iq3kX8OkTDuKKR9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*nqVOKMP03fRWuTNTjI5zIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*gVj9U6mugQ8HnC0iAOVtZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*uE2Lh1rTHi54JRb6BLEQOA.png" /></figure><p>Retention policy — time-based and size-based.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*Ah-naHaoof9inwBfLL4L8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*zmPEPXz3rgZp8r6fh8Sdkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1DsJKsipbmLBxk5K4AbXmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ck0OnoHKLZOHxYlEd1L-rA.png" /></figure><p>The replication factor is no. of partitioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*trhot9GH_nklAicT2SvWFA.png" /></figure><p>Every partition has one broker leader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*ygEiFvG7VaR1kocxvo8Tnw.png" /></figure><p>Data replicate every broker me hota hai.</p><p>ISR means In Sync Replica meaning replica sync me hai.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*Ro1wZa7-b0tF-fcz7OSd6Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02b49d80e7a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interview DBMS:-]]></title>
            <link>https://medium.com/@gandharvdalal123/interview-dbms-a53895e5a927?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/a53895e5a927</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Sat, 07 Sep 2024 12:34:11 GMT</pubDate>
            <atom:updated>2025-01-08T06:32:54.533Z</atom:updated>
            <content:encoded><![CDATA[<p>Interview DBMS:-</p><p><strong>Lecture 1:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61XK7kfgJtQ6j3deIlW_hQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*-LswyDjLnuNQKEENJjUaPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R8B835MxNCzon08C3N5eBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_5pzzSuWFULJNHEtwhhJ1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UZrrV1gpkLl5g3N2B-Qw6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yn-WwisGp3FOdKMIw85l6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHzUWf8T3enZC0Jl93bjPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*dcsP92gQ3ZMMFiblFz2EUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gSVt2-8Us6Q_SMi_j5aNIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDZ-4rDEMVmcpRag2y9Zvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwuG0hQsgLJHQINEchei9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*g4lZHF04DMXhbGPM3wnSAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H3hdI3vPJJran4KZzZ3nGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*1fof0msogURtqs87TT5WSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PNo3LytqO2110_npv5sTA.png" /></figure><p><strong>Lecture 2:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PpP2Ecq7Pd1f5PeSyXF8MA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBHjz6ozfaeYz91i00ftcg.png" /></figure><p>Every entity has a different “View”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UsdgX70gbN3e7jGoWdBeg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJRO1OPiKY-wP0K5GB2bhA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_VpqMiKiU0EFmDl3OUA4bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPzUWG--YfVo6kEmR294kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zH8pT7ZEzrGYduWvzjJR7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*cO2TGW-3KfCH6sa_JM0BaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*cWKaVvdjSKtwZdI_IUBsaQ.png" /></figure><p>A database schema refers to the logical and visual configuration of the entire relational database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*_ixiTELESKY8CXJXDqjtIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*n0JsZCLbrodUwnIOW04sKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*-FXO4LWRQnGbL65lXVq_Ug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-B7Qy8wuAAGiNqB-cafUFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I40oCvCyjxXzQ9pCvL7epw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGoY8KPHNKVybPbh_yA9NA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Ycxs4WtaDEiyGNyGhROaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*YpIFC4Jn2W3OfTiS__Ks7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*y1BhvYjDNoOUy3s3Qc5sBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUgsHiomSulmM1d3Trm4fQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYrMxQotyLS3CFtnyrzlng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*T3c5kcSm9L4f0okWGdGozg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*2leY8-zvBPWeBYHjkrUIOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*WgGVeXGUD415AzmobB8-MA.png" /></figure><p><strong>Lecture 3:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H6jpkqgGMeYLsjx8zpYeJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QPbsUe5EFkbUbk-ODa-CGw.png" /></figure><p>1 student 1 entity hoga. Baaki collection of student entity set hoga.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dzt2cUPoZfApRdaeDPSDuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbrB3Om5UjbmPyM8w63NTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOMnm32bCmukIZRqJvIuwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oo4CHsKPVPnQ7NViZbPBLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*InPEXaYXzy8YOKA5DBZA-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMmMPoJFpOn94pQ-2OhSDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQgEhouhIsaSUyCwM5cU4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yY6mw-Sl6ZAkTFDE6xJfMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2D0Hx_o30pLlTlh90G7q8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*aflbTfd-37dxfxACfSu8tw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wf6WWYQ5bwLQhFAZjtOmBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*0Ub0NIxKsHUeAgVHXeJKow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_S59CzZCOEp09G1mCUvL8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*2N0Sd_NGoLGKXc7rtffFDA.png" /></figure><p>Lecture 4:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*waqBwv1zuPkVBCphp2nDLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qoUwyBHLZtaS5__bPOhS2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*ny4fNZ4ow6qCl2cIgavd4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNcGRCf03sS6tWEuXvBBcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*3yiIY0XS-eann5zokVOSGw.png" /></figure><p>Generalisation is just the opposite of specialisation.(bottom to up)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*NxdiX2hCoZEKBKcLwrT6Aw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*GckT1e2MWXFwQW2zOwMC2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWoB_6cKRy18HHJHdl25Vg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIURDLrJV08_cs9dhgaM9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*ksQorAhU8XqlgnI6mDATeg.png" /></figure><p><strong>Lecture 5:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lg-HrcIxK2mZytoDScsQrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qZY2jfoK-Pw9m3iRqX_5ww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17hpjUBunPgCHJlGG0iN6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eEqMprqjJuo2a3tIf91QBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGbsaRBQgG7x_qQNRWWC_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DhCx77VEFN0L82dhawHu7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*K8We1oq6CXAXoUOPSLwqsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*LQs47KzXgqNLW2BO2lpgSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D1cgQLFnwtgFF3hpYQ7WNg.png" /></figure><p><strong>Lecture 6:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9U-koXvkcIQrAsyloiXhcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wfjMGTRw4WThJl_MYx64Zw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyjuKI3zt7le1kS7xKGLqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBsuD_xct1r6ib80XxvicQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rgf49s0LKc1GTWIwk9HYHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PbMrK1YpX-V-njeSLZRK5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VWh4My1v62tfzWDCQkF3Kw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6IrKgEC1ZSGbh_hOveinQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1BvkZVbdefXJNWLMCdmPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*70NOlwh3W9MqPsjLkHVbrQ.png" /></figure><p><strong>Lecture 7:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3o8RF4hHJDJQhGxjdlIs_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0HdkfnyimuIAcfOpb7__Sw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ScJMLn33TCNTpOoHWKzLgA.png" /></figure><p>Mysql, Oracle.</p><p>Reads all the types of keys from the Gate syllabus</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_WqIpxPnl6HstVk3my29g.png" /></figure><p>a synthetic key generated by DBMS. Automatically get incremented. We can use it as PK.</p><pre>CREATE TABLE Enrollment (<br>    EnrollmentID INT AUTO_INCREMENT PRIMARY KEY, -- Surrogate key<br>    StudentID INT NOT NULL,<br>    CourseID INT NOT NULL,<br>    EnrollmentDate DATE NOT NULL,<br>    FOREIGN KEY (StudentID) REFERENCES Student(StudentID)<br>        ON DELETE CASCADE,<br>    FOREIGN KEY (CourseID) REFERENCES Course(CourseID)<br>        ON DELETE CASCADE<br>);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*Bulv0r9HM5TNnAkRrPaixg.png" /></figure><p>CHATGPT IT (ABOVE)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ryqQSLVAIdBjrbwInrvyFw.png" /></figure><p>ON delete cascade</p><p>ON delete set null</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XIqR54gexuOPiJeamF3WSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ciW0AS1681wkY9MTY-68lw.png" /></figure><p>YES.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hWgXPHFognHf_xWp1PQ4_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZbDd4dYnqnY9j1LEtpm5g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3dppoms7ASVIgdOlyWHl2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODUz974WOrRNa17eGZ-NWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BsCyksEB559JQ7d2vlKs4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DFccaPcv4JqoeTsl1HAalw.png" /></figure><p>LECTURE 8:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lObd8ZAraI7Cc-tOxto0lA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FA-oqc3c4Rxgo69qepUwMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hIrOoHoKXL90L14qWzs2Ww.png" /></figure><p>Yes, a <strong>foreign key</strong> can reference a column that is <strong>not the primary key</strong> in the referenced table. The foreign key does not have to reference a primary key; it can reference any <strong>unique key</strong> in the referenced table. (BUT IT SHOULD BE UNIQUE)</p><pre>CREATE TABLE Employee (<br>    EmployeeID INT PRIMARY KEY,  -- Primary key for Employee<br>    Name VARCHAR(100) NOT NULL,<br>    Email VARCHAR(100) UNIQUE,   -- Unique email<br>    DepartmentCode VARCHAR(10),<br>    FOREIGN KEY (DepartmentCode) REFERENCES Department(DepartmentCode)  -- Foreign key referencing a unique column<br>);</pre><pre>CREATE TABLE Department (<br>    DepartmentCode VARCHAR(10) UNIQUE,  -- Unique but not the primary key<br>    DepartmentName VARCHAR(100),<br>    PRIMARY KEY (DepartmentCode)  -- Primary key is still DepartmentCode<br>);<br><br><br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OvjLvQcyy25wauZ0IaRgsQ.png" /></figure><p>Lecture 11 (Normalization ):-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6qO2NJ92ZeO9lzOEP1tsPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*l8voCj60BfSrOA1LPLf5IQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OW6Y8KkGDNQG-KDTguMgDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPGDnqLOA3bE4buwPJK89g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LmOVM2UQ4yQTrbvCMG_DUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r8F205TxyGA6IercO5MXtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*v869dY-8Io5INkJXEd1tbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PDWWpACm-c0CL-_VMYw1hA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*kcsG7CREV0dqRbwUJrun_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qu7tL8R-FZbQ1MhLAH-5CQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dUkDsq1MqezhN7Xvb2iVPw.png" /></figure><p>We cannot add an IT course because no student is present for the same course.</p><p>For<strong> deletion</strong>, if we delete one particular student of the IT course(one student present in that course) then the whole Course will also get deleted from the Table.</p><p>For Updation:- if we have updated some course then we have to go through the whole table and update the whole table wherever that course is there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYdfEI0CkBKuTP4mkrASOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*JUn2pfBcp4Ziq6M7HkqzrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*cfPSN51zlH_MDNMx6K2WsA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*O3G7XmSlGQFj3ZUy7u1UnA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ghzjhn-Ob-LkcOaPGOOPOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*SXxbdANh5AbpOoWVpsJ6eQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RAv5GUs6RPFAcwXrM1AT_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KllAsmyLWfMUEGoWufFIww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*WIaZE7F-ruJ1tXwguNEglg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_3GxKHKvhijfec2w-zyeLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*KNm-KGkNbSRY80kyP9okjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*LT8uPtyQoqo090Iv4PhqYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IMMRRC7HDrkXNt_7KKXkvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UuOOyYAIhAdEtDaqOploZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*kWOdMLl55H1mTGCU9Zo3xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*P2WW6hzcM8P4xB2UGHR63g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*uE6BxTHbkp-n6TXg2cjtfQ.png" /></figure><p><strong>Lecture 12:-</strong></p><p><strong>ACID PROPERTIES</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mb4thN8WpZsmoyqe6D-oTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N6hpv9Vc-BdrIpKudvkjWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*VW4S6AvNVSNChTpid9Akjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*8ZrH9zyCYvRLtyjI_JmHLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-dPU2VeLL58wcHXWOzLixg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OFuWsVLTYjR5Rw4MjQPsVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCgxYoNrFXFayi7gfDaavw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OPAA77HbEETdOjM2_752RQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eElHaEI_Ci1R6CwHg7AE0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4wP36yQ2ph8ZM933xkmKvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vYDWTqoDsjxo6MjDXKXkEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*R372YiOkVf-ZDLMW9g9sQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*hoa1Pml5Or12fAF28HOrbQ.png" /></figure><p><strong>Lecture 13 :-</strong></p><p>Atomicity implementation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iP8ib53W8qRyhKa0-N3Szw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQX3RBkPX28J-9J4suIiEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eWvKZwv_elHaR2tRFPrDAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T9vMhn2pTUI8HOTVGsBY5w.png" /></figure><p><strong>Lecture 14:-</strong></p><p>Indexing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-Gha70lICYQtfOZEtOh-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r7XLJd06yda_ilckWZMkbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HhO6kCIURfXo_aRa-LlPVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oc-QgE59EWLzc4tu9tp_SA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w14idqVzIYH4M--NWhJZgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xo_U-Cku5Opp8gEZeMoC7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlCAbyEuSF8M5D8uaRE4cw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jMdfIzV7kOZBR2uogvHdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FzkngOFGTFEBFOlEhdZIyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PJoNzJSJWgrBAF2tblfhA.png" /></figure><p>LinkedList is used as a Base pointer so that it can point to every base location of every occurrence of each Search Key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*RK2wC2x7CL8eCL1fL58ayw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*tQLZAFgAx-ShuGYbz3ZgHA.png" /></figure><p>Lecture 15:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*o-IZixRU5kroVDWEutHyxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhJoIrsUeZBGezhEagjD4A.png" /></figure><p>Example JSON</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eydY2UuNqfOMw9VeR2BMyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*djsQfVuYHCTXTskdt5_-Hw.png" /></figure><p>in the form of key value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6Sd3pEGrMpTAUrDxz4ZUw.png" /></figure><p>Flexible? Some attributes receive null values as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q9SwQVNgpkUA8HfrVVVCyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1o2QB8qWBnwCVQ2vDCbnw.png" /></figure><p>Higher performance cost .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UpEaqnjJ131T401-qodVkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJqGT_Ni66T_96Hf0ZdUug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*FQydm4uPZ2HTXxJDh-s8gQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*RxISfNbTSZOyW7FA7Juaww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmKCFjg4lGLedaQSW06Bsw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97RsntGfyNMDp2h1-vTXlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JFXajlXvnHFeCTUxY_Tlqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oHWuODN_O0Ow3_C0_ghbQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pB5kc5e36hZyzlLHkjqtYg.png" /></figure><p><strong>Lecture 16:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*4hlr4dya8g6dvam2OGC8Aw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*jSF9UJRivXBiMn2zlj_6Sw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*ibz9aRHOtqeAHRlGAYA5OA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IxJab68YN43vz0PaJkbehg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*WWmI0N48jm8DukUSyH8gJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fU2FvIxjco2DwUDRtWYhVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ML_wrNlz82zwGXTHO3SEMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*21aSa1cbXW51cYjZ5jAqhQ.png" /></figure><p><strong>Lecture 17:-</strong></p><p>What is clustering?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UWoj4obsM6VtewPGRF24FA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*ZpQgFbvnJ0UjfZodQ2hf4Q.png" /></figure><p>Features of Clustering:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*c8AuStxr2pa_kxbNeNLogA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QN4MudrUoYcjYiC_EazU4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*8r1IwX9GH_2UlHf9peyj2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kTQ2_CW1qAQJFLgK0P6C5g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DiCWPbSGDLfhHvd3RlnmLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*HuIBWCo-fn5JEddlUgnSEw.png" /></figure><p><strong>Lecture 18:-</strong></p><p><strong>Partitioning and sharding in database.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XdTuC8AzkWH1KpkydwVj3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ERmTCKHmauStyot2efNkIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J2Z4eCAapY2awCYAwDFYoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bijeeGWjOl1F6f2b1ZMNcg.png" /></figure><p>row-wise:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*bQsMuU8xcYhq0DYzizLBuA.png" /></figure><p>column-wise:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9hVoM_8xEgE9GlGa9FiZ4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*dg-GpkCDCWfW7ePMdc98kA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*unQw-PhN7DikfX6IR8jczg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gF69_MiGeZTl2Dt0fOGIeg.png" /></figure><p>diff in partitioning and sharding is routing layer additional implementation we must do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffbcywD_Juc5PmRYmEGJDQ.png" /></figure><p>eg :-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*HvmzLuaXAwU5QBPhiMM8ag.png" /></figure><p>Lecture 19:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opao203B22c_kHZbkVyzdg.png" /></figure><p>out of these 3 only two are achievable at one time. (In case of distributed system only). In case of single server all there can be applied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*wVSFrxF1wZFkpEqwJ3mIkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hj0IAojbuUZh4-HEdhG7tw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZVMwOyMYeV0zVuCm1U3gkA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6cd19-zQlDWCfi0-YjMEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*yJIy7DWWNSfaPg4tJC2gXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*avxBm2IqTHTG4q-MCiZoPg.png" /></figure><p><strong>Lecture 21:-</strong></p><p><strong>Master-slave architecture</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RMgwRSuCmQaKoFVuw4ytUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7xuSOy8gy0plK3MH4QOW6Q.png" /></figure><p>A single point of failure was there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCbFNrKG46IZfNWF359NQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fp-ZARFCOtISLrMvmV-u9g.png" /></figure><p>Slaves can only perform read operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*DgjXkmwQGG8lk4JFBDN8cQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxUhVB2StbFGksuAA6zthg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*03xzNsQfid7pMPQglgGy1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*9LxPBtpxX332qfO0r52yyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*872GCdXqYoYXP2JZGl9qZg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a53895e5a927" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project Intro:-]]></title>
            <link>https://medium.com/@gandharvdalal123/project-intro-28239141498f?source=rss-9244def9d457------2</link>
            <guid isPermaLink="false">https://medium.com/p/28239141498f</guid>
            <dc:creator><![CDATA[Gandharv Dalal]]></dc:creator>
            <pubDate>Mon, 02 Sep 2024 08:43:35 GMT</pubDate>
            <atom:updated>2024-09-02T08:43:35.707Z</atom:updated>
            <content:encoded><![CDATA[<p>Overview :-</p><p>Good after sir, First of all thank you for this opportunity. My name is gandharv Dalal. I am currently working as a system engineer which is SDE1 basically in tcs for the last 2 years.</p><p>I am currently part of tcs Bank project . TCS BaNCS is a core banking solution that Tata Consultancy Services (TCS) developed. It is designed to cater to the needs of banks and financial institutions by providing a robust and scalable architecture that supports a wide range of banking operations.</p><p>My client is Socgen which is a France-based corporate bank. I am in the credit transfer team. Which handles the bank-to-customer transactions from Europe to Asia through different channels like swift routing, RTGS that we use in India and Target (They are nothing but protocols).</p><p>In our architecture, the System Integrator (SI) teams retrieve data from the JBoss server and process it, delivering the output in XML format. We use Java JDBC to store this data in a MySQL database, where we can perform code enhancements to address any issues or bugs that may arise on the server. Java is then used to retrieve the data from the database, converting it into objects that can be manipulated. The changes are reflected on the GUI using CSS and JavaScript. Once we confirm that everything is working correctly, we use Java to send the data back to the SI team in the form of a PAC08 message, enabling them to carry out transactions. Our application follows a microservices architecture, and I am specifically working on the Payment server.</p><h3>SOAP Web Services</h3><p><strong>SOAP</strong> stands for <strong>Simple Object Access Protocol is a network platform</strong> used in a web service to exchange or communicate data between two different machines on a network. It uses the XML format of data to transfer messages over the <a href="https://www.javatpoint.com/computer-network-http">HTTP</a> protocol. In Web services, SOAP allows the user request to interact with other programming languages. In this way, it provides a way to communicate between applications running on different platforms (Operating system), with programming languages and technologies used in web service.</p><p>Greeting</p><p>name</p><p>designation</p><p>years of experience</p><p>graduation</p><p>current project overview and I am part of their back end payments team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28239141498f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>