Wednesday, October 11, 2023

Tribute to Indian Soldiers

 The life of immense selflessness, there Only aim to guard India from the ghostly evil.

Into the Wuthering, In the frightening darkness, On the rigorous mount with their determined soul, there Only aim, to guard Indians from threatening forces.

Not to forget, our peaceful sleep, prosperity belongs to their courageous detour, there only aim to drape the besieging demur.  

Sacrificing their happiness, there only aim to contour their anger against berating thunder. 

In the border with ever lynching, life threatening Challenges, there only aim to seize the evil.

Into a war, like a rigorous shield resting on Indian border, there only aim to sacrifice for better good of countrymen.

Like a burning ether, there only aim to make India peaceful.

Into the skies, on land, in water, having a stringent vigil, there only aim to win over vicious.





Thursday, September 28, 2023

How Spring is different from core java

 Mostly Spring differs from Core java has it reduces dependency of one element on other. In spring the code is made loosely coupled and hence dependency on one element on other is completely eliminated.

With the help of dependency injection (dependency is injected through annotations or xml). Code is made loosely coupled. For good programming practice, the code should be loosely coupled. Which in core java, we cannot do. It can be done in spring.


For Example

Class Employee{

private String empID=null;

private Address add=null;


public String getEmpId(){

return empID;}

public void setEmpId(String empID){

this.empID=empID;}

public Address getAddress(){

return add;}

public void setAddress(Address add){

this.add=add;}




}

Class Address{

}

In the above example Class Employee depends on Class Address in Core Java. The example is said to be tightly coupled code. In spring Injection of Class Address is either done by .xml file or annotation. Hence the dependency is reduced, and code is made loosely coupled. 


Monday, September 25, 2023

Brain neuron's siphon at zero cost

 Brain which is considered to be one of the most important parts in human body, is contemplated to be the powerhouse of human advancements. Either excelling at business or education or any activity, brain power is must. Measure of intelligence is directly correlated to, how striking is electric neurons activity. Advancement in science, medicine or in any field majorly revolves around the brain. From early man to the human being now, brain played major role in human advancements. In this article, I like to reveal some secrets that can increase our brain activity with zero cost involved.

With my experiments from past 12 years, I got to know, how to make brain electric.

                                                          Chess

Thing, I like the best with chess is, that it makes people think, which will definitely lubricate the brain. I recommend solving chess puzzles are best to increase your brain power. The title of this article is with no cost involved; I will improve your brain activity. With my experience with chess, it will be more rewarding if you only solve chess puzzles. I like to reveal some free chess puzzles sites and applications which are free.

                


   




www.lichess.org (There chess puzzles are free, I find those puzzles having depth and will increase your creativity and imagination) 

   

TACTICS FRENZY

This App, which belongs to world number 1(according to FIDE Rating) Magnus Carlsen's a chess app.Chess  puzzles are free of cost and very deep. I will guarantee you for a complete neuronlitement(joke).

You can get this app in play store.

Note:Even for people with chess background also can daily, solve 10 puzzles will improve their brain activity.

                                                        SUDOKU

With my experience, I find solving sudoku's are good for brain. I like to give free sudoku site, that you can find on the internet.


You will get mind bending sudoku's here.The swordfish sudoku's and X-Wings puzzles are the best here.From beginner to advance geeks, everybody can find the recipe over here.


                                           MATH AND RESONING

MATH and RESONING provides much needed inputs to brain. I like to list some really good YouTube channels, that can make you excited.

           

                       (1476) LOGICALLY YOURS - YouTube
The above YouTube channel have good puzzles and interview questions, which will definitely enrich your view.


                   (1476) MindYourDecisions - YouTube
Good YouTube channel. We can get the puzzle books of the author in different sites.


                                              PUZZLE BOOKS

Solving puzzles from puzzle book. You might be confused because you have to purchase books, but that is no need. If you type pdfroom or pdfdrive in google you will go to the site, there type puzzle books, you will get many puzzle books there. 


 These are the things and habits done regularly and with a dedicated discipline can increase our IQ and the brain power. Getting the things done with no cost and greater optimization is what this blog post refers to, Hope this post is engaging and interesting.




---------------------                              Comment and share                                                                                                            ----------------

                                  

 

Sunday, September 24, 2023

How To Make A telegram Blot using SpringBoot (java)

 To Make a Telegram Bot ,first you have to create a bot in telegram,type BotFather in telegram search 

type /newbot in the telegram (like there in pic)

Here, I gave bot name as (satishbot),has shown in the pic.



we will get the token,like there in above pic ,In the above pic you can see(Use this token HTTP API),there at the botton ,you will see the token.This is all you have to do with telegram App

With the use of Spring Iniatializer create a SpringBoot project


  

The above pic is the package structure of a chatbot application using Eclipse IDE.


The above pic shows classes in the package.I will give the code below of each class in the package

ChatbotApplication main class

Here we have  to register out bot class with telegram

package com.example.chatbot.chatbot;


import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.telegram.telegrambots.meta.TelegramBotsApi;

import org.telegram.telegrambots.meta.exceptions.TelegramApiException;

import org.telegram.telegrambots.meta.generics.BotSession;

import org.telegram.telegrambots.meta.generics.LongPollingBot;

import org.telegram.telegrambots.meta.generics.TelegramBot;

//import org.telegram.telegrambots.meta.TelegramBotsApi;

//import org.telegram.telegrambots.meta.TelegramBotsApi;

/*import org.telegram.telegrambots.meta.exceptions.TelegramApiException;

import org.telegram.telegrambots.meta.generics.BotSession;

import org.telegram.telegrambots.meta.generics.LongPollingBot;

import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;*/

import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;


import com.example.chatbot.config.TelegramBotConfig;


//import com.pengrad.telegrambot.TelegramBot;


@SpringBootApplication(scanBasePackages={ "com.example.chatbot.config"})

public class ChatbotApplication {


public static void main(String[] args) {

SpringApplication.run(ChatbotApplication.class, args);

///TelegramBot telegramBot = new TelegramBot();

//TelegramBot telegramBot = new TelegramBot();

    try {

        TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);

        botsApi.registerBot(new TelegramBotConfig());

        System.out.println("bot registered successfully");

    } catch (TelegramApiException e) {

        e.printStackTrace();

    }

}


}

TelegramBotConfig :: class code 

package com.example.chatbot.config;

import com.example.chatbot.UserState.UserStateEnum;

import com.pengrad.telegrambot.TelegramBot;

//import com.pengrad.telegrambot.request.SendMessage;


import java.util.HashMap;

import java.util.Map;


//import com.pengrad.telegrambot.TelegramBotAdapter;

import org.springframework.beans.factory.annotation.Value;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import org.springframework.stereotype.Component;

import org.telegram.telegrambots.bots.DefaultAbsSender;

import org.telegram.telegrambots.bots.TelegramLongPollingBot;

import org.telegram.telegrambots.meta.api.methods.send.SendMessage;

import org.telegram.telegrambots.meta.api.objects.Message;

import org.telegram.telegrambots.meta.api.objects.Update;

import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;

import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardRemove;

import org.telegram.telegrambots.meta.bots.AbsSender;

import org.telegram.telegrambots.meta.exceptions.TelegramApiException;

import static  com.example.chatbot.UserState.UserStateEnum.AWAITING_NAME;

import com.example.chatbot.KeyBoardFac.*;

import static com.example.chatbot.UserState.UserStateEnum.FOOD_DRINK_SELECTION;

import static com.example.chatbot.UserState.UserStateEnum.AWAITING_CONFIRMATION;

import static com.example.chatbot.UserState.UserStateEnum.PIZZA_TOPPINGS;


@Component

public class TelegramBotConfig extends TelegramLongPollingBot  {

private final HashMap<Long, UserStateEnum> chatStates =new HashMap<>();

 

@Override

public void onUpdateReceived(Update update) {

String userMessage=update.getMessage().getText();

Long chatId=update.getMessage().getChatId();

SendMessage message = new SendMessage();

   if(userMessage.equalsIgnoreCase("/start")) {

   replyToStart(chatId);

   

  }

  

   if(!userMessage.equalsIgnoreCase("/start")) {

  switch (chatStates.get(chatId)) { case AWAITING_NAME ->

  replyToName(chatId, update); case FOOD_DRINK_SELECTION ->

replyToFoodDrinkSelection(chatId, update);

case PIZZA_TOPPINGS -> 

  replyToPizzaToppings(chatId, update); case AWAITING_CONFIRMATION ->

  replyToOrder(chatId, update); default -> unexpectedMessage(chatId); }

   }

   }

   

@Override

public String getBotUsername() {

return "satred35bot";

}



  @Override public String getBotToken() { return "6467366090:AAE-1eCSTPVhbeu0O0VlqYjODeaOu8_jHWE"; }

 


public void replyToStart(Long chatId) {

try {

SendMessage message=    new SendMessage();

message.setChatId(chatId.toString());

message.setText("Welcome to satishbot ,please enter your name");

execute(message);

chatStates.put(chatId,AWAITING_NAME ); 

}catch (TelegramApiException e) {

        e.printStackTrace();

    }

    

}

private void unexpectedMessage(Long chatId) {

    SendMessage sendMessage = new SendMessage();

    sendMessage.setChatId(chatId.toString());

    sendMessage.setText("I did not expect that.");

    try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

private void replyToName(Long chatId, Update message) {

    promptWithKeyboardForState(chatId, "Hello " + message.getMessage().getText() + ". What would you like to have?",

      KeyboardFactory.getPizzaOrDrinkKeyboard(),

     FOOD_DRINK_SELECTION);

}

private void promptWithKeyboardForState(Long chatId, String text, ReplyKeyboard YesOrNo, UserStateEnum awaitingReorder) {

    SendMessage sendMessage = new SendMessage();

    sendMessage.setChatId(chatId.toString());

    sendMessage.setText(text);

    sendMessage.setReplyMarkup(YesOrNo);

   try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}


  chatStates.put(chatId, awaitingReorder);

 }

private void replyToPizzaToppings(Long chatId, Update message) {

    if ("margherita".equalsIgnoreCase(message.getMessage().getText())) {

        promptWithKeyboardForState(chatId, "You selected Margherita Pizza.\nWe will deliver it soon. Thank you!\nOrder again?",

                KeyboardFactory.getYesOrNo(), AWAITING_CONFIRMATION);

    } else if ("pepperoni".equalsIgnoreCase(message.getMessage().getText())) {

        promptWithKeyboardForState(chatId, "We finished the Pepperoni Pizza.\nSelect another Topping",

                KeyboardFactory.getPizzaToppingsKeyboard(), PIZZA_TOPPINGS);

    } else {

        SendMessage sendMessage = new SendMessage();

        sendMessage.setChatId(chatId.toString());

        sendMessage.setText("We don't sell " + message.getMessage().getText() + " Pizza.\nSelect the toppings!");

        sendMessage.setReplyMarkup(KeyboardFactory.getPizzaToppingsKeyboard());

        try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

    }

}

private void replyToFoodDrinkSelection(Long chatId, Update message) {

    SendMessage sendMessage = new SendMessage();

    sendMessage.setChatId(chatId.toString());

    if ("drink".equalsIgnoreCase(message.getMessage().getText())) {

        sendMessage.setText("We don't sell drinks.\nBring your own drink!! :)");

        sendMessage.setReplyMarkup(KeyboardFactory.getPizzaOrDrinkKeyboard());

       try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

    } else if ("pizza".equalsIgnoreCase(message.getMessage().getText())) {

        sendMessage.setText("We love Pizza in here.\nSelect the toppings!");

        sendMessage.setReplyMarkup(KeyboardFactory.getPizzaToppingsKeyboard());

        try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

chatStates.put(chatId, PIZZA_TOPPINGS); 

    } else {

        sendMessage.setText("We don't sell " + message.getMessage().getText() + ". Please select from the options below.");

        sendMessage.setReplyMarkup(KeyboardFactory.getPizzaOrDrinkKeyboard());

       try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

    }

}

private void replyToOrder(Long chatId, Update message) {

    SendMessage sendMessage = new SendMessage();

    sendMessage.setChatId(chatId.toString());

    if ("yes".equalsIgnoreCase(message.getMessage().getText())) {

        sendMessage.setText("We will deliver it soon. Thank you!\nOrder another?");

        sendMessage.setReplyMarkup(KeyboardFactory.getPizzaOrDrinkKeyboard());

       try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

chatStates.put(chatId, FOOD_DRINK_SELECTION); 

    } else if ("no".equalsIgnoreCase(message.getMessage().getText())) {

        stopChat(chatId);

    } else {

        sendMessage.setText("Please select yes or no");

        sendMessage.setReplyMarkup(KeyboardFactory.getYesOrNo());

       try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

    }

}

private void stopChat(Long chatId) {

    SendMessage sendMessage = new SendMessage();

    sendMessage.setChatId(chatId.toString());

    sendMessage.setText("Thank you for your order. See you soon!\nPress /start to order again");

chatStates.remove(chatId); 

    sendMessage.setReplyMarkup(new ReplyKeyboardRemove(true));

   try {

execute(sendMessage);

} catch (TelegramApiException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}



}


class KeyboardFactory code::::


package com.example.chatbot.KeyBoardFac;


import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;

import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardMarkup;

import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardRow;


import java.util.List;


public class KeyboardFactory {

public static ReplyKeyboard getPizzaToppingsKeyboard() {

KeyboardRow row = new KeyboardRow();

row.add("Margherita");

row.add("Pepperoni");

return new ReplyKeyboardMarkup(List.of(row));

}


public static ReplyKeyboard getPizzaOrDrinkKeyboard(){

KeyboardRow row = new KeyboardRow();

row.add("Pizza");

row.add("Drink");

return new ReplyKeyboardMarkup(List.of(row));

}


public static ReplyKeyboard getYesOrNo() {

KeyboardRow row = new KeyboardRow();

row.add("Yes");

row.add("No");

return new ReplyKeyboardMarkup(List.of(row));

}

}




Enum UserStateEnum





package com.example.chatbot.UserState;


public enum UserStateEnum {

AWAITING_NAME, FOOD_DRINK_SELECTION, PIZZA_TOPPINGS, AWAITING_CONFIRMATION

}





OUTPUT WILL BE LIKE 






Friday, June 16, 2023

Paparazzi pilaster

 lease Rate This Story


In a bustling suburb of Mumbai, a school named Mumbai public school, on the eve of Independence Day is sprouting with activity. School with its legendary past, known to invite a famous personality of the year, for its independence day. The climate serenity, with the gigantic crowd collocated, echoed an aura of happiness. With the Indian flag entwined

On the podium, looking to be unfurled by the chief guest, all sight rested on the chief guest of the day,
The crowd is in a cryptic dilemma, with high dignitaries of the school refusing to reveal the name of the guest,
Every face in the crowd was mazed by the question, who will be the chief guest for this year? Into the
Grim silence, a BMW choke its tethering flow, and a man with a pale emblemed face, thin in appearance entered from the BMW, with he left the residing, crowd at the end of the cusp, seeing the principal rushing towards the entry of auditorium, to invite the guest of the day. With an affable smile, the principal of the school invited the guest into the auditorium. With Forlorn walking in front of the audience, the crowd got a glimpse of the guest, murmur broke into the crowd, with some part of the audience recognizing the famous figure. The principal and the guest, stepping ahead on the podium of the auditorium, found their chair to be seated. With the guest settled and having a glimpse of the curious crowd, the crowd enjoyed the full view of the guest. The senior teacher of the school nears the Mike on podium, to start the proceedings of the day. The senior teacher, called on the principal of the school, to introduce the chief guest. With a beaming flash the principal took Mike into his hand and started introducing the guest. The principle says: "Good morning to enthused gathering. I like to introduce to the audience our chief guest. He is Mr susheel, a paparazzi, with his mystic photos winning many awards, in and outside our country. Recently, he won a world-famous award in paparazzi. I like him to unfurl our tricolor ".Part of the crowd already knew the guest's name before the introduction, so were unmoved.
With that, the principal and Mr susheel took great steps toward the flag pole. Mr susheel, unfurled the tricolor, and petals of flowers graced the guest. A Crescendo of the Indian National anthem spread through the auditorium. The guest, principal, and crowd stand to the National anthem, with patriotic fervor running in the veins of people. The last lines of the anthem saw, the crowd in a serene pose. The anthem ended, principal moved towards Mike, to invite Mr susheel to engross his an inspiring journey to the crowd filled with students and their parents. Mr susheel moved towards Mike in brisk style, the crowd seeing Mr susheel, where into conundrum, how come Mr susheel made a living and went from rags to riches, while being a paparazzi?, the crowd was spellbound by the magnetic personality of Mr susheel. Mr susheel taking Mike into his hand started with a sober mood overtook the jubilant state, which he was previously in. Mr susheel started addressing the crowd, and became emotional, Mr susheel says, "Good morning parents and students, Success in any field depends on knowing the intricacies of the field as well as the luck involved. My journey is moved by two wheels of luck and hard work both balancing my paparazzi vehicle equally. Never in my budding days, dreamed about my success being so big. I want these tech-savvy, Hitech parents not to draw a boundary to their child's career plan. I saw in India, very few risks with new fields like paparazzi. In the U.S., European countries, take up different fields. My story is no less engrossing than a super-hit Bollywood movie, having all types of shades visible. (Mr susheel, took a pause, sipping water, from the glass on the table, with his stern glance towards the audience, saw the crowd mesmerized). Mastery of any field, depends on the intellectual depth you have in that field, I can take the example of the great Picasso, why is his art, so famous and costly? It is because of the Intellectual depth his art emulates. Similarly in any field may be it Engineering, paparazzi, maths, etc, talent in these fields depends on Intellectual depth. My story goes back to 30 years earlier Telangana, born in the slums of Adilabad. My parents both toddy toppers, have their profession. In the grim reality, my parents in one room stay, deprived of basic amenities. With the family income of 1000 rs per month, life was very tough and rough. Those were the day, our family struggled for every piece of bread. My success in paparazzi is because of my mind filled with terrifying scenes of childhood struggles, I had seen, and my surroundings filled with sorrow. Recently, I won a prize because my photo unfolded, the cryptic story of a hungry person, which I experienced. The success of today mostly depends on the tough ride, I go through in my childhood. Going to school was travel for 20 km, outside our slum, and my parents decided to enroll me in school, that was the crucial decision my parents took, which paid off, in my later quest for success. In early schooling, i was studious and always liked by my teacher. When I was in 2 class of schooling, an incident completely changed the course of my life. I was coming from school, and there I found a person, holding a camera in his hands, taking some, interesting photos of our slum, seeing him taking photos, I was curious, some questions encountered my thought, about why he was taking the photos of these grim realities? What he will get?, because of the curious mind, I have, the questions made me inquire, I started moving towards the photographer, and started asking my questions, I found him very friendly, he told, he was a paparazzi, representing a Hindu newspaper and told, that I am very small to know the meaning of the word. I asked him to give, me the camera for a moment, which he did, and my fascination for my weapon (camera) started. But I got to know, the thing he was doing, behind the grim reality of an empty stomach, there started my, adventure for photography. In the 5 class of schooling, I was collecting photos from the magazines I encountered. To my surprise, one day, I saw the same paparazzi, whom I met 3 years back. I met him, and with the first glace of his sight, he recognized me. I told, him to wait for me, went to the house, and got the collection of photos, I collected, he was my first guide, who took me into his stride, and was impressed by my interest in Paparazzi. His name was Mr. Shyam, he was a struggling paparazzi but a generous and kind-hearted person. He inquired about my family, (he told, he was impressed by my keen eye for photography and liked to help me, his salary is rs 10000 per month, he told, he will help me). He got the complete whereabouts of my place, left the place, promising me to help. He appeared in front of me, after 3 months gap, and to my surprise, he gifted me Kodak 240, an entry model, to me. I thanked the generosity shown by him towards me. He told me to click some photos of a variety of birds in and around the Adilabad slums. He left the place, never after that, incident, we ever met again. After two years, in the Hindu newspaper, I found the news of Mr. Shyam's obituary. On that day, I cried a lot, with my tears, telling Mr Shyam, to rest in peace. Mr Shyam concomitant, played a crucial part in the marvelous success, I am enjoying. Into the 8 class of schooling, being a backbencher, I studied the intricacies of Steven's photos, which are like a bible for paparazzi. With the camera( kodak 240, which was gifted by Mr Shyam), I had a complete collection of photos of birds, and slums captured every minute detail in my photos. My first success came when I was in 10 class of schooling, the picture I took of my slum, was figured out in Hindu and I was paid Rs 5000 for that, it was my first salary, my parents were happy about it, my friends in the slum, were in the jubilant state, with my photo appearing in Hindu, Hyderabad edition, started my professional career in paparazzi. From that day, my photos appeared in newspapers like the Hindu, and Indian Express regularly. I was earning respectable money at the age of 16, and my life which was on tenterhooks before transformed into reasonable living. With my reasonable salary, I was able to buy, my parent's dress, which braced my confidence, with their sanguine words. I prayed to Ganesha (god), known to be a words magician. I joined Vivekananda junior college, known to finance budding talent, and got a scholarship for my further endeavors. Soon after completing of my college, got a job in an elite American company, where the glitters of the Royal elite, made me part of the elite. With my skills sharpened, in the company of the elite, in the span of 12 years, went from rags to riches. Where I am now, is the story of the hard work and dedication I gave to my field. Thanking the gathering of parents, children, and respectable teachers, I like to end my speech. The whole crowd gave a standing ovation to Mr susheel, moved by the grand ovation, and tears roll out of Mr susheel eyes. The principal addressed the gathering, "Mr susheel is an inspiration to many, who want to reach the skies. Thank you Mr susheel".Mr susheel left the podium of the auditorium, Principle accompanied him and gave a send-off. Curtains to the inspiring life.

Saturday, May 6, 2023

crescendo of deaf

                                                  

 

I am perplexed whether being deaf is really an imprecation. Close enculturation into the premiate of deafness. I conclude it can be boom also. To exonerate the maze of the above thinking, I like to delve into Mother nature's deafness. Being deaf to human cruelty, nature's deaf crescendo inculcates love into humans. The deaf crescendo of nature tunes a string of notes, that fills love. Human's arrogance is tamed by sweet crescendo of nature.


Thursday, September 8, 2022

Alisha, its you and me




 Into the alluring evening, On the preface of finding love, my sight on a restless fringe, saw a dp that my senses placatingly agreed to find love in that angelical woman, toting from the dp her unlimited love. I fidgetily started pinging her, into the surprise of dawn, I find her reply full of agreement. With her charming reply, to my never-ending curiosity, with her patience completely made my desire unfurl. I started asking her name, with turquoise emblemed head, tutoring me to tone with no flam, my unconditional love. With her ever confidence reply, that made an angelical woman an Alisha. I started echoing "Alisha, it's you and me".