teleren/devto huggingface dataset:
Java--Replace an Image in PowerPoint
Tags: java, powerpoint
Published: 2020-10-20 03:49:38

In the process of daily work, we may sometimes encounter a situation where we need to replace the image in a PowerPoint document. And Free Spire.Presentation for Java provides us a method to replace an existing image with a new image in Java application. In this article, I will share the Java code used.

**Import Jar Dependency**

**Method 1:** Download the [Free Spire.Presentation for Java](https://www.e-iceblue.com/Download/presentation-for-java-free.html) and unzip it. Then add the Spire.Presentation.jar file to your project as dependency.

**Method 2:** You can also add the jar dependency to your maven project by adding the following configurations to the pom.xml.
```xml
<repositories>
        <repository>
            <id>com.e-iceblue</id>
            <name>e-iceblue</name>
            <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
        </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.presentation.free</artifactId>
        <version>3.9.0</version>
    </dependency>
</dependencies>
```

**Replace Image**
```java
import com.spire.presentation.*;
import com.spire.presentation.drawing.IImageData;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;

public class ReplaceImage {

    public static void main(String[] args) throws Exception {

        //create a Presentation object
        Presentation presentation= new Presentation();

        //load the sample PowerPoint file
        presentation.loadFromFile("Polar bears.pptx");

        //add an image to the image collection
        String imagePath = "C:\\Users\\Administrator\\Desktop\\p1.jpg";
        BufferedImage bufferedImage = ImageIO.read(new FileInputStream(imagePath));
        IImageData image = presentation.getImages().append(bufferedImage);

        //get the shape collection from the first slide
        ShapeCollection shapes = presentation.getSlides().get(0).getShapes();

        //loop through the shape collection
        for (int i = 0; i < shapes.getCount(); i++) {

            //determine if a shape is a picture
            if (shapes.get(i) instanceof SlidePicture) {

                //fill the shape with a new image
                ((SlidePicture) shapes.get(i)).getPictureFill().getPicture().setEmbedImage(image);
            }
        }

        //save to file
        presentation.saveToFile("ReplaceImage.pptx", FileFormat.PPTX_2013);
    }
}
```

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

**After**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4kyga003pawpw91axhko.png)
Hacktoberfest
Tags: hacktoberfest
Published: 2020-10-20 03:27:58

## What I Learned From Hacktoberfest

<!-- What did you learn that can help others contribute to the project you worked on? What did you learn that can help the users of that project?! -->

Three years ago I received my first invitation to participate in Hacktoberfest. But I was an inexperienced programmer. Today, I consider myself a programmer with a lot, a lot to learn! Every year I make a list of projects to contribute in some way, fix a bug, implement a feature. But I always think that the code of other programmers is much better, easier to understand, etc. Yeah, it's true, but if I don't go a step further, get out of my comfort zone, I may never reach my goals.
This year I finished the Hacktoberfest challenge! Thank you Digital Ocean and Github for encouraging us to contribute and create open source projects.
Console.log('Hello World');
Tags: javascript, node, typescript, career
Published: 2020-10-20 03:15:51


> *At First, this is my first post and first in english, my apologies for any grammatical error, I'm studying english to improve this.*

<b>Hello everyone</b>, I'm Lucas, a developer in transition from .NET/.NET Core to Node. I've been work with Node since 2018, when I see the facility to develop API's and other things. Look impressive, I really like and decide to change my focus to this world of javascript.

I have 28 years old and like study and discover many ways to build something using new technologies, this make me feel when i started develop in 2014. I'm very excited to learn more frameworks, partterns, concepts and improve my knowledge in software development.

This is my First post talking about me and my career, the Focus of New posts is to, talk about my study and knowledge I've acquired with node to share with someone, began in this World.

The next post is to talk about my template project and How I use the libraries.

Thanks guys.
My Hacktoberfest 2020
Tags: hacktoberfest, github, opensource
Published: 2020-10-20 03:10:11

## What I Learned From Hacktoberfest

Well, it's been a while for me contributing to the open-sourced, but this was the first time I participated in a Hacktoberfest. So, what I thought of this Fest is instead of just randomly contributing to the open-sourced to main self's repository or for the sake of just completing the same, I thought of "Let's do something which will either automate people's task or will help them in real". So, that's my motto for __Hacktoberfest 2020__. 

![Coding Image](https://dev-to-uploads.s3.amazonaws.com/i/x395v59ju6zdyla6s8of.jpg)

## What I've Contributed

I'm and have been working on three projects this October.

The First One is "__Directory Organizer__" which will help you to rearrange your directory and put the files in their respective type directories making it more maintainable and easy to guide through.

The Second Project I worked on is "__Directory Tree__". Basically, I felt the need of designing this as we often do `ls`[linux] or `dir` [windows] to find out the folder and files present in our current working directory or let's say any directory. But, it won't give out the files present in the sub-directory of that particular directory. And also, the format they give us is not representative of the project's point of view. So, I thought of developing this project to automate the whole thing and give us just a simple command to run.

The Third and the current project I'm working on is "__Rare Label One Hot Encoder__". Basically, this module would be useful for a Machine Learning Project where we've to one-hot encode features, but also due to the presence of rare-labels in train-test sets, we're unable to do it. So, I'm basically automating the whole thing up.

## Links for my Projects [for Hacktoberfest 2020]

1. [Directory-Organizer](https://github.com/rahulbordoloi/Directory-Organizer.git)
2. [Directory-Tree](https://github.com/rahulbordoloi/Directory-Tree.git)
3. [Rare-Label-One-Hot-Enocder](https://github.com/rahulbordoloi/Rare-Label-One-Hot-Enocder.git)
Vehicle window sticker / monroney sticker API
Tags: javascript
Published: 2020-10-20 03:04:49

Hi all, still work in progress but for the car enthusiasts and early adopters amongst y'all:

https://www.withclutch.com/window-stickers

These used to be internal tools but since we got so much inbound interest, we decided to subtly and gradually make them available.

Supported makes:

Audi, Chrysler, Dodge, Fiat, Hyundai, Infiniti, Jeep, Kia, Lexus, Porsche, Maserati, Mitsubishi, Nissan, Ram, Scion, Toyota, Volkswagen and a lot more to come!

Years currently supported: 2013 and newer.

Hit rate is around 50% right now and we're improving that daily. Feedback and thoughts highly welcome.

We didn't think there was a market for these but if you can think of a use case, please let us know!

Thanks team!
How to paste into text fields in websites that block pasting?
Tags: javascript, unblock, textfield
Published: 2020-10-20 02:59:34

---
title: How to paste into text fields in websites that block pasting?
published: true
description: May websites block pasting into text fields like user id and password, how to overcome it?
tags: javascript, unblock, textfield
//cover_image: https://direct_url_to_image.jpg
---
Press F12 and paste the following code into the console.
```
var allowPaste = function(e){
  e.stopImmediatePropagation();
  return true;
};
document.addEventListener('paste', allowPaste, true);
```
Viola one can now paste into any text filed.
Repeat again if the site again blocks pasting.
Bug fixing should be of high priority in your activity list, if you are a programmer.
Tags: java, kotlin, swift, node
Published: 2020-10-20 02:57:52

In one of our sales meetings, a participant from their side, a mobile app developer, told us that their app has very low bug count and most of them are of low priority. They are happy with their play store rating of 4.4. That was almost an year back. They didn't convert.

Today I happened to check their play store listing again, and surprised to see that their rating has dropped to 3.2 !!! Looks like they got thousands of single stars in last one year. Review comments suggest that the app has become too buggy and almost unusable.

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

Never take testing and bug fixing out of your priority list. Bugs do exist in software and if you think your code has low bug count, it could most likely because of inefficient testing. Leave the bugs with out fixing, and they will one day manifest as too complicated to solve.

[Background of the sales conversation mentioned in this post is that our venture Finotes ([https://finotes.com](https://finotes.com)) is in the business of finding bugs 🙂]
How Imposter's Syndrome Makes You a Better Developer
Tags: mentalhealth, career
Published: 2020-10-20 02:48:11

Oftentimes the feeling of imposter's syndrome is seen as something that should be fixed. While lately more and more people of all skills have come out with their experiences of imposter's syndrome, it still is seen as shameful or a negative. I'm here to offer a slightly different take on it.

## Imposter's syndrome is a sign that you're doing something right
Imposter's syndrome often occurs when you are stretching yourself and venturing outside your comfort zone. It is normal to feel more and more like an imposter as you grow in your career. If you let imposter's syndrome own you, then it can be detrimental. There are times where I have missed out on opportunites because I let it convince me I wasn't good enough to take on bigger tasks. 

## Rely on data, not on feelings
As developers, we tend to be very detail oriented. Imposter's syndrome makes it easy to _feel_ that you're not doing well, but looking at data can keep you rooted. Keep an accomplishments document with all your successes that you can refer to when you feel you're not doing well. Whenever you're struggling with a concept, document it so you know what you should focus on learning. Gather data from others and ask for feedback, from code reviews to general one-on-one's.

## Don't feel like you need to know everything
As a developer, your job isn't to know the answer to everything. Your job is to be able to solve problems. Focus on honing in your problem solving skills over specific knowledge, especially if you're a beginner. In-depth knowledge will come over time, but it will stick better if you are actively applying it to a problem. The other day I read [an article](https://dev.to/futurice/fight-the-inner-impostor-with-just-in-time-learning-b3i) that discussed "just-in-time" learning to fight the anxiety of needing to know it all. This additionally fights the inevitable burnout that comes with attempting to learn everything too quickly.

## Normalize talking about your experience, no matter your experience
This is one that I realized later on in my career. When I was an intern and a young engineer, people would talk about imposter's syndrome, but as something that they had beat or something of their past, not as a constant. I thought that I was behind because I felt like an imposter all the time. Now, when I interact with younger engineers and interns, I make sure to be open that imposter's syndrome is something I continue to grapple with and it is _normal_ and _healthy_ to feel it as they continue to learn. Whether you are new to your field or are someone that newer engineers might look up to, be open and honest about your feelings. Imposter's syndrome is _not_ a weakness, but shows you are growing and embracing being uncomfortable.

___

<sup>Photo credits to [Nicole Wolf](https://unsplash.com/@joeel56) on Unsplash</sup>
Looping over a range of numbers in Python3
Tags: python, coding, development, beginners
Published: 2020-10-20 02:32:01

```python
for i in range(7):
    print(i**3)
```

We have used [range](https://docs.python.org/3.9/library/stdtypes.html?highlight=range#ranges) here to generate the sequence of numbers. 
 
#### range(stop)
returns the sequence of numbers up to `stop` argument.

`range` takes two other arguments as well 
1. start 
2. step

#### range(start, stop[, step])
`start` argument tells where to start the sequence from. Defaults to 0.
`step` argument tells the increment value between each number in the sequence. Defaults to 1.

**Note** -  `range` in Python3 returns a `range` object, not list.
Public Courses on Cloud Native Technologies
Tags: alibabacloud
Published: 2020-10-20 01:43:35

The term Cloud Native was originally used to describe the typical architectures and characteristics of cloud-based applications. With the evolution of containers, Kubernetes, Serverless and FaaS technologies, the Cloud Native Computing Foundation (CNCF) defined Cloud-Native as a basic technology that makes applications more elastic, fault-tolerant, and observable. It can also make applications easier to write and orchestrate. This technology can enable developers to make the best use of cloud resources, products and delivery capabilities.
This course is jointly developed by Alibaba Cloud and CNCF. The entire course is free of charge and requires no registration. We will provide you with:

A comprehensive knowledge system for you to build your own cloud-native skill set
An understanding of Cloud Native's essence and key ideas
An online testing for each chapter to verify your learning progress
Key best practices in Cloud Native from technical teams on the cutting edge of this technology

Start Learning: https://edu.alibabacloud.com/certification/university-cloudnative
Alibaba Cloud Global AI Innovation Challenge
Tags: alibabacloud
Published: 2020-10-20 01:32:20

Win a Total of $116,000 in Prizes with Your Innovative AI Projects!

As cloud and AI technologies are shaping all industries globally and driving numerous innovations, Alibaba Cloud has launched the Machine Learning Platform for AI (PAI) service to empower AI developers and innovators by lowering technical barriers and development costs. The Alibaba Cloud Global AI Innovation Challenge is an open competition for global AI developers, researchers, startups and solution providers to make and/or enhance their products or projects based on machine learning using PAI.

Register for the challenge now, you can get:

A $50 PAI coupon to start your model training with CPU/GPU resources for free

A voucher of Machine Learning Specialty Certification for free

Chance to win a total of $55,000 in cash prizes and $61,000 in cloud credits

See step-by-step guide of how to register for the challenge and claim a coupon

Join Now: https://tianchi.aliyun.com/s/35414e9bfdf3108b3b5151aef02fbb1c?spm=a3c0i.19911262.2990968790.1.27eb140eLKiSYc

Claim Coupon: https://www.alibabacloud.com/#J_5662607660
Format a list for a title in Python
Tags: codenewbie, python
Published: 2020-10-20 01:17:49

Some times is need it to show a list of items, but are you tire of the simple lists joined comma?
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tktd0orjb0mqvxu9pbpb.png)
No?! Well I do, and this is the reason for this code snippet than can change your life ... well maybe not, but I found useful.

Given a list of strings X,Y,Z it will return a simple string separated by comma but the last element will be separated by the string ' and ', thats it.

```
def formatListforTitle(words):
  """
  This function returns a string like:
  For W,X,Y,Z
    W, X, Y and Z
  For X,Y
    X and Z
  """
  words = [s for s in words if s]
  if not words:
    return ''
  if len(words) == 1:
    listTitle = words[0]
  else:
    listTitle = ', '.join(words[:len(words) - 1]) + ' and ' + words[-1]
  return listTitle
```

This is my first post, I hope all you people like it.
An Easier Way To Write CSS Variables
Tags: css, swordcss, node, javascript
Published: 2020-10-20 00:57:22

# Wait What?
I think you should be familiar with CSS Variables, which can be used like this:
```css
:root {
	--color: red;
}

.component {
	color: var(--color);
}
```
These can be manipulated at runtime, though they seem a little hard to write. What if I told you there is an easier better way?
# SwordCSS
[SwordCSS](https://github.com/swordcss/swordcss) is a CSS preprocessor I have been working on in my free time. It allows you to write CSS Variables like this:
```css
@sw-variables {
	color: red;
}

.component {
	color: color;
}
```
and it gets converted into this:
```css
:root {
	--color: red;
}

.component {
	color: var(--color);
}
```
There are [some other features](https://swordcss.github.io/swordcss/) so have fun with it!
Week 2 and Making it Up to Myself
Tags: opensource
Published: 2020-10-20 00:22:52

This week was actually pretty alright. Once I noticed that looking for issues on the GitHub app on my phone was pretty easy, actually doing the looking on my commute to work was even easier. I very quickly found multiple simple issues I was eager to fix.

I want to be clear, I did two pull requests this week because I wasn't terribly happy with my last one. I submitted the pull request and got no real response, but I decided I wanted to have *something* done so I threw it up there.

In hindsight, I'm really not happy with it.

So to make up for it, this week I did two! Both are of roughly equal quality but slightly more than or on par with what I would expect from a first PR. The first was simple documentation.

{% github https://github.com/coderaiser/putout/issues/26 %}

As you can see, all the issue required was for documentation to have updated headers that reference the new name for the app.

Simple! I [branched](https://github.com/fluentinstroll/putout/tree/issue-26) off the main branch and spent some time updating headers. Though I could've used replace all in vscode, I preferred to be a little more holistic and review the files to make sure I only changed headers. That was all the issue called for after all!

The pull request was happily accepted and I went on to the next issue.

{% github https://github.com/coderaiser/putout/pull/27 %}

The second issue I worked on this week was a quality of life edit of some code in [fetch-json](https://github.com/center-key/fetch-json)

{% github https://github.com/center-key/fetch-json/issues/20 %}

Including a comma in multiline arrays seems like a superfluous decision on the part of a developer, but truthfully, it can save a lot of hassle when it comes to modifying code and it helps stop merge conflicts because if every array has a trailing comma, they are all consistent with each other.

Again, quite an easy fix. I once again [branched](https://github.com/fluentinstroll/fetch-json/tree/issue-20) off from the original and got to work, just working in the specified file, adding a couple of trailing commas.

{% github https://github.com/center-key/fetch-json/pull/21 %}

I want to be clear again that I don't think either of these pull requests is really up to the standard of a 3rd week pull request when it comes to the complicated nature of the edits. But, making up for last week's submission is what I meant to do and fixing these issues showed me how nice it is to just work on someone else's project because you want to. 

Low-stress fixes like these are all over the place and even when I'm done with this month having completed more complicated pull requests I'll probably be fixing trailing commas on every project I can find.

It's just fun!
How to sync the fork repository with the main repository in Git?
Tags: git
Published: 2020-10-20 00:00:00

---
  title: How to sync the fork repository with the main repository in Git?
  published: true
  tags: Git
  date: Tue Oct 20 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/sync-fork-repo-with-remote-main-repo-git
  cover_image: https://melvingeorge.me/_next/static/images/main-8618d8b5b9d8e428bcf1c9f120c51ce5.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/sync-fork-repo-with-remote-main-repo-git)
  
To sync a forked repository with the main remote repository in Git. First, you need to fetch all the latest commits and branches from the remote main repository.

## Step 1: Check if the main repository is added as a pointer!

Before starting we need to make sure that we have a pointer to the main repository to fetch the latest commits.

We can check this using this command,

```bash
git remote -v
```

It may show something like this,

```bash
origin  https://github.com/<YOUR_USERNAME>/<YOUR_FORKED_REPOSITORY_NAME>.git (fetch)
origin  https://github.com/<YOUR_USERNAME>/<YOUR_FORKED_REPOSITORY_NAME>.git (push)
```

The `origin` here means our fork of the main repository which is not what we want (Because the fork contains only our latest commits. 🙄).

So There should be a pointer to the main repository.

Let's call the main repository `upstream` and let's add a pointer to the main repository using this command,

```bash
git remote add upstream <MAIN_REPOSITORY_GIT_URL>
```

You need to replace `<MAIN_REPOSITORY_GIT_URL>` with the main repository Git URL.

This will add the main repository.

Now if you do

```bash
git remote -v
```

again.

It will show the new `upstream` also.

```bash
origin  https://github.com/<YOUR_USERNAME>/<YOUR_FORKED_REPOSITORY_NAME>.git (fetch)
origin  https://github.com/<YOUR_USERNAME>/<YOUR_FORKED_REPOSITORY_NAME>.git (push)

upstream  https://github.com/<MAIN_REPOSITORY_USERNAME>/<MAIN_REPOSITORY_URL>.git (fetch)
upstream  https://github.com/<MAIN_REPOSITORY_USERNAME>/<MAIN_REPOSITORY_URL>.git (push)
```

Yay. 🌟 Now the upstream is added.

## Step 2: Get the latest commits

To get the latest commits from the `upstream` (the main repository) you need to use this command,

```bash
git fetch upstream
```

This will fetch all the latest commits, branches, etc from the main repository.

## Step 3: Merge the `main` or `master` branch of upstream (main repository)

### Info: `master` branch name is now `main` if you are using Github.

To merge the `main` or `master` branch of the main repository you can use this command,

```bash
git merge upstream/main


# OR

# git merge upstream/master
```

Now you are synced with the `main` (or `master`) branch of `upstream`.

### Feel free to share if you found this useful 😃.

---