Search This Blog

Are You A Thinker Or Maybe It's Overflowing?

Hi, everybody. I'm Rohit Patel and I'd like to ask you today, "Are you a thinker
Or maybe it's overflowing? Do you live in a zero-sum world where somebody can win only if somebody else loses? How you answer these questions will help you determine whether you're an abundance thinker. How you think is so important. That's why I'm talking to you about it today because as a man or woman thinker, so he or she is. You outer world, everything about you, where you live, where you work, how much money you earn, your relationships, your surroundings,what happens to you and even your countenance - your facial expressions - are a reflection of your inner world of thoughts, feelings and beliefs.


The Bible says, "beloved, I wish above all things that you should prosper." It also says that in all things whatsoever you pray and ask for, believe that you have received it and you shall have it. I believe that an abundance mentality stems from knowing you are loved, deeply loved, and created for a purpose on purpose. This gives a deep sense of inner peace and purpose that opens the doors of your world to see possibilities, blessings, abundance in all things. Abundance thinkers still face challenges in life. They face sickness, sadness, death and grief. They feel disappointments and sometimes they suffer. What abundance thinking enables them to do is to feel the love that conquers all, that underpins everything, and reminds them of their worthiness and their purpose. Like those inflatable toys when I was a child,I think we called them Bozos, we'd try to knock them down but, because they were weighted in the bottom, they'd always stand right back up. 


So like those toys, an abundance thinker is able to bounce back because they are grounded in the knowledge of purpose and filled inside with uplifting love. They rebound. They see possibilities and opportunities and they see them because they understand they're worthy of them. The glass is always half full with more on the way - overflowing - more than half full! They understand the concept of win-win and find ways for everything and everyone to be better. To be more enriched rather than see a need for someone to lose. Abundance thinkers are people just like you and me. They don't look any different except maybe their facial expression conveys that feeling that comes from believing in what I call abundance. Love. They are problem solvers, not drama queens. Abundance thinkers are peace makers not pot stirrers. They're mediators rather than instigator sand they're winners rather than losers because they refuse to be. 


So, on a scale of 1 to 10 with 10 being a full-up abundance thinker, how would you rate yourself today? Right now? If you need to move up that scale to get closer to the 10, you have the power to do that. Simply zoom out and see the world around you. See that it's filled with good-hearted people. People who convey love and light. Then commit to being more like them. Surround yourself with people like that. Emulate them. Allow yourself to bask in love and the purpose for which you are created. You can have a life filled with abundance. In fact, I believe you already have that abundance. It's inside you programmed just like the operating system that's already programmed in your computer. You just need to boot it up or maybe sometimes you need to re-boot it to access that endless abundance. Limitless love. Bountiful beauty that's installed in you in your operating system. Some people may dream and spend their days wishing for things.


Today is the day for you to step into what's already yours. Claim it. Embrace it. Love it. Believe it and then enjoy living in that abundance. Magnify it by sharing it with others. Share the love. Share the knowledge of what is already programmed inside of those with whom you come in contact. Share the belief and the knowledge that all we need to do is boot or reboot our system and move forward with grace and ease. And remember, do just that - take thyme for you because you deserve it abundantly. Til next time.

Difference between "keyword" and "text" type in elastic search

Here we go with very simple example of statement "I'm running now!" and see how it will be splits into token and store into elastic search index.

statement : "I'm running now!"


if type="keyword" : [I'm running now!] - it will store in one token, you can not retrieve document it by matching 'running' or 'now' terms

if type="text": [i'm, running, now!] - it will store in three tokens, you can retrieve document by matching 'running' or 'now' terms

Text datatype

A field to index full-text values, such as the body of an email or the description of a product. These fields are analyzed, that is they are passed through an analyzer to convert the string into a list of individual terms before being indexed. The analysis process allows Elasticsearch to search for individual words within each full text field. Text fields are not used for sorting and seldom used for aggregations (although the significant text aggregation is a notable exception).

If you need to index structured content such as email addresses, hostnames, status codes, or tags, it is likely that you should rather use a keyword field.

Keyword datatype

A field to index structured content such as email addresses, hostnames, status codes, zip codes or tags.

They are typically used for filtering (Find me all blog posts where status is published), for sorting, and for aggregations. Keyword fields are only searchable by their exact value.

If you need to index full text content such as email bodies or product descriptions, it is likely that you should rather use a text field.

How do I find distinct values of date/ specific field based on date range in Elasticsearch

You need to do it this way, i.e. add the date range as a query to reduce the document set, and then run the terms aggregation only on the documents that fall into that date range:

Terms Aggregation

A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.

Date Range Aggregation

A range aggregation that is dedicated for date values. The main difference between this aggregation and the normal range aggregation is that the from and to values can be expressed in Date Math expressions, and it is also possible to specify a date format by which the from and to response fields will be returned. Note that this aggregation includes the from value and excludes the to value for each range.

POST index/_search?size=0
{
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "tstamp": {
              "gte": 1591795757000,
              "lte" : 1591890413000
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "result": {
      "terms": {
        "field": "tstamp",
        "size":171
      }
    }
  }
}

Issue with running a Update By query elasticsearch API in AWS

welcome to the knowledge gaps that I’ve been screaming about for many moons!

                 Elasticsearch - How to add new field to existing document by update by query. Elasticsearch: Back-fill old documents with email, documents would be around 1M+ records.

You can use the update by query API in order to add a new field to all your existing documents:
POST index/_update_by_query?conflicts=proceed&scroll_size=500
{
  "script": {
    "source": "ctx._source.email = 'rohitpatel0105@gmail.com'",
    "lang": "painless"
  },
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "email"
          }
        }
      ]
    }
  }
} 

        While running update by query API around 700k records have been updated and suddenly CPU utilization went to maximum state and nodes started to go down with cluster status "Red".



the most likely root cause is exactly that - my UBQ … which hit too many documents too fast and destroyed the cluster. in addition to UBQ being SO easy to over-match on and update docs you didn’t mean to.{ memory and gc graphs are towards the bottom of those dashboards }

I would suggest that you use the _tasks api to first find and annihilate any remaining, running UBQ tasks ( which will keep running independent of whether you are still connected ) … or just wait out the storm and see if the cluster ever comes back.

If deleting a problematic index isn't feasible, you can restore a snapshot, delete documents from the index, change the index settings, reduce the number of replicas, or delete other indices to free up disk space. The important step is to resolve the red cluster status before re-configuring your Amazon ES domain. Re-configuring a domain with a red cluster status can compound the problem and lead to the domain being stuck in a configuration state of Processing until you resolve the status.

Conclusion: Don't try to use update by query API with large docs without closing index directly in cluster.

Elasticsearch - How to add new field to existing document by update by query

     Elasticsearch: Backfill old documents with email
 
 
You can use the update by query API in order to add a new field to all your existing documents:

POST index/_update_by_query
{
  "script": {
    "source": "ctx._source.email = 'rohitpatel0105@gmail.com'",
    "lang": "painless"
  },
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "email"
          }
        }
      ]
    }
  }
}

Have you discovered yourself in prevailing pandemic lockdown - Covid 19 in 2020? - By Hardik Patel

 
 

Every fade has a fall for sometime and so this growing pace too. It could take only 6 to 7 months for a tiny virus to grow in more than 125 countries. Does this call for a cause? Well its not a cause but seems to be a curse of how a man is a bundle of desires. We are not even a size of a virus against the nature and if we really have not understood these things, we are surely at a wrong race trust me.
 

Every luxury and lifestyle arrangements are affected but have you seen any impact on the water, air, fire and other forms of nature? Contrary they have purified but are we also purified on our thoughts? This uncertainties have brought lot of eye openers and those are points of discussions exactly on how we should learn things for not grooming and look decent to others but to curate ourselves as to how are we well prepared post this time to evaluate on knowing our souls and our heart which is loaded with the fake commitments and wrong requirements in life.

This time calls for a moment to think why do you be known to the world and why do you exist in this world? Is it because of the fulfillment's of other's dream or is it for the betterment of the society? Giving donations to poors or want to do something for poors? It can be so soothing and cool to be a part of the community by engaging ourselves on innovations and betterment of the community. Of course money will fall on you if these are done with the pure commitments. Falling money here I mean by is the karma's return and not money earned by doing something wrong.

Time is endless and it just ends for those who are done. You need to press hard the surface to extend the more seconds and minutes on life for regenarting and reopening up of our minds on how are we going to do something really different in this new normal.

We are not even a small hair in the entire galaxy, don't try to mess with nature, be natural on your thoughts and reinvent yourselves.

A small ending thought - cooking new dishes in this time is a waste of time if that is not helping the community.

We should spread equal love for community. We are the same as our color of the blood is same. Be wise and reinvent yourself.
 
- From a small piece of shit

How to create a war file directly inside jboss deployments folder(external folder) using maven in pom.xml

Kindly keep a configuration as below mentioned :
 
    Pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.seedsofjava.blogspot.com</groupId>
 <artifactId>abc</artifactId>
 <packaging>war</packaging>
 <version>1.0</version>
 <name>abc</name>
 <build>
 <finalName>abc</finalName>
 <pluginManagement>
 <plugins>
 <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-compiler-plugin</artifactId>
 <version>3.5</version>
 <configuration>
 <source>${java-version}</source>
 <target>${java-version}</target>
 </configuration>
 </plugin>
 <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-war-plugin</artifactId>
 <configuration>
 <warName>abc</warName>
 <warSourceDirectory>src/main/webapp</warSourceDirectory>
 <failOnMissingWebXml>false</failOnMissingWebXml>
 <webResources>
 <resource>
 <directory>lib/</directory>
 <targetPath>WEB-INF/lib</targetPath>
 <includes>
 <include>**/*.jar</include>
 </includes>
 </resource>
 </webResources>
 <outputDirectory>C:/Softwares/jboss-eap-7.0/standalone/deployments</outputDirectory>
 </configuration>
 </plugin>
 </plugins>
 </pluginManagement>
 </build>
</project> 

How to compare two string dates in hibernate using criteria if DB field

 
It is very simple and easy to do in hibernate using criteria condition. Let's say we have two fields like from date and to date As "String". 

First we should consider below mentioned conditions while developing it

It will be like below cases: 
  1. User select fromdate and didnt select todate than 'it should fetch all records from fromdate to systemdat'
  2. if user select only todate and not formdate than it should fetch all record till todate
  3. If user enter both than it should filter the record in date range and display
  4. If fromdate > todate then we should through error 
  5. Both are not given than it should find all the records till Systemdate i.e. Today
Code will be look like something as :
 Hibernate DAO layer:
if(!Utils.isNullOrEmpty(model.getDateFrom()) && !Utils.isNullOrEmpty(model.getDateTo())) { cr.add(Restrictions.sqlRestriction("TRUNC(COLUMN) >= TO_DATE('" + model.getDateFrom() + "','dd/mm/yyyy')"));
 cr.add(Restrictions.sqlRestriction("TRUNC(COLUMN) <= TO_DATE('" + model.getDateTo() + "','dd/mm/yyyy')"));
 }
 else if(!Utils.isNullOrEmpty(model.getDateFrom()) && Utils.isNullOrEmpty(model.getDateTo())) {
 cr.add(Restrictions.sqlRestriction("TRUNC(COLUMN) >= TO_DATE('" + model.getDateFrom() + "','dd/mm/yyyy')"));
 //cr.add(Restrictions.sqlRestriction("TRUNC(COLUMN) <= TO_DATE('" + Utils.formatNewDate() + "','dd/mm/yyyy')"));
 }
 else if(Utils.isNullOrEmpty(model.getDateFrom()) && !Utils.isNullOrEmpty(model.getDateTo())) {
 cr.add(Restrictions.sqlRestriction("TRUNC(COLUMN) <= TO_DATE('" + model.getDateTo() + "','dd/mm/yyyy')"));
 }
Utils.java:
public class Utils {
 public static Boolean isNullOrEmpty(String str){
 return (str != null && !str.isEmpty()) ? false: true;
 }
}

Best way to use Spring MVC ModelAttribute field in JSTL/JSP page in c:if

        Let's say that you want to hide/show in GUI based on Spring MVC @ModelAttribute field, Kindly follow below mentioned steps :

Guess that you have one UserModel with field saveButton as string type for storing true/false.

UserModel.java

public class UserModel {
    private String saveButton = "true";
}

UserDetails.jsp
<c:if test="${userModel.saveButton == 'true'}">
	<input type="submit" class="btn btn-primary btn-sm" id="saveUserDetails" name="method" value="Save">
</c:if>

In this best way, we can achieve to hide/show button in spring mvc.

Are You A Thinker Or Maybe It's Overflowing?

Hi, everybody. I'm Rohit Patel and I'd like to ask you today, "Are you a thinker Or maybe it's overflowing? Do you live in ...

Popular Posts