teleren/devto huggingface dataset:
Tutorial Install Composer di Windows
Tags: tutorials
Published: 2022-11-19 17:09:28

---
title: Tutorial Install Composer di Windows
published: true
date: 2022-08-17 14:03:46 UTC
tags: Tutorials
canonical_url: 
---

 **Composer Windows -** Composer berfungsi untuk menghubungkan project aplikasi  dengan library dari packagist.org. Packagist merupakan situs yang menyimpan banyak library PHP yang bisa digunakan melalui Composer. Nah, pada artikel ini saya akan membagikan cara install composer di windows sebelum kita masuk ke tutorial yang fokus dalam menggunakan Laravel.

![Composer Installer](https://divisidev.com/storage/photos/1/composer/composer-installer.PNG)

Oke, silakan download composer installer di website resminya di [https://getcomposer.org/download/](https://getcomposer.org/download/). 

![lets get started to Install composer on windows](https://divisidev.com/storage/photos/1/composer/composer-1.png)

Jalankan installer di PC teman-teman.

 

![install composer](https://divisidev.com/storage/photos/1/composer/composer-2.png)

Pada screen yang pertama, terdapat opsi yang dapat kita pilih, apakah ingin menggunakan Developer mode atau tidak. Jika tidak menggunakan Developer mode seperti yang saya contohkan di atas, silakan bisa langsung saja melanjutkan langkah dengan klik **Next**.

![install composer](https://divisidev.com/storage/photos/1/composer/composer-3.png)

Kemudian, pilih path PHP yang ingin digunakan untuk composer ini nantinya. Selanjutnya klik Next.

![install composer](https://divisidev.com/storage/photos/1/composer/composer-4.png)

Next, ada ada opsi lagi apakah kita ingin menggunakan proxy server untuk akses ke internet atau tidak, jika tidak seperti yang saya contohkan di atas, bisa melanjutkannya dengan klik **Next**.

![step by step install composer](https://divisidev.com/storage/photos/1/composer/composer-5.png)

Oke selanjutnya masuk ke review screen. Pada langkah ini, screen akan menampilkan informasi dari apa yang telah kita pilih atau kita isi pada langkah sebelumnya. Jika ada yang perlu diperbaiki, silakan klik **Back** , namun jika semua dirasa sudah Oke, lanjutkan dengan klik **Install**.

![install composer](https://divisidev.com/storage/photos/1/composer/composer-6.png)

Selanjutnya, akan menampilkan screen seperti gambar di atas. Pada step ini, kita bisa langsung klik **Next**.

![install composer finish](https://divisidev.com/storage/photos/1/composer/composer-7.png)

Proses installasi bisa dikatakan selesai jika sudah menampilkan screen seperti gambar di atas. Silakan klik **Finish**.

```
composer -v
```

Untuk memeriksa apakah composer sudah benar-benar terinstall atau tidak, silakan jalankan perintah `composer -v`.

Demikianlah artikel tentang cara install composer secara global di windows kali ini. Semoga dari apa yang telah saya tulis di artikel ini dapat mudah dipahami dan dapat membantu teman-teman dalam melakukan install composer. See you 👋
Listing All AWS Lambda functions with Runtime end of support(across all regions)
Tags: shell, aws, lambda
Published: 2022-08-17 14:01:00

In the post, there is an AWS CLI / AWS CloudShell command that lists all  Lambda functions that have Runtime end of support.

**Script:**

```
runtimes=("dotnetcore3.1" "nodejs12.x" "dotnetcore2.1" "python3.6" "python2.7" "ruby2.5" "nodejs10.x" "nodejs8.10" "nodejs6.10" "nodejs4.3-edge" "nodejs4.3" "nodejs")
for region in `aws ec2 describe-regions --query "Regions[].RegionName" --region us-west-1 --output text`
do
    echo "[${region}]"
    for runtime in ${runtimes[@]}
    do
        aws lambda list-functions --region ${region} --output text --query "Functions[?Runtime=='${runtime}'].{ARN:FunctionArn, Runtime:Runtime}"
    done
done
```


**Usage AWS CLI**
```
export AWS_PROFILE=xxxx # Not necessary if you always set the default profile.
sh ListingLambdaEOS.sh
```

**Usage AWS CloudShell**
Just copy the Script and run in your CloudShell.

**Output**
```
[eu-north-1]
[ap-south-1]
[eu-west-3]
[eu-west-2]
[eu-west-1]
[ap-northeast-3]
[ap-northeast-2]
[ap-northeast-1]
arn:aws:lambda:ap-northeast-1:111111111111:function:bla   python2.7
arn:aws:lambda:ap-northeast-1:111111111111:function:blalba   python3.6
[ca-central-1]
[ap-east-1]
[ap-southeast-1]
[ap-southeast-2]
[eu-central-1]
[us-east-1]
arn:aws:lambda:us-east-1:111111111111:function:testx node12
[us-east-2]
[us-west-1]
[us-west-2]
arn:aws:lambda:us-west-2:111111111111:function:testz rubi
```

**Reference**
[Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)
[AWS Command Line Interface](https://aws.amazon.com/cli/)
Django Creating New Project Cheat Sheet
Published: 2022-08-17 13:42:00

Part of Django 3.2 docs:
[Optimizing PostgreSQL’s configuration](https://docs.djangoproject.com/en/3.2/ref/databases/#optimizing-postgresql-s-configuration)

Django needs the following parameters for its database connections:

    client_encoding: 'UTF8',
    default_transaction_isolation: 'read committed' by default, or the value set in the connection options (see below),

    timezone:
            when USE_TZ is True, 'UTC' by default, or the TIME_ZONE value set for the connection,
            when USE_TZ is False, the value of the global TIME_ZONE setting.

If these parameters already have the correct values, Django won’t set them for every new connection, which improves performance slightly. You can configure them directly in postgresql.conf or more conveniently per database user with ALTER ROLE.

Django will work just fine without this optimization, but each new connection will do some additional queries to set these parameters.
Why I always prefer Python for machine learning.
Published: 2022-08-17 13:39:00

Python has been there for so long, to this date, it is always ranked among the top giants in tech tools. I don't think it will ever fade. I've used Python for a couple of years and am still exploring other different languages and every single of them has its own potential.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xep1fiqgak5kuy4lczo0.jpg)


🤔**So why would I always prefer Python for ML?**

 Trust me, when it comes to Machine Learning, there is no doubt that most Machine Learning engineers use Python. Without considering how much python is simple to learn just like most people say, I think any language can be simple and easier to learn depending on the developer and his/her own background. 

Personally, among all other benefits that come with using Python, I'm always fascinated by how much python makes it very simple to integrate our projects with other existing systems of different programming languages. This means that, it's even easier to blend your model or other programs into other existing AI projects😃

How about you?😀
What do you love most about Python in your own experience?
Which tool do you prefer the most for a specific task in Machine Learning?
How to Easily Remove Objects From Photos?
Tags: api, webdev, news, ai
Published: 2022-08-17 13:28:00

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/soxooe3etk8kr0q2lpj2.png)
[Removing unwanted objects](https://www.ailabtools.com/image-erasure) and texts from an image to remove clutter from your photos used to require specialized equipment and knowledge, but nowadays, AI has resulted in tools like Content-Aware fill in Photoshop that lets anyone accomplish this task with only a couple of clicks. If you don't have a Photoshop subscription, there's a Web and mobile application named AILabTools Image Erasure you can use.

In photography, it's important to strike a delicate balance between elements you want to incorporate into your photograph and those you'd prefer to eliminate. Enhancing your photography expertise requires paying careful attention to this balance. However, it's often difficult to create the perfect composition. There are always inexplicably artifacts like background objects or people, which distract from the photograph's principal purpose. There are, fortunately, powerful tools like [AILabTools Image Erasure](https://www.ailabtools.com/image-erasure) that can help with post-processing these images.

**Not only does it support online use, it also supports APIs and is developer friendly.**



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cozvvfxqvj9eb4r609yx.png)
Angular - Webpage redirect to homepage when opening external URL
Tags: angular
Published: 2022-08-17 13:12:00

Whenever I open an external URL from my webpage, this webpage redirect to homepage. The external URL gets open in new tab but the webpage from which I am opening the external URL it redirect to homepage. I don't know why this is happening I tried all the possible but couldn't get rid of it.

```
xyz.html

<a (click)="goToLink('https://www.example.com/abc')">page link</a>

xyz.ts

goToLink(url: string) {
  window.open(url, "_blank");
}
```
FlutterFlow - Hackathon!
Tags: flutter, gamedev, programming, dart
Published: 2022-08-17 13:07:27

We're hosting a Hackathon to see who can build the best game in FlutterFlow. Build any game you like (word, number, music, trivia) - it's totally up to you ✨

The Games Hackathon kicks off today, with submissions due by September 5th. Click here to learn more and sign up 👇

[Hackathon!](https://flutterflow.io/hackathon-2022)
What Does "!" Symbol Mean in Typescript?
Tags: typescript, tutorial, react
Published: 2022-08-17 13:06:05

In this short guide, I will introduce you to the Definite Assignment Assertion feature in typescript and demonstrate to you an interesting use case to implement this feature.

#### Prerequisites 
This guide assumes you have basic knowledge of [Typescript](https://www.typescriptlang.org/), you have a basic understanding of the [Stripe API](https://stripe.com/docs/api), and you have installed the [Typescript error translator](https://marketplace.visualstudio.com/items?itemName=mattpocock.ts-error-translator) extension.
<br/>

#### The Problem
When working with the Stripe API in one of my Next.js & Typescript projects, I came across an error where typescript didn't recognize my environment variable as a string. It later displayed the error message below.
![environment variables returns an error in typescript environment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ficlszeo6qc4cs2yr3ag.png)
<br/>
#### The Solution
The solution in this case is to use the "!" symbol which is a feature in Typescript known as the definite assignment assertion. 

As defined in the official [Typescript Documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#definite-assignment-assertions), the definite assignment assertion feature is used to tell the compiler that the variable assigned is indeed valid for all intents and purposes, even if Typescript's analyses cannot detect so. 

The "!" symbol is used and is declared after an instance property and/or variable declarations.
![environment variables error fixed with ! symbol (definite assignment assertion)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qn1oxs2mc00s4mo1q2gb.png)

With the definite assignment assertion, we can assert that indeed in this case we have environment variables (`process.env.STRIPE_SECRET_KEY`) in string format and there is nothing to worry about.

This workaround still leaves us with weaker type safety since any misconfiguration (in our case the environment variables) could lead to errors that cannot be caught at compile time. These errors can only be caught at runtime which beats the logic of having a strict and functional type checking system. With this in mind it's your responsibility to ensure correctness.

It's also good to note that previous Typescript versions used the "!" symbol as a non-null assertion operator. You can read more about this in the [Typescript Documentation about Non-null assertion operator](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator).

Thank you for reading this far and happy coding!
Running next.js in cluster mode (dead simple)
Tags: javascript, nextjs, tutorial, webdev
Published: 2022-08-17 13:06:00

Honestly, I feel like an idiot - I've been maintaining Next.js apps last few years, and thought Next.js is automatically running clustered in production.

Moreover, I did not find any nice solutions for running Next.js clusterized - everything is over-complicated with ton of code.

Well, turned out (at least for Next 12) it is really simple - and Google did not give me any nice answer, so I had to research on it by myself today.

So, here's the solution - mostly simply based on node `cluster` docs:

```javascript
const cluster = require('node:cluster');
const process = require('node:process');
const { cpus } = require('node:os');

const numCPUs = cpus().length;

if (cluster.isPrimary) {
  console.log(`Primary ${process.pid} is running`);
  // all the magic goes here. 
  // `setupPrimary` is altering cluster behaviour
  // see docs: https://nodejs.org/api/cluster.html#clustersetupprimarysettings
  cluster.setupPrimary({
    // node_modules/.bin is directory for all runtime scripts,
    // including `next`.
    // we can work with it like with a common node package,
    // so require.resolve simply gives us path for `next` CLI 
    exec: require.resolve('.bin/next'),
    // args should skip first 2 arguments, 
    // "node" path and file to execute path
    args: ['start', ...process.argv.slice(2)],
    // just directly passing all the IO to not handle pipes
    stdio: 'inherit',
    // making stdout and stderr colored
    shell: true,
  });

  for (let i = 0; i < numCPUs; i++) {
    cluster.fork();
  }

  cluster.on('exit', (worker, code, signal) => {
    console.log(`worker ${worker.process.pid} died`, { code, signal });
  });
}

// we do not need to do "else" here as cluster will run different file
```
Customer Upload Files for WooCommerce
Tags: woocommerce, upload, files, plugins
Published: 2022-08-17 13:03:00

WooCommerce upload file enables your customers to quickly upload a file as an attachment to their orders to communicate their requirements more effectively.

Key features of Customer Upload files are:

1. Add file upload button to the product, cart, or checkout page.
2. Create multiple rules to manage the file upload option.
3. Customers can preview or delete files.
4. Allow single or multiple file uploads.
5. Determine specific file type and size for uploads.
6. Set a price to charge customers for file uploads.
7. Restrict rule by products, categories, user roles.
8. Admin can approve / disapprove file
9. Email Notification to customer on file approve or disapprove
10. Customize upload file button (text, color etc)
11. Download file option for admin & customer
12. Option to allow customer to attach a note with each file upload
Make your self-signed certificate trusted by Chrome (and Firefox)
Published: 2022-08-17 12:56:59

These instructions are for Windows and works for me™ in Chrome.

#### Create a self-signed certificate with a DnsName

Create a new certificate with powershell 

`New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:\LocalMachine\My`

The DnsName is important and if you use a custom domain via a host file you should add the domain you use there.

#### Make sure you use this certificate on your localhost

![Picture of setting your certificate for your host in IIS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/coe21k2dxm5itihlme28.png)

#### Export the certificate from Chrome

1. Go to your localhost website and open up the inspector
2. Under the security tab, click the "View Certificate" button.
3. Go to the details tab in the dialog and click "Copy to file"
4. Follow the wizard and choose the Cryptographic Message Syntax Standard - PKCS #7 (i do not think the "Include all checkbox" is important)
5. Save it somewhere.

#### Import the certificate to the "Trusted Root Certification Authorites"

1.  Go to Chrome Settings
2.  Click advanced at the bottom
3.  Click the Manage Certificates link to open the certificate dialog
4.  Click import
5.  Follow the wizard and pick your exorted certificate file
6.  Click browse and choose "Trusted Root Certification Authorites"
7.  Done!

After this you should restart Chrome and you should not get any warnings.

All this information was collected at various places in this Stack Overflow question: <https://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate>

### Bonus - Make it work in Firefox as well

Apparently Firefox doesn't use the global windows store for certificates. But it's easy to fix.

-   In Firefox, type 'about:config' in the address bar
-   If prompted, accept any warnings
-   Right-click to create a new boolean value, and enter 'security.enterprise_roots.enabled' as the Name
-   Set the value to 'true'

Credits to [this post](https://support.umbrella.com/hc/en-us/articles/115000669728-Configuring-Firefox-to-use-the-Windows-Certificate-Store) for this info.
i18n management made easy
Tags: typescript, localization, javascript
Published: 2022-08-17 12:47:10

"How do we handle the localization? Do we have a repo, do we use any service? Do I need to contact someone?"

"We have a json which we edit"

Did this ever happen to you? If it did, I may have the solution for you!

I've recently stumbled upon the classical "we kinda have localization but we kinda don't" issue and I've decided to make a micro-library so that -at least- we can collaborate on Google Sheets. [Give it a look!](https://github.com/Tails128/loca-mapper)

It's very simple to use (if you think it's not please give me a feedback and I'll do my best to make it more intuitive!) and it basically just requires your API keys or your service account in case you're working within a company.

**Configuring the Google Sheets doc**
Pretty straightforward:

**first row:**
- The first cell is 'locaKeys', which will just hold the translation keys
- The other cells contain the localization name (en-uk, de-de, etc...)

**other rows:**
- the first cell contains the key for the translation: univoque and i suggest no spaces and all uppercase, to make it easy to spot if there's somthing wrong with the translations.
- the other cells contain the value for the corresponding language

here's an example:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6yjdmn2tndybk20n8xte.PNG)

Use it freely via: ```npm i -D loca-mapper```
Order on WhatsApp for WooCommerce
Tags: woocommerce, order, whatsapp, plugin
Published: 2022-08-17 12:43:40

WooCommerce order on WhatsApp customers to place order through WhatsApp for your products. Boost your store conversions by enabling your customers to place orders or share products on WhatsApp.
Key Features of WooCommerce Order on WhatsApp is

1. Take orders directly from your WhatsApp account
2. Displays checkout form in a popup on shop and product page
3. Allow customers to share your products on WhatsApp
4. Option to enable WhatsApp order button only for customers
5. Option to create orders at admin side
6. Choose default status for orders from the admin side
7. Display the WhatsApp order and share button on the shop, product, and cart page
8. Apply the facility to specific products, categories, or all products
9. Customize order on WhatsApp and Share button
10. Prefilled messages for WhatsApp orders
11. Supports variable products
12. Enable the WhatsApp option on the checkout page
13. Option to hide Add to cart button on product & shop page
14. Option to hide WhatsApp button on desktop
15. Email notifications for WhatsApp order
Need Statistics Homework Help
Tags: statisticshomeworkhelp, onlinehomeworkhelp, education, homework
Published: 2022-08-17 12:39:48


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hegeht2u4ckjpd7ax8ip.PNG)When you come across a challenging homework topic the first thing you want to do is find a homework writer who will write the paper on your behalf however when you look for homework help services online you realize that they are not the cheapest option out there not every student can afford to spend hundreds of dollars just for one homework in such cases you have the option of using online homework to improve your paper where you can get the cheapest and best [Statistics homework help](https://www.statisticshomeworkhelper.com/) in this article you will find commonly used online [SAS homework help](https://www.statisticshomeworkhelper.com/sas-assignment-help/) around the world and their most important benefits.
My note on JS Timezone, Firebase Cloud Functions and Luxon
Tags: firebase, javascript, luxon, datetime
Published: 2022-08-17 12:32:00



- **Cloud Functions:** No matter what your defined region in cloud functions, the default timezone is UTC.
- Firebase Console shows date time based on your device region setting.
- Default Luxon .setZone (keepLocalTime: false) doesn't change the underlying timestamp

```javascript
process.env.TZ = 'UTC';
const startDay = {
		seconds: 1660738904,
	};
const d1 = DateTime.fromSeconds(startDay.seconds);
const d2 = DateTime.fromSeconds(startDay.seconds)
		.startOf('day');
const d3 = DateTime.fromSeconds(startDay.seconds)
		.setZone('UTC')
		.startOf('day');
const d4 = DateTime.fromSeconds(startDay.seconds)
		.setZone('Asia/Bangkok')
		.startOf('day');

console.log(d1.toString()); // 2022-08-17T12:21:44.000+00:00
console.log(d2.toString()); // 2022-08-17T00:00:00.000+00:00
console.log(d3.toString()); // 2022-08-17T00:00:00.000Z
console.log(d4.toString()); // 2022-08-17T00:00:00.000+07:00
```

From the example above, I used the default setZone to set different timezones from the same timestamp and monitor the result. On the first line, I set the console timezone to UTC to match with what has been configured on Cloud Functions.

`d4` after setZone to Bangkok and set time to start of day, so it will set the time to 00:00:00 GMT+7 (it's 17:00:00 GMT+0)

The computation after setZone will respect the timezone that we set 
- startOf('day') will be start of the day based on Bangkok timezone
- .toString() will print the time based on Bangkok timezone

Similar to `d3` that the computation after setZone will respect the timezone as UTC.


However, if we use `setZone('Asia/Bangkok', { keepLocalTime: true})`. It will change the underlying timestamp.

```javascript
process.env.TZ = 'UTC';
const startDay = {
	seconds: 1660738904,
};
	console.log(DateTime.fromSeconds(startDay.seconds).toSeconds());
// 1660738904


console.log(
	DateTime.fromSeconds(startDay.seconds)
		.setZone('Asia/Bangkok')
		.toSeconds()
);
// 1660738904


console.log(
	DateTime.fromSeconds(startDay.seconds)
		.setZone('Asia/Bangkok', { keepLocalTime: true })
		.toSeconds()
);
// 1660713704
```

From the above example, the first and second give the same timestamp. But for the third, it changes the timestamp to reflect the same time with different timezone.

```javascript
process.env.TZ = 'UTC';
const startDay = {
	seconds: 1660738904,
};
	console.log(DateTime.fromSeconds(startDay.seconds).toString());
// 2022-08-17T12:21:44.000+00:00

console.log(
	DateTime.fromSeconds(startDay.seconds)
		.setZone('Asia/Bangkok')
		.toString()
);
// 2022-08-17T19:21:44.000+07:00

console.log(
	DateTime.fromSeconds(startDay.seconds)
		.setZone('Asia/Bangkok', { keepLocalTime: true })
		.toString()
);
// 2022-08-17T12:21:44.000+07:00 --> try to keep the time 12:21:44 with timezone to GMT+7
```