Skip to main content

Posts

why html5 either you use angularjs or reactjs still bad for mobile app when you have to deal with really big application.

creating big application when you have to deal with canvas or webgl using reactjs and angularjs is really a bad idea specially when we have to deal with slow device. reactjs and angularjs are super cool framework but when we have to deal with lots of image data and canvas than mixing these framework with each other for example mixing canvas and webgl with reactjs and angularjs is really bad idea.  so how can i raise up my app above from these problem's ? REACTJS --------------- 1. reactjs works on virtual dom which is different from real dom. reactjs only changes real dom when there when react found a difference between real and virtual dom. 2. same methods which i explain also applied on react too. 3.one benefit of using react over angularjs is that  reactjs is just a library and angularjs is a framework so separation of code in react is more flexible instead of angularjs which follow's more rules.    ANGULARJS 1. there is no solution when ...

why cocos2dx is best framework for 2d cross platform native game development.

cocos2dx  link:-http://www.cocos2d-x.org/ i start working on cocos2dx few year's back and found it's  a complete solution for 2d game development. best thing about cocos2dx it's open source and very powerful gaming engine. my few point's about cocos2dx 1. its  a open source so we can use it for any type of gaming without worrying about copyright issues even you can modify engine at your end which i don't think you required 80% of time. 2. cocos2dx runs on every platform desktop mac android ios and even on play station i never tried on  play station but some people successfully implemented it on playstation.  3.cocos2d-x using opengl es 2.0 so you don't need to worry about rendering as lots of people know  opengl is a cross-platform application programming interface for rendering 2D and 3D vector graphics and it's not easy to write your own graphics rendering pipeline so why we need to waste our time to write a 2d game engine if coco...

understanding interface in typescript

1. interface is one of most important part of typescript they contain  properties function or event but only definition. work code example-> https://stackblitz.com/edit/typescript-gzh1np example of interface is=> //understanding interface in typescript //a interface can be used liked a object in js //for example interface user { //string typer property name : string , //number type property age : number //string type property occupation : string ; //height can be string or number :) height : string | number } //create a instance of user var manish : user ={ name : "manish chauhan" , age : 27 , occupation : "game developer" , height : 30 } //access a property console . log ( manish . name ); //example2------------------------------------------------>> //interface can be nested for example suppose for example //suppose a group of student from different class interf...

Combine Redux and RxJS with pure html to understand how you can mix both and solve problem in a different way

full link-> https://stackblitz.com/edit/typescript-u8ub9q?file=index.ts html part-----> -------------------- < div id = "app" > < input type = "text" id = "totalValue" value = ":)" >< br >< br > < input type = "button" value = "ADD NEW NUMBER" id = "addMe" ></ button >< br >< br > < input type = "button" value = "SUB TWO NUMBER" id = "subMe" ></ button >< br >< br > < input type = "button" value = "MUL NEW NUMBER" id = "mulMe" ></ button >< br >< br > < input type = "button" value = "DIV TWO NUMBER" id = "divMe" ></ button >< br >< br > </ div > //Javascript part //REDUX----------------------------------------------- /*starting with redux and rxjs wi...

Which Gaming framework needed when and how to use a rightframework for gaming based on client requirement

Mobile gaming and web Gaming these day's are a big market. so how to choose a right framework here are some point to remember. situation 1->you need to run your game on web and mobile too but performance is second priority then you should choose either canvas or webgl there are tons of   webgl and canvas framework around there i would talk only which i haven used in my past. 1. Pixijs    link- http://www.pixijs.com/ example:-https://pixijs.io/examples/#/basics/basic.js pixijs is a small renderer which uses canvas fallback to run your content on both mobile device and web. so first question comes to your mind what is canvas fallback canvas fallback means its tried to run your content on webgl (which run's really fast on gpu) if there is no webgl support its run's your content on canvas. Benefit of using Pixi Js. 1. it's really easy to use if you are a flash developer or from a gaming background. 2. it's really fast ...

reduce using typescript

//reduce takes a array and return a single item interface student { name : string , age : number , //total marks from 600 marks : number } var studentList : Array < student >=[ { name : "seema" , age : 25 , marks : 400 }, { name : "manish" , age : 25 , marks : 300 }, { name : "sachin" , age : 25 , marks : 400 }, { name : "nishi" , age : 25 , marks : 272 }, { name : "ranjeet" , age : 25 , marks : 450 } ] const totalMarks = studentList . reduce (( acc , studentObject )=>{ acc += studentObject . marks return acc ; }, 0 ) //percentage marks scored by each student var percentage = Math . round ( totalMarks / studentList . length ); code link= https://stackblitz.com/edit/typescript-5ms7ug

How to use map and filter in typescript using callback

workable link:- https://stackblitz.com/edit/typescript-jrjqw4 w//====================>MAP<===================================== //Map works on each item of array and perfrom a operation on each item using function or callback and return a new array with modified values original array untouched //eg1 //how to use map in real situation with callback //each student get following marks var studentMarks =[ 299 , 578 , 232 , 521 , 490 , 171 , 137 , 190 , 141 ]; //percentage get by each student const passStudentWithMarks : string []= studentMarks . map (( mark , index )=> { return Math . round ( mark * 100 / 600 )+ "%" ; }) //console.log(passStudentWithMarks); ///eg2 getting full name of all user based on thier first name and last name with id var users =[ { id : 1 , firstName : "manish" , lastName : "chauhan" }, { id : 1 , firstName : "sachin" , lastName : "rawat" }, { id : 1 , firstNam...

Linear search in typescript ( Data structure)

A simple linear search using typescript..... //create a node object (interface) which hold's index and any type of data interface node { index : number ; value : any ; } //base class which hold's array of nodes inside data array class Search { public data : Array < any > = new Array (); constructor () { }; } //extend Search class class LinearSearch extends Search { constructor ( _data : Array < any >) { super (); this . data = _data ; } public search ( _value ) { for ( var i = 0 ; i < this . data . length ; i ++) { if ( this . data [ i ] === _value ) { return { index : i , value : this . data [ i ] }; } } } } var linearSearch = new LinearSearch ([ 4 , 5 , 11 , 23 , 12 ]); //get search index console . log ( linearSearch . search ( 23 ). index );

binary search using typescript

interface node { index : number ; value : any ; } class Search { public data : Array < any > = new Array (); constructor () { }; } //notBinary Search needs shorted data while LinearSearch works on unshorted datae: class BinarySearch extends Search { private startIndex : number ; private endIndex : number ; constructor ( _data : Array < any >) { super (); this . data = _data ; } public search ( _value ) { this . startIndex = 0 ; this . endIndex = ( this . data . length - 1 ) while ( this . startIndex <= this . endIndex ) { let mid = Math . round ( this . startIndex + ( this . endIndex - this . startIndex ) / 2 ) if ( this . data [ mid ] === _value ) { return { index : mid , value : this . data [ mid ] }; } ( this . data [ mid ] < _value ) ? this . startIndex = ( mid + 1 ) : this . endIndex = ( mid - 1 )...

Loading data form external api automatically and using some event such as on a button click in reactjs

beginner level- just creating a simple example how to load data from a external api using typescript and reactjs. running code: link  https://stackblitz.com/edit/react-ts-ek3vme code:- //calling data from external api //calling data on event import React , { Component } from 'react' ; import { render } from 'react-dom' ; import './style.css' ; interface AppProps { } //user data interface interface userData { key : string ; body : string ; title : string ; userId : number ; id : number ; } //urldata interface interface urlData { origin : string ; url : string ; } //app state interface interface AppState { name : string ; data : urlData userdata : Array < userData >; } //app code class App extends Component < AppProps , AppState > { listName : string = "click on button to load list" load : Function = null ; constructor ( props ) { super ( prop...