teleren/devto huggingface dataset:
Set Text Transparency in PowerPoint Using Java
Published: 2021-07-30 07:19:23

This article will demonstrate how to set text transparency in PowerPoint using Free Spire.Presentation for Java.

**Import jar dependency (2 Methods)**
● Download the [free library](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.

● 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>
```

**Sample Code**
```java
import com.spire.presentation.*;
import com.spire.presentation.drawing.FillFormatType;

import java.awt.*;
import java.awt.geom.Rectangle2D;

public class TextTransparency {

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

        //Create a PowerPoint document
        Presentation presentation = new Presentation();
        presentation.getSlideSize().setType(SlideSizeType.SCREEN_16_X_9);

        //Add a shape
        IAutoShape textbox = presentation .getSlides().get(0).getShapes().appendShape(ShapeType.RECTANGLE,new Rectangle2D.Float(50, 70, 300, 120));
        textbox.getShapeStyle().getLineColor().setColor(new Color(1,1,1,0));
        textbox.getFill().setFillType(FillFormatType.NONE);

        //Remove default paragraphs
        textbox.getTextFrame().getParagraphs().clear();

        //Add three paragraphs and apply colors with different alpha values to the text
        int alpha = 55;
        for (int i = 0; i < 3; i++)
        {
            textbox.getTextFrame().getParagraphs().append(new ParagraphEx());
            textbox.getTextFrame().getParagraphs().get(i).getTextRanges().append(new PortionEx("Text Transparency"));
            textbox.getTextFrame().getParagraphs().get(i).getTextRanges().get(0).getFill().setFillType(FillFormatType.NONE);
            textbox.getTextFrame().getParagraphs().get(i).getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID);
            textbox.getTextFrame().getParagraphs().get(i).getTextRanges().get(0).getFill().getSolidColor().setColor(new Color(176, 48, 96, alpha));
            alpha += 100;
        }

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

**Output**
![Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3sw6urc5xqqyp5a8h6vr.jpg)
How to simplify and clean your sass import with Angular.json
Tags: angular, sass, css
Published: 2021-07-30 07:01:40

When we work with Sass and Angular, import files is a very common task, and if you have more than 10 files and want to change the path of your sass structure? 

```scss
@import 'shared/styles/colors';
@import 'shared/forms/input';
@import 'shared/forms/select';
@import 'shared/mixis/grid';
```
All files need to be updated and are not nice, let angular help with it.


## Angular.json to rescue

Go to angular.json file, under styles add stylePreprocessorOptions object with includePaths option and define all paths available in an array with your file paths, it should be relative to the angular.json.

```json
"styles": [
   "src/styles.scss"
   ],
"stylePreprocessorOptions": {
   "includePaths": [
        "src/share/forms",
        "src/share/styles",
        "src/share/mixins"
        ]
}...
```

Angular will compile using these paths, and you can remove them from your files, and the compiler found these files.

```scss
@import 'colors';
@import 'input';
@import 'select';
@import 'grid';
```
## Done!!

Everything is working with a clear path for your sass files and If in the future you want to change path or rename, only need to edit the angular.json file :) 

<a href='https://www.freepik.com/photos/background'>Background photo created by whatwolf - www.freepik.com</a>
Create Tarfile(tar.gz) in Python
Tags: python, pytest, tarfile
Published: 2021-07-30 06:29:11

Let's write some test-cases to test the behavior of `create_tar_file` function.

`test_tarfile.py`
```python
import pytest

from tarfile import create_tar_file


def test_creates_tarfile_from_source_dir(tmpdir):
    source_dir = tmpdir.mkdir("source")
    file_path = source_dir.join("a.py")
    file_path.write("x=2")
    assert file_path.read() == "x=2"
    create_tar_file("tarfile.tar.gz", source_dir, ["a.py"])


def test_raises_exception_if_source_is_not_a_dir(tmpdir):
    with pytest.raises(ValueError, match="Not a directory"):
        create_tar_file("tarfile.tar.gz", "not_found_dir", ["a.py"])


def test_raises_exception_if_file_not_found_in_source_dir(tmpdir):
    source_dir = tmpdir.mkdir("source")
    file_path = source_dir.join("a.py")
    file_path.write("x=2")

    with pytest.raises(ValueError, match=f"b.py is not a file inside {source_dir}"):
        create_tar_file("tarfile.tar.gz", source_dir, ["b.py"])
```

Now, let's write the implementation of `create_tar_file`.

`tarfile.py`
```python
import os
import tarfile
from typing import List


def create_tar_file(tarfile_path: str, source_dir: str, files: List[str]) -> None:
    if not os.path.isdir(source_dir):
        raise ValueError('Not a directory')

    os.chdir(source_dir)

    with tarfile.open(tarfile_path, "w:gz") as tar:
        for f in files:
            if not os.path.isfile(os.path.join(source_dir, f)):
                raise ValueError(f'{f} is not a file inside {source_dir}')
            tar.add(f)

```
AR Developers?!
Tags: unity3d
Published: 2021-07-30 05:45:15

One of the best ways for AR developers to seize an opportunity is to participate in a competition or what is sometimes called "Challenge". We believe in this in Resight, therefore are organizing (for the second time) a cross-community one, with partners as #AWE and #openARcloud - See all details here >> https://www.awexr.com/usa-2021/ar-cloud-challenge
How I got Tabnine Pro for free as a Student Developer and you can too
Tags: tabnine, vscode, students, codenewbie
Published: 2021-07-30 05:32:15

We all know that @Tabnine is one of the best AI powered Code Completion Extensions out there today. It is available for a variety of text editors and IDEs and also offers free pro plan for students.
Yes, you heard it right!!
As far as i know, there are two ways to get Tabnine Pro for free as long as you are a student:
* Using an school issued email
* Providing your documents for verification
![gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jms4go7y2x7x7dms4vhl.gif)

### 1)Using your school issued email

If your school/uni provides a .edu domain email address, you are all set and don't need anything else. Just send them an email and the team will verify your student status. You should receive your license within 1-2 days max.
### 2)Providing your proof documents

This is how i got my pro license, as my University does not provide .edu mail addresses to students. I was already using the free version for a while before, then saw that they had a student version.
So, I emailed the support team explaining that i don't have a school issued email but would love to use the full version. I got a quick reply within 12 hours and they asked me to attach my ID card, and a link to my university website, and they would be happy to provide me a Pro license. I did the same and got a reply next day, saying that my student status is verified and i just have to log back in my account, and i will have the Pro version.
So, this is how i got my hands on Tabnine Pro, and so far i am loving it. I have used it for last 15 days or so, and tested it with C++, Python, React, etc languages and it performs beyond expectations.
If you are a student and into development and stuff, or just into programming, I would strongly recommend this extension. Even if you are not a student, the free version also has a lot of amazing features which can help you increase your productivity and code more in less time.
Hope you get some help from my content.

Consider to give me a follow: 

Instagram: https://www.instagram.com/thesmartdeveloperr 

Twitter: https://www.twitter.com/ursmartengineer
 
![gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mav023da1vzrvu3mgd3w.gif)
Decorating Service Objects - FunctionalObject
Tags: ruby
Published: 2021-07-30 04:11:53

A common pattern used in Ruby programs are Service Objects. They help enforce the Single-responsibility Principle throughout the app, which in turn makes the program easier to test, debug and reason about.

```Ruby
  result = CheckoutService.new(item: item, user: user).call
  if result.successful?
    ...
```

At my workplace, we use service objects extensively in our codebase. One modification we made to them was to shorten the code it takes to invoke the service. All our service objects are invoked like this:

```Ruby
  result = CheckoutService.(item: item, user: user)
  if result.successful?
    ...
```

It's a minor code shortening, but it also enforces a single interface to invoke the class within the entire program. It's like we are saying "Only invoke services with the `#call` method".

## Implementation
Implementing this pattern is pretty straightforward.

First, we define a base class for all our Service Object's.

```Ruby
  class ApplicationService
    def self.call(...)
      new(...).()
    end

    def call
      raise "Not Implemented"
    end
  end
```

Here, we do two things.

```Ruby
  def self.call(...)
    new(...).()
  end
```
One, we define a class method `self#call`. It doesn't care what arguments it receives (see [this footnote](#method-forwarding-operator) if you're wondering what `(...)` does), it just forwards them to `new()` and then immediately invokes `#call` by chaining `.()` behind it.

```Ruby
  def call
    raise "Not Implemented"
  end
```
Two, we enforce that all subclasses define `#call`- we raise an error if it isn't implemented.

Then we make all our service classes inherit from our base class.

```Ruby
class FooService < ApplicationService
  def initialize(name: )
    @name = name
  end

  def call
    "Hello #{@name}"
  end
end
```

That's it. All classes that inherit from `ApplicationService` needs to adhere to the `#call` class signature, and can be invoked with the shorter method.

```Ruby
FooService.(name: "Dan")
=> "Hello Dan"
```

## One step further
As you can see, this pattern can be applied to any Ruby class. In the future, you might have other classes in your program that you also want to invoke with this shorthand method. In that case, you can implement it as a mixin.

```Ruby
module FunctionalObject
  module ClassMethods
    def call(...)
      new(...).()
    end
  end

  def self.included(klass)
    klass.extend(ClassMethods)
  end

  def call
    raise NotImplementedError
  end
end
```

Now any class that wants to behave similarly can just include the mixin, like so.

```Ruby
class ApplicationService
  includes FunctionalObject
end
```

## Footnotes
### Method Forwarding Operator
Since Ruby 2.7, the `(...)` operator can be used to forward all arguments from a forwarding method to a concrete method.

```Ruby
  def forwarding_method(...)
    concrete_method(...)
  end
```

See the [official docs](https://docs.ruby-lang.org/en/master/doc/syntax/methods_rdoc.html#label-Argument+Forwarding) for more info.
How to Add BUY ME A COFFEE Button in DEV.TO Blog
Tags: discuss, javascript, webdev, codenewbie
Published: 2021-07-30 04:58:47

Hello Dev, 

In this article i will show you and help you out adding **"BUY ME A COFFEE"** button in you **dev.to** blog post in very simple and easiest way (ONLY IN 2 STEPS).

So without wasting any time, lets get into the article

**STEP 1** : Please first make your account @ www.buymeacoffee.com and get your username.

**STEP 2** : Add the below anchor tag wherever you want to add your buy me a coffee button in your blog post.
 and make sure to add your username in `href` link : `https://www.buymeacoffee.com/your_username`

**Example:**
```html
<a href="https://www.buymeacoffee.com/capscode" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
```

## IF YOU LIKED THE POST, THEN YOU CAN BUY ME MY FIRST COFFEE EVER, THANKS IN ADVANCE.
<a href="https://www.buymeacoffee.com/capscode" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>


Thank you for reading this far. This is a brief introduction oN **How to add BUY ME A COFFFEE BUTTON IN DEV.TO BLOG POST** .
If you find this article useful, like and share this article. Someone could find it useful too. If you find anything technically inaccurate please feel free to comment below.

Hope its a nice and informative read for you.
VISIT https://www.capscode.in/#/blog TO LEARN MORE...

Thanks,
@capscode
Hands-On Experience Course to Learn Tailwindcss
Tags: tailwindcss, nextjs, javascript, frontend
Published: 2021-07-30 04:03:07


![tailwind-academy-intro (1)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f0ojhjo5w8o9lvqg503.gif)

If you read my previous post about [Why "Learn by Doing" is important](https://dev.to/corpcubite/why-learn-by-doing-is-important-5a7f) where I argued that learn-by-doing is more practical than sit and watching a video, then it should come as no surprise to find out we are developing interactive hands on experience courses to teach Tailwindcss. In this course We're using Next.js for the frontend framework and we are using Stackblitz as interactive development environment.

We are working hard on it and hoping that we can have all of its first modules ready by then end of September! If you're interested in checking out what's available now feel free to visit https://tailwind.academy where you'll find information about how this is an interactive course unlike any other. Also if you have any comments or feed back feel free to share it with us.

We'll start with the basics and build up more advanced modules over time, so you can go at your own pace. You will need a Github account to be able to follow along.

We'll be using Stackblitz, it's an online IDE which is free to use, so no need to install any software in your local environment.

Here's a quick video of what it looks like when you're following along with this course:

{% youtube oH0mcF94Q9Q %}

I'm really exited about this project and looking forward to see you in the course! Feel free to check out Tailwind.Academy where you can see a sneak peak of what we're working on now!
Writing a command system in JavaScript
Tags: javascript, tutorial
Published: 2021-07-30 04:33:48

If you [search Google for "text adventure"](https://google.com/search?q=text+adventure) and open the Developer tools, you get a neat little text adventure game to play, which involves the blue `G` finding his friends red `o`, yellow `o`, blue `g`, green `l`, and the always quirky red `e`.

![text-adventure](https://user-images.githubusercontent.com/76640268/127134594-2cd44287-2c5a-47a5-bebc-6e2ebe3a38ab.gif)
<figcaption>Pretty hard</figcaption>

I started wondering how they did this: They implemented a whole command system without using any external stuff, with only plain JavaScript. And so at once I started digging through the code, immediately stopped because it was obfuscated, and started thinking. The result was [this](https://github.com/SiddharthShyniben/cmd-quiz) simple trivia quiz ([hosted here](https://siddharthshyniben.github.io/cmd-quiz/)).

![Quiz!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fh30jvzzr76ybkuroe05.gif)
<figcaption>I'm really bad at trivia.</figcaption>
<figcaption>Wondering how I'm styling those logs? Check out <a href="https://dev.to/siddharthshyniben/how-to-add-css-to-console-log-s-2hk5">this explainer</a> I wrote</figcaption>

---

## How does this even work?

`yes`, `no`, `north`, `moon`, they all don't seem to be anything. If you open the DevTools and run them, you'll just get a `Uncaught ReferenceError: yes is not defined`. But that gives us a hint – why don't we define it?

```js
const yes = "yes";

// Later...
yes
// => "yes"
```

That works perfectly, but we have no way of saying whether it was called. But then, we can use [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get).

### Quick demo of getters

```js
const obj = {
  foo: 'bar',
  get foo() {
    return 'something entirely different'
  }
}

obj.foo //=> 'something entirely different'
```

---

We obviously can't use getters on global variables, but we can just set the variables on window and add getters to them:

```js
Object.defineProperty(window, "yes", {get: () => {
	// Do something
	console.log("Got yes");
	return "yes";
}});

yes
// => "yes"
// => "Got yes" (logged to console)
```

And that's basically it, you can just keep setting variables statically or dynamically, and you basically get a command system!

---

What are the uses of this? I dunno, all this can be done by using regular functions instead of this. Maybe easter eggs? Maybe for some debugging?

I can't wait to see people writing code like this:
```js
Object.defineProperty(window, "main", {get: () =>  {...}})

main;
// Wait, is main supposed to be a function or something?
// Linters are gonna be angry...
```
Trying out one of the most cursed gba games. Shrek Swamp Kart Speedway
Tags: cursed, gba, game, review
Published: 2021-07-30 03:58:20

Hwlo there!!!! So today I will try this game called Shrek Swamp Kart Speedway which is considered very damn cursed!!


The Visual Boy Advance (VBA) emulator will help us here on our journey!!! Cuz I dont have a real game boy advance lol!



Ok So I heard that this is one of the worst games and was jus a Mario Kart with a Shrek Skin. I have personally never watched Shrek or played Mario Kart.. So lets try.. 


![Shrek---Swamp-Kart-Speedway-(U)-[!].png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627554789132/Ob6NxpySK.png)
This is where I am... Wish me luck

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627554832455/dEVz3MkRV.png)
OH MY FRICKING GOD!! THATS CURSED ALREADY OH NO!!

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627554870849/N9meMhJef.png)
Watching these weirdos bobbing their head is giving me anxiety.
I will just go with the gingerbread. 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627555086669/9OQVkyyO4.png)
ITS FRICKING HARD AND AS I WAS TOLD, THE CONTROLS ARE BAD!! ITS TOO SPEED !! I have never been a good car game player so maybe to an extent its my incopetence.
Ok So I will rather Jus do a gameplay video here ok?

https://youtu.be/3azFgxaytZ8

You can check it out here.... I got the hang of it quick and came 2nd while I could come 1st but got stuck. It was actually hard and it took me like 5 attempts after which I started recording. The Graphics were the worst!!! And the controls the hardest!! AND THE FRICKING HEAD BOBBING I SHOWED IN THE VIDEO!! I WAS DAMN FEELING WEIRD!!!


I mean thats it for today.. I forgot to save it... There are a lot of levels I guess in this game...

Bye!!!
Updates on dev.to clone in Angular - July 30
Tags: angular, webdev, showdev, typescript
Published: 2021-07-30 03:53:13

Github Repo - https://github.com/ajitsinghkaler/devto-clone

Deployed on Firebase - https://dev-toclone.firebaseapp.com/

Last week I added article section dev.to clone.
![Dev.to clone July 30](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/syxzk0w3xwwqjylu0wsy.png)

This week we added the tags store and joined the tags to the api. We mostly follow a pattern to add an api service which makes all the api calls and a store service which sores al the data related to that service. 

We also added listings using the same pattern. This is the first time we used *rxLet. It really makes working with all Observable in the templates easier do [check](https://github.com/rx-angular/rx-angular/blob/master/libs/template/docs/api/let-directive.md) it out. It allows you four states for an observable suspense, error. complete so that you can handle each one of them separately and gets rid of the *ngIf with async pipe. Like if you want to display something else while loading and error is a big disadvantage of the async pipe when used with an api.

There was one interesting thing we did this time we created a reusable component which when passed a tag will show all the top articles from these tags in the last 3 days if you want to check [this](https://github.com/ajitsinghkaler/devto-clone/commit/4a031584b9008c2733c64d1e61fb00883d5db94f) out. 

This is how it looks now
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iag6222gych0y86ts846.png)
Next week we will start working on article details page.

## Issues

[Issue](https://github.com/ajitsinghkaler/devto-clone/issues/6)
The article tag store and article store are quite common can we make them one. Same for listings HTML and article-tag HTML. I'm not sure what to do about this.

## Commits done in this update

1. [added right side tags articles](https://github.com/ajitsinghkaler/devto-clone/commit/4a031584b9008c2733c64d1e61fb00883d5db94f)
1. [add listings to homepage ](https://github.com/ajitsinghkaler/devto-clone/commit/6889840004204b4ae0997dc52abc6cc95824b16f)
1. [add tags store](https://github.com/ajitsinghkaler/devto-clone/commit/359198b4cd2154cfe46aeefd8f7cf6f2d4c7fdba)

## Contributions
[Chellappan](https://twitter.com/che_off) has also offered some help. He will raise a detailed feature request on what he will work on Waiting for that. 

If you want to contribute too. I've created a lot of issues. Anyone can work on issues but for feature requests you have to raise a detailed feature request before working on it.

[Sunny](https://twitter.com/VakilSunny) also raised his first pr on the project. Thank you sunny.