ReactJS : Functional or Stateless components

ReactJS : Functional or Stateless components

Many times you might come across a situation where React Component doesn’t need any state, which we call as stateless components. Thanks to React0.14 update, It introduced new types of react components with no state. 

React Stateless components are very much needed when the components is readonly doesn’t perform any operation other than just showing information.

How to Write React Functional component ?

React Functional Component Example: for stateless react component or a functional react component

const MessageBar = function(props) {
  return <p>Dear {props.username} you have completed the task successfully</p>;
};

The same component can nicely be written in one line using ES2015 standard as follows

const MessageBar = ({ username }) => <p>Dear {username} user, you have successfully completed the task</p>;

 

Conceptually components are like javascript functions here, they accept inputs as props, and return react elements. Functional components wherever required will also reduce load on redux since it is not required to maintain state for these components.

For more information on React functional components visit facebook react official site 

Check Advantages of React Functional Components

Also Check How to integrated Google Maps in reactJS : http://knowledge-cess.com/reactjs-google-map-component/

 

ReactJS: Google Map Component

ReactJS: Google Map Component

Steps to implement google maps in Facebook’s ReactJS Web Application

1. Add npm module in your project for react-google-maps

npm install --save react-google-maps # or
yarn add react-google-maps

 

Reference : https://github.com/tomchentw/react-google-maps

Before this you have to include google maps api sdk in your index.ejs file 

<script src=”https://maps.googleapis.com/maps/api/js?v=3.27&libraries=places,geometry&key=<YOUR_API_KEY>”></script>

How to get Google Maps Api Key ? 

Follow the steps given in this link

2. Create Google Map Handler Component

'use strict';

import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import update from 'react-addons-update';

import canUseDOM from 'can-use-dom';

import raf from 'raf';
import GoogleMapComponent from './gMapComponent';

const geolocation = (
  canUseDOM && navigator.geolocation ?
  navigator.geolocation :
  ({
    getCurrentPosition(success, failure) {
      failure('Your browser doesnt support geolocation.');
    },
  })
);

class GoogleMapHandlerComponent extends React.Component {

    state = {
      bounds: null,
      center: null,
      content: null,
      radius: 400,
      markers: []
    };

  constructor(props) {
    super(props);
    if (props !== null &&
        props !== undefined &&
        props.location !== null &&
        props.location !== undefined &&
        props.location.markers !== null &&
        props.location.markers !== undefined) {
      const locationInfo = {
        center: props.location.center,
        markers: props.location.markers
      };
      this.state = locationInfo;
    }
  }

  componentDidMount() {
    const tick = () => {
      if (this.isUnmounted) {
        return;
      }
      this.setState({ radius: Math.max(this.state.radius - 5, 0) });
      if (this.state.radius > 10) {
        raf(tick);
      }
    };
    geolocation.getCurrentPosition((position) => {
      if (this.isUnmounted) {
        return;
      }
      this.setState({
        center: {
          lat: position.coords.latitude,
          lng: position.coords.longitude,
        },
        content: 'Location found using HTML5.',
      });

      raf(tick);
    }, (reason) => {
      if (this.isUnmounted) {
        return;
      }
      this.setState({
        center: {
          lat: 60,
          lng: 105,
        },
        content: 'Error: The Geolocation service failed (${reason}).',
      });
    });

    if (document.getElementsByClassName('pac-container').length > 0) {
      const gmapSearchResultsBox = document.getElementsByClassName('pac-container')[0];
      gmapSearchResultsBox.style.zIndex = '2000';
    }
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps !== null &&
        nextProps !== undefined &&
        nextProps.location !== null &&
        nextProps.location !== undefined &&
        nextProps.location.markers !== null &&
        nextProps.location.markers !== undefined) {
      this.setState({
        center: nextProps.location.center,
        markers: nextProps.location.markers
      });
    }
  }

  componentDidUpdate() {
    if (document.getElementsByClassName('pac-container').length > 0) {
      const gmapSearchResultsBox = document.getElementsByClassName('pac-container')[0];
      gmapSearchResultsBox.style.zIndex = '2000';
    }
  }
  componentWillUnmount() {
    this.isUnmounted = true;
  }

  isUnmounted = false;

 handleMapMounted = this.handleMapMounted.bind(this);
 handleBoundsChanged = this.handleBoundsChanged.bind(this);
 handleSearchBoxMounted = this.handleSearchBoxMounted.bind(this);
 handlePlacesChanged = this.handlePlacesChanged.bind(this);
 handleMarkerClose = this.handleMarkerClose.bind(this);
 handleMarkerClick = this.handleMarkerClick.bind(this);

 handleMapMounted(map) {
     this._map = map;
   }

   handleBoundsChanged() {
     this.setState({
       bounds: this._map.getBounds(),
       center: this._map.getCenter(),
     });
   }

   handleSearchBoxMounted(searchBox) {
     this._searchBox = searchBox;
   }
   handleLoadPlaces(markers) {

   }
   handlePlacesChanged() {
     const places = this._searchBox.getPlaces();

     // Add a marker for each place returned from search bar
     const markers = places.map(place => ({
       position: place.geometry.location,
     }));

     // Set markers; set map center to first search result
     const mapCenter = markers.length > 0 ? markers[0].position : this.state.center;
     this.setState({
       center: mapCenter,
       markers,
     });
     this.props.handleLocationChange(mapCenter, places);
   }

   // Toggle to 'true' to show InfoWindow and re-renders component
  handleMarkerClick(targetMarker) {
    this.setState({
      markers: this.state.markers.map(marker => {
        if (marker === targetMarker) {
          if (marker.showInfo) {
            return {
              ...marker,
              showInfo: false,
            };
          }
          return {
            ...marker,
            showInfo: true,
          };
        }
        return marker;
      }),
    });
  }

  handleMarkerClose(targetMarker) {
    this.setState({
      markers: this.state.markers.map(marker => {
        if (marker === targetMarker) {
          return {
            ...marker,
            showInfo: false,
          };
        }
        return marker;
      }),
    });
  }

  render() {
    return (
      <GoogleMapComponent
        containerElement={
          <div style={{ height: '100%' }} />
        }
        mapElement={
          <div style={{ height: '100%' }} />
        }
        center={this.state.center}
        onMapMounted={this.handleMapMounted}
        onBoundsChanged={this.handleBoundsChanged}
        onSearchBoxMounted={this.handleSearchBoxMounted}
        bounds={this.state.bounds}
        onPlacesChanged={this.handlePlacesChanged}
        onMarkerClick={this.handleMarkerClick}
        onMarkerClose={this.handleMarkerClose}
        markers={this.state.markers}
      />
    );
  }
}

 function mapDispatchToProps(dispatch) {
   return bindActionCreators({ }, dispatch);
 }

export default connect(null, mapDispatchToProps)(GoogleMapHandlerComponent);

 

3. Create Google Map Component, this component uses the components of react-google-maps module

'use strict';

import React from 'react';
import IconButton from 'material-ui/IconButton';

import {
  withGoogleMap,
  GoogleMap,
  Circle,
  InfoWindow,
  Marker
} from 'react-google-maps';

import SearchBox from 'react-google-maps/lib/places/SearchBox';
import GoogleMapMarkerInfoWindow from './gMapMarkerInfoWindow';

import layoutStyle from '../../../constants/layoutStyle';

const INPUT_STYLE = {
  boxSizing: 'border-box',
  MozBoxSizing: 'border-box',
  border: '1px solid transparent',
  width: '240px',
  height: '32px',
  marginTop: '27px',
  marginRight: '20px',
  padding: '0 12px',
  borderRadius: '1px',
  boxShadow: '0 2px 6px rgba(0, 0, 0, 0.3)',
  fontSize: '14px',
  outline: 'none',
  textOverflow: 'ellipses',
};

const GoogleMapComponent = withGoogleMap(props => (
  <GoogleMap
    ref={props.onMapMounted}
    defaultZoom={15}
    center={props.center}
    onBoundsChanged={props.onBoundsChanged}
  >
    <SearchBox
      ref={props.onSearchBoxMounted}
      bounds={props.bounds}
      controlPosition={google.maps.ControlPosition.TOP_RIGHT}
      onPlacesChanged={props.onPlacesChanged}
      inputPlaceholder='Search Location'
      inputStyle={INPUT_STYLE}
    />

    {props.markers.map((marker, index) => (
      <Marker
        key={index}
        position={marker.position}
        onClick={() => props.onMarkerClick(marker)}
      >
        {/*
           Show info window only if the 'showInfo' key of the marker is true.
           That is, when the Marker pin has been clicked and 'onCloseClick' has been
           Successfully fired.
        */}
        {marker.showInfo && (marker.pinOnly === null ||
        marker.pinOnly === undefined || !marker.pinOnly) && (
          <InfoWindow onCloseClick={() => props.onMarkerClose(marker)}>
            <GoogleMapMarkerInfoWindow infoContent={marker.infoContent} />
          </InfoWindow>
        )}
      </Marker>
    ))}

    {props.center && (
      <Circle
        center={props.center}
        radius={props.radius}
        options={{
          fillColor: 'red',
          fillOpacity: 0.20,
          strokeColor: 'red',
          strokeOpacity: 1,
          strokeWeight: 1,
        }}
      />
    )}
  </GoogleMap>
));

export default GoogleMapComponent;


4. Use Google Map Handler component whereever you wish to place the map

render() {
      const handleLocationChange = this.handleLocationChange;
      const mapsComponent = (
        <GoogleMapHandlerComponent
          location={this.props.location}
          handleLocationChange={handleLocationChange.bind(this)}
        />);
      return (
        <div
          id='mapId'
          style={{ width: '450px', height: '350px' }}
        >
          {mapsComponent}
        </div>
      );
    }

Note you have to pass your current location to land user on his current location, else any other location which is default location.
and a callback for handling change in location.

ReactJS google map location change callback will be called by react-google-maps library when there is change in location,
like user searched some location

Also check stateless react components : http://knowledge-cess.com/reactjs-functional-or-stateless-components/

 

simple steps towards saving water

simple steps towards saving water

I am not going to tell again Water is precious, We have to save water ! I am not going to tell again Importance of water and why we have to save water ! Because since my childhood and ofcourse you too, listening all these and thats nothing new for us.

I am writing this article just to share about a simple experiment we did at our home and a simple analysis based on the data we collected. Now it is upto the reader whether to follow it or not because you know the importance of water and you all know that what you are doing is wrong and you are leaving nothing to your kids.

Few months back we stopped using washing machine and we started using a small hand held machine to wash our cloths. one fine day I realised something very important, that is when we were using washing machine we were wasting lot of water, because all these modern washing machines will consume too much water and we do not re-use that water. Since we started using small hand held machine these days we realised how much water we are saving using this machine and we started re-using the water after washing the cloths.

after doing it for few days  we thought to collect the data so that we can do some simple calculations and do some analysis on it. The analysis gave us an astonishing result, so thought to share with all of you.

Here is what we did :

1.we stopped using washing machine which consumes too much amount of water

water-consuming-washing-machine
water-consuming-washing-machine

2. we started using small hand held washing machine which consumes very minimum amount of water

hand-held-small-washing-machine
hand-held-small-washing-machine

3. finally re-using the water after washing the cloths

re-using-water
re-using-water

These are the simple steps we followed to save enough water. How much water we can save if we all together join hands ? Let us come to the analysis part.

Some data we collected for the period of 30 days

So the above table shows how much buckets of water we are using for washing the cloths and re-using the same water. total for around 30 days we re-used 264 liters of water.

Now considering certain data which helps us to do some calculations 

  1. Average amount of water consumed by any modern washing machine = 170.3 liters per load
  2. Average amount of water used by flush in toilets = 4 liters
  3. Some important data regarding Bengaluru water supply – 

    Bengaluru Water supply
    Bengaluru Water supply

Keeping above data for reference we did some simple calculations as follows

Converting all the data for a month.

170.3 ltr per load in washing machine -> So per month even if we use 10 times = 1700 liters ( assuming in a family of 3-4 people we use atleast 10 times in a month)

4 liters per flush and if we use 6 times per day then 24 liters per day and 744 liters per month ( assuming we use toilet flush at least 6 times in a day )

So total per month both washing machine and toilet flush together it consumes 2500 liters of water

Now here we are just using 264 liters of water for waching cloths and we are re-using the water after washing cloths which means we are able to manage both washing cloths and toilet with just 264 liters of water.

That means almost 90% of total consumption is optimised, means 2300 liters water is saved or reused per month.

2300 liters of water saved per month 

Let us calculate it for 12 months -> 2300 x 12 = 27600 liters

Now considering another stats 8.5 million people served daily in Banglore 

If all 8.5 million people save water as suggested above, we can save 8.5 * 2300 = 19550 ML 

Another stats given is 1350MLD water served in Bengaluru daily

so now

total_water_saved_by_8.5M_people / water_served_per_day_in_Bengaluru

19550ML/1350ML = 14.48

which means if all 8.5M people together save 19550ML of water then we can serve these 8.5M people for extra 14.48 days.

 

MOBILE APPLICATION TESTING

Types of Mobile App Testing:

Usability testing : To make sure that the mobile app is easy to use and provides a satisfactory user experience to the customers.

Compatibility testing: Testing of the application in different mobiles devices, browsers, screen sizes and OS versions according to the requirements.

Interface testing: Testing of menu options, buttons, bookmarks, history, settings, and navigation flow of the application.

Services testing: Testing the services of the application online and offline.

Low level resource testing: Testing of memory usage, auto deletion of temporary files, local database growing issues known as low level resource testing.

Performance testing : Testing the performance of the application by changing the connection from 2G, 3G to WIFI, sharing the documents, battery consumption, etc.

Operational testing: Testing of backups and recovery plan if battery goes down, or data loss while upgrading the application from store.

Installation tests : Validation of the application by installing /uninstalling it on the devices.

Security Testing : Testing an application to validate if the information system protects data or not.

Things to consider while testing a mobile application

The basic roadmap to testing involves testing in the following order:
• Does your application install properly on all devices?
• Can your application be uninstalled without any error?

• How does your application behave when there is no network or poor network?

• Is your applications logo, name, splash screen, etc. properly displayed?

• Does your application start and restart quickly?

• Is your application affecting the performance of the device or other applications?

• Can your application be exited from exit modes such as End key or Exit options etc.?

• Can the user receive a call / SMS notification when the application is running?

• Does the application hang or crash after a phone call / SMS notification?

• Does your application notify about low battery?

• Is your graphical user interface (GUI) including color scheme, theme, menu, font color font style etc. as they should be on all devices/browsers?

• Is your application posing security risks?

• What is the data consumption? If the application consumes too much data, it may drain the data plan of the customer causing him/her to make more payments to their Service provider.

 

Posted by              

Vinayak Mudiyappanavar     

Test Engineer           

From one satellite to 104 satellites (Cartosat-2D) : Historic Achievement by ISRO

From one satellite to 104 satellites : Historic Achievement by ISRO

It is Bharat once again maid a historic achievement, Our scientists at ISRO proved to the world that the world just can not ignore Bharat. Bharat is emerging, Bharat will soon become Vishwa Guru again. Going further let us understand how the journey was since our first satellite launch to till date.

Carrying satellite on bicycle and Bullock Cart
Carrying satellite on bicycle and Bullock Cart

The picture speaks a lot you can read more about here http://knowledge-cess.com/journey-towards-space-isro/ We started lifting satellites on bicycle and bullock cart, it is really an inspiring to read about our scientists. Placing a satellite on its orbit is not an easy job we have achieved it many times and we have achieved it in unique way.

Frugal Engineering : ISRO’s key to success

Bharat always lacking behind in space exploration not because of talent but because of budget and I am not saying that Bharat is not so rich to spend on it. We are capable both talent wise and budget wise, but our previous government was not so keen about this and hence our scientists were helpless. 

Despite government’s less support ISRO has done remarkable job, it is possible because the way ISRO is working. Frugal Engineering is the key to success for ISRO to achieve the best with a less budget. I will explain it in simple way, NASA will prepare atleast 4-5 test samples and then will launch the final satellite, which cost more for all test launches, but ISRO tries all possible way by simulating it and then analyzing every possibilities then trying with a final launch. It is possible only because we have best minds, who can analyse, who can calculate everything without even doing a prototyping and without even real testing

Aryabhata India’s First Satellite to Cartosat-2D 104 satellites at once

It was in April 1975 Bharat launched first Satellite as an experiment and for learning all the basics of satellite launch, Active technological experience in building and operating a satellite system. India’s first satellite. It is not the weight it is carrying matters here because smaller satellites will make it possible but satellites have to be stacked all together with specific settings so that they can be released in their orbits without affecting the flights of others or colliding with each other. This is where ISRO has done a remarkable job and a great engineering innovations.

Aryabhata was a kind of experimental launch but cartosat-2D carried 104 satellite at once, it took decades of hardwork and dedication. It was a continuous learning for our scientists.

PSLV-C37 - Cartosat-2D ISRO 104 satellites
PSLV-C37 – Cartosat-2D ISRO 104 satellites

 

Innovative Approach Used By ISRO To Separate 104 Satellites

Imagine packing up your bag for your journey ! uff wasn’t it challenging to keep most of your items all in one bag? Despite we do hundreds of journey, every time when we travel we spend enough time to pack our stuffs. Common this is not a joke here we are packing 104 satellites in one launch vehicle. And it is not just packing the satellites but releasing satellites in a specific order, with precision in time is most important otherwise they collide with each other. So ISRO has done a remarkable job here, packing 104 satellites? yeah they have done it through an innovative approach.

At the Sriharikota High Altitude Range (SHAR) at the Satish Dhawan Space Centre (SDSC),ISRO used adapters such as Multiple Satellite Adapter (MSA) and Payload Adapter (PLA) were used along with six custom made adapters to house the satellites. The primary payload was mounted on the PLA, Some of the custom made adapters allowed multiple tier attachments of satellites. A few nanosatellites were even housed in the Vehicle Equipment Bay,which normally only contains the systems for ground communications, and functions as the “brain” of the launch vehicle.

Managing the separation events of the satellites, satellites would have to be released after the launch vehicle lost contact with the Isro Telemetry, Tracking and Command Network (ISTRAC) tracking station at Mauritius, and before establishing contact with the Troll station in Antartica. 

The stage to which the satellites were attached had a complex maneuvering program, along with a sequence and timing for the satellite separation events. Isro engineers conducted detailed studies to ensure that the 105 objects, including a PSLV stage, would not collide after separation. Isro had to track 5460 pairs of objects

The separation of satellites, a very complex task in the mission was accomplished using a complex electrical wiring scheme, Any error in the wiring scheme would mean that the wrong satellite would be separated at the wrong time, potentially leading to collisions between the satellites.

 

The on board camera video shows how Satellites were injected into orbit 

 

Read more about ISRO : http://knowledge-cess.com/journey-towards-space-isro/

Read more about ISRO : http://knowledge-cess.com/reaching-the-red-planet-mom-isros-successful-mission/

Android Gradle : multiDexEnabled property

Android Gradle : multiDexEnabled property

Android Build Error

Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

Solution: Add the following multiDex property in your build.gradle.
multiDexEnabled true
so your build.gradle looks like follows

 

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "dhi_ti.com.repositoryapp"
        minSdkVersion 11
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    testCompile 'junit:junit:4.12'
    compile project(path: ':dhilib')
}

What is  multiDexEnabled true ? Why it is required ?

As per the documentation from Google, As the Android platform has continued to grow, so has the size of Android apps. When your app and the libraries it references reach a certain size, you encounter build errors that indicate your app has reached a limit of the Android app build architecture.

About the 64K reference limit

(APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. 

The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536—including Android framework methods, library methods, and methods in your own code. In the context of computer science, the term Kilo, K, denotes 1024 (or 2^10). Because 65,536 is equal to 64 X 1024, this limit is referred to as the ’64K reference limit’.

Reference : https://developer.android.com/studio/build/multidex.html#about

 

Research For Resurgence : Bhārata Is Changing

Research For Resurgence : Bhārata Is Changing

I remembered a conversation happened between me and my friend long ago, may be 7-8 years back. We were discussing about establishing a research centre in Bhārata, it happened during our morning walk when we were discussing about some out of the box ideas.

I am happy today because the life has given me an opportunity to work for one such great research foundation. I must say that Bhārata is changing, something really great is about to happen in near future, soon Bhārata will once again emerge as “Vishwa Guru”.

Let me elaborate what is changing and what is Research For Resurgence Foundation. RFRF is an ambitious project started by  Bharatiya Shikshana Mandala, a non profit organisation working to bring Bharatiyata in Bharatiya Education. Great minds at Bharatiya Shikshana Mandala while doing brainstorming session, the discussion gave an insight on research works happening within the nation. It is then organisation felt the importance of research work and started discussing with eminent researchers, scientists, academicians.

Several such discussions , workshops started giving a very good shape and more clarity on what is need to be done. Research For Resurgence Foundation has been started with a great vision. Research has no boundary, any one can do a research, in fact most of the inventions happened either accidentally or  because of the necessity. As we all know necessity is the mother of invention.

So far in Bhārata research quality has gone really low, research is being done for the sake of better jobs, but a true research is not that, something unbelievable has to be done to call it as a research. Another important aspect the organisation considering is , the research should be socially relevant and it is not mandatory to have a qualification to do any research. Even a farmer who has done something different for his necessity and wish to explore something new, even he will get an opportunity to do a research, we call them as Non-Formal-Researchers

What is Research For Resurgence (RFRF) ?

   RFRF is an idea of Bharatiya Shikshana Mandal which creates a platform for such research ideas which are socially relevant and imbibe ‘Bharatiya Integrated Perspective’. If any one of you who does’t have any qualifying degree but you have any crazy idea which might look impossible then you have a great opportunity to get associated with Bharatiya Shikashana Mandal.

RFRF will bring a great platform for researchers, you will be getting guidance from eminent researchers,scientists and also funding for your research work if its really a great idea and has a social relevance.

RFRF International Conference :

 Bharatiya Shikashan Mandal organised an international conference on Research For Resurgence at VNIT Nagpur, where a total of 728 scholars from Bharat and 9 other countries, 68 universities from 15 states including 17 central institutes. Participation of 24 industrial houses and organisations including TATASONS,CEAT,RPG,MIDC,MADC,FICCI,CII made involvement. The conference was graced by the attendance of 55 Vice Chancellors and heads of National Authorities in the field of educational such as NAAC,AICTE,NCTE.

Noted economist S Gurumurthy said “Prejudiced mindset of the intellectuals about Bharat and everything that is Bharateeya proved fatal for innovation”.

Bharata Emerging As Vishwa Guru Again

Ancient Bharata was a glorious Bharata, we knew that our Past was wonderful but it is the time to prove it and bring it back to the present. Swami Vivekananda Said Bharata is a Vishwa Guru, Bharat has talented minds but every Bharatiya should work towards bringing back that glorious Bharat again, in this journey the research will play a vital role and RFRF is opening a door for the bright future .

Structure Of Research For Resurgence Foundation 

RFRF has various departments and centers as following.

  • Fundamental Research Center
  • Technology Demonstration Park
  • Industry Interaction and Incubation Center
  • Agricultural and Forestry Research Center
  • Educational Research Center
  • International Collaboration Center
  • Intellectual Property Right Center
  • Collegium and Conventions Center 
  • Training and Capacity Building Center
  • Socio-Economic-Policy Research Center
  • Yoga and Health Center
  • Knowledge Resource Center
  • Publication House
  • Project Monitoring and Evaluation Division
  • Administration
  • Finance And Accounts
  • Research Scholar home and Facilitation Center

The proposed Activity Distribution targeting four R’s as given below

Research-Researchers-Resources-Reach
Research-Researchers-Resources-Reach

 

NOTE:

You can go through the RFRF brochure (Click Here), and those who has any great Idea please Visit Bharatiya Shikshan Mandal Website(Click here) and propose your idea.

 

Java Springs SEVERE Exception : javax.servlet.ServletException: Circular view path

Java Springs SEVERE  Exception : javax.servlet.ServletException: Circular view path

Exception : occurred while calling REST API in Springs

 org.apache.catalina.core.StandardWrapperValve invoke SEVERE:

Servlet.service() for servlet [Spring] in context with path [/app] threw exception

[Circular view path [events]: would dispatch back to the current handler URL [/app/service/events] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause javax.servlet.ServletException: Circular view path [events]: would dispatch back to the current handler URL [/app/service/events] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.) at org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:209) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:149) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)

Solution :

Change your controller API signature from

public EventListResponse fetchEvents() 

To

public @ResponseBody EventListResponse fetchEvents

Mind blowing facts about Sanskrit : Learn Sanskrit

Mind blowing facts about Sanskrit : Learn Sanskrit

This post is just to list out some mind blowing facts about the most scientific language, an ancient root Sanskrit

  1. Sanskrit has the highest number of vocabularies than any other language in the world. • 102 arab 78 crore 50 lakh words have been used till now in Sanskrit. If it will be used in computers & technology, then more these number of words will be used in next 100 years.
  2. Sanskrit has the power to say a sentence in a minimum number of words than any other language
  3. Sanskrit is the best computer friendly language.(Ref: Forbes Magazine July 1987).
  4. Sanskrit is a highly regularized language. In fact, NASA declared it to be the “only unambiguous spoken language on the planet” – and very suitable for computer comprehension
  5. There is a report by a NASA scientist that America is creating 6th and 7th generation super computers based on Sanskrit language. Project deadline is 2025 for 6th generation and 2034 for 7th generation computer.
  6. The language is rich in most advanced science, contained in their books called Vedas, Upanishads, Shruti, Smriti, Puranas, Mahabharata, Ramayana etc. (Ref: Russian State University, NASA etc. NASA possesses 60,000 palm leaf manuscripts, which they are studying.)
  7. Research has shown that the phonetics of this language has roots in various energy points of the body and reading, speaking or reciting Sanskrit stimulates these points and raises the energy levels, whereby resistance against illnesses, relaxation to mind and reduction of stress are achieved. •Sanskrit is the only language, which uses all the nerves of the tongue. By its pronunciation, energy points in the body are activated that causes the blood circulation to improve. This, coupled with the enhanced brain functioning and higher energy levels, ensures better health. Blood Pressure, diabetes, cholesterol etc. are controlled. (Ref: American Hindu University after constant study)

  8. Sanskrit is the primordial conduit between Human Thought and the Soul; Physics and Metaphysics; Subtle and Gross; Culture and Art; Nature and its Author; Created and the Creator.

    Youtube Channel for Learning Sanskrit

    Learning Vibhakti in Sanskrit : Start point – https://www.youtube.com/playlist?list=PLQ5oNpr1XhOQr-owlfbLUW40y1vl4h8_n

    Learning Sanskrit through Yoga : https://www.youtube.com/watch?v=aYFmpuPS2X8&list=PLmozlYyYE-EQ0677VLtnYa3oKbYklofiN

    Learning Sanskrit through Tinantaprakriya : https://www.youtube.com/watch?v=pN2nnb4KTMs&list=PLmozlYyYE-ESsTZC0uG3rallpDePEzctb

javax.persistence.PersistenceException : NonUniqueDiscoveredSqlAliasException

javax.persistence.PersistenceException : NonUniqueDiscoveredSqlAliasException

Exception javax.persistence.PersistenceException: org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias [id] during auto-discovery of a native-sql query at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:458) $$FastClassBySpringCGLIB$$ad104aa9.invoke( <generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:58) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at 

Solution : 

Give different alias to each column you are selecting. This happens mainly due to same column names in different tables.

Something like this “select u.id as userid, adm.id as adminId from user as u, admin as adm”