Job for apache2.service failed because the control process exited with error code. 2023-06-25


https://askubuntu.com/questions/1013261/job-for-apache2-service-failed-because-the-control-process-exited-with-error-cod

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)


https://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run

https://stackoverflow.com/questions/21944936/error-1045-28000-access-denied-for-user-rootlocalhost-using-password-y

MacOS: Composer install 2023-06-04



php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ’55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”
php composer-setup.php
php Read More

MacOS: brew command not found


Fix “brew command not found” on Mac with zsh

MacOS Terminal: Default Shell Bash selection


chsh -s /bin/bash

Send data to DHIS2 instance from R 2023-04-27


library(httr)
library(readr)
library(assertthat)
library(jsonlite)
library(purrr)

baseurl

Stacked Bar Using R 2023-04-26


# Library
library(ggplot2)
library(openxlsx) #install.packages(“openxlsx”)
library(gridExtra) #install.packages(“gridExtra”)

# File location
path

AWS RDS: How to check max_connection and processlist 2023-04-16


SELECT @@max_connections;

SHOW FULL PROCESSLIST

AWS RDS: How do I increase the max connections of my Amazon RDS for MySQL or Amazon RDS for PostgreSQL instance?



Step-1: Log into your account https://ap-south-1.console.aws.amazon.com/rds
Step-2: Click on databases >> Detail of the database >> Click on the networking
Step-3: Click on the first box under Read More

Apache: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting 2023-04-15


#nano /etc/apache2/mods-enabled/mpm_event.conf
—————————–add—————————————-

StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 625
MaxConnectionsPerChild 10


And
… mpm_prefork.conf

Read More

DHIS2 Metadata: create program using API 2023-04-06


GET: http://server/api/programs.json
Program details: http://server/api/programs/uid.json
Get TrackedEntityType UID: http://server/api/trackedEntityTypes

POST: http://server/api/programs
Program JSON Payload:
{

“name”: “mWater Interoperability”,
“shortName”: “mWater”,
Read More

DHIS2 Metadata: Data element create API



GET: /server/api/dataElements.json?fields=aggregationType,domainType,categoryCombo,valueType,zeroIsSignificant,name,shortName&filter=domainType:eq:TRACKER&pageSize=1

POST: http://server/api/dataElements

{
“name”: “BCG given (0-11m)”,
“shortName”: “bcg”,
“aggregationType”: “SUM”,
Read More

DHIS2: Adding and removing objects in a single request


Adding and removing objects in a single request
API: POST /api/categories/IDA/categoryOptions
JSON Payload:
{
“additions”: [
Read More

DHIS2: Creating event metadata Web API



Create constant:
API: http://server/api/constants
JSON Payload:
{
“name”: “PI”,
“value”: “3.14159265359”
}

Response:
{
Read More

Laravel: Eloquent get results grouped by days 2023-03-16



DB::table(‘table’)
->select(DB::raw(‘DATE(login_date) as date’), DB::raw(‘count(*) as total’))
->groupBy(‘date’)
->get();

DHIS2: Tracked Entity Attribute – Automatically generate 2023-03-13



ORG_UNIT_CODE(…) + “-” + CURRENT_DATE(yyyyww) + “-” + SEQUENTIAL(#####)

System property dhis2.home not set 2023-03-05

curl Install on Ubuntu 2023-02-25


sudo apt update
sudo apt upgrade
sudo apt install curl


Ref: https://www.cyberciti.biz/faq/how-to-install-curl-command-on-a-ubuntu-linux/

PHP install on Mac


brew install php

Path not found: https://stackoverflow.com/questions/65487249/getting-a-warning-when-installing-homebrew-on-macos-big-sur-m1-chip

Laravel Composer – error: Root composer.json requires phpoffice/phpword 2023-02-19


sudo apt install php-xml will work but the thing is it will download the plugin for the latest PHP version.

If your PHP version is not the latest, Read More

DHIS2: Delete trackedEntityInstances 2023-02-16


https://your_server/api/trackedEntityInstances/CM1zLmk6qvA?strategy=DELETE

$href = $request->get(‘href’);

$url = $href.”?strategy=DELETE”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_HTTPHEADER, array(‘Content-Type:application/json’));
curl_setopt( $ch, CURLOPT_USERPWD, “user:pass”);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “DELETE”);
$result = Read More

Unable to upload large DB in MySQL 2023-02-12


max_allowed_packet=10000M
C:\xampp-7.4\mysql\bin\my.ini

Laravel Exception: The stream or file could not be opened: failed to open stream: Permission denied 2023-01-29


chmod -R 777 /var/www/html/storage

Composer Install 2023-01-26


sudo apt-get update
sudo apt-get install composer

Ref: https://howtoinstall.co/en/composer

Uninstall composer


sudo apt-get remove composer

sudo apt-get remove –auto-remove composer

sudo apt-get purge composer

sudo apt-get purge –auto-remove composer


Reference: https://howtoinstall.co/en/composer?action=remove

During inheritance of ArrayAccess: Uncaught ErrorException



Laravel version issue: https://bytexd.com/fix-laravel-return-type-of-illuminatesupportcollectionoffsetexistskey/

PHP Version Downgrade



php artisan –version

Install PHP: sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt update
apt install php7.4

Version check: update-alternatives –config php
Read More

Laravel: Not Found The requested URL was not found on this server. 2023-01-25


sudo nano /etc/apache2/apache2.conf
Find the following code inside the editor:


Options Indexes FollowSymLinks
AllowOverride None
Require all Read More

PHPMyAdmin: ERROR 1819 (HY000) – Password does not satisfy the current policy requirements


Select ‘abort’
sudo mysql -p
mysql> UNINSTALL COMPONENT “file://component_validate_password”;
mysql> exit
sudo apt install phpmyadmin

Remove the plug-in:
UNINSTALL PLUGIN validate_password;
In the event of an error, use:
Read More

-bash: /usr/bin/composer: No such file or directory


alias composer=’/usr/local/bin/composer’
composer

apt install composer

mkdir /usr/local/bin/composer

Phpmyadmin Not Found


Create a link in /var/www like this:

sudo ln -s /usr/share/phpmyadmin /var/www/

Note: since 14.04 you may want to use /var/www/html/ instead of /var/www/

If that’s Read More

Certbot: Unable to locate package python-certbot-apache


sudo apt install -y certbot python3-certbot-apache

PHP Divisio by Zero Handle 2023-01-18


$percentage = round( (($countAST[0]->total * 100) / ($countTotal[0]->total ?: 1)), 2);

SQLSTATE[HY000] [2002] No connection could be made 2023-01-14


SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused
Check .env and config/database.php

Generate CSR for SSL certificate 2023-01-11


openssl req -newkey rsa:2048 -nodes -keyout my_domain.key -out my_domain.csr


Writing new private key to ‘my_domain.key’
—–
You are about to be asked to enter information that will Read More

Laravel 419 | Page Expired issue 2023-01-05



Step-1: Update the following method:
app/Http/Middleware/VerifyCsrfToken

class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should Read More

Guideline to add Laravel Socialite 2022-12-06


1. Run: composer require laravel/socialite

2. Go config >>

2.1 Add the following line under the “providers”: Laravel\Socialite\SocialiteServiceProvider::class,

2.2 Add this line in aliases: ‘Socialite’ Read More

Tracker: Failed to metadata 2022-04-08


Solution: Add the following line to your Tomcat server.
C:\Program Files (x86)\Apache Software Foundation\Tomcat 9.0\conf\server.xml

Open the server.xml file and add the following line:

relaxedQueryChars=”[,]”


Read More

Phpmyadmin not found 2022-02-08


https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04

Insufficient memory problem or OutOfMemoryError or GC overhead limit exceeded or java.lang.OutOfMemoryError: Java heap space or heap memory out of 2022-01-18


Solution: Change the JAVA_OPTS from your Environment variable

JAVA_OPTS: -Xms7500m -Xmx7500m -XX:PermSize=2048m -XX:MaxPermSize=2048m

Forbidden. You don’t have permission to access this resource. 2021-12-24


Visit: /etc/apache2/apache2.conf

Options Indexes FollowSymLinks
AllowOverride None
Require all granted


Source: https://stackoverflow.com/questions/60981999/forbidden-you-dont-have-permission-to-access-this-resource

Where are stored the files uploaded to DHIS2? 2020-08-10


Apps and other files location: home/dhis/config/files
AWS configuration: https://docs.dhis2.org/master/en/implementer/html/install_file_store_configuration.html

Pivot table/ Chart/ Reports all say Organization units not found 2020-07-29


1. Go to Maintenance then Organization Unit
2. Click on “Organization unit level”
3. Select the levels and save it


How to kill MySQL process? 2020-07-27



1. Login using your root access to your server
2. Access mysql by: mysql -u root -p and enter your password
3. mysql> show full processlist; You Read More

How to disable or read only DHIS2 Custom Data Entry Fields 2020-06-27


Add the “disabled” attribute in the data element: disabled=”disabled”

Example:





TypeError: Cannot read property ‘path’ of undefined 2020-06-18

Error: TypeError: Cannot read property ‘path’ of undefined


Solution: Go to Tracked entity type management and update the “Person” sharing settings.


Error Unsupported value type: COVID-19 cased-based surveillance 2020-06-17

Error: Unsupported value type



Solution: it is known issue for tracker capture.  The issue is with the assignment of the data elements to the program stage. Read More

How to extract DHIS2 org units using PHP? 2020-05-03


$ch = curl_init($this->serverIP.”/organisationUnits/”.$districtId.”.json?fields=children[id,name,level,children[id,name,level,children[id,name,level]]]”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_USERPWD, $this->auth);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “GET”);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); Read More

How can I get organisation unit information in DHIS2 data entry form? 2020-04-24




dhis2.util.on( ‘dhis2.de.event.formReady’, function( event,aLpVgfXiz0f) {

var orgName= $( ‘#selectedOrganisationUnit’ ).val();// From DHIS2 Selection Param
jQuery.get(“https://play.dhis2.org/2.31dev/api/organisationUnits.json?query=”+orgName+”&fields=id,level”,function(json){
$.each(json, function(key, value){

var arr = [];
for(var x in Read More

How to upload dhis2 backup database in ubuntu server? 2020-04-17



How to upload dhis2 backup database in server?

1. Login into your root access in ubuntu server and create database:

sudo -u postgres createdb -O Read More

DHIS2 event web api to update existing event 2019-11-15


POST: http://your-server/api/events/

{
“events”: [{
“program”: “ywNJYaTUVRT”,
“orgUnit”: “xDybhnrm1NW”,
“event”: “nnjyTxUY39n”,
“eventDate”: “2019-11-05”,
“status”: “ACTIVE”,
“programStage”: “HrdLXTOGh8A”,
“dataValues”: [{
“dataElement”: “lIkk661BLpG”,
“value”: “AMC94237”
}, {
“dataElement”: “dRKIjwIDab4”,
“value”: Read More

Opening Balance calculation in DHIS2 stock management 2019-11-14



dhis2.util.on( ‘dhis2.de.event.formReady’, function( event,iReVg2xgFPL ) {
var periodN= $( ‘#selectedPeriodId’ ).val();// From DHIS2 Selection Param
var nextPeriod=(+periodN) + (+1);//201611,201612,201613
var nextPeriodSeperate=periodN.toString().substring(0, 4);
Read More

DHIS2 bulk custom attribute json payload 2019-10-15



if(typeof customAttributeString.optionSet !==’undefined’ ){
jsonPayload = JSON.stringify({
“name”: customAttributeString.name,
“shortName”: customAttributeString.shortName,
“aggregationType”: customAttributeString.aggregationType,
Read More

DHIS2 bulk custom elements json payload


jsonPayload = JSON.stringify({
“name” : customElementString.name,
“shortName” : customElementString.shortName,
“aggregationType”: customElementString.aggregationType,
Read More

Smooth Interoperable DHIS2 Mechanisms Curb High Mortality Rates in Bangladesh 2019-09-25

Bangladesh is making huge strides in curbing child mortality rates! The Bangladesh National Health Care System holds maternal, neonatal and child health (MNCH) as one of its biggest focuses. Between Read More

How to merge data elements and datastore payload using React JS 2019-07-18


let self = this;
await getPrograms().then((response) => {
self.setState({
dataElements : Read More

Laravel database table migration 2019-07-13


## Generate Migration

php artisan make:migration –path=database/migrations/modules/globalSettings create_admin_settings_table

### Migration Run Commands for table generate


php artisan migrate –path=database/migrations/modules/globalSettings

DHIS2 Login using Laravel and CURL 2019-07-12



public function dhis2Login(Request $request) {

$username = trim($request->input(‘username’));
$password = trim($request->input(‘password’));
$ch = curl_init(“http://……..:8080/api/me”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_USERPWD, “admin:district”);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status Read More

How to calculate previous month value in DHIS2 data entry form? 2019-07-09


dhis2.util.on( ‘dhis2.de.event.formReady’, function( event,iReVg2xgFPL ) {
var periodN= $( ‘#selectedPeriodId’ ).val();// From DHIS2 Selection Param
var nextPeriod=(+periodN) Read More

React JS Async await 2019-07-07




if(this.state.duplicateStatus) {
let dpRes = await ( async (payload, currentIndex) => {
Object.entries(updateTeiJson).map(payload => {
let trackedEntityInstance = payload[1].trackedEntityInstance;
Read More

PostgreSQl-cannot execute nextval() in a read-only transaction 2019-06-20


Issue: ERROR: cannot execute nextval() in a read-only transaction



Solution: Go >> C:\Program Files\PostgreSQL\11\share, open postgresql.conf and replaced default_transaction_read_only to off as `default_transaction_read_only = Read More

PostgreSQL could not open extension control file “C:/../share/extension/postgis.control”: 2019-06-19


ERROR: could not open extension control file “C:/Program Files/PostgreSQL/10/share/extension/postgis.control”: No such file or directory

Actual Cause: If you installed postgres

DHIS 2 web request gives “Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986” 2019-06-18





Solution:

This happens because DHIS 2 uses brackets in some of their URLs, and because Tomcat version 8.5 later has prohibited the use Read More

PostgreSQL database upload on windows


Go >> /c/Program Files/PostgreSQL/11/bin

Type: psql -U dhis -f dhis.sql dhis

Provide Password for user dhis: your dhis-password



Domain and Hosting Configuration in Digital Ocean 2019-06-17

If you have purchased a domain from name.com/cheapname.com or any other website and want to host it in Digital ocean server, this post will guide you how to configure you Read More

How to update categoryOptions using DHIS2 web api? 2019-06-16


https://amrtest.icmr.org.in/amrtest/api/categoryOptions/v71U0ziiKTr
{
“name”: “Joint Fluid”,
“shortName”: “JTFL”,
“attributeValues”: [
{
“value”: “Joint Fluid Read More

How to update meta attributeValues (elements) using DHIS2 web api?


https://your-server/api/dataElements/2a19h5eZldA

{
“name”: “Hospital department”,
“shortName”: “Hospital department”,
“aggregationType”: “NONE”,
“domainType”: “TRACKER”,
“valueType”: “TEXT”,
“attributeValues”: [{
“value”: “DEPARTMENT”,
“attribute”: {
“id”: “xmp9h5eZldA”
}
}]
}


Read More

How to update specific trackedEntityAttributes using DHIS2 web api?


https://your-server/api/trackedEntityAttributes/DfXY7WHFzyc

{
“name”: “Age / DOB”,
“valueType”: “AGE”,
“aggregationType”: “AVERAGE”,
Read More

How to get elements detail using DHIS2 d2 framework


getInstance()
.then(d2 => {
d2.Api.getApi()
.put(‘dataElements/lIkk661BLpG’,{
Read More

Create New track entity through web API 2019-06-13

Tracker Web API consists of 3 endpoints that have full CRUD (create, read, update, delete) support. The 3 endpoints are /api/trackedEntityInstances /api/enrollments and /api/events and they are responsible for Tracked Read More

DHIS2 current user roles, organization unit and authorization using d2 framework 2019-05-20



Read More

Parsing CSV file in React JS 2019-05-11

Sometimes, you may need to upload CSV file using React JS. I have written here a script that can upload and parse CSV file data!


Read More

Deleting DHIS2 Tracker Records using WEB API 2019-05-03

We can delete DHIS2 Tracked Entity Instances using postman as follows:




Read More

DHIS2 OAuth2.0 Authentication & Fetch Data 2019-05-01

In this post, I will show you how to access DHIS2 data using OAuth2. Let’s start:
DHIS2 supports the OAuth2 authentication protocol. OAuth2 is an open standard for authorization Read More

DHIS2 installation in Amazon Elastic Compute Cloud (AWS-EC2) Server 2018-12-27

Server specifications:


Read More
Read More

DHIS2 404-not found error 2018-11-29


Problem Statement: DHIS2 404-not found error: After running tomcat


Read More

DHIS2 user create using web api 2018-09-19

Sometimes, we face problem to create DHIS2 users using web api. In this post we will show you how to create users in DHIS2 using web api. See the below Read More

DHIS2 2.30 Failing to start & Java Heap Space Problem with Solution 2018-08-30


Problem Statement: HTTP Status 500 – Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space

Read More

DHIS2 custom form scripting example for Stock calculation 2018-08-02


In custom data entry form you can use JavaScript to create dynamic behavior and customizations. As an example, you can hide form sections based on Read More

DHIS2 Data Sets and Data Entry Forms

All data entry in DHIS2 is organized in data sets. A data set is a collection of data elements grouped together for data entry and data export between instances of Read More

DHIS2 core configuration and data management second round training materials 2018-07-17

The purpose of this second-round training is to further tailoring of skills for national data management team on DHIS2 customization and maintenance. This training will emphasize on DHIS2 aggregated and Read More

ডাটা (Data), বিগ ডাটা (Big Data) ও মেটা ডাটা (Meta Data) ? 2018-07-15

ধরুন আপনি ইলেকট্রনিক জাহাজে (Air Bus) করে বাংলাদেশ থেকে নরওয়ে তে যাচ্ছেন ডিএইচআইএস ২ র এক্সপার্ট একাডেমী তে জয়েন করার জন্য। একবার কি ভেবে দেখেছেন যে প্রতি সেকেন্ড এ বিমানে Read More

ইন্ডিকেটর কি?

এটি অনেকটা ডাটা এলিমেন্ট এর মত যা ডাটা এনালাইসিস এর জন্য ব্যবহার করা। এটি একটি calculated formula যা ডাটা এলিমেন্ট, ক্যাটেগরি অপশন, দ্রুবক বা কোন ফ্যাক্টর এর সমন্বয়ে তৈরি। যেমন, Read More

ক্যাটেগরি, ক্যাটেগরি অপশন কি এবং কেন ব্যবহার করবেন? 2018-06-25

একটি উদাহরণ এর মাধ্যমে বিষয়টি আলোচনা করা যাক। ধরুন কোন একটি এলাকায় কোন নিদিষ্ট সময় এর ম্যালেরিয়া রুগীর মোট সংখা কত তা দেখতে চান। সেক্ষেত্রে আপনি কি করবেন নিশ্চয় আপনি Read More

ডাটা এলিমেন্ট কি (What is data element) ?

ডিএইচআইএস ২ তে র-ডাটা ক্যাপচার করার মাধ্যম ই হল ডাটা এলিমেন্ট। ডেটা উপাদানগুলি কিভাবে সিস্টেমে রেকর্ড করা হয় ডাটা এলিমেন্ট সেটিই সংজ্ঞায়িত করে। যেমন ম্যালেরিয়ার ক্ষেত্রে মোট ম্যালেরিয়ার সংখ্যা কত Read More


Fatal error: Uncaught Error: Call to undefined function isperp_custom_pagination() in /var/www/dhis2trainingland.com/dhis2trainingland.com/eportal/wp-content/themes/tucana_educate/blog.php:121 Stack trace: #0 /var/www/dhis2trainingland.com/dhis2trainingland.com/eportal/wp-includes/template-loader.php(106): include() #1 /var/www/dhis2trainingland.com/dhis2trainingland.com/eportal/wp-blog-header.php(19): require_once('...') #2 /var/www/dhis2trainingland.com/dhis2trainingland.com/eportal/index.php(17): require('...') #3 {main} thrown in /var/www/dhis2trainingland.com/dhis2trainingland.com/eportal/wp-content/themes/tucana_educate/blog.php on line 121