teleren/devto huggingface dataset:
Pycraft v0.9.6-2.0 is now live!
Tags: programming, python, gamedev, opensource
Published: 2022-08-20 10:48:14

Pycraft v0.9.6-2.0 is now live on GitHub, this is the first of many releases that will include the new settings menu design! I've attached some photos below!

You can find the update here: https://github.com/PycraftDeveloper/Pycraft/tree/Pycraft-v0.9.6-2.0

![Toggle and slider design](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh81nidfp9smsgxph7jm.png)

![Button design](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9pfq0z143qcd4b501ln.png)
Interface Segregation Principle in TypeScript
Tags: typescript, cleancode, javascript, webdev
Published: 2022-08-20 10:41:00

> Clients shouldn’t be forced to depend on methods they do not use.

The idea behind this principle is that it is better to have smaller and more specific interfaces rather than a big interface.

If we had just one interface that covered a lot of features, clients of that interface would have to implement behavior that they didn't need. Instead, if we have smaller interfaces, clients can implement just the needed behavior.

Another advantage is that when we update an interface, the changes will affect less clients, so there is less risk of breaking the code.

Remember that a class can implement multiple interfaces, so there is no need to include everything in just one interface.

---

In the following bad example we have an interface for animals with 2 methods: walk and fly.

As you can see, the `Dog` class has to implement the method fly even though that class does not need it.

```ts
interface Animal {
  walk(): void;
  fly(): void;
}

class Dog implements Animal {
  walk() {
    console.log("Walking");
  }

  fly() {
    throw new Error("Dogs cannot fly");
  }
}

class Duck implements Animal {
  walk() {
    console.log("Walking");
  }

  fly() {
    console.log("Flying");
  }
}
```

Following this principle we can split the `Animal` interface into multiple ones. This way, the `Dog` class will only have to implement the methods that it needs.

```ts
interface AnimalCanWalk {
  walk(): void;
}

interface AnimalCanFly {
  fly(): void;
}

class Dog implements AnimalCanWalk {
  walk() {
    console.log("Walking");
  }
}

class Duck implements AnimalCanWalk, AnimalCanFly {
  walk() {
    console.log("Walking");
  }

  fly() {
    console.log("Flying");
  }
}
```
Verilog Projects For B.Tech
Published: 2022-08-20 09:39:29

Engineering student projects for B.Tech and M.Tech final year students. Takeoff Edu Group offers a wide range of projects best for [verilog projects for btech](https://takeoffprojects.com/verilog-projects-for-btech) looking for magnificent final projects at low cost. 
 
We have successfully delivered verilog projects for btech to our engineering students. Our programs are specially designed by experts for best results of verilog projects for btech for engineering students. max of the B.Tech, M.Tech, PhD and Diploma scholars.
 
Takeoff Edu Group provides the most creative conceptions and ideas that can make very effective final year projects for scholars, experimenters, and engineers. So browse through our list of [verilog projects for btech](https://www.youtube.com/watch?v=kzEHLbvmJgA&t=2s) and choose the smart final year projects for your requirements. 


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

Verilog is a HARDWARE DESCRIPTION LANGUAGE( HDL). It's a language used for describing a digital system like a network switch or a microprocessor or a memory or a flip − flop. It means, by using a HDL we can describe any digital hardware at any degree. Designs, which are described in HDL are independent of technology, very easy for designing and correcting, and are typically more useful than schematics, particularly for large circuits.

Verilog supports a design at numerous situations of abstraction. The major three are −
- Behavioral position
- Register- transfer position
- Gate Position

One can describe a simple Flip flop as that in the above figure, as well as a complicated design having 1 million gates. Verilog is one of the HDL languages available in the assiduity for hardware designing. It allows us to design a Digital design at Behavior Level, Register Transfer position( RTL), Gate position and at switch position. Verilog allows hardware contrivers to express their designs with behavioral constructs, postponing the details of perpetration to a after stage in the final design. numerous engineers who want to learn this language, veritably frequently ask this question, how important time will it take to learn Verilog? Well my answer to them is" It may take no further than one week, if you happen to know at least one programming language"
I made a virus
Tags: javascript, webdev, beginners
Published: 2022-08-20 09:35:58

Noot Noot?

## Watch the video here

{% youtube qrosbKZO47c %}

## Give it a ⭐ on Github
https://github.com/virejdasani/Noot-A-Virus

## Download it here
https://virejdasani.itch.io/noot-a-virus

I made the app using the Electron framework and JavaScript!
The app is called 'Noot A Virus' (it's not really a virus) because you can't close it like any other app once it's opened.
And in sometime, the Pingus multiply until your screen is covered with Pingus Nooting constantly!

Thanks for watching and reading!

> Use `Ctrl+Shift+Alt+X` to exit the app ;)

Let me know if you have any questions or comments!
Data Engineering 101: Introduction to Data Engineering
Tags: python, beginners, datascience, codenewbie
Published: 2022-08-20 09:18:00

Data Engineering involves building of systems to enable collection and data usage.

A data engineer focuses on production and readiness of data.

However a data engineer and a data scientist do not perform similar functions but they work together.
As a data engineer produces data that is ready for use, a data scientist foucuses on using the ready made data for analysis.

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

For anyone interested in embarking on the journey to become a data engineer, the roadmap is already defined for you.

First ensure that you learn the relevant programming language needed, one can chose the most preferred from Python, Java,R,Scala,Rust.
However chosing a language that is widely used by different companies will be better.

Afterwards learn various frameworks as per the language you chose, not forgetting to include SQL.

Finally learn the fundamentals of cloud computing and database design.
All these techniques can be acquired from various platforms for free, such as:
Freecodecamp
YouTube
Sololearn
W3school
Datacamp
Learnpython.org
edX


For individuals who don't prefer being self taught,the internet has made it possible to learn through online schooling at an affordable fee, from Udemy, Udacity, Code academy,Coursera and so forth.

As you learn be sure to engage in the tech community for insights and mentorship, a good place to start from is Twitter.
Feel free to practice your coding skills in the following platforms to become better; Leetcode,Hackerrank, Coding bat and Coderbyte.

Hopefully this article has provided a snippet of the data engineering world, how to get started and the remaining answers you need are now upto you to find out as you learn.
MetaMask Login
Published: 2022-08-20 09:03:47

At its core, it acts as an Ethereum wallet: By installing it, you will get a key to a special Ethereum general address, with which you can begin mailing and receiving ether or tokens. MetaMask is a digital cryptocurrency wallet used to interact with the Ethereum blockchain that allows users to access their digital wallet via a browser extension or portable app, which can then be used to interact with decentralized applications. For more information click here [metamasklogin](https://maskmeta-login.mystrikingly.com/)
Brave Shortcut and Ubuntu Application
Tags: ubuntu, linux, brave
Published: 2022-08-20 08:52:00

Hi Everyone,
In this Article i want to explain how to create pwa from any site and adding it as launcher application
Some Websites not accept install as PWA but we want have it alike a application

### 1. Open Homepage of some website

I'm Choose [css-tricks.com](https://css-tricks.com) for example

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

### 2. Create Shortcut

To Doing this, first, on the top and left of view, click the hamburger menu and go to `More tools` > `Create Shortcut...`

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

### 3. Check As Window

Brave, show you a prompt, then, enter your custom name for application and Check the `open as window`

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

### 4. Tada!, Your Application created

application dekstop file exists on `~/Desktop/` directory by `brave-{ANY_NAME}.desktop` file name

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

### 5. Move to Luanchers

Move the `brave-{ANY_NAME}.desktop` file into `~/.local/share/applications/` path by Terminal or GUI

```bash
$ mv brave-{ANY_NAME}.desktop ~/.local/share/applications/brave-css-tricks.desktop
```

Then, You can change replace any name to instead 'css-tricks' because this make it readable

### 6. Change Properties

open `nano` in Terminal and update `Exec=` and `Icon=` property

```bash
$ nano ~/.local/share/application/brave-css-tricks.desktop
```

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

### 7. Change Executor

on the `nano` editor, change the `Exec=` property to `brave` as launcher (alike below screenshot)


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

### 8. Change Icon path

on the `nano` editor, change `Icon=` to correct path (alike screenshot)

NOTE : you should change `{USERNAME}` to your exactly username `/home/your-username`

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

you can copy the `{APP_ID}` from the `Exec=` property

### 9. Enjoy! :)
Ethical source movement, or how to try to fight the evil corporation to use your code
Tags: opensource, ethics
Published: 2022-08-20 08:24:20

## source :

{% embed 
https://stackoverflow.blog/2022/08/08/can-you-stop-your-open-source-project-from-being-used-for-evil %}

This post was made on stack overflow blog by 

> David Gray Widder is a PhD Student in Software Engineering at Carnegie Mellon, and has studied challenges software engineers face related to trust and ethics in AI at NASA, Microsoft Research, and Intel Labs. You can follow his work or share what you thought about this article on Twitter at @davidthewid.https://twitter.com/davidthewid

I found the article interesting enough to share it.

I received it via stack overflow newsletter.

https://stackoverflow.blog/newsletter/

## What does the article is about ?

> The Ethical Source Movement seeks to use software licenses and other tools to give developers “the freedom and agency to ensure that our work is being used for social good and in service of human rights.” This view emphasizes the rights of developers to have a say in what the fruits of their labor are used for over the rights of any user to use the software for anything. There are a myriad of different licenses: some prohibit software from being used by companies that overwork developers in violation of labor laws, while others prohibit uses that violate human rights or help extract fossil fuels...

I cannot say more without copy pasting the article which would be wrong.

> Free and open-source software licenses remove your ability to control what others do with your code. That’s kind of the point. It’s also why they’re so popular: anyone can use, remix, and sell your code into new technological possibilities with little restriction! What could go wrong?

Read it on the author blog.
Are Tuples really immutable? #PyTip03
Tags: python, programming, tricks, tips
Published: 2022-08-20 08:15:28

Tuple in Python are immutable Data Structures. Unlike sets, dicts and lists, the values in a tuple cannot be changed once initialized.

But is it really the case for tuples? See, tuples are immutable for the **contents they hold ** that means the **references of the objects** inside the tuple cannot be changed. But what if we change the contents of the **without changing the object references**.

To see it in action look at the below code

```
>>> p = 7
>>> id(7)
2917349484976
>>>p = 8
>>>id(p)
2917349485008
```

In the above code when we changed the value of an integer `p` the `id` of the object changed, that means the variable `p` started to point any other memory location. Now look at the below code.

```
>>> a = [1,2,3]
>>> id(a)
2917355980416
>>> a.append(4)
>>> id(a)
2917355980416
>>> a += [3,4,5]
>>> id(a)
2917355980416
```

In the above code we can see that even if we modify our list the id of the list reamains same, which means our variable a still points to the same memory location. We can exploit this behaviour to make our tuple immutable.

Type the below code to make a mutable tuple.

```
>>> tup = (1,2,[3])
>>> tup
(1, 2, [3])
>>> tup[2]
[3]
>>> tup[2].append(4)
>>> tup
(1, 2, [3, 4])
```

You can see that since the `list` object held its `id` even after we appended 4 to it, so the tuple had no problem mutating itself. The int data structure in Python changes its reference once its value is changes that is why we cannot change integer value in a tuple.

```
>>> tup[0] = 8
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
```

Thanks for reading, Hope you liked it.
I created landing page like "Pinterest" using splidejs and swiperjs
Tags: tailwindcss, react, splidejs, swiperjs
Published: 2022-08-20 08:15:00

Hi, there.

I have created a Pinterest landing page using the tailwindcss library and would like to share it with you. I tried to workaround it with a skeleton-like image at a less built-up stage.

I have made some changes, but this time I tried to reproduce the automatic slider in the first view. The stagger part is a bit truncated.

[pinterest landing page](https://www.pinterest.jp/)

[demo site](https://react-tailwind-pinterest-landing-vite-app.onrender.com/)

[demo code](https://codesandbox.io/embed/lucid-pine-9frkp1?fontsize=14&hidenavigation=1&theme=dark)

{% embed https://codesandbox.io/embed/lucid-pine-9frkp1?fontsize=14&hidenavigation=1&theme=dark %}


PS I'm adding a demo site that worked as expected with iphone mobile confirmation.

[demo site v2](https://react-tailwind-pinterest-landing-vite-gcum.onrender.com/)


Cheers.

Higashi Kota
[Laravel/Eloquent] Why you should avoid using Accessors?
Tags: laravel, eloque, php, accessor
Published: 2022-08-20 08:13:02

Hi Laravel developers,

As you may know, Laravel's Eloquent provides you a fancy way to create a "getter" and transform/access the data as how you want. Example:

```php
// App/Models/User 

public function getFullNameAttribute(): string
{
    return sprintf('%s %s', $this->first_name, $this->last_name);
}

// Seth Phat
$user->full_name;
```

Looks cool, isn't it? 

But, you have to avoid it as soon as you can, here are the reasons.

### 1/ Conflicts between the table's columns

As the example above, we can't tell the different between an accessor and a table's column. It is too similar how we access the data.

When your projects grow, more and more features come to join, overusing the accessors will create a big pain in your codebase:
- You can't tell the different between the columns and the accessors in your code. 
- Maintenance and tech debt will rise high.
- Confuse new people when they're reading the code, logic,...
- You have to open a SQL Manager (eg TablePlus) all the time to see what is it.
- ...

### 2/ Maintain phpDoc manually

The more accessors you have, the higher time to maintain the phpDoc of your Model class.

To make it IDE-friendly, code suggestions,... you have to add  your accessors into the phpDoc of your class, example:

```php
/**
* @property-read string $full_name // Accessor
* @property-read string $sex // Accessor
*/
```

Imagine you created 10 accessors, you have to add it 10 times. Or when you don't need it anymore, you need remove both the accessor and the doc attribute. 

Not so fun, IKR? 

### 3/ Hard to mock

When TDD comes to play, you want to write test. You want to mock your Eloquent model. The mocking process itself is a big pain.

Eloquent will check what attribute wanna access then return the data via `__get()` magic method. And to mock:

```php
$user = $this->createMock(User::class):
$user->expects($this->exactly(3))
    ->method('__get')
    ->willReturnOnConsecutiveCalls(
        'Seth Phat', // full_name
        'Male', // sex
        // ... more and more
     );
```

And I believe nobody would like that mocking process above. It is super hard to maintain.

## So what should I use?

A good'ol getter method is simply perfect. IDE-friendly, no need to maintain phpDoc, super easy to mock:

```php
public function getFullName(): string
{
    return sprintf('%s %s', $this->first_name, $this->last_name);
}
```

Mock:

```php
$user = $this->createMock(User::class):
$user->expects($this->once())
    ->method('getFullName')
    ->willReturn('Seth Phat');
// mock more...
```

With that mocking process, write test is totally enjoyable and easy to maintain.

### Limitation
- Can't use  `appends` & `hidden`
    - Alternatively: you can use [Laravel's Resource](https://laravel.com/docs/9.x/eloquent-resources#main-content) response and preferred to use this way instead of return a whole Eloquent Model

## Final

That's my experience for this one. How about you guys?

Cheers!
How to translate HTML for free using google translate.
Tags: javascript, webdev, googlecloud, verycool
Published: 2022-08-20 07:51:10

## Introduction 
While working on a new feature for my side project [eduo instrukcije](https://instrukcije.eduo.help/), I needed to translate HTML to other languages which was challenging to do for free. Google translate api has parameter "format" that when set to "html" ignores all tags and translates only real text, but it's not free. There are couple of reversed engineered google translate apis that are totally free, but none of them had the format option available. Then I found out that you can use Google Translate api inside google sheets, and you can create real apis with google sheets, and I think that's pretty cool.

## How to do it?
First open google sheets and open a new app script
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ztsdt9z9p0nry6gfj8bl.png)

Then paste this doGet function 

```js
function doGet(e){
  var params = e.parameter;
  var translation = LanguageApp.translate(params.text, params.froml, params.to, {contentType: 'html'});

  return ContentService.createTextOutput(translation).setMimeType(ContentService.MimeType.TEXT);
}
```
Then go and deploy your api

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

Make sure that type is Web app and that everyone has access to it
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3iix608m1tmiwfml21b8.png)

Then copy your url ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovlm2vef1c1iane7ert8.png)


## Testing
Go to your url and add query parameters 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p80amh23ixwipk2da41r.png)

And that's it! 

## One more thing

If you want to use this inside sheets, just modify the script:
```js
function translation(text, froml, tol) {
  return LanguageApp.translate(text, froml, tol, {contentType: 'html'});
}
```
Like this:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ayk2qqrm1xz1podte3r.png)
Press "run", and return on sheets.
Then you can use it like this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ftr6xs5bg1qb5svrf7t.png)
My personal surprises when learning to code.
Tags: junior, community, welcome, beginners
Published: 2022-08-20 07:36:37

Having got into coding recently there have certainly been some surprises for me.

Some of it had stemmed from how the code works Vs how I expected it to work. Some things seem counterintuitive until I dive and delve further into the why as well as the what and then it makes sense.

One of the surprises was the community and how friendly, helpful and supportive they are. I have always heard great things about coding communities but to see it and be on the receiving end has been different. I really see now how much of this is people's passion and it's so refreshing to see how excited people are to see others moving into their industry.

My biggest surprise though was how much I want to code!

Now I want to code for a living, I never saw it as a hobby or general past time. It for me was a way to make a living doing something I enjoyed. I always saw people who lived, breathed and slept code. The kind who do it for work, have personal projects on the go, spend time helping others and contribute to open source works too. I always admired those people but I always thought "these are people that live to work" and I am someone who "works to live".

How wrong I was!

The more I code, the more I want to code. I find myself becoming more and more passionate about it the more I learn and the more I write.

Just this week I almost cancelled two sets of plans because I just wanted to code or I was in the zone and didn't want to stop. Thankfully the voice in my head reminded me about balance in life so I closed the laptop and socialised like a good boy.

What I'm getting at is;

- I have discovered that you really can make a living out of something you love.
- I now know how wonderful it is to be part of a community.
- It's a great to have something to feel so passionate about.

I just can't wait to get myself up to speed and contribute to some projects myself.
Lamport timestamp
Tags: distributedsystems, algorithms
Published: 2022-08-20 07:16:00

## Introduction
Lamport timestamp is a method proposed by Leslie Lamport for generating sequence numbers that are consistent with a causality law.

## Lamport timestamp

1. Each node (replica) is assigned a unique ID.
2. (counter, NodeID) is the timestamp
3. If the counters have the same value, the one with the
larger node ID is considered the larger timestamp. (3,2) < (3,5)
4. When a node generates a timestamp, it compares the largest value it is aware of with the client's value and sets the larger value as the timestamp counter value.

The figure below shows a concrete example of a Lamport timestamp.

![Lamport timestamp](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12xjgxwrnrmay9pa52fm.png)

The order of execution in the above diagram is as follows.

(1,1)<(1,2)<(2,1)<**(2,2)<(3,1)**<(4,1)<**(5,1)<(5,2)**

Comparing this sequence with the figure shows that real time and the time line do not match. For example, in real time, (3,1) < (2,2) and (5,2) < (5,1), but in reverse order in the Lamport timestamps.

## Why is this so?
That is because the Lamport timestamp is always intended to define the entire sequence. In other words, Lamport timestamp cannot identify whether two operations were performed in parallel or causally dependent. Because of this, it is designed to be more compact than the version vector.
This week’s newsletter is out! (20-08-2022) - Actual empty list
Tags: javascript, tech, webdev, discuss
Published: 2022-08-20 06:59:34

---
title: This week’s newsletter is out! (20-08-2022) - Actual empty list
published: true
description: Another week of great javascript, tech and web development links.
tags: javascript, tech, webdev, discuss
---

Actual empty list

https://markjgsmith.substack.com/p/mark-smiths-newsletter-18-08-2022

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)