Resting the SQL server auto incremental number
DBCC CHECKIDENT ( [SFA_M_PRODUCT_PRICES], RESEED,220);
Tuesday, September 3, 2019
Tuesday, July 16, 2019
Create Navigation Panel Sample in React Native
How the Navigation sample Works
==============================================================
1. install react-navigation using
npm install react-navigation or
yarn add react-navigation
2. Folder Struncture should like below
NavigationTest
.
...assets
TabBarIcon.js
Color.js
...navigation
MainNavigation.js
...screens
HomeScreen.js
ProfileScreen.js
HomeScreen2.js
ProfileScreen2.js
App.js
2. Create some native components called
HomeScreen.js
ProfileScreen.js
HomeScreen2.js
ProfileScreen2.js
in a folder called "Screen" .
At the bottom area, you can see the samples.
3. Create
TabBarIcon.js , Color.js in the asset folder
4. Create
MainNavigation.js in the navigation folder.
5. Scripts
MainNavigation.js file
=================================================================
import React from 'react';
import { Platform } from 'react-native';
import { createStackNavigator, createSwitchNavigator, createAppContainer, createBottomTabNavigator,
createDrawerNavigator } from 'react-navigation';
import AuthLoadingScreen from '../screens/AuthLoadingScreen';
import ProfileScreen from '../screens/ProfileScreen';
import HomeScreen2 from '../screens/HomeScreen2';
import ProfileScreen2 from '../screens/ProfileScreen2';
import HomeScreen from '../screens/HomeScreen';
import TabBarIcon from '../assets/TabBarIcon';
//Create Staks for each menu items you need
const TabHome = createStackNavigator({
Home: {screen: HomeScreen},
});
//Add navigation options like below to manage, Icon, titles to your menu item
TabHome.navigationOptions = {
tabBarLabel: 'Home in SUB 1',
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-pulse'
}
/>
),
};
//Create Staks for each menu items you need. In here we didn't add a navigation
options
const TabProfile = createStackNavigator({
Profile: {screen: ProfileScreen},
});
//Create Staks for each menu items you need
//Create Staks for each menu items you need
//Create the Navigator types for your Menu items.
const DrawHome2 = createStackNavigator({
Home: {screen: HomeScreen2},
});
//Add navigation options like below to manage, Icon, titles to your menu item
DrawHome2.navigationOptions = {
drawerLabel: 'Notifications',
drawerIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-pulse'
}
/>
)
};
const DrawProfile2 = createStackNavigator({
Profile: {screen: ProfileScreen2},
});
//Add navigation options like below to manage, Icon, titles to your menu item
DrawProfile2.navigationOptions = {
tabBarLabel: 'Home in SUB 1',
drawerIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-pulse'
}
/>
),
};
//In here Menu Items "TabHome"', and "TabProfile", put into a TabNavigator,
// which you can see at the bottom of the Screen
const TabNav = createBottomTabNavigator(
{
TAB1: TabHome,
TAB2: TabProfile,
}
)
//Create the Navigator types for your Menu items.
//In here Menu Items "DrawHome2"', and "DrawProfile2", put into a DrawerNavigator,
// which you can see by pulling it from the left side.
const DrawNav = createDrawerNavigator(
{
DRAW1: DrawHome2,
DRAW2: DrawProfile2,
}
)
// Now Add all the Navigators to a Switch Navigator. By using this, you can
// simply switch between each navigator types by using
// this.props.navigation.navigate('Sub1');
or
// this.props.navigation.navigate('Sub2');
export default createAppContainer(createSwitchNavigator(
{
AuthLoading: AuthLoadingScreen,
Sub1: TabNav,
Sub2: DrawNav,
},
{
initialRouteName: 'Sub2', // You can set the default Sub menu from here.
}
));
===================================================
App.js file
====================================================
import React from 'react';
import MainNavigation from './navigation/MainNavigation';
export default function App() {
return (
<MainNavigation/>
);
}
=====================================================
TabBarIcon.js file
======================================================
import React from 'react';
import { Ionicons } from '@expo/vector-icons';
import Colors from './Colors';
export default function TabBarIcon(props) {
return (
<Ionicons
name={props.name}
size={26}
style={{ marginBottom: -3 }}
color={props.focused ? Colors.tabIconSelected : Colors.tabIconDefault}
/>
);
}
=====================================================
Color.js
======================================================
const tintColor = '#2f95dc';
export default {
tintColor,
tabIconDefault: '#ccc',
tabIconSelected: tintColor,
tabBar: '#fefefe',
errorBackground: 'red',
errorText: '#fff',
warningBackground: '#EAEB5E',
warningText: '#666804',
noticeBackground: tintColor,
noticeText: '#fff',
};
===========================================================================
HomeScreen.js
===========================================================================
import React from 'react';
import {View, Text, Button} from 'react-native';
export default class HomeScreen extends React.Component {
render(){
return(
<View>
<Text> Home screen Woow </Text>
<Button title="GoTo Sub2" onPress={this.GoToSub2}/>
</View>
);
}
GoToSub2 = ()=>{
this.props.navigation.navigate('Sub2');
}
}
===========================================================================
===========================================================================
import React from 'react';
import {View, Text, Button} from 'react-native';
export default class HomeScreen2 extends React.Component {
render(){
return(
<View>
<Text> Home screen </Text>
<Button title = "Goto Sub 1" onPress={this._GoToSub1Async}></Button>
</View>
);
}
static navigationOptions = {
title: 'Lots of features here',
};
_GoToSub1Async = () => {
this.props.navigation.navigate('Sub1');
};
}
===========================================================================
ProfileScreen.js
===========================================================================
import React from 'react';
import {View, Text} from 'react-native';
const ProfileScreen = () => {
return(
<View>
<Text> ProfileScreen screen </Text>
</View>
);
}
export default ProfileScreen;
===========================================================================
ProfileScreen2.js
===========================================================================
import React from 'react';
import {View, Text} from 'react-native';
const ProfileScreen2 = () => {
return(
<View>
<Text> ProfileScreen screen 2 </Text>
</View>
);
}
export default ProfileScreen2;
Saturday, June 15, 2019
Saturday, May 4, 2019
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
if more than 65535 files in your temp folder, this error can occurs,
To resolve this, remove all temporary files in C:/Windows/Temp.
Error:
2019-05-05 00:09:32,333 ERROR MonitoringLogger- PrintReport:- PrintWebReport() System.IO.IOException: The file exists.
at System.IO.__Error.WinIOError( Int32 errorCode, String maybeFullPath)
at System.IO.Path. InternalGetTempFileName( Boolean checkHost)
at CrystalDecisions.ReportSource. EromReportSourceBase. ExportToStream( ExportRequestContext reqContext)
at CrystalDecisions. CrystalReports.Engine. FormatEngine.ExportToStream( ExportRequestContext reqContext)
at CrystalDecisions. CrystalReports.Engine. ReportDocument.ExportToStream( ExportOptions options)
at CrystalDecisions. CrystalReports.Engine. ReportDocument. ExportToHttpResponse( ExportOptions options, HttpResponse response, Boolean asAttachment, String attachmentName)
at CrystalDecisions. CrystalReports.Engine. ReportDocument. ExportToHttpResponse( ExportFormatType formatType, HttpResponse response, Boolean asAttachment, String attachmentName)
at SFAWebAdmin.WebPages. PrintReport.PrintWebReport( ReportDocument Report)
Saturday, March 23, 2019
ES6 Importent areas with Sample code in Visual Studio code and "Code Runner" Plugin installed to Cisual Studio Code
//import { promises } from "fs";
//import { resolve } from "path";
//import {MOName, MOAge, func} from './moduleTest';
// import p from person;
//########################################
// 1) Install Visual Studio Code
// 2) Install Code Runner from View --> Extension
// 3) Run the Code
//########################################
console.log("test");
//########################################
//Scope
//########################################
var name = "hi";
console.log(name);
console.log("########################################");
console.log("SCOPE Intro");
console.log("########################################");
{
name = "ravika";
age = 10;
}
console.log("Test 1 " + name + " " + age);
{
const name = "satsara";
let age = 40;
console.log("Test 2 " + name + " " + age);
}
console.log("Test 3 " + name + " " + age);
//########################################
//Array
//########################################
console.log("########################################");
console.log("Array");
console.log("########################################");
const num = [1,2,3];
num.push(4);
console.log(num);
//########################################
//Functions
//########################################
//Old method
const multi = function(n){
return n*n;
}
//Inline functions
const type = () => console.log("HI there\nTest in next line");
console.log("Multi " + multi(5));
console.log("Type func " + type()); // This type function is calling, but ths output gives an error.
// due to type() fuction is not return anything. to ignor this,
// you can just take the type() function out from the console.log
const arr1 = (n) => {
return n*n;
}
const arr2 = n => { //If only one parameeters, no need to use the () as (n)
return n*n;
}
const arr3 = (a,b) =>{
return a * b;
}
const arr4 = (a,b) => a * b; // if only one line in the function body
console.log(" Arr1 " + arr1(5));
console.log(" Arr2 " + arr2(5));
console.log(" Arr3 " + arr3(5, 2));
console.log(" Arr4 " + arr4(5, 3));
//########################################
//Function - Default params
//########################################
console.log("########################################");
console.log("Default Params");
console.log("########################################");
const aboutMe = (name, country="Sri Lanka") =>{
console.log("Default para " + name + " " + country);
}
aboutMe("satsara");
aboutMe("Olivier", "Belgium");
//########################################
//Classes
//########################################
console.log("########################################");
console.log("Classes");
console.log("########################################");
//########################################
// Inner Classes
//########################################
class Address {
constructor(city, country, age){
this.city = city;
this.country = country;
this.age = age;
}
static staticPrint()
{
console.log("Static method works!");
}
print(){
console.log("Class Call " + this.city + " " + this.country + "Age:" + this.age);
}
}
class students extends Address { // Inheritance
constructor(city, country, age, grade){
super(city, country, age);// Call super constructor
this.grade = grade;
}
print()
{
console.log("Print Super ");
super.print();
console.log("Print Grade " + this.grade );
}
}
const add = new Address("Homagama", "Sri Lnaka", 40);
add.print();
Address.staticPrint();
const stu = new students("Homagama", "Sri Lnaka", 40, 13);
stu.print();
//########################################
// SET
//########################################
console.log("########################################");
console.log("SET");
console.log("########################################");
const ArraySetNum = new Set([1,2,3,1,2]);
console.log(" Set Value " );
console.log(ArraySetNum);
ArraySetNum.add(10);
console.log(" Set Value 10" );
console.log(ArraySetNum);
ArraySetNum.add(10);
console.log(" Set Value 10 again (No duplicates are added" );
console.log(ArraySetNum);
//########################################
// Object Initializer
//########################################
console.log("########################################");
console.log("Object Initializer");
console.log("########################################");
const newName = "Satsara";
//ES5 OLD version
var person = {
newName: newName,
getAge: function(){
console.log("Ageis 45");
}
};
console.log(" Object is ES5 way " + person.newName);
console.log(" Object is ES5 way function ");
person.getAge();
//ES new Version
const person2 = {
newName, //Removed the newName: newName
getAge(){ // removed the :function() from ES5
console.log("Ageis 45");
}
}
console.log(" Object is ES6 way " + person2.newName);
console.log(" Object is ES6 way function ");
person2.getAge();
//Computerd property name
//########################################
//Dynamic keys for Objects
//########################################
console.log("########################################");
console.log("Dynamic Key Objects");
console.log("########################################");
//############This fails to substitute fruit_var with fruit, not working and wrong
var fruit_var = 'fruit'
var eatables = {fruit_var: 'Apple', vegetable: 'Carrot'}
console.log(eatables) // {fruit_var: 'Apple', vegetable: 'Carrot'}
var eatables = {vegetable: 'Carrot'}
var fruit_var = 'fruit'
eatables[fruit_var] = 'Apple'
console.log(eatables) // {fruit: 'Apple', vegetable: 'Carrot'}
//ES6
var fruit_var = 'fruit'
var vegi_var = 'vegi';
var eatables = {[fruit_var]: 'Apple', vegetable: 'Carrot'}
console.log(eatables) // {fruit: 'Apple', vegetable: 'Carrot'}
//avascript computations using computed property names
var eatables = {[fruit_var]: 'Apple', [fruit_var + ' Cake']: 'yummy',[vegi_var + ' ' + fruit_var]: 'Tomato'}
console.log(eatables) // {fruit: 'Apple', fruit Cake: 'yummy'}
//avascript computations using computed property names
var eatables = {[fruit_var]: 'Apple', [fruit_var + ' Cake']: 'yummy',[vegi_var + ' ' + fruit_var]: 'Tomato', [fruit_var]: 'Banana'}
console.log(eatables) // {fruit: 'Apple', fruit Cake: 'yummy'}
const key = "key" + 1;
const key3 = "keyTest" + 3;
const obj = {
[key]: 'data', // if [], then it must define befor it use
key2: 'data2',// Key2 is
[key3]: 'data3',
};
console.log("Print Key " + obj[key] + " " + obj.key2 + " " + obj.key + " " + obj[key3] );
//*********/obj[key2] not working, obj.key cannot access and it displayied as undifiend
//########################################
// Distructuring
//########################################
console.log("########################################");
console.log("Distructuring");
console.log("########################################");
var person3 = {
name: 'satsara',
age: 45
}
var {name, age} = person3;
console.log('Distructuring ' + name + ' ' + age);
const PersonInfo = ({name, age}) => {
console.log('Function distructuring ' + name.toUpperCase() + ' ' + age);
}
//Calling the distructuring function
PersonInfo(person3);
//########################################
// Distructuring Array
//########################################
console.log("########################################");
console.log("Distructuring Array");
console.log("########################################");
const arr = [6,7,3,4,5];
const [one, two] = arr;
console.log(' Array Distruturing ' + one, two);
//########################################
// Distructuring Array spread operator ...
//########################################
console.log("########################################");
console.log("Spread Operator");
console.log("########################################");
const arrSpread = [1,2,3,4,5];
const arrSpread2 = arrSpread;
console.log('1) Both Arrays are Equals : ' + (arrSpread === arrSpread2));
console.log(arrSpread === arrSpread2);
arrSpread2.push(6);
console.log('2) Both Arrays are Equals : ' + (arrSpread === arrSpread2));
console.log('Added new value 6 to arrSpread2. that auto added to the arrSpread as well');
console.log('arrSpread and arrSpread2, Both accessing the same address (print 6)->' + arrSpread);
console.log('....Now Spred operator...');
const arrSpread3 = [...arrSpread];
console.log(' Array returns fales: because spread operator... ' + (arrSpread3 === arrSpread));
//########################################
// spread operator ... for Objects
//########################################
console.log("########################################");
console.log("Spread Operator for Objects");
console.log("########################################");
const obj2 = {
name:'rice',
price: '123.00'
}
const typ = 'groceries';
const obj3 = {...obj2, typ};
console.log(' Object assign with spread : ');
console.log(obj3);
//########################################
// Modules
//########################################
console.log("########################################");
console.log("Modules, but lines are commented");
console.log("########################################");
//console.log(' From Module ' + MOName);
//func();
//const pe = new p('Ravika',12);
//pe.print();
//########################################
// Promise Object syncronus for Operations
//########################################
console.log("########################################");
console.log("Syncronus / Promise");
console.log("########################################");
//Define the Prmiss Function
const getData = () => {
return new Promise((resolve, reject) => {
setTimeout(()=>{
resolve('Data Found');
},1000);
setTimeout(()=>{
reject('Error found XX');
},100);
});
};
const PromissData = getData();
PromissData.then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
});
setTimeout(()=>{console.log(' Wait for promis to complete'),1500});
const asyncSum = async (a,b) => {
return a + b;
};
console.log('Async function calling in wrong way' + asyncSum(2,3));
console.log(asyncSum(2,3));
const result = asyncSum(2,3);
result.then(value =>{
console.log(' The correct way to call Async function: ' + value);
});
//########################################
// Promise Object Asyncronus for Operations
//########################################
console.log("########################################");
console.log("Asyncronus / Promise");
console.log("########################################");
const asyncPower = async (a, b) => {
return new Promise((resolve, reject) => {
const r = Math.pow(a,b);
if ((a > 0) && (b > 0))
{
resolve(r);
}
else
{
reject(-1);
}
});
}
asyncPower(2,2).then((val)=>{console.log('Async Result wth asyncPower(2,2) ' + val)}).catch((err ) => {console.log(err)});
asyncPower(0,2).then((val)=>{console.log(val)}).catch((err ) => {console.log('Async Result wth asyncPower(0,2) ' + err)});
const getData2 = async () => {
const data = new Promise((resolve, reject) => {
setTimeout(()=>{
resolve("Data sent OK");
}, 2000);
});
console.log('Test async, timeout 1');
let result = await data;
console.log('Test async, timeout 2');
return result;
}
getData2().then((result)=>{
console.log(result);
}).catch((err)=>{
console.log(err);
});
Subscribe to:
Comments (Atom)
Postgress - Read a XML file from a postgress table XML column
SELECT xmltable.* FROM xmldata, XMLTABLE('//ROWS/ROW' PASSING data COLUMNS id int PATH ...
-
if more than 65535 files in your temp folder, this error can occurs, To resolve this, remove all temporary files in C:/Windows/Temp ....
-
select upper(substr(CTY_CITY,1,1))|| substr(CTY_CITY,2,length(CTY_CITY)-1) as Ax from AGM_M_COUNTRY_CITY; update AGM_M_COUNTRY_CITY set ...
-
Common text box validation function for all the text boxes within the same form. Using Sender parameter to handle. private void tex...