teleren/devto huggingface dataset:
php: Optimise forloop with this tip
Tags: php, laravel, cakephp, tutorial
Published: 2022-07-28 08:11:00

This is not a long lists of whats and what-not-to-do when using the forloop syntax in php. It's just a tip I got from official php doc. Also this tip is not specific to php

For the following example, take note of the `count()` method: 

Sometimes, It's a common thing to many php developers to iterate through arrays like in the example below.

```php
<?php
$vehicles = array(
    array('name' => 'toyota', 'salt' => 856412),
    array('name' => 'ford', 'salt' => 215863)
);

for($i = 0; $i < count($vehicles); ++$i) {
    $people[$i]['salt'] = mt_rand(000000, 999999);
}
?>
```
According to [official php doc](https://www.php.net/manual/en/control-structures.for.php), the above code can be slow because it has to count `count($people);` the array size for every iteration but most of the time, the size is usually constant hence, you can optimise by using an intermediate variable to hold/store the size instead of repeatedly calling `count()`.. See example below: 

```php
<?php
$vehicles = array(
    array('name' => 'toyota', 'salt' => 856412),
    array('name' => 'ford', 'salt' => 215863)
);
$size = count($vehicles);
for($i = 0; $i < $size; ++$i) {
    $people[$i]['salt'] = mt_rand(000000, 999999);
}
?>
```

That's it!

Let me know what you think? 
[Cover Image credits](Photo by Mikhail Nilov: https://www.pexels.com/photo/a-man-pointing-at-the-monitor-7989025/)
Azure Devops for Automation Testers
Tags: selenium, azure, cypress, automation
Published: 2022-07-28 08:09:00

Hi All,
Sharing the list of videos to that will help you get started with Azure DevOps Services 
1)     Introduction to Azure DevOps
(https://lnkd.in/gDbVv8TT ) 
2)     How to create Azure DevOps Account
https://lnkd.in/gGq7z7hr
3)     Agile Project Planning and Project Management using Azure DevOps
https://lnkd.in/gGH-PExW
4)     Introduction to Azure Boards and Work Items
https://lnkd.in/gwZnNwEp
5)     Sprint Planning Using Azure Boards
https://lnkd.in/gDuJ4zBd
6)     Create Repository in Azure DevOps
https://lnkd.in/g3AvsNFU
7)     Clone Azure Repository
https://lnkd.in/gyfWTTBf
8)     Adding code to repository and pushing the repository to Azure DevOps
https://lnkd.in/gNzKCgm5
9)     Push existing code to Azure DevOps Repository
https://lnkd.in/guktbE8W
10)  Creating Pull Request
https://lnkd.in/gcijgwYE
11)  Run Selenium Tests in Azure DevOps Build Pipeline
https://lnkd.in/gViZXC4x
12)  Run Selenium Tests in Azure DevOps Release Pipeline
https://lnkd.in/gUWuPAbi
13)  Run Selenium Tests in Azure DevOps where source code is present in GitHub
https://lnkd.in/dKZHSiGW
14)  Run Cypress Tests in Azure DevOps where source code is present in GitHub
https://lnkd.in/dVRESh5v
#azure #devops #testautomation #sdet #seleniumautomation #cypress #github
Collections ( reject - Unique ) - Laravel
Tags: laravel, php, beginners, programming
Published: 2022-07-28 08:03:42

Today we will take an idea of two old collections  but very useful data in dealing with and filtering data and it will help you greatly in your next projects. We will quickly take some examples that will clarify the idea of their work.

- Collection With reject

Example 1
```php
$collection = collect([1, 2, 3, 4]);

$filtered = $collection->reject(function ($value, $key) {
    return $value > 2;
});

$filtered->all();

// [1, 2]
```
Example 2
```php

use Illuminate\Support\Collection;
use Illuminate\Support\Str;
 
// Create a new collection instance.
$collection = new Collection([
    'Alice', 'Anna', 'Bob', 'Bev'
]);
 
// Only keep names that begin with the letter 'a'.
$names = $collection->reject(function($item), {
    return !Str::startsWith(Str::lower($item), 'a');
});

/* 
object(Illuminate\Support\Collection)
  protected 'items' =>
    array
      0 => string 'Alice'
      1 => string 'Anna'
*/
```
Example 3 with `` map() ``
```php
$names = $users->reject(function ($user) {
            return $user->active === false;
         })->map(function ($user) {
            return $user->name;
         });
```

- Collection With Unique 

Example 1
```php
$data = [1,2,4,5,3,2,2,4,5,6,8,9]; 
$data  = collect($data)->unique();  
dd($data);

/*
Array
(
    [0] => 1
    [1] => 2
    [2] => 4
    [3] => 5
    [4] => 3
    [9] => 6
    [10] => 8
    [11] => 9
)
*/
```
Example 2
```php
$data = collect( [
            [
                [ "id" => 1, "name" => "Hardik"],
                [ "id" => 1, "name" => "Hardik"],
                [ "id" => 2, "name" => "Mahesh"],
                [ "id" => 3, "name" => "Rakesh"],
            ],
            [
                [ "id" => 1, "name" => "Hardik"],
                [ "id" => 3, "name" => "Kiran"],
            ]
        ] );
  
$data = $data->map(function ($array) {
       return collect($array)->unique('id')->all();
});   
dd($data);

/*
Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [name] => Hardik
                )
            [2] => Array
                (
                    [id] => 2
                    [name] => Mahesh
                )
            [3] => Array
                (
                    [id] => 3
                    [name] => Rakesh
                )
        )
    [1] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [name] => Hardik
                )
            [1] => Array
                (
                    [id] => 3
                    [name] => Kiran
                )
        )
)
*/
```

I hope you enjoyed the code and I wish you a happy code .
Today's Fun Joke For Developers - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-07-28 08:00:12

---
title: "Today's Fun Joke For Developers - Daily Developer Jokes"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259869e0aa.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ What kind of computer can hold a musical note?

___A:___ A Dell.
 -->
create variable data in button and share to another button
Published: 2022-07-28 07:34:04

I have one simple case to create variable in button html share into another button

```
<td style="width: 3rem">
              <button
                mat-icon-button
                type="button"
                [matMenuTriggerData]="{ data: data }"
                class="cell-action"
                [matMenuTriggerFor]="actionsMenu"
                (click)="id = data.id"
              >
                <mat-icon
                  style="font-size: 24px"
                  [icIcon]="icMoreHoriz"
                ></mat-icon>
              </button>
            </td>
```
see into `[matMenuTriggerData] = {data: data}`

```
  <ng-template let-data="data" matMenuContent>
    <button mat-menu-item [routerLink]="'./>
      <mat-icon [icIcon]="icPageView"></mat-icon>
      <span>Detail</span>
    </button>
    <!-- <button mat-menu-item (click)="dd(id)">
      <mat-icon [icIcon]="icArrowDownward">Canceled</mat-icon>
      <span>Unduh</span>
    </button> -->
    <!-- <button *ngIf="statusDelete"  mat-menu-item (click)="alertDialog(id)">
      <mat-icon [icIcon]="icDelete"></mat-icon>
      <span >Hapus</span>
    </button> -->
    <button *ngIf="data.status != 'Canceled'" mat-menu-item (click)="alertDialog(id)">
      <mat-icon [icIcon]="icDelete"></mat-icon>
      <span >Hapus</span>
    </button>
  </ng-template>
```
🔢 Show trello numbers on cards!
Published: 2022-07-28 07:32:00

**TL;DR**: The video was originally posted on [YouTube](https://youtu.be/G-nZXr_Gs6o), for a higher-quality version you can [watch it there](https://youtu.be/G-nZXr_Gs6o).

Add unique Trello card numbers to easily communicate with your team and write ids in commit messages.

Get the extension: https://chrome.google.com/webstore/detail/trello-card-numbers-plus/ncibjlmfhjcjnphnpphgphbflpdpliei

The software is Open Source if you want to contribute! You can find here the repo: https://github.com/Balastrong/trello-card-numbers-plus

**BONUS**: Since the video, the OS project moved forward and now you can select a different color for the numbers :D

[![Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wwvy8he62x7o3eyh9s06.jpeg)](https://youtu.be/G-nZXr_Gs6o)
Setup for New Machine
Published: 2022-07-28 07:30:00

Things to install when setting up a new machine.

## Windows

In PowerShell, you can quickly install software via scoop

```
irm get.scoop.sh | iex
scoop install git
scoop install 7zip
scoop bucket add extras
scoop install putty
scoop install nvm
scoop install vscode
```

Desktop apps
* Libreoffice
* DBeaver
My First Big Python Project - Text Adventure
Tags: python, beginners
Published: 2022-07-28 05:30:46

![Terminal Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2olonfxiaqk8yrkc012.png)
Hello World,

 This is my first posted project made in Python. This project is a Codecademy assignment. The project objectives are as follows:

1. Build a terminal program using Python

2. Add at least one interactive feature using input()

3. Use Git version control

4. Use the command line and file navigation

5. Write a technical blog post on the project

The program is a  short text-based adventure game. 
Where you start out in an empty room with one door that leads you to another room with choices to make that will lead to different endings.
The game has 12 endings, with secrets to uncover and decode.
I will be updating this program to have better and new endings.

This project was a fun learning experience for me, and I hope I can be a better programmer with projects like these.


[Link to replit](https://replit.com/@danishhilman1/Text-Adventure?v=1)
[Link to the git repository](https://github.com/danishhilman/text-adventure)
Project - 11: IndexedDB. Storing data in browsers
Tags: beginner2advanced, beginners, webdev, tutorial
Published: 2022-07-28 07:04:00

This is the eleventh project in the Beginner to Advanced Challenge (#beginner2advanced) where it’s expected to build a [simple database app](https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/First-DB-App.md). 

The database management system used for the mock project is IndexedDB, which is a database management system built into modern browsers.

This is the end product of the project built:

![first-db-app.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1658991034773/X9ZWAqrFC.gif)

## What is IndexedDB

IndexedDB is a database built into modern browsers and it’s more powerful than `LocalStorage`.

The IndexedDB API is event-based and may be complex for simple use cases. There are many use wrappers you can use to simplify your experiences.

- [idb](https://www.npmjs.com/package/idb): A tiny library that mostly mirrors the IndexedDB API, but with small improvements that make a big difference to usability.
- [localForage](https://localforage.github.io/localForage/): A Polyfill providing a simple name-value syntax for client-side data storage, which uses IndexedDB in the background, but falls back to WebSQL and then localStorage in browsers that don't support IndexedDB.
- [Dexie.js](https://dexie.org/): A wrapper for IndexedDB that allows much faster code development via nice, simple syntax.

I made use of the event-based IndexedDB API without a wrapper and was finally able to understand the concept of version change and upgrading. This [article](https://javascript.info/indexeddb#object-store) proved helpful in understanding IndexedDB.

You can find the code I wrote here: [https://github.com/zt4ff/app-ideas/tree/main/beginners/first-db-app](https://github.com/zt4ff/app-ideas/tree/main/beginners/first-db-app) which is a bit crude but I am open to your feedback and reviews. (Learn and help me learn).

You can support me by [buying me a coffee](https://www.buymeacoffee.com/kayode).
Install boostrap in Laravel 9 with Vite
Tags: laravel, php, vite, bootstrap
Published: 2022-07-28 06:36:00

As we as of latest version Laravel switched from webpack to Vite so I am going to mention how you can install bootstrap with Vite.
Instead of `webpack.mixin.js` now we see `vite.config.js`.Now you can see vite config file.
If we look at project directory from the top we can see `vite.config.js`
![topprojectdirectory](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4ua7fr7xklu7cvo0d1v.png)
 
![ViteConfigfile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dypdxku2gq0bi87r11n9.png)

So there are two ways to install ***Bootstrap***
The first simple way is via ***CDN***
If we go to `welcome.blade.php` we can just put in a CDN link and it will work exactly like you want. 
![welcomebladecdn](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lh9mkk4swv95onphojgo.png)

We include it like regular css and javascript.
Second is via NPM here we will take help of the ui package.
First type ***composer require laravel/ui***
Then ***php artisan ui bootstrap***
Now we see there is webpack.mixin.js we can delete it
![bootstrap](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/314u0g2wk0kt7eofxcg2.png)
We need to go to ***vite.config.js*** and write ![vitepathdefined]
![viteconfig](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xzpckhbfreof6f3qsuxc.png)
in ***bootstrap.js***
Here we need to import app.scss
![importappcsss](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yhnxmgcsie1zm4x3g147.png)
Then write `import * as bootstrap from bootstrap`
Then go to welcome.blade.php and write this as per documentation in head section of html
` @vite(['resources/css/app.css', 'resources/js/app.js'])`
![viteinawelcomeblade](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tj9g1hi8ybf6vmf5be8.png)
In CLI now run `npm install` and `npm run dev`
If we run we see the same output 
![outputofbootstrap](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/449en5umrg2ifgygxfk9.png)
Full Employee Management - Laravel Filament Tutorial
Tags: beginners, laravel, tutorial
Published: 2022-07-28 06:30:57

In this video, we are going to build a full employee management project with Laravel and Filament.
{% embed https://www.youtube.com/watch?v=gpjFP6RJMXA %}


Laravel 9 tutorial.
Laravel 9 full tutorial.
Laravel Filament tutorial.
Laravel Filament full tutorial.

Support me: 
https://www.patreon.com/Laraveller
Referral Hosting
Cloudways hosting: https://www.cloudways.com/en/?id=1107304
DigitalOqean $100 free: https://m.do.co/c/35b78d1e88a4

Follow me:
Twitter: https://twitter.com/Laravellercom
Facebook Page: https://www.facebook.com/1laravellercom
Instagram: https://www.instagram.com/laravellercom/
Github: https://github.com/laraveller
Website: https://laraveller.com/


Setup VS CODE for Laravel: https://youtu.be/EliywWn4IK4
Setup Mac for development: https://youtu.be/yxuR5myrVi4

Playlists:
React tutorial for beginners - https://bit.ly/3arkqjX
Laravel Filament Blog - https://bit.ly/3nWYv74
Laravel 9 Full Tutorial - https://bit.ly/3nTiyTR
Laravel 9 Media Library - https://bit.ly/3LpJmVr
Laravel Essentials Full Tutorial - https://bit.ly/3vplyuC
Laravel Mail Tutorial - https://bit.ly/37mJUNh 
Laravel Restaurant Reservation - https://bit.ly/3Jc5IcG
Spatie Laravel Permission - https://bit.ly/3pOsOhN
Laravel Testing For Beginners - https://bit.ly/3t1gNq4
Laravel Roles and Permissions - https://bit.ly/3gOhM7d
LARAVEL INERTIA MOVIE APP - https://bit.ly/3FVMp4Q
Laravel Livewire Movie App - https://bit.ly/3s8D6v1
Laravel Classified Website - https://bit.ly/3nsFRnb
Livewire Employees - https://bit.ly/2ZtIpZY
Laravel Employees Management - https://bit.ly/3Gglt14
Laravel admin panel - https://bit.ly/3CcX75M
image processing
Published: 2022-07-28 06:27:00

clear all; close all; clc

a=imread('football.jpg');
b=flipdim(a,2);
c=flipdim(a,1);
d=flipdim(c,2);

subplot(2,2,1)
imshow(a)

subplot(2,2,2)
imshow(b)

subplot(2,2,3)
imshow(c)

subplot(2,2,4)
imshow(d)
Webinar: “Accelerate Transformer Model Training with Hugging Face and Habana Labs”
Tags: nlp, deeplearning, tutorial, aws
Published: 2022-07-28 06:31:59

---
title: Webinar: “Accelerate Transformer Model Training with Hugging Face and Habana Labs”
published: true
date: 2022-07-28 06:09:12 UTC
tags: nlp,deeplearning,tutorial,aws
canonical_url: https://julsimon.medium.com/webinar-accelerate-transformer-model-training-with-hugging-face-and-habana-labs-45abd89fb204
---

Transformer models deliver state-of-the-art performance on a wide range of machine learning tasks, such as natural language processing, computer vision, speech, and more. However, training them at scale often requires a large amount of computing power, making the whole process unnecessarily long, complex, and costly. Join us for a live webinar to learn how the Hugging Face and Habana Labs joint solution makes it easier and quicker to train high-quality transformer models. Live demo included!

{% youtube efxbZth-LYs %}
Sudden permission problem in Ubuntu
Published: 2022-07-28 06:08:00

Hi,
I have Ubunto on Win 10.
(It's connect with wsl)
always- everything woeked well.
this morning I opened the Terminal and typed in the root `mkdir some` 
and got: **mkdir: cannot create directory ‘some’: Permission denied**.

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

and when I did `ls` I got only folders and files of installations whithout the folders and the files I created.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cswoum4aczjp7v5rfxp0.png)
 
If anyone knows what the problem is- Itll help me a lot
thanks
Principles, Definitions and Ideas behind offshore software development center.
Tags: productivity, career, principle, odc
Published: 2022-07-28 06:01:00

As the demand for software development increases worldwide, offshore software development centers are popping up and rising higher and higher in recent years.An offshore development center is a development company that provides you with software development services but is located in another country. It is deemed that this type of company is a subsidiary of your main company.

There are multiple benefits that ODC can bring. Here are some rationales behind it:

1.Expand the market to a foreign country: being in another country’s marketplace is a way to increase the sales volume, reputation, get closer to the customers, and understand their needs better. This is also a way to be physically present in the target market, at the same time reducing logistics costs. 

2.Large team with a different set of skills: if you want to set up a team of 50+ members, vendors can establish a separate office in which all your developers, PMs, QAs, and marketing specialists will work here for your employee branding.

For more information visit:https://megaincomestream.com/what-is-the-odc-offshore-software-development-center-model/
How do I use JSON formatter extension in Chrome?
Tags: javascript, tutorial, programming, python
Published: 2022-07-28 05:57:44


Chrome has a built-in JSON formatter extension that you can use to format and export your JSON data. To get started, open Chrome, click on the three lines in the top right corner of the browser window (gear icon), select "Tools", then click on "Extensions". In the Extensions list, find and install the JSON Formatter Extension. After installation is complete, you will see a new button named "JSON" next to File > Export.. Clicking this button will open up a dialog box where you can configure how your data will be formatted and exported.

## read also : **[How to Convert JSON to CSV with Python](https://professional-writer0.blogspot.com/2022/07/how-to-convert-json-to-csv-with-python.html)**

JSON formatter extension is an extension for Google Chrome that helps you to formatting the JSON data. It is available as an add-on in the Google Chrome web store and can be installed in just a few seconds. Once installed, the JSON formatter extension will be available in the extension bar located at the top of the browser.

## read also : **[vscode annotation autoclose](https://professional-writer0.blogspot.com/2022/07/vscode-annotation-autoclose-tool-to.html)**

Starting with the extension, you will first need to load the JSON data you want to format. Once the JSON data is loaded, you will be able to select the format you want to use for the data. Currently, the JSON formatter extension supports three formats - text, JSON, and Markdown. After selecting the format, you will be able to choose the level of formatting you want to use for the data. The available formats and levels of formatting are as follows:

- Text - The data will be formatted using basic text formatting options such as font, color, and size.
- JSON - The data will be formatted using the standard JSON formatting options.
- Markdown - The data will be formatted using the standard Markdown formatting options.

Once the data is formatted, you will be able to save the formatted data in either a text or JSON file. In addition, you will also be able to share the formatted data with other people.

JSON formatter extension is an essential tool for anyone who wants to format the JSON data in a professional manner. It is easy to use and provides a wide range of formatting options.
Print to console - console.log() and more
Tags: javascript, webdev, beginners, programming
Published: 2022-07-28 05:53:16

Logging or printing messages to the console is a very basic way to diagnose and troubleshoot minor issues or bugs in your code.

_In this article, I'll show you how to print to the console in JS, as well as all of the things you didn't know console could do._

- **To clear the console**
`console.clear();`
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7iy7vf5zwyqzguyd339e.png)

- **Print string, number or boolean values in console**
`console.log('Hi there');
console.log(10);
console.log(false);`
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fkr1try2tr76k5cufehl.png)

- **Print the value of a variable**
```
let say = 'Hello';
console.log(say);
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3x3w7m29ixplba9irlk.png)

- **Print an array to console**
```
let quote = ['Keep','it','simple'];
console.log(quote);
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00j1yvemfj2n06kvdop0.png)

- **Print an object to console using log and table method**
```
let person = {
  id:002,
  age:20,
  job:'tech'
}
console.log(person);
console.table(person);
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xzd2w9bx1t924fsr1acd.png)
The Hardest Problem in Computer Science: How do You Wait While Compiling?
Tags: watercooler, discuss, programming
Published: 2022-07-28 05:50:00

Your code is slow to compile, or your test suite to run, or the CI to become green.

The hardest question in computer science:

> How do you wait in front of a computer screen in the meantime?

[_obligatory xkcd_](https://xkcd.com/303)