Monday, 2 September 2024

Healthy Wieght Loss Journey Me

 Overview

Hello Guys, I am starting a new blog series on how to achieve a healthy and happy weight loss journey tips. This details and information I am going to share is on my own experience and weight loss journey.

Lets cover points in details in my this and upcoming blogs.

 

Lets start our journey..

 "How I can quickly get rid of excessive weight?" this is mostly asked question to self and to internet by group of people who are suffering from high weight or obesity. There are many information available over internet and video streaming applications and sites as well. I am also going to share some information with you, which also follow on same pattern but only difference is the information which I am going to share with you is based on my self experience and steps I followed.

So get ready for buying new set of cloths for you in next 90 days 😉..

 

Lets categories to make it simple

  •   Why a 'X' person gains a weight? There could be more reasons behind this in medical terms but I am not medical expert, but the one I observed from self and some close peoples study is below -
    • Not having proper sleep
    • Wrong eating habits (consumption, content, quantity and time)
    • Activity Level (Active time & type of activity)
    • Emotions & Stress

 Now lets cover each of this one by one.

  • Not having proper sleep
    • Every human being, whether is healthy or not healthy always need a proper and non interrupted sleep at-least 7-8 hours.
    • When we have a proper sleep, whole day becomes energetic and active. This is most important aspect in our weight loss journey.
    • In short, when we are energetic and active, it helps us to increase the activity level in rest of the day.
    • Make sure you will have a proper sleep of 7 to 8 hours, try to sleep early say 9-10 PM and start a day at 5 AM.
  • Wrong eating habits (consumption, content, quantity and time)
    • What is wrong eating habits?
      • Day starting with any sort of food (tea, coffee or breakfast) as soon we wake-up within 1 hour.
      • Eating too many bakery products (Biscuits, Cake, Cookies, Pastries, or any sort of item having refined floor, salt and any sort sugar's or sweeteners included in it).
      • Excessive oily and spicy food.
      • Eating till we feel full!
      • Drinking too much water during eating and after eating (no matter hot or cold).
      • Drinking any sort of breakages either during eating or any time.
      • Very short duration between two meals.
      • Quantity you take in single meal.
      • Sweets/Deserts portion in your meal is high.
      • Carbs and Fats portion in you mean is high.
      • Dinner time and quantity!
      • Less amount of fruits and veggies in diet.
    • How to get healthy eating habits?
      • Once you wake-up, drink one glass of lukewarm water.
      • Get fresh, and do one decent morning walk for minimum 1 hours (more details on exercise lets cover in later part)
      • Avoid Tea / Milk / Coffee with Sugar as much as you can! start slowly but ultimate goal is come on zero direct sugar consumption.
      • You can drink another glass of hot water, or tea or coffee without sugar & milk. Avoid eating any bakery products along with your sip of tea/coffee.
      • You can also have any herbal or green tea. 
      • After some gap, you can go for breakfast which should be high in protein and healthy fats and vitamins (you can search for healthy breakfast option over internet, but avoid ready to use food, instant foods, or processed foods).
      • If you ask me what I eat, I will put all schedule down section for reference.
      • After a two hours gap go for healthy lunch; include balanced diet lunch.
      • In evening avoid drinking any beverage better to go for dinner before 6 PM.
      • Dinner should be very light, more in fibers and which you fuller in low calories intake.
      • After 6 PM, only water till rest of day. 
  • Activity Level (Active time & type of activity)
    • Your weight loss journey, your activity level plays most important role. 
    • Remember simple mantra 

                         How we loose weight or fat? 

                         Eat balanced & Perform workouts

    • In simple words
      • If you eat more, and workout less - you will gain weight 
      • If you eat more, and workout decent- you might maintain the weight 
      • If you eat balanced and workout decent - you will loose fats/weight 
      • If you eat balanced and workout less - you will loose weight but body muscles too.
  • Emotions & Stress
    • Stress, depression, and anxiety can sometimes lead to overeating or unhealthy eating habits, contributing to weight gain.
    • Get Proper sleep and meditations.
    • Get relaxed with some soft musics, or calm walk.
    • Get proper sleep, in case of any other issues, consult with doctor.


How I made it!!

  • People think, I cannot do the Gyms, or Running etc.
  • You don't need to do it, simple step is to get more steps!!
  • Just Walk on decent speed (100-110 steps per minute)
  • Just walk, whenever and wherever you can!!
    • Walk in early morning
    • Walk while having call on mobile
    • Walk on listening music
    • Walk while media consumption (ensure you walk on safe places, which you know better; not on road or public places)
    • If you get 2 min's free time, just walk 200 steps in it.
  • Put yourself a target that daily you will walk 6000 steps with high intensity.
  • Then increase the limit every week by 1 or 2 thousand, and ultimately reach on 12 to 15 thousand steps per day or even more for faster results.
  • Always remember, 
    • Their so quick process for fat loss! no medicines, no fancy foods, no treatments.
    • It's you! you can do it, just have patience and never give-up.
    • Not expect daily significant decent in your fat loss graph.
    • No daily weighing, always do weekly weighing.

With simple change is food habit and walk (following above steps) I managed to to reduce my weight by 25 KG in 3 months.

 Comment me for more information you need, I will definitely love to share. 


** Please note, follow the medical / doctor advice always if you are suffering from any explicit disease before following this. This is my self steps and process, and I am not a medical expert.

 


Wednesday, 14 February 2018

ORM - Object Relational Mapping

Overview

When we work on enterprise level application's in Java, most of the times we come across the various relational databases. For a application developer, apart from main business logic, putting efforts for database handling part, which will be time consuming and  tedious task for him. It may include lot of activities like DB configuration, DAO/DTO code creation, handling transactions and rollbacks, and exception handling for same.

Now is there anyone who can take developer out of this stuff, and let them only concentrate on Business Logic only?? Well!! Yes... its ORM tools (Object Relational Mapping).

Why ORM

In above scenario we are more clear why we need ORM. 
ORM tools may simplify efforts for data creation, its manipulation and access of persisted data in database, and more stuffs on transactions and sessions side.

Also you can think! in java, mainly we talk about OOPs (Object Oriented Programming), now what does it mean? it mean, everything in application we treat in terms of objects. And that object holds state for specific purpose, with its member variables.
Now while working with OOPs/ Java, when it comes to Relational Database for persistence and accessing, in conventional way (simple JDBC java code), we do deconstruct  object back to variables for making sqls/statements and while reading from database, again simple variables we put back in object instance variables to construct meaningful object back.
If we think of this as a whole, end to end, it somehow breaks OOPS feature for java. 
So ORM will also help in this case, to make everything as OOPS way. i.e. to ORM we pass a object for persistence, and from ORM we get object as row presentation DB.

Note that ORM tools internally uses JDBC API's to interact with underlying databases.

Some Examples for ORM tools are - 

  • Hibernate
  • TopLink
  • MyBatis
  • and many more...

Tuesday, 12 December 2017

WebLogic 12C EJB deployment issue

Recently I faced issue while deploying existing custom ear, while deploying on upgraded WebLogic Version 12C. The existing ear is previously compatible with older WebLogic version 10.3.4
While deploying same ear on newer version of WebLogic got following error on server and console -

weblogic.management.DeploymentException: weblogic.application.naming.ReferenceResolutionException: [J2EE:160199]Error resolving ejb-ref "com.xxx.xxx.xxx.xxx.xxx.xxx.XXXX/xxxRemote" from module
"XXX-X.X.X.war" of application "XXX-X.X.X". The ejb-ref does not have an ejb-link and the JNDI name of the target Bean has not been specified.

Solution:
To deploy it, I have removed my EJB module jar from

XXX.ear
             |__ xxx.war
                               |__ WEB-INF
                                                    |__ lib
                                                             |__ ejb jar [which causing issue]

Note, in my case the jar I removed from WAR file, is already present under EAR, and having duplicate occurrence inside the WAR/lib.

Hope this will help. 

SQL Join's Example

'Join' by word itself we get to know, it talks about something we combine together to get desired result.

In database terms, join is all about combining data from multiple tables as single record. Now days, all the data in database is normalized and to display some meaning full information we need to combine data from more than one table.

For example, let's take classic example of customer and order.
In real world, customer information will go in CUSTOMERS table and orders will go in ORDERS table having FOREIGN_KEY for CUSTOMER_ID.
Now when we have to retrieve data for one of use case say, who has placed order with ID=xyz. Here we will get the record from ORDERS, and check for respective customer from CUSTOMERS table using FOREIGN_KEY in that record, combine this data and result will be populated.
Now such operations can be done either by coding or SQL way.

Lets now talk more on SQL Join's in detail -

While talking about SQL Join's, there are 4 basic types of join's as -

  1. Inner
  2. Left
  3. Right
  4. Full
To understand this type quickly let's see below examples with diagrams -

Considering above diagram and join scenario's we might need data like -

  1. Only B              [Inner]
  2. A and B            [Left]
  3. B and C            [Right]
  4. All A, B and C    [Full]
Lets see in detail one by one -

Before going to types, see below database table example, which will be used as reference further to explain all types of Join's.


CUSTOMERS
CUST_IDCUST_NAMECUST_CONTACTCUST_CITY
11111Ram32145646Pune
11112Sarika65465812Mumbai
11113Manisha45454545Delhi
11114Vishal89295956Chennai
11115Mahesh54945956Jaipur


ORDERS
ORDER_IDO_DATEAMOUNTCUST_ID
11122-05-2017120011111
11223-05-2017350011112
11324-05-201720011114
11424-05-2017200011120




Inner Join
    [Select all records from MyTable1 and MyTable2, for which the given join condition is valid]

    Let's say we want to display list of customers whole had made an order, along with the details of order they placed.
    If we consider above diagram, this use case will be, all the records from MyTable1 for which there is reference in MyTable2 (Portion B).
    Best fit example for Inner Join.

    Query:

    SELECT CUST_NAME, CUST_CONTACT, O_DATE, AMOUNT FROM CUSTOMERS C INNER JOIN ORDERS O ON C.CUST_ID = O.CUST_ID;



    INNER JOIN RESULT
    CUST_NAMECUST_CONTACTO_DATEAMOUNT
    Ram3214564622-05-20171200
    Sarika6546581223-05-20173500
    Vishal8929595624-05-2017200



    Left Join

    [Select all records from MyTable1 along with records from MyTable2, for which the given join condition is valid]

    Simply we want to display all the customers and their respective orders.
    i.e. All the records from MyTable1 (A) for which there is reference in MyTable2 (B) and NOT records from MyTable2 (C) for which there is no entry in MyTable1.
    This is good example for Left Join.

    Query:

    SELECT CUST_NAME, CUST_CONTACT, O_DATE, AMOUNT FROM CUSTOMERS C LEFT JOIN ORDERS O ON C.CUST_ID = O.CUST_ID;

    LEFT JOIN RESULT
    CUST_NAMECUST_CONTACTO_DATEAMOUNT
    Ram3214564622-05-20171200
    Sarika6546581223-05-20173500
    Vishal8929595624-05-2017200
    Manisha45454545NULLNULL
    Mahesh54945956NULLNULL



    Right Join

    [Select all records from MyTable2 along with records from MyTable1, for which the given join condition is valid] 
    Now consider that, we have to display all the order details along with customers who had placed the order.

    i.e. All the records from MyTable2 (C), for which there is reference in MyTable1 (B), and NOT there records from MyTable1 (A) which don't have corresponding record in MyTable2.

    Query:


    SELECT CUST_NAME, CUST_CONTACT, O_DATE, AMOUNT FROM CUSTOMERS C RIGHT JOIN ORDERS O ON C.CUST_ID = O.CUST_ID;


    RIGHT JOIN RESULT
    CUST_NAMECUST_CONTACTO_DATEAMOUNT
    Ram3214564622-05-20171200
    Sarika6546581223-05-20173500
    Vishal8929595624-05-2017200
    NULLNULL24-05-20172000




    Full Join


    [Select all records from MyTable1 along with records from MyTable2, regardless of given join condition is valid or not]

    If we have to display all the details of customer tables as well of order tables.

    Query:

    SELECT CUST_NAME, CUST_CONTACT, O_DATE, AMOUNT FROM CUSTOMERS C FULL JOIN ORDERS O ON C.CUST_ID = O.CUST_ID;


    FULL JOIN RESULT
    CUST_NAMECUST_CONTACTO_DATEAMOUNT
    Ram3214564622-05-20171200
    Sarika6546581223-05-20173500
    Vishal8929595624-05-2017200
    NULLNULL24-05-20172000
    Manisha45454545NULLNULL
    Mahesh54945956NULLNULL


    Advance Encryption Standard

    Advance Encryption Standard (AES) is a encryption algorithm which overcomes limitations of DES or Triple DES.

    As DES have -

    • Theoretical attacks that can break it.
    • Demonstrated exhaustive key search attacks.
    In order to overcome this we can use Triple-DES (3DES), but it is slow as it has small data blocks.

    US NIST issued call for ciphers in 1997, 15 candidates accepted in Jun 98. Out of which 5 were shortlisted in Aug-99. 
    Rijndael was selected as the AES in Oct-2000 issued as FIPS PUB 197 standard in Nov-2001.

    Overview:
    AES cipher was designed by Rijmen-Daemen in Belgium.
    It has 128/192/256 bit keys, 128 bit data. 
    It is an iterative rather than Feistel cipher:
    • Processes data as block of 4 columns of 4 bytes
    • Operates on entire data block in every round
    Designed to have:
    • Resistance against known attacks
    • Speed and code compactness on many CPUs
    • Design simplicity

    Application Protocol Data Unit (APDU)

    Application Protocol Data Unit i.e. APDU is a communication Protocol between the smart card and smart card reader.
    APDU can be divided into two subcategories -

    • Command APDU
               Command APDU will hold data unit, which will be sent from smart card reader to smart card.
               After receiving such APDU on smart card, it will be executed on smart card based on                           implementation and command sent.

    • Response APDU
              Response APDU will hold the data, of executed Command APDU by smart card, and sent to              smart card reader.


    The structure of command and response of APDU defined in ISO 7816-4

    Command APDU will contain 4 mandatory bytes in it, those are CLS, INS, P1 and P2


    CLASS - CLS - APDU Class - denotes type of command. This can be standard or proprietary.
    INSTRUCTION - INS - Instruction Code - denotes specific command, e.g. Update Data, Delete Data etc.
    P1 - P2 - Indicates parameters (offsets) for data to be written or updated.
    Lc - Indicates length of data passed.
    DATA - Will contain actual data, of length specified by Lc.

    Response APDU will at least contain 2 bytes
    SW1 - Status Word first byte
    SW2 - Status Word second byte

    Based on SW1 and SW2, card reader will come to know, if given Command APDU is executed on Card successfully or not, and if not what is error.
    In notmal scenario, Status word for Success is 90 00.


    PL/SQL Functions

    In this post we will see how create, use and drop PLSQL functions using the syntax.

    CREATE FUNCTION

    Like in most of programming languages we have provision to create user defined functions. Oracle also provide way to create our own custom functions to do various operations on database.

    Syntax:

    CREATE [OR REPLACE] FUNCTION function_name [parameters] 

    RETURN return_datatype;  

    IS  

    -- Declaration_section  

    BEGIN  

    -- Execution_section 

    Return return_variable;  

    EXCEPTION  

    -- exception section  

    Return return_variable;  

    END; 

    • Return Type: The header section defines the return type of the function. The return datatype can be any of the oracle datatype like varchar, number, varchar2 etc.
    • The execution section and exception section both should return a value which is of the datatype defined in the header section.
    • Function can also have parameters there are three types of parameters that can be declared
      1. IN - The parameter can be referenced by the procedure or function. The value of the parameter can not be overwritten by the procedure or function.
      2. OUT - The parameter can not be referenced by the procedure or function, but the value of the parameter can be overwritten by the procedure or function.
      3. IN OUT - The parameter can be referenced by the procedure or function and the value of the parameter can be overwritten by the procedure or function.

    Example

    For example, let’s create a function called ''student_age_finder' similar to the one created in stored proc

     CREATE OR REPLACE FUNCTION student_age_finder ( stdId IN varchar2 )
        RETURN number;
     IS 
        stdage  number; 
     BEGIN 
    SELECT age INTO stdage
    FROM student WHERE studentId = stdId;
    RETURN stdage;
    END;

    In the example we are retrieving the ‘age’ of Student with stdId given in function call to variable 'stdage'.
    The return type of the function is number.
    The function returns the 'stdage' which is of type NUMBER.


    How to execute a PL/SQL Function?

    A function can be executed in the following ways.

    1) As a part of a SELECT statement

    SELECT student_age_finder(100) FROM dual;

    2) Since a function returns a value we can assign it to a variable.
    student_age :=  student_age_finder(100);

    3) In a PL/SQL Statements like,
    dbms_output.put_line(student_age_finder(100));

    DROP FUNCTION

    Syntax
    The syntax to a drop a function in Oracle is:

    DROP FUNCTION function_name;

    Where function_name is name of which is to be dropped.

    Example

    DROP FUNCTION student_age_finder