It's All Writing.

Writing makes you happy.

Entries from 2019-01-01 to 1 year

How to track pageview with Google Analytics in Node app

Environment Node ( TypeScript ) Google Analytics universal-analytics Premise Normally, in order to track pageview with Google Analytics, it is necessary to embed the tracking code in client-side JavaScript and execute it in the browser. Th…

How to share styles at React Native

Environment React Native mobx react-native-extended-stylesheet Code gist.github.com react-native-extended-stylesheet provides EStyleSheet.build which compile variables to reuse any style in EStyleSheet.create. (e.g. $dark087) And by using …

How to access lfs binary files from GitHub Pages

Environment GitHub.com GitHub Pages lfs Premise At the GitHub.com, you can not push large file ( over 50MB ) to remote repository. In this case, you can use lfs to solve this problem as below. ( in your local repository ) $ git lfs install…

How to implement summation and product with recursion or reduce at node

Environment node Code Recursion gist.github.com Reduce gist.github.com Note Typically, reduce is faster than recursion, and more simple.

How to get return value from then function at node

Environment node Code gist.github.com The value returned by the then function can be received in a variable with await.

How to retrive parent custom sobjects field value by SOQL at Apex

Environment Apex SOQL Premise Note that when retrieving parent SObject information with the child SObject's retriving query, it is necessary to receive the SOQL execution result in the SObject type. For example, if you do the following, yo…

How to custom react navigation's header options each screen which using HOC at React Native

Environment React Native React Navigation 4.x node Premise Typically, react navigation's header options are written in App.js. However, this is undesirable for two reasons: App.js gets bigger and more complex Knowledge specific to each scr…

How to detect software keyboard visible state at React Native

Environment React Native react-native-keyboard-accessory NativeBase node Code gist.github.com If the software keyboard is visible ( when you'll input Textarea ), the Button is enabled. Otherwise, the Button is disabled. Typically, The timi…

How to provide utility functions for every components ( How to make HOC ( higher-order component ) ) at React Native

Environment React Native node Premise When there is a utility function you'd like to use in common during each components, you can do it easily via props by using HOC. Using common.js which provides common utility functions has the fault a…

How to navigate between different nested stacks in React Navigation

Environment React Native React Navigation ( react-navigation ) lodash Prerequisites If we have the following Navigator structure: ScreenA ScreenB ScreenC ScreenD TabScreenA StackScreenA StackScreenB TabScreenB StackScreenC StackScreenD Tab…

How to test multiple language test at Apex ( How to change using language dynamically in the test code )

Environment Apex Premise In the present, we must change test user language at m17n testing ( like label which have to change by using language ) because the method like getLabel('key', 'language') doesn't exist in Apex. So, dynamically cha…

How to detect leads which has the same name at Salesforce by node

Environment Salesforce node jsforce lodash Premise We can't solve this problem with using report. So, I'll show you the solution which using node ( with jsforce and lodash ). Code gist.github.com Code's Summary The summary of the process i…

How to run CI ( Continuous Integration ) on Gitlab ( executing Test code and deploying code to salesforce organization )

Environment Gitlab.com Apex Prerequisites First I prepare deployed Apex and Apex which tests that. The Apex code are shown as below. gist.github.com Code CI in gitlab comes to move by putting .gitlab-ci.yml in the route of a repository of …

How to get data which made in @testSetup method at Apex

Environment Apex Prerequisites We cannot access variables which made in @testSetup method at @isTest method. The example is shown as below. gist.github.com Solution The solution is to select the test data by using SOQL again. gist.github.c…

How to get attribute which passed to a dynamically creating component

Environment Lightning component Prerequisites For example as this case, I'll use code shown at last entry. At the code as below, we cannot get contacts which modified at child component. gist.github.com Solution It's simple. The code is sh…

How to avoid lightning aura:iteration's bug ( Rerendering child components in aura:iteration when parent attribute changed )

Environment Lightning component Prerequisites aura:iteration has a bug as child components in aura:iteration is not re-rendered when parent attribute changed. The example is shown as below. gist.github.com When a parent object (Contact) ex…

How to make a lightning component which is a sObjects selector and is a field selector which interlocks with specified sObject.

Environment Apex Lightning component Image sObject のリストから sObject を選ぶと、その sObject が持つフィールドのリストが出る汎用 lightning component の作り方を書きました。https://t.co/Mg2aGk6UHx pic.twitter.com/oYJZMd1SMu— シン (@shintaka…

How to select sObject with date type condition in correct timezone at Apex ( and SOQL )

Environment Apex Code For example I assume that you get a variable of two dates-type as follows already. gist.github.com Please refer to last entry for details of the FiscalYearCalculation.getLastFiscalYearPeriod method. Now, we'll select …

How to get Fiscal Year's start and end date at Apex

Environment Apex Code gist.github.com You can also use other literals (e.g. NEXT_FISCAL_YEAR, THIS_FISCAL_QUARTER and many ) to get each duration's start and end date with same method. Reference developer.salesforce.com

How to extends an @AuraEnabled method from super class at Apex

Environment Apex Prerequisites We can not access An Extended @AuraEnabled method from Aura ( node ) as below. gist.github.com AuraHelper.js can't access c:getAccounts. So, this code is not work. Code The solution is to change SubClass as b…

How to get Salesforce sObject's fields List that is sorted by field's name at Apex

Environment Apex Code String sobjectApiName = 'Account'; Map<String, Schema.SObjectField> fieldMap = Schema.getGlobalDescribe().get(sobjectApiName).getDescribe().fields.getMap(); List<String> fieldNames = new List<String>(fieldMap.keySet()); fieldNames.sort(); for (String fieldName: </string></string></string,>…

How to get arrays intersection include duplicate values at node

Prerequisites There are two arrays has multiple elements as below. array1 is [ { "mail": "shinchi@its-all-writing.com", "hobby": "Walking" }, { "mail": "shinchi@its-all-writing.com", "hobby": "Playing the Bamboo Flute" }, { "mail": "kazuyo…

How to implement multiple key's group by at node

Prerequisites There are arrays has multiple elements as below. [ { "name": "SHINCHI, Takahiro", "mail": "shinchi@its-all-writing.com", "hobby": "Walking" }, { "name": "SHINCHI, Takahiro", "mail": "shinchi.xx@gmail.com", "hobby": "Playing t…

How to execute End-to-End Testing with WebdriverIO on CircleCI 2.0

It's easy way to execute Web application's End-toEnd testing that using circleci/node:latest and selenium/standalone-chrome:latest as image of Docker. I'll show sample .circleci/config.yml as below. version: 2 jobs: build: docker: - image:…

How to get Salesforce sObject's fields information by node

It's simple. You can use jsforce for this purpose. The describe method returns sObject's meta data. The environment and code is below. Enviroment node jsforce lodash Code const jsforce = require('jsforce'); const lodash = require('lodash')…

How to detect that it can be merged between multiple elements in an array at node.

Prerequisites There are arrays has multiple elements as below. const mergeableArray = [ { 'age': 18, 'status': true }, { 'hobby': 'fishing' }, { 'status': null } ]; const unmergeableArray = [ { 'age': 18, 'status': true }, { 'hobby': 'fish…

How to get Salesforce sObject's fields information by python

It's simple. You can use simple_salesforce for this purpose. The describe method returns sObject's meta data. The environment and code is below. Environment python 3.6.x simple_salesforce Code #!/usr/bin/python from simple_salesforce impor…

How to delete child records ( cascade deleting ) at the time of deleting parent record.

I wrote The application in which have the structure in which User ( parent record ) has many Comments ( children records ). And I tried to implement cascade deleting ( at the time of deleting User (parent record ), I also want to delete Co…

How to make a End-to-End Testing by WebdriverIO and Microsoft Excel.

I explained the way to convert xlsx to JSON and a basis of WebdriverIO by entry in last time and the time before last.Now, I’ll explain “How to make a End-to-End Testing by WebdriverIO and Microsoft Excel.”. Prepare Now, I’ll prepare the e…

Basis of WebdriverIO

Basis of WebdriverIO WebdriverIO is a End-to-End Testng tool for a Web Application.It implements all Webdriver protocol commands and provides that you can manipulate that by Node.js. Previous entry, I explained the way to take JSON out fro…