My experience on my daily works... helping others ease each other

Sunday, December 22, 2019

Ionic 4 + React + Capacitor: Publishing Your Apps

Since I don't have Apple Store Developer Account yet, I can only publish on Android, of which at Google Play Store. Head up if you are ready.

Before you start. Here is my development tools/environment.
  1. VS Code 

  2. Version: 1.41.0
    Commit: 9579eda04fdb3a9bba2750f15193e5fafe16b959
    Date: 2019-12-11T17:58:38.338Z
    Electron: 6.1.5
    Chrome: 76.0.3809.146
    Node.js: 12.4.0
    V8: 7.6.303.31-electron.0
    OS: Darwin x64 19.2.0


  3. OSX Catalina with zsh (I am not using Bash)

  4. Samsung A50 running Android

Steps to publish your first Apps on Google Play.

1. Check your installation
           Command to check your NPM version
       % npm -v
       6.13.4
           Command to check your ionic version
       % ionic -v

       5.4.13

2. Test your apps on Android devices by running the following command on your command prompt
    ionic serve --devapp

   > ionic integrations enable cordova
   [ERROR] Ionic doesn't support using Cordova with @ionic/react projects.
        
        We encourage you to try ⚡️ Capacitor ⚡️ (https://ion.link/capacitor)

If you come across the above error, no worries. This is because your app is Ionic + React and Cordova does not support this. You need to add capacitor to it. If you already configure it with capacitor before, you don't need to run the command.

Run the following command.
      % ionic integrations enable capacitor
Once completed, you will see the following
     ðŸŽ‰   Your Capacitor project is ready to go!  🎉


    Add platforms using "npx cap add":

    npx cap add android
    npx cap add ios
    npx cap add electron

    Follow the Developer Workflow guide to get building:
    https://capacitor.ionicframework.com/docs/basics/workflow
     

    [OK] Integration capacitor added!

Next, initialize your apps to use the capacitor by running command npx cap init [appname] [appid]. The appname and appid are available in file capacitor.config.json.

Once done, run ionic build command. You shall see similar to following
> react-scripts build
Creating an optimized production build...
Compiled successfully.


File sizes after gzip:
...

354 B     build/static/js/5.c9486a88.chunk.js

The project was built assuming it is hosted at the server root.
You can control this with the homepage field in your package.json.
For example, add this to build it for GitHub Pages:

  "homepage" : "http://myname.github.io/myapp",

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve ##this command is to install static server
  serve -s build       ##this command is to run the static server

Find out more about deployment here:   

Give it a try by running the last two command shown above. I did and the following appeared. Give it a try and use any other computer to browse your apps.

   ┌───────────────────────────────────────────────────┐
                                                    
     Serving!                                       
                                                    
     - Local:            http://localhost:5000      
     - On Your Network:  http://192.168.1.123:5000  
                                                    
     Copied local address to clipboard!             
                                                    

   └───────────────────────────────────────────────────┘

Voila!! You are halfway go from releasing your apps. BUT damn, you get few more errors when you try running command npx cap add android
   [error] The web directory ([some folder of your apps]) must contain a "index.html".

    It will be the entry point for the web portion of the Capacitor app.

What is next? If you google it, you will only be directed to https://github.com/ionic-team/capacitor/issues/116 or few which won't resolve your problem. Just go to your project folder, find where index.html is located. For mines, it is located in the folder public.


So, change your capacitor.config.json to point the webDir to the folder that holds the index.html. In my case, it will look like below
"npmClient": "npm",
"webDir": "public",

Finally, run ionic build and followed by npx cap add android.
Once done, you will see the following message.
Installing android dependencies in 18.77s
Adding native android project in: /YourProjectPath/android in 77.66ms
Syncing Gradle in 107.10s
add in 125.95s
Copying web assets from public to android/app/src/main/assets/public in 7.90ms
Copying native bridge in 1.21ms
Copying capacitor.config.json in 4.62ms
copy in 24.10ms
Updating Android plugins in 3.01ms
  Found 0 Capacitor plugins for android:

update android in 14.69ms

Now you can run npx cap open android to launch Android Studio

So go ahead run the command npx cap open android 
The command will open your android studio, update your Gradle and build your apps. It shall tell you where your APK is released.



Once done, observed on Gradle Sync Issues. Any Red or Orange, please do resolve it first.
Test your apps by running it.

NOTE: If you still face a problem; for instance, you have blank screen, Follow the following steps:
Ionic 4 + React + Capacitor — The right way of building mobile apps with these three https://link.medium.com/uHL1APKDx2 or http://malaysiandeveloper.blogspot.com/2019/12/ionic-4-react-capacitor-right-way-of.html

3. Test your apps by running it on emulater.
4. Before you publish your apps, create your splash screen. You can follow the steps shown here. I do it manually; that is by changing all icons in all folders located at android/app/source/main/res using Adobe Photoshop. Then I added the following in my capacitor.config.json file
"plugins": {
"SplashScreen": {
"launchShowDuration": 3000,
"launchAutoHide": true,
"backgroundColor": "#000000",
"androidSplashResourceName": "splash",
"androidScaleType": "CENTER_CROP",
"androidSpinnerStyle": "large",
"iosSpinnerStyle": "small",
"spinnerColor": "#ff9900",
"showSpinner": true
}
}

That shall do it.

5.  If you change the config and add new files, just recompile your code (start at step 2 again) and rebuild your APK.

6. Finally, you are ready to publish. If you are using Ionic 4 + React + Capacitor, skip step 7 to 10.

7. Create your key (if you have yet to do so). Follow the following step
(base) % keytool -genkey -v -keystore [yourkey.keystore] -alias [aliasname] -keyalg RSA -keysize 2048 -validity 999999
Enter keystore password:  
Re-enter new password: 
What is your first and last name?
  [Unknown]:  [Your Name]
What is the name of your organizational unit?
  [Unknown]:  [Your Company]
What is the name of your organization?
  [Unknown]:  [Your Company]
What is the name of your City or Locality?
  [Unknown]:  [Your current Local]
What is the name of your State or Province?
  [Unknown]:  [Your State]
What is the two-letter country code for this unit?
  [Unknown]:  MY
Is CN=My Name, OU=MyName, O=MyName, L="Local", ST=State, C=MY correct?
  [no]:  Yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 999,999 days
for: CN=My Name, OU=MyName, O=MyName, L="Local", ST=State, C=MY

[Storing my-release-key.keystore]

8. Signed your Unsigned APK (or your successful compiled/debug APK). Normally, your APK is located at android/app/..../debug/
- Run the command
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore /android/app/build/outputs/apk/debug/app-debug.apk [your-alias-name-given-during-key-generation]
Enter Passphrase for keystore: 

 updating: META-INF/MANIFEST.MF
....
Warning: 
The signer's certificate is self-signed.
No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (4757-11-17).

(base) % 

Note: Don't worry about the warning as you are signing using your own certs.
If you face problem of jarsigner error: java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0
Don't worry, just change your Java Environment/JDK to higher version. For example, I'm using Java 9 during the signing process, I just switch to JDK10 using JEnv. and it works

9. Next, align your APK or in other words, compile for final release using the Zipalign command.

(base) % zipalign -v 4 [your-signed-apk].apk [yourfinalnameapps].apk

please make sure you include the path to your APK and path to zipalign. Zipalign is located in android folder; for instance, mine is located at ~/Library/Android/sdk/build-tools/29.0.2/

10. Once done, you should be able to release it to Google.

11. For Ionic + React + Capacitor, you must perform few edits before you can begin.



12. Then run the command npm run build, followed by npx cap copy android or npx cap sync android.

13. Open your Android Studio and rebuild the projects.

14. Use your Android Studio to perform the following:


** Note: Please create key using Android Studio to ease in publishing the apps

15. Touch down. Open your Google Play Dashboard and start your publishing process.

The full documentation is reachable at https://ionicframework.com/docs/publishing/play-store and https://ionicframework.com/docs/v1/guide/publishing.html and https://support.google.com/googleplay/android-developer/answer/7159011
Share:

Thursday, December 19, 2019

Improving and Managing the Applications Performance

I was developing my personal resume mobile apps using Ionic Framework + React and Capacitor. It is using a few JSON files so that I can easily manage it in the future.

It works perfectly when I run npm start or ionic serve command. However, when I move it to mobile apps, there start a problem. It is lagging despite running on an emulator or even on my devices and I'm just using local files.

After days of googling and try-n-error, I found a good solution to it. Used

  • Lazy
  • Suspend
  • Error controller


And it should solve it.

Here it is done:

1. Lazy & Suspend

import React, {lazy, Suspense, Component} from 'react';
//import { IonContent, IonHeader, IonItem, IonLabel, IonList, IonPage, IonTitle, IonToolbar } from '@ionic/react';

const AboutPage = lazy(() => import('./AboutPage'));

class Abouts extends Component<any, any> {
constructor(props: any) {
super(props);
this.state = {
details: true
}
}
showDetails() {
this.setState({ details: true });
}
renderLoader = () => <div className="loader">Loading About & Credit...</div>;
render() {
const { details } = this.state;
return (
<div className="divLoading">
{ details &&
<Suspense fallback={this.renderLoader()}>
<AboutPage />
</Suspense>
}
</div>
);
}
}
export default Abouts;

2. Error controller

class ErrorBoundary extends React.Component<any, any> {
constructor(props: any) {
super(props);
this.state = {hasError: false};
}

static getDerivedStateFromError(error: any) {
return {hasError: true};
}

render() {
if (this.state.hasError) {
return <p>Loading failed! Please reload.</p>;
}

return this.props.children;
}
}
.....
#part of your code
<ErrorBoundary>
<Suspense fallback={this.renderLoader()}>
<ThePageToLoad />
</Suspense>
</ErrorBoundary>

All is based on the following resources. Credit goes to them who help me to solve it:

  1. https://web.dev/code-splitting-suspense/
  2. https://codesandbox.io/s/7zx3jlrry1?from-embed
  3. https://www.freecodecamp.org/news/how-to-optimize-react-applications-with-lazy-loading-232183e02768/
Share:

Wednesday, December 18, 2019

Ionic 4 + React + Capacitor - The right way of building mobile apps with these three

React is supported in Ionic starting from Ionic 4. And this is the issue if you started to develop ionic react apps by running command ionic start [appsname] --types=react.

I started with that command and it becomes issues of which it took me 3 days and still it won't work. Few issues found was:
1. You cannot build or compile into mobile apps with normal ionic cordova add android, etc commands. It will stated that it is a react apps and you need to use capacitor instead.
2. So you start to install capacitor and follow many steps. You will be succeed in building and compiling.
3. But, upon running the apps on emulator or your devices, you'll get blank screen. 

How to solve that? I've followed many steps including changing the default href in index.html, remove and add capacitor and rerun it. Yet it failed. 

How do I solve that? Here is the steps:

1. Remove everything

(base) % npm uninstall -g ionic    
up to date in 0.05s
(base) % npm uninstall -g capacitor
up to date in 0.045s
(base) % npm uninstall -g cordova  
up to date in 0.047s
(base) a% npm cache clean -f        
npm WARN using --force I sure hope you know what you are doing.

2. Update your NPM modules
(base) % npm i -g npm              

3. Install ionic with capacitor
(base) % npm install -g ionic capacitor

4. Create your apps
(base) % ionic start yourapps tabs --type=react

5. Run NPM install to install any modules required upon completed. For any additional modules, run npm install to ensure required modules is updated.
(base) % cd yourapps 
(base) % npm install

6. Run your apps to test it out
(base) % ionic serve

7. After doing your development, build it using npm run build or ionic build
(base) % npm run build

8. Next, build for your platform. Once build is completed, please ensure your www or public folder exist. Then add the required platform. In my case, I'm developing for android.
(base) % ionic cap add android

9. Open IDE. If succeed, proceed with opening the apps on XCode or Android Studio (depend on your chosen platform)
(base) % ionic cap run android

10. Once your IDE is opened, compile/build and run it on emulator or devices.

It shall do it.



Share:

Saturday, December 14, 2019

Each child in a list should have a unique "key"

When you are developing apps using Ionic Framework (and probably using React), you may implement

  • IonList
  • IonItem
  • IonGrid
  • IonRow
  • IonCol
  • etc

and when you successfully compiled and displayed on web, you may or may not realize that there is a warning (unless you are using chrome and turn on Developer Tool) like I did. To those who did, you will have similar like I have below:
index.js:1375 Warning: Each child in a list should have a unique "key" prop.

Check the render method of `ThePage`. See https://fb.me/react-warning-keys for more information.
    in ForwardRef(IonItem) (at PublicationPage.tsx:72)
    in PublicationPage (created by Context.Consumer)
    in Route (at App.tsx:63)
    in View (created by StackManager)
    in ViewTransitionManager (created by StackManager)
    in ion-router-outlet (created by IonRouterOutlet)
    in IonRouterOutlet (created by ForwardRef(IonRouterOutlet))
    in ForwardRef(IonRouterOutlet) (created by StackManager)
    in StackManager
    in Unknown (created by ForwardRef(IonRouterOutlet))
    in ForwardRef(IonRouterOutlet) (at App.tsx:52)
    in div (created by IonTabs)
    in div (created by IonTabs)
    in IonTabs (at App.tsx:51)
    in NavManager (created by RouteManager)
    in RouteManager (created by Context.Consumer)
    in RouteManager (created by IonReactRouter)
    in Router (created by BrowserRouter)
    in BrowserRouter (created by IonReactRouter)
    in IonReactRouter (at App.tsx:50)
    in ion-app (created by IonApp)
    in IonApp (created by ForwardRef(IonApp))
    in ForwardRef(IonApp) (at App.tsx:49)
    in App (at src/index.tsx:6)

Searching through the web won't help much. Especially when the warning message is not helping at all.

What you need to do is to ensure for each item you used (list, row, col, grid, etc), you need to assign a key to it. For example, as shown below; whereby for each child within the list, I declared key to it.

certs.Lists.map( ( cert, index ) => {
return (
<IonItem key={1 + '' + index}>
<IonGrid key={1 + '' + index +'0'}>
<IonRow key={1 + '' + index + '' +1}>
<IonCol size="12" style={{backgroundColor:'lightgreen', color:'black'}}><strong>{cert.Certification}</strong></IonCol>
</IonRow>
<IonRow key={1 + '' + index + '' +2}>
<IonCol size="4">Cert. No:</IonCol>
<IonCol size="7">{cert.CertificationNo}</IonCol>
</IonRow>
<IonRow key={1 + '' + index + '' +3}>
<IonCol size="4">Certified By:</IonCol>
<IonCol size="8">{cert.Trainer}</IonCol>
</IonRow>
<IonRow key={1 + '' + index + '' +4}>
<IonCol size="4">Validity:</IonCol>
<IonCol size="8">{cert.Validity} since {cert.Since}</IonCol>
</IonRow>
<IonRow key={1 + '' + index + '' +5}>
<IonCol size="4">Expired:</IonCol>
<IonCol size="8">{cert.Expired}</IonCol>
</IonRow>
</IonGrid>
</IonItem>
);

Once you did that, voila, the warning disappears.

If you don't know where is Developer Tool, it only applies to Chrome Browser as below.
Go to three '.' on the top-right of Chrome, click it. Then go to More Tools and select Developer Tools
Select Developer Tool

The Developer Tools



Share:

Sunday, November 17, 2019

Setting up Laravel with Homestead on Mac

First - Don't trust your VirtualBox
Second - Focus on your Terminal only

Then follow the instruction here:
https://www.danwalker.com/setting-up-a-laravel-homestead-box/

if the first one fails, you can follow here https://petericebear.github.io/installing-laravel-homestead-osx-20160514/

Finally, you can take a look at the documentation https://laravel.com/docs/6.x/homestead or start reading the step at https://laravel.com/docs/6.x/installation

Just remember - virtualbox is there for nothing if you follow the instruction from Dan Walker :)

Basically (after you install virtualbox, vagrant and git)
1. Install the Homestead
2. Then, go to Homestead folder and run vagrant up (after you configure Homestead.yaml - follow Dan Walker steps)

Homestead % sudo vagrant up
Password:
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Checking if box 'laravel/homestead' version '8.2.1' is up to date...
==> homestead: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> homestead: flag to force provisioning. Provisioners marked to run always will still run.
Homestead % sudo vagrant provision
==> homestead: Running provisioner: file...
    homestead: /Users/mylap/Homestead/aliases => /tmp/bash_aliases
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
    homestead: Ignoring feature: mariadb because it is set to false
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
    homestead: Ignoring feature: ohmyzsh because it is set to false
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
    homestead: Ignoring feature: webdriver because it is set to false
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/vagrant-shell20191118-12061-jukqa0.sh
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/vagrant-shell20191118-12061-1m33y24.sh
==> homestead: Running provisioner: shell...
    homestead: Running: script: Creating Certificate: mytest.local
==> homestead: Running provisioner: shell...
    homestead: Running: script: Creating Site: mytest.local
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/vagrant-shell20191118-12061-sbf7fz.sh
==> homestead: Running provisioner: shell...
    homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: shell...
    homestead: Running: script: Clear Variables
==> homestead: Running provisioner: shell...
    homestead: Running: script: Restarting Cron
==> homestead: Running provisioner: shell...
    homestead: Running: script: Restarting Nginx
==> homestead: Running provisioner: shell...
    homestead: Running: script: Creating MySQL Database: homestead
==> homestead: Running provisioner: shell...
    homestead: Running: script: Creating Postgres Database: homestead
==> homestead: Running provisioner: shell...
    homestead: Running: script: Update Composer
    homestead: You are already using composer version 1.9.1 (stable channel).
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/vagrant-shell20191118-12061-iyqu6p.sh
==> homestead: Running provisioner: shell...
    homestead: Running: script: Update motd
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/vagrant-shell20191118-12061-dwbd58.sh


3. Then, open the ssh

Homestead % sudo vagrant ssh
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-64-generic x86_64)

Thanks for using 
 _                               _                 _ 
| |                             | |               | |
| |__   ___  _ __ ___   ___  ___| |_ ___  __ _  __| |
| '_ \ / _ \| '_ ` _ \ / _ \/ __| __/ _ \/ _` |/ _` |
| | | | (_) | | | | | |  __/\__ \ ||  __/ (_| | (_| |
|_| |_|\___/|_| |_| |_|\___||___/\__\___|\__,_|\__,_|

* Homestead v9.2.2 released
* Settler v8.2.0 released

0 packages can be updated.
0 updates are security updates.


vagrant@homestead:~$ ls
code
vagrant@homestead:~$ cd code

 4. Finally, install the laravel (I defined as mytest.local)
vagrant@homestead:~$ laravel new mytest.local 


5. configure your /etc/hosts to have ip 192.168.10.10 pointing to your laravel page. In my example, 192.168.10.10 mytest.local is the name

6. Open browser and go to http://mytest.local (or your page name defined in Homestead.yaml and /etc/hosts)

That's all bro




Share:

Thursday, November 14, 2019

Useful resources to learn Flutter

I started to learn Flutter and Dart due to 'given' free time. So, to fill up my free time, besides reading some articles and play games with my kids, I add new things to my knowledge and Flutter it is.
Image result for flutter

As I've left programming quite some times, I had to do lots of searches and found a few best sites to learnt and perform what we do best; i.e. CTRL+C and CTRL+V.

Here are the usefull list and will try to add as I found more.

    Image result for Dart
  1. Flutter Dev
  2. An open list of apps built with Flutter
  3. Flutter Tutorials Handbook
  4. AppDividend
  5. A collection of Flutter examples and demos
  6. FB Flutter Development - Maintained by fellow Malaysian
  7. FB Flutter Dev
  8. Flutter Master
  9. Flutter Community @ Medium and their code sharing
  10. Dart and Flutter Command
  11. Flutter Command Cheat Sheet
  12. List of Widgets for newbies by Annsh Singh


Enjoy programming

Image result for programmers
Share:

Wednesday, November 13, 2019

Flutter problem with MacOS Catalina

Apple has just released it's latest OSX known as Catalina. At the time this is written, there is still bugs or problem faces by developers especially when developing other than swift (or any apply proprietary) programming language. One of these problematic languages is Flutter by Google.

There are no shortcut on this. When you enable/allow one, few more will surface. Just be patient and continue to verify the problem as shared via these two link

1. https://github.com/flutter/flutter/issues/42302
2. https://medium.com/codespace69/flutter-idevice-id-cant-be-opened-because-its-integrity-cannot-be-verified-44ad2b313a0e
Share:

Monday, September 16, 2019

Securing eWallet and eTicket Apps

Last year, I was requested to do a research on Blockchain and looking for ways to implement it here. At that time, due to limited resources, I just spend a few days to do the research and thought of a few applications based on the Blockchain.

Two of them are eWallet and eTicket. Out of many, I found Aventus is one of the key company doing it. Today, they have released another feature of their product. Check it out here.

Of course, the implementation of it won't be easy. Unless you do understand how blockchain works.
Check it out at CNET to get a brief on how it works.

Image result for blockchain

Share:

Friday, September 13, 2019

Improving JP with Improvised Prediction Model

Yesterday I wrote on low ridership (read here), of which out of many factors, information availability for journey planning contributes 12% from overall factors. However, the value is based on a survey on one location; that is Penang. Nonetheless, I believed, information availability is the key importance for a smooth journey planning, no matter of the services used or the impact to ridership. The reason for this is based on comments in Google Play for various Journey Planner such as Moovit, Transit Apps, SWIVL, SITS, etc, whereby many user stated their frustration on the accuracy of information displayed by the apps.

Beside information availability being a vital role for riders to plan their journey and services to use, based on the articles referred to in the post, the information must be also reliable, accurate and at real-time (or at least near real-time). If you received an information that was accurate a few minutes ago, there is a probability of the information to be inaccurate at the time of view or receive resulting in the inaccurate plan and action.

How to improve information accuracy, no matter how and when the information arrives at the user?
I did a quick review too on the following articles:

  1. https://www.papercast.com/insights/predict-accurate-bus-arrival-journey-times/
  2. https://core.ac.uk/download/pdf/82293981.pdf
  3. https://escholarship.org/uc/item/51t364vz
  4. http://gamma.cs.unc.edu/TROUTE/
  5. https://www.researchgate.net/publication/274028208_Multimodal_Public_Transit_Trip_Planner_with_Real-Time_Transit_Data
  6. https://repositorio-aberto.up.pt/bitstream/10216/6817/2/26915.pdf
  7. https://jungleworks.com/predicting-accurate-arrival-time/
  8. https://www.researchgate.net/publication/332342499_Survey_of_ETA_prediction_methods_in_public_transport_networks
  9. https://dl.acm.org/citation.cfm?id=3219819.3219874
  10. https://pdfs.semanticscholar.org/8c95/f20cd049e5f0d35466544958631e3e10c258.pdf
  11. https://www.papercast.com/wp-content/uploads/2017/06/Papercast_A4_Better-ETA_2017.pdf
  12. https://datascience.stackexchange.com/questions/10301/how-to-predict-eta-using-regression
  13. https://ieeexplore.ieee.org/abstract/document/1212964
  14. https://www.tandfonline.com/doi/abs/10.1080/15472450600981009
  15. https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1467-8667.2004.00363.x
  16. https://journals.sagepub.com/doi/abs/10.3141/1666-12
  17. https://link.springer.com/chapter/10.1007/978-981-13-3393-4_29
  18. https://patents.google.com/patent/US10254119B2/en
  19. https://arxiv.org/abs/1904.05037
  20. https://patents.google.com/patent/US20190130260A1/en
  21. https://www.tandfonline.com/doi/abs/10.1080/19427867.2017.1366120
  22. https://link.springer.com/article/10.1007/s12652-019-01198-1
  23. https://arxiv.org/abs/1904.03444
  24. https://patents.google.com/patent/US20190051154A1/en
  25. https://ieeexplore.ieee.org/abstract/document/8691701

Based on the articles above, below is the gist of the findings:

  1. Reliable and accurate information at real-time (or near real-time) is critical for smooth journey planning
  2. Recent technology (BDA, AI, ML & IoT) has resulted in many new algorithms to predict accurate ETA to be used in JP
  3. The most recent is KNN which requires lots of historical data and real-time tracking for accurate prediction


Recommendation:

  1. To research and try-n-error all the algorithms to find the best algorithm to predict accurate ETA to be used in the Malaysian environment
  2. To define the best algorithm based on time of request (peak or non-peak)
  3. To come out with a new algorithm and flow to ensure the ETA for JP is 95% accuracy during non-peak and 90% accuracy during peak.


Share:

Tuesday, September 10, 2019

Is JP contributors to low ridership?

I was thrown a question on this and was also told the reason for low ridership. I am curious about it when it does not make sense to me. The two reasons shared to me are:
1. Ridership goes down because there is no Journey Planner
2. The customer doesn't need real-time data. They just want to have information about the services. It can be 3 minutes ago of information as long as we stated that the information is true 3 minutes ago.


It actually raised a few questions in my mind.
1. Was it really because of JP? or there are different factors.
2. If the information true 3 minutes ago, and I was standing in from of station or stops getting information that was updated saying that the bus or train is at 1 km away 3 minutes ago, will there be bus now (after 3 minutes) or has the bus pass through me 1 minutes ago because the information I get is delay 3 minutes. If I'm doing the planning right now, how can I plan with previous 3 minutes data? Should I add 3 minutes and assume the location of the bus upon receiving the info?

So, to answer my question, I do a quick review of many studies done earlier as listed below.

  1. https://www.edmonton.ca/city_government/documents/RoadsTraffic/transit_factors_ridership.pdf
  2. https://www.researchgate.net/publication/282656951_Factors_Affecting_to_Public_Bus_Transport_Ridership_A_Case_of_Capital_Colombo
  3. https://pdfs.semanticscholar.org/d3f0/63f546d97e676029dc1267ae1c09d9d298c3.pdf
  4. https://www.researchgate.net/publication/298371532_Factors_Affecting_Bus_Ridership_With_Respect_to_Passenger_Demography_A_Case_Study_of_Seberang_Perai_Pulau_Pinang_Malaysia
  5. http://www.reconnectingamerica.org/assets/Uploads/ridersipfactors.pdf
  6. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.683.858&rep=rep1&type=pdf
  7. https://fas.org/sgp/crs/misc/R45144.pdf
  8. http://www.ncarpo.org/uploads/1/3/8/1/13819061/factorsaffectingridership_20181004.pdf
  9. https://la.streetsblog.org/2016/01/29/what-factors-are-causing-metros-declining-ridership-what-next/


Findings:
1. From all papers, only 2 mentioned about information availability as one of the factors impacting ridership.
2. From the two papers, 1 mentioned real-time info is required but it is not one of the key factors. It is 1 out of many factors.
3. On the other papers (studies on bus ridership in Penang) - the author stated that the availability of information only accounts for 12% of the total factors contributing to low ridership.
4. The biggest factors contributed to low ridership are:
4.1 Service availability & reliability
4.2 Drivers behavior
4.3 Fare
4.4 Access to the services
4.5 Disruptor - e-hailing services

Further review on trip planning in new york based on the following two papers revive a few interesting facts.

  1. https://dl.acm.org/citation.cfm?id=2811271.2811272
  2. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.888.1033&rep=rep1&type=pdf

1. Despite was told that in new york, the information display shown is updated 3 minutes ago, I found out that it is actually a real-time update. Just that it stated updated 3 minutes ago because there is no new information at that time of the query.
2. The above two papers clearly state the importance of real-time information and it must be reliable info.

Conclusions:
1. JP is not the main key factors contributing to low ridership but JP availability can affect the decision of the public to use available services.
2. Service availability & reliability is the biggest contributor. If the OTR is reduced, definitely there will be a reduction of riders compared before OTR reduced.
3. e-Hailing has played a significant role in low ridership too. I believed, if Gojek successfully landed here in Malaysia, it will play a vital role in lowering the ridership too.
4. Real-time information and real-time update of information is the key to provide reliable info.

Recommendation:
1. JP is something needed but the information displayed in it shall be reliable and trustworthy. Thus improving the information relay process shall be the main focus.
2. Service availability and reliability shall be improved.
3. Implementation of BOS to complement each other for the benefit of the public.


* it is updated with a recommendation as many have shared their opinion on the post.
Share:

About Me

Somewhere, Selangor, Malaysia
An IT by profession, a beginner in photography

Blog Archive

Blogger templates