teleren/devto huggingface dataset:
Thoughts from a Junior Developer on their first pair-programming session
Tags: juniordev, pairprogramming
Published: 2020-11-22 12:48:02

In August of 2020, I joined the Centre of Computational Law (CCLaw) in SMU as an Assistant Research Engineer (essentially a junior developer). I've had the opportunity to pick up several skills in my time here thus far, and have also been exposed to several ways of working that are specific to devs, one of them being pair-programming. 

Pair-programming as a method of work was very foreign to me. In my "coding life" thus far, I've always worked on problems alone. The only time another pair of eyes would see what I've written was when there was an error or problem I couldn't put my finger on. As such, Coding was a meditative exercise of sorts, where I would drown out everything from the world around me, and focus solely on the problem at hand. I believe some would call this the "flow state". 



### My first pair-programming session

For the session, I was paired up with my reporting officer, someone who has had decades of experience. The problem we were going to tackle was the Gilded Rose Kata. I've never done a kata before, and with two about-to-be-firsts, safe to say I went into the session feeling very unsure of what was going to happen. I was worried that I'd end up stumbling and tripping over my tongue, trying to express/describe my thought process to someone else. 

### How it went

The session was actually very enlightening for me. Even though I read up as much as I can about the Gilded Rose Kata, when it was time to actually start, I didn't know where to begin. Given a guiding nudge from my pair partner, we started listing all the various possible cases/categories that could take place. It was extremely helpful to have someone else think of edge-cases while I wrote down what the general cases could be. This accelerated the amount of time needed to get the maximal theoretical coverage, even before any proper code has been written.

When we started on writing the solution, we went with a driver-navigator approach, and I spent most of my time driving (i.e. writing the code) while my pair partner pointed out possible issues, caught my mistakes, and also suggested improvements. 

After we had a simple working solution, we proceeded to look at solutions for the Gilded Rose written by others, and had a short discussion about how and what they were doing. It was a great opportunity to pick the brain of a senior dev, and I definitely walked away learning quite a bit.

### Final Thoughts

While the idea of it was slightly distressing, I actually learnt a lot from the pair programming session. I would definitely recommend that people who are junior-devs like me, reach out to their senior colleagues and work on a Kata or two together!
Creating base docker image for hosting your Java 8 application
Tags: java, springboot, docker
Published: 2020-11-22 12:25:34

Creating clean image is very important from trusted sources. This article demonstrates how you can create a docker image for hosting your Java 8 application using Alpine Linux distro.

### Dockerfile for Java8

```
FROM alpine

RUN apk update && \
    apk upgrade 
RUN apk add openjdk8=8.252.09-r0

ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
EXPOSE 8080
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
```

The above Dockerfile creates image for hosting Java8 application using alpine distro. Lets go through each instruction one by one,

**FROM alpine** - 
FROM instruction gets the baseimage for your application which in this case is alpine. You can also specify tags if you want a specific image of alpine e.g. alpine:3.9.

**RUN apk update && apk upgrade**
Runs update and upgrade instructions to update the sources and install any upgrade available.

**RUN apk add openjdk8=8.252.09-r0**
Installs specific version of JDK 8 on alpine.

**ARG JAR_FILE=build/libs/*.jar**
Argument for getting all jar files

**COPY ${JAR_FILE} app.jar**
Copy the jar file in the docker image

**EXPOSE 8080**
Exposes port 8080 on the docker image, if your application should be accessible on this port. (This is only applicable if your application should be accessible on certain port e.g. REST API)

**ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]**

This instruction is responsible for running your application. So that's how you can create a lightweight clean image for your Java8 application. We have not touched on the safety aspect of this image, we will see how to secure this image in our next article.

Happy coding!
I'm delivering a tech talk. Any suggestions?  🤷‍♀️💡
Tags: watercooler, discuss
Published: 2020-11-22 12:01:46

Hi devs 👋

I'm delivering a tech talk next weekend at [DevMela](https://devmela.web.app/) (*Mela* means *Fest* in Hindi). It's my first tech talk ever. And it's online.

Do you have any suggestions for me? What to do? What definitely not to do? And more...

Even if you've never yourself spoken at an event, can you think of what you would expect from a speaker? What are some things that speakers do, which end up boring you? Everything will help me!

Leave 'em all in the comments below 👇

PS: I'm speaking on 28th Nov about *Cloud Computing* and on 29th Nov about *Emerging as a Leader*, do attend my session if you wish to 💕
The joy of diagramming
Tags: 100daystooffload
Published: 2020-11-22 11:52:05

The past few days have been a bit frustrating for me. There was a touch of uncertainty about work and the annoying inaction that that caused in my daily activity. This was all swept away after I had the opportunity to get stuck into some of my favourite work: diagramming.

Generally I am quite a visual thinker. Although I love writing and the craft of carefully constructing a sentence to communicate exactly the right message and nothing more, when it comes to formulating ideas and a plan of action, I work in diagrams.

I use diagrams to break down a complex idea or design an approach to solve a problem. I use diagrams to structure my thoughts and communicate them. And I use diagrams as a way to learn about what I'm trying to do (I primarily use [yED](https://www.yworks.com/products/yed), the free graph editor from [yWorks](https://www.yworks.com)).

This week, after its sluggish start and lack of direction, I had an idea about an approach to take for a particular task. I started looking at a large diagram that forms the basis to most of our work (you could think of it a bit like a tree diagram that breaks down the ultimate goal into a hierarchy of sub-goals). My original intention was to "read" the diagram as part of a mind-mapping a new plan. But then I realised that I could extend the diagram in a way that would both solve my particular problem but be easier to explain to those people I needed to share it with.

Not only was the use of the diagram a good starting point for me, as I began to work with it, I found that it drove some of my thoughts; rather than simply being a space for me to work, it actively helped to structure my work.

I realise that this post is quite abstract and lacks any useful illustration, but unfortunately that's the nature of this particular work. However, the point I'm really aiming for is to encourage you to _think about the ways you work best_, and to try to incorporate those more into your work. For me, having a diagramming tool at my fingertips provides me with inspiration, motivation and a place to work that's better than the alternative of writing an email or a note to myself. It may well be different for you depending on how you work, but I do think it's worth a bit of time to think about this so that you have the opportunity to not only be effective, but to enjoy it too.

_I'm publishing this as part of 100 Days to Offload. You can join in yourself by visiting [https://100daystooffload.com.](https://100daystooffload.com)_

Photo by [Vojtech Bruzek](https://unsplash.com/@vojtechbruzek?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/flowchart?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText).
How to get free SVG Icons for your projects?
Tags: svg, css, html, ux
Published: 2020-11-22 11:38:23

We always find problems searching for Icons that we can use in our projects such as desktop, mobile or web Apps.

From the biggest problems that there's a lot of resources we can get Icons from, so this causes a problem for all of us as these Icons are not all similar so to solve this problem I always advise that when you download Icons for your project download them from the same place.

In this article, I will give some resources for thousands of Icons to use whether you are a designer or a developer.

---

<br/>

![material design icons](https://cdn.hashnode.com/res/hashnode/image/upload/v1655475536827/hZ09KERit.png)

[Material Design Icons](https://materialdesignicons.com)

Material Design Icons' growing icon collection allows designers and developers targeting various platforms to download icons in the format, color and size they need for any project. This is what I prefer the most as you can download the icon after giving it the size and color you want and if you are a developer you can there [package](https://www.npmjs.com/package/mdi) or you can use the cdn.

---

![nucleo](https://cdn.hashnode.com/res/hashnode/image/upload/v1655475538595/eU8V7e_DG.png)

[Nucleo](https://www.nucleoapp.com/)

You can download their Desktop App for MacOs and windows.

You can use more than 30231 free Icons and there are also unfree Icons that you can't use so if you want to use those free Icons you have to pay one time then you will be able to download all the paid icons .

---

![feather icons](https://cdn.hashnode.com/res/hashnode/image/upload/v1655475539991/Qtz-3pCMO.png)

[Feather Icons](https://feathericons.com/)

You can download all of its Icons by one click and they will be distributed in structured folders and you can choose the color and the size of each icon before downloading it.
If you are a designer and you design on figma, they have a figma extension so you can directly download the icons into your project.

---

![icons8](https://cdn.hashnode.com/res/hashnode/image/upload/v1655475541983/xO4Vks0mi.png)

[Icons8](http://icons8.com/)

This website has a lot of services but we'll stick to the icons, they have about 139,430 icons you can download the icon as PNG or SVG.

---

![heroicons](https://cdn.hashnode.com/res/hashnode/image/upload/v1655475543473/VjzvSpXJ4.jpeg)

[Heroicons](https://heroicons.dev)

Heroicons is a set of free SVG icons by the makers of Tailwind CSS that come in two different sizes, and are pre-optimized to be styled with CSS classes directly in your HTML. I would recommend using it in simple projects.

---

[**Subscribe to my newsletter**](https://amrelmohamady.hashnode.dev/)

Twitter: [@Amr__Elmohamady](https://mobile.twitter.com/Amr__Elmohamady)
Starting with ZERO!
Tags: discuss, techtalks, productivity
Published: 2020-11-22 11:18:09

Have you ever submitted a talk proposal to any conference on the topic you knew little about, or any project you hadn't really started, or an incomplete idea?

Let me know how was your experience in the comment section 👋🏻

Were you selected or not? How did the talk went? or any other experience? 🤗
AWS Project: Deploying a Static Website to AWS
Tags: devops, aws, cloud, sre
Published: 2020-11-22 11:12:24

My first project for my AWS Cloud Engineer Nanodegree at Udacity was to learn how to Deploy a Static Website to AWS.

The first thing I had to do was to create an s3 Bucket
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/b9zsgefblhwkij1gyfn4.png)



The second thing was to upload files to the S3 Bucket that you have created

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wfrknyud4phi87590yn0.png)



Next is to Secure the bucket via Identity and Access Management (IAM)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4l8jl9vss2habwgg2wk2.png)



 I had to configure the s3 bucket
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9jt40bhdnnieomhybyqf.png)


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6picsm2kktltwi6vb4px.png)

Then I had to learn how to distribute the website via CloudFront


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zz2uxhab0azasy69m071.png)


Topics Covered:
S3 bucket creation
S3 bucket configuration
Website distribution via CloudFront
Access website via web browser
Basic regular expression in different languages
Tags: regex, regularexpression
Published: 2020-11-22 10:46:31

This blog entry is to remind myself how to use regular expression for different languages.

Java
```java
Pattern pattern = Pattern.compile("Hello, (.+)");
Matcher matcher = pattern.matcher("Hello, Franz");
if (matcher.matches()) {
  System.out.println(matcher.group(0)); // This will print "Hello, Franz"
  System.out.println(matcher.group(1)); // This will print "Franz"
}
```

Rust
```rust
let str = "Hello, Franz";
let re = Regex::new("Hello, (.+)").unwrap();
match re.captures(str) {
    Some(caps) => {
        println!("{}", &caps[0]); // This will print "Hello, Franz"
        println!("{}", &caps[1]); // This will print "Franz"
    },
    None => (),
}
```

Python
```python
pattern = re.compile("Hello, (.+)")
matcher = pattern.search("Hello, Franz")
if matcher is not None:
  print(matcher.group(0)) # This will print "Hello, Franz"
  print(matcher.group(1)) # This will print "Franz"
```

Javascript
```javascript
const str = 'Hello, Franz';

// Regular expression is compiled when script is loaded
const pattern1 = /Hello, (.+)/;

// Regular expression is compiled when script is executed
const pattern2 = new RegExp('Hello, (.+)');

// match() returns all matches while exec() returns first match
const matches1 = str.match(pattern1);
if (matches1) {
  console.log(matches1[0]); // This will print "Hello, Franz"
  console.log(matches1[1]); // This will print "Franz"
}
```

grep
```bash
#!/bin/bash

echo "12345678 is my phone number" | grep -oE "[[:digit:]]+" # This will print "12345678"

# GNU grep has -P option
echo "12345678 is my phone number" | grep -oP "\d+" # This will print "12345678"
```

sed
```bash
#!/bin/bash

# -n to prevent printing result twice
# -E to use extended regular expressions
echo 'Hello, Franz' | sed -nE 's/Hello, (.+)/\1/p' # This will print "Franz"
```

gawk
```bash
#!/bin/bash

# $0 is the original string without field splitting
echo 'Hello, Franz' | gawk 'match($0, /Hello, (.+)/, groups) { print groups[1] }' # This will print "Franz"
```
Installation of Mysql in Docker (Ubuntu 18.04)
Tags: mysql, docker, ubuntu, devops
Published: 2020-11-22 10:18:40

######Info: This post is one of the articles in context of this post: [Huawei Cloud ECS server notes](https://dev.to/jemaloq/huawei-cloud-ecs-server-notes-1gnj)

Just now, I installed **MySql** on my cloud server using **Docker**.

1) Create launcher file and mapping folders:
```bash
cd ~/launchers
touch mysql_docker_22345.sh
cd ~/docker
mkdir mysql_22345
```
2) Launch **Mysql** container using cmd line with initial password for *root* user (this will take some time because docker needs to pull the image from its server):

```bash
docker run --name mysql_docker_22345 -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306  -v /home/jemaloQ/docker/mysql_22345/mysql_conf/:/etc/mysql/  -v /home/jemaloQ/docker/mysql_22345/data:/var/lib/mysql -d mysql:5.7
```

3) Check if **MySql** container is working correctly:
```
docker ps -a | grep mysql
```

4) If container is running, then we need to change the password config. We enter the inside of the container and login **MySql** as root:
```
docker exec -it mysql_docker_22345 mysql -u root -p

```
then type the initial password and type enter.

5) Once we enter successfully **MySql** console inside the container, we change the password:

```bash
set password for 'root'=password('jemaloQ*#!');
```
if everything goes Ok, it shall yields output like:
```
Query OK, 0 rows affected, 1 warning (0.00 sec)
```
6) Now we copy the following script into our launch file:
```bash
docker rm -f mysql_docker_22345
docker run -it -d \
 --name mysql_docker_22345 \
 -p 22345:3306 \
 -v /home/jemaloQ/docker/mysql_22345/mysql_conf/:/etc/mysql/ \
 -v /home/jemaloQ/docker/mysql_22345/data:/var/lib/mysql \
 mysql:5.7
```
7) Re-launch our Mysql service in container:
```bash
sh ~/launchers/mysql_docker_22345.sh
```
8) Re-check if Mysql container is working correctly
```
docker ps -a | grep mysql
```

Now try connecting it from Heidi:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/m8k77xqmm7h75n2tf3u6.png)

Enjoy!
Top coding questions asked by Amazon 
Tags: amazon, codenewbie, beginners, devops
Published: 2020-11-22 09:49:26

If you want to crack the coding interview of Amazon, or looking for the perfect list to prepare for it. You are at right place buddy, I have been practicing from this and is very effective. 

That's why I am sharing it with everyone of you. Check it at below link - 

https://geeks-terrace.blogspot.com/2020/11/list-of-most-asked-questions-by-amazon.html
I'm working to kickstart a campaign for Developers to try our cloud platform. Which one works best IYO?
Tags: help, devops, cloudnative, kubernetes
Published: 2020-11-22 09:23:02

1	Managed Kubernetes - on a city level- anywhere		
2	Run your application in more than 90 locations 
        worldwide

3	We built the first CDN and now we're building the most 
        distributed cloud platform

4	Keep your application data where your application is- 
        anywhere


We are building a distributed cloud platform that spans more than 90 locations today with the goal to grow to a few hundred in the next year. We offer managed Kubernetes, containers, and storage but more services will join soon. Thanks, for your help
Easier way to fetch data with React using ReactQuery
Tags: react
Published: 2020-11-22 08:05:27

This time i will not say that fetching data in React is overcomplicated.

I read this article [How and Why You Should Use React Query](https://blog.bitsrc.io/how-to-start-using-react-query-4869e3d5680d),
and I must say he conviced me :-)

You can test it here [ReactQuery](https://flems.io/#0=N4IgtglgJlA2CmIBcBWADAOhQFgDQgGcBjAJwHtZZkBtNXNAXXwDMIECbQA7AQzESQgMACwAuYKviJkuo+LOQgAPFAgA3AATQAvAB0QPAA6H9APiUB6VWtO6uK9Vqh6DxgExm7GjXcvXTIPgE8AhEohAyHIIAjEhoIAC+uNx8AkIAVhxSMnIKgnbMAK5cYRFcGgCCxgAUwIbwZIYI0AkAlBrAXhrSXASiHVoEADJkPKpcAOa4GvAk5CTTUDyiPBoJGto+5d4ahcEAioWzAJ7VAOTM8KJEwkOFANbwZ9PV7dq22zsaPAAeEQTVAAGYlEhgISAsFgIAHcjBAMFB4GoLHCLPVGggLAASOoNJrwFoWQGtdpbbwkK6FEjlapdbwOTREWA8AgEAByqQ2PhAVRMIA+X3pwmipg0ACV4DwwhpDicZj8+PiNNCIKJhBo+jwSMqtQRKgAFACSGkswoFguAMzmZG1ADJbSb-ABlMj8NUQSbK+T9aHkT0YAN+dSihJ0naWiDDUbjCZkwVfAD8juD4quJAgSI9sbujw0Tvux1hsEe2sNXGYNrAyzKGgDGBNVmDYfjSBNhgpouAACknQB5NkYPrpyYQZinJYraZcQqUabYVrrSzt+Dmr6hz4N-xdVoAbjs67sEqlogAIr2ALIYClcREkapKXkadH46Bc-TRfQaCymRZkIiFfhZAwCYrgAUQQQDRAAIWOQ0oFpVw+RJbw7ECEBpDAQw2FmRQACMeFwkI0OCUJwkiRRogADjiRJkhAXh+EUDAiFZNCelyURFESJgQFgD17iiagUkYwQKWPNCqSoQQQTBCELGKQx7gmZjXQsMSwnksAoDUyUwgRJEQkaSCMEyNDRGOepFGIdNDE4pJhLSdTRAAWigV0JJIKSQBk8FIQUpSVLAHTj1c1SAO0pzQrAfS1EMwxjNM-BzMswRrIgWzaIcxRfn+DyvJ8uT-OUjCUT+MgCAAAUwNxogwNBGz6Ur-gwSAuBMrIQGStI0oy+z6NSRRIoARyOEhjjyxQCr8rhFOK1ThtG44KrcDA3AANgwABmBrRGCsJnJGk4YrihKOq6qzSHSzj8EMZYbngQTqFoJL0zCM49y4EAmGoaJ8G8eAfkMG1RD1TYVRvMhoS+3BnpALojzCaHojW3BNrwbA0DoDHGB4kj4FKcjBBQJAqO4-AGLSBHRFlMbEiAA)

```js

function App({peopleid}) {
  const { isLoading, error, data } = 
    useQuery('fetchLuke', () =>
      axios(`https://swapi.dev/api/people/${peopleid}/`))  
  return (
    <div className = "App">
      <h1> React Query example with star wars API </h1>
      { error && <div>Something went wrong ...</div> }
      { isLoading 
          ? <div> Retrieving Luke Skywalker Information ... </div>
          : <pre> {JSON.stringify(data, null, 4)} </pre>
      }
    </div>
  );
}

ReactDOM.render(<App peopleid = "1" />, document.getElementById("app"))  

```
Beginning to the GREAT <CODING> World!!
Tags: beginners, fresher, programming, developer
Published: 2020-11-22 09:22:41

I am very pleased to tell you all that After passing from my High School Now I am going to start my journey in the Developer Community.

I have joined Bachelors of Technology in the field of Computer Science and Engineering with specialization in Artificial Intelligence.

lets hope to have a Great Future Ahead!!

You Can follow Me to be with me on this GREAT WAY!!!

:)
Upload svg and other format image laravel intervention
Tags: php, laravel, file
Published: 2020-11-22 09:06:01

  Upload svg and other format image laravel intervention



use App\SiteSetting;
use Session;
use Image;
use DB;


 $this->validate($request,[
            'site_logo' => 'required|mimes:png,jpeg,svg',
        ]);

DB::beginTransaction();

try{
       $siteSetting = SiteSetting::firstOrFail();
         $siteSetting->site_logo_title = $request->site_logo_title;
        if($request->hasFile('site_logo')){

             if($siteSetting->site_logo){
                 if(substr($siteSetting->site_logo, -3)  == 'svg'){
                    @unlink(public_path().'/'.$siteSetting->site_logo);
                 }else{
                      $this->globalImageUnlink($siteSetting->site_logo);
                 }
            }

            $originalImage = $request->file('site_logo');
            $imagePath = 'frontend/images/site-images/';
            $imageName = uniqid().time().'logo.'.$originalImage->getClientOriginalExtension();
            $imageFullPath = $imagePath.$imageName;

            if($originalImage->getClientOriginalExtension() == 'svg'){
                $originalImage->move(public_path().'/'.$imagePath,$imageName);
            }else{
                $image = Image::make($originalImage);
                $this->globalImageSave($image,$imageFullPath);
            }

            $siteSetting->site_logo =  $imageFullPath;
        }

            $siteSetting->save();

            DB::commit();
            $status = true;
        
        }catch(\Exception  $e){
           return $message = $e->getMessage();
            DB::rollback();
            $status = false;
            return back()->with('error','Please fill out form correctly...');
        }

      
        Session::flash('success','Information Saved Successfully..');
        return \redirect()->route('admin.edit.setting');



protected function globalImageSave($image,$imageFullPath){
        $image->save(public_path().'/'.$imageFullPath);
    }
    protected function globalImageUnlink($imagePath){
        @unlink(public_path().'/'.$imagePath);
    }