teleren/devto huggingface dataset:
I love Linux ... and AppImages <3
Tags: linux
Published: 2021-05-24 21:47:23

I've been using Ubuntu/Debian/Nitrux/Manjaro ARM as my main go-to OS' for several years now. I absolutely love being part of this vast community of great individuals.

"Linux is difficult" - "Packaging is hard" was once the most predominant ways for software companies to tell users, why they didn't support Linux. 

But these days we got things like AppImages[1], which I think is very underappreciated within the community (just a feeling, no figures to back it up). Actually I'm unaware why AppImages aren't already part of all Linux distros out there. I guess it's because everyone is trying to roll their own distribution formats?

Anyway, An AppImage is a container format much akin to Mac Applications. You just download an AppImage from e.g. AppImageHub[2], set the execute permission on the file and off you go. No installation required - you can even place the AppImage file where ever you'd like. If you want to skip the "set execute bit" step and need tighter GUI integration there's a daemon called appimaged[3] that you can run beforehand which will take care of all this.

[1] https://appimage.org/
[2] https://www.appimagehub.com/
[3] https://github.com/probonopd/go-appimage
Laravel 8 Resource Route Tutorial Example
Tags: laravel, php, programming, tutorial
Published: 2021-06-03 04:20:20

<p>Hi Dev,</p>

<p>Today,I will expound you how to engender resource route in laravel 8. we will show laravel 8 resource routing example.laravel resource routing assigns the typical "crud" routes to a controller with a single line of code. for example, you may wish to engender a controller that handles all http requests for "posts" stored by your application. utilizing the composition:controller artisan command, you can expeditiously engender such a controller.</p>

more..

https://codingtracker.blogspot.com/2021/06/laravel-8-resource-route-tutorial.html
Retrieve Video List from the official TikTok APIs
Tags: php, tiktok, api, composer
Published: 2021-06-03 04:11:11

The [TikTok PHP SDK](https://github.com/andreaolivato/TikTok-LoginKit-PHP) has been updated, and the new [v0.2](https://github.com/andreaolivato/TikTok-LoginKit-PHP/releases/tag/v0.2) brings support for retrieving the User’s Videos.

If you’re new to the TikTok PHP SDK, please read my [previous tutorial](https://dev.to/andreaolivato/how-to-implement-the-tiktok-login-kit-for-web-in-php-2161) on how to log in and receive the Access Token. In that article, I also provide a bit of backstory and more general information about the TikTok Login Kit APIs for Web.
Once you’re all caught up and know how to log in and retrieve the access Token, retrieving the Videos is blazing fast.

The easiest way is to use the `getUserVideoPages` helper method, since it provides built-in pagination.

```php
$videos = $_TK->getUserVideoPages();
```

This will return an array that contains all the videos of the logged in user. Watch out because this will keep looping and calling the APIs for all the videos you have. So you might want to add the `max_pages` parameter. For example to limit to the latest 10 pages only:
```php
$videos = $_TK->getUserVideoPages(10);
```

If you want more control over the pagination, you can use the higher-level `getUserVideos` method, which allows you to manage your own pagination via the `cursor` and `num_results` parameters. For example, let’s say you only want the latest video:

```php
$videos = $_TK->getUserVideos(0, 1);
```

The pagination info is provided in the `cursor` and `has_more` returned values. 

Here’s how you can implement your own pagination:

```php
$videos = [];
$cursor = 0;
$count_pages = 0;
$max_pages = 3;
while ($vids = $this->getUserVideos($cursor)) {
    $count_pages++;
    if ($count_pages > $max_pages && $max_pages > 0) {
        break;
    }
    foreach ($vids['videos'] as $v) {
        $videos[] = $v;
    }
    if ($vids['has_more']) {
        $cursor = $vids['cursor'];
    } else {
        break;
    }
}
```

Once you have your `$videos` you can use the simple getter methods, for example `getCoverImageURL` to get all the available parameters.

Here’s a quick sample, populating a table

```php
foreach ($videos as $v) {
   $trs[] = <<<HTML
       <tr>
           <td width="100"><img src="{$v->getCoverImageURL()}" style="width:100%"></td>
           <td width="100">
               <strong>ID</strong>: {$v->getID()}<br /><br />
               <strong>URL</strong>: {$v->getShareURL()}<br /><br />
               <strong>Caption</strong>: {$v->getVideoDescription()}
           </td>
       </tr>
HTML;
  }
```

All done! If you have any suggestion on the class or its implementation please feel free to reach out on [GitHub](https://github.com/andreaolivato/TikTok-LoginKit-PHP) or [Twitter](https://twitter.com/andreaolivato).
Debugging a Crash in Unsafe Rust with Windbg
Published: 2021-06-03 03:51:42

Lately, I had a crash in my [Rust project](https://github.com/rustdesk/rustdesk) on Windows. It is hard to get any clue from the console messages, because it is a segmentfault crash related to unsafe rust code.
```
error: process didn't exit successfully: `target\debug\rustdesk.exe` (exit code: 0xc0000374, STATUS_HEAP_CORRUPTION)
```
I am familiar with Linux debugging tools like GDB and Valgrind. So I attempted to use Windbg.

# Install Windbg
Download and install Windbg via below link first.
[https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools)

# Debug with Windbg
Start your program `cargo run`. It is ok to run release version, but debug version has a bit of nicer symbol information.

Open Windbg, and attach your process as below.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h1sdhxvrqq2xseowcob8.png)
 
Then the process is attached and paused. Please click on "**Go**" button on Windbg toolbar to continue the process.

Now you can run your program until it crashes, and get a crash stack in Windbg as below.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o09tsgz7srqn9us5x6ev.png)
 
This is not the exact location that caused the crash，but it does help me solve the problem.
Python program to automate custom telegram chat forwarding
Tags: python, programming, telegram
Published: 2021-06-03 03:44:19

Github Link [tgcf](https://github.com/aahnik/tgcf)

The content of this article has been removed, because they no longer match with the latest version. Check the github link above.

The ultimate tool to automate telegram message forwarding.

You can forward messages from a source chat to a destination chat. You can configure tgcf to do exactly what you need.
9 Simple Full Screen Navigation Menu Using CSS
Tags: javascript, css, webdev, codenewbie
Published: 2021-06-03 03:18:29

I created 9 simple full screen navigation menu for beginners using CSS and JavaScript. These are just beginner level, you can play with to create your own designs. These designs are not made responsive.    

1. [Design 1] (https://codepen.io/kiran-r-raj/pen/gOmvZBB)
2. [Design 2] (https://codepen.io/kiran-r-raj/pen/qBrxLzV)
3. [Design 3] (https://codepen.io/kiran-r-raj/pen/rNyJogW)
4. [Design 4] (https://codepen.io/kiran-r-raj/pen/gOmvZyQ)
5. [Design 5] (https://codepen.io/kiran-r-raj/pen/GRWQPeY)
6. [Design 6] (https://codepen.io/kiran-r-raj/pen/NWpyeoZ)
7. [Design 7] (https://codepen.io/kiran-r-raj/pen/KKWQbJK)
8. [Design 8] (https://codepen.io/kiran-r-raj/pen/RwpQEqJ)
9. [Design 9] (https://codepen.io/kiran-r-raj/pen/qBrxLeV)

{% codepen https://codepen.io/kiran-r-raj/pen/gOmvZBB default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/qBrxLzV default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/rNyJogW default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/gOmvZyQ default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/GRWQPeY default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/NWpyeoZ default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/KKWQbJK default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/RwpQEqJ default-tab=result %}
{% codepen https://codepen.io/kiran-r-raj/pen/qBrxLeV default-tab=result %}
Accessibility Audit: Auditing/comparing a Bank site (India vs USA)
Tags: a11y, webdev
Published: 2021-06-03 03:14:11

>> I made a video to audit the sites and it is in Hindi.

Hello All,

I did a few audits of the websites to create awareness around accessibility and highlight the broken experiences. 

This time I did the accessibility audit and compared the same brand's website of India and the USA to show the huge difference between the accessibility level.

[Here is the video](https://youtu.be/9gvawF9szJs)

PS: This video is totally for educational purposes and not to defame the brand. If anyone has any issues please feel free to reach out to me and we will work to fix the issues of accessibility.
🔥 Call back functions in JavaScript
Tags: javascript
Published: 2021-06-03 02:58:01

📌 Definition:

Call back functions are those which are passed as an argument for a parameterized function.

✨ Ex: 

Lets say you have 3 tasks which needs to be done one after the another. As JavaScript is asynchronous in nature you will not have the control on the execution of the .js programs. 

So to achieve it, You need to control each actions(ie, functions which perform some actions on the GUI). 

Here there are 2 tasks which needs to be executed one after the another: 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5y40tcijyine4d8yiwy0.png)
 
Output: 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6cw7fkuxdxkb5i61321.png)
 

Now, Set a timeout for one function and then execute the program and observe the actual results. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zdk1p20a1rlprfsvu3cn.png)
 
Output:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p9ofduilpxc2xkoc4h1w.png)
 
Hence, If the expectation is to execute a function before another, Ensure to call it inside a function which is referred as "Call back" function
Front-end Standards
Tags: javascript, css, html, tips
Published: 2021-06-02 17:48:41

For any moderate to large programming project you will want to set some standards or guide lines. Settings standards assists in readability for collaborative efforts as well as helping when coming back to a project after some time has passed. If you are joining or taking over a project, then adopt the established standards to maintain consistency.

Programming standards can include naming conventions, indentation, white space, organization and methods of inclusion into the overall architecture. It can also include things to avoid.

Most of my front-end programming is done in Vanilla JavaScript, HTML and CSS with some support libraries, such as jQuery. Following are some of the standards I use to make my code easier to follow and maintain:

##Naming Conventions

Descriptive names: use longer, descriptive names to clearly identify usage. Exceptions can be made for tight loop counters or small arrow functions.

```javascript
let myArray = [ 'eggs', 'bread' ]; // bad, non-descriptive name
let shoppingList = [ 'eggs', 'bread' ]; // good, descriptive name
```
Pascal Case: for named functions
```javascript
function CalculateSum(a,b) {
  return a + b;
}
```

Camel Case: for variables and object properties
```javascript
let camelCaseVariableExample = null;
let camelCaseObjectExample = {
 exampleProperty: 0
};
```
Lower Case: for CSS style names and HTML attributes.
```html
<div class='boldfont'></div>
```
Upper Case: for constants
```javascript
const MAX_LIMIT = 10000;
```
##Function Definitions

I use an object to act as a name space instead of putting my functions at the global (window) scope. This helps with organization and preventing name conflicts.

```javascript
let myNamespace = {};
let myNamespace.myComponent = function() {
 ...
 return {
   myTask: () => {}
 };
}();

myNamespace.myComponent.myTask();
```

What are some of the standards you like to use in your projects? Leave in the comments below.
Persistence
Tags: codenewbie
Published: 2021-06-03 02:44:32

Many of us struggle with the idea of persistence but it's one of the most important qualities you can have. If you want to achieve something, you need to persist. However, as humans we find this very hard to do.

We often rely on motivation and inspiration to do something. However, it's never enough. I heard a great quote from a YouTuber who said: “motivation is fleeting.” This quote resonated with me and made me think about everything I had ever done in my life. 

Often pure passion, inspiration and motivation were not the only things that drove me to finish something. It was often other things like money, getting a qualification or the satisfaction of finishing something. Being persistent and committed is what helped me achieve my goals.

# 1.Get through the door
Using pure inspiration to stay committed isn’t sustainable. We’re emotional beings and our emotions fluctuate and lack objectivity. 

Because of this, we need to use methods and tools that help form habits and minimise the amount of emotion required.

An effective way to approach something is to just “get through the door.” What this means is, just show up and do something. That could be simply opening a book or turning on your computer. Once you are there, you will find that you will take the next step and start the task.

# 2.Small consistent steps
After you get through the door, you want to finish the task. It's easy to get overwhelmed so you want to set a small and achievable goal. 

A small goal could be: “I will work on this task for 25 minutes.” If you can do that and do it consistently, you’re taking small steps toward your goal.

As your consistency and commitment to these smaller goals increases, you can start to increase the amount of time you spend on something. It's about working your way up to bigger things, but it’s always good to start small.

# 3.Block out negativity 
Don’t let any form of negativity get to you. This is easier said than done, but some good ways to do this is are:
- remind yourself of your goals,
- have faith in the process,
- don’t compare yourself to others,
- know your worth,
- understand and value your unique skills and experience,
- be patient with yourself,
- be kind to yourself,
- surround yourself with positive people who support and encourage you, and
- block out negative information, thoughts and ideas.

# 4.Don’t over do it
Don’t push yourself too hard. Hard work is good and important but know your limits. Make sure you take breaks and don’t burn yourself out. If you burn yourself out, you will lose the desire to keep going.

# 5.Conclusion
This blog does not discuss anything technical about coding or programming. It’s something I want to share about my journey. It's about knowing how to: 
- follow a plan, and
- turn my passion for coding into something tangible.
Investment Tip For Students
Tags: investment, money, webdev
Published: 2021-06-03 02:36:32

**All I can say is start investing if you can :)**

**Why?**

- Second Income Is Important 

- Risk-Taking capability is high 

- Financial stable 

- Will Get to know about how the finance things works 

- Money 

**Where to Invest?**

- Stock Market

**How to start?**

- Youtube

**From where to get money to invest?**

- Pocket Money

- Savings

**How much to invest?**

- That you can afford to lose.


**Note:**

- 
Don't jump directly to the stock market, First understand all the concepts and see how people invest 

- 
My suggestion - **long term investment**  


- Invest after learning and understanding the company you are going to invest in.


- 
Don't follow anyone blindly and stay away from the telegram channels until you trust someone


- Happy Investing :)


**Follow for more tips :)**
Convert JS associate array to JSON
Published: 2021-06-03 02:02:52


An associative array is an array with string keys rather than numeric keys[1]. Sometimes, we need to convert the array into a JSON object. Here is a single line of code to do it;

```
let jsArray = []
jsArray['name'] = 'foo'
jsArray['birthday'] =  '04-04-2011'

console.log(jsArray['name'])

if (Object.keys(jsArray).length !== 0) {       
   let json = Object.assign({}, jsArray)
   console.log(json)
}
```

output:
```
foo
{
name:"foo",
birthday:"04-04-2011"
}
```

https://playcode.io/776216/

Readings:
* [1] http://dyn-web.com/javascript/arrays/associative.php
Find and Replace a Bunch
Tags: sed, text
Published: 2021-06-03 02:00:51

_Reposted from [original article](https://reergymerej.github.io/blog/2021/06/03/redactor.html)_

Say I'm writing a journal and want to make sure I'm not leaking names.  I'd like to change it consistently so it's anonymous, but still makes sense.

Instead of this

```
John force-pushed to `master` for some reason.  Harold didn't pull before he
added his fix and Betty ended up cherry-picking into yet another branch.  To
avoid this, next time we could...
```

I'd like this

```
Farmboy force-pushed to `master` for some reason.  Jimmybob didn't pull before
he added his fix and Horsenator ended up cherry-picking into yet another
branch.  To avoid this, next time we could...
```

Find-and-replace is what I want to do, but consistently and repeatedly (and quickly!).  `sed` is the tool for the job.


First, define the replacements in files named `encode` and `decode`.

## Encode

```
s/Betty/Horsenator/g
s/Harold/Jimmybob/g
s/John/Farmboy/g
```
## Decode
```
s/Horsenator/Betty/g
s/Jimmybob/Harold/g
s/Farmboy/John/g
```

## Replace

Then to replace, we use one of
```
sed -i "" -f encode journal.md
sed -i "" -f decode journal.md
```

Obviously, we don't want to keep the encode/decode files with the output, but you get the idea.  You can also send a whole bunch of files through `sed` with this set up.  Maybe you could add a build step that cleans up content or something.

[This article](https://reergymerej.github.io/blog/2018/12/06/thats-what-she-sed.html) gives explains a few more basic `sed` options that may help you get started.

You can find an example [here](https://github.com/reergymerej/doof) to play with.
There's a first time for everything- My first simple app using React.
Tags: beginners, react, javascript
Published: 2021-06-03 00:57:09

I met with my mentor and we discussed that I would make a simple app using react. It took me some time which was expected but I did it! As soon as I downloaded node.js and opened it VS code I didnt know where to start. LOL. I edited the text and started removing code to see what would happen on the screen. I eventually came up with an idea and decided to start from scratch. I had all the errors in the world and I just took my time to figure out where I was going wrong(a.k.a googled and looked at my notes). Long story short, I sent a screenshot to my mentor and I received good feedback. I was so excited because that was my first time writing my own code for something I just learned. Other times I was reviewing code from my bootcamp.

Until next time!
Happy Pride Month! I created a flag compilation video to celebrate!
Tags: watercooler, lgbtq, pride, devpride
Published: 2021-06-03 00:37:20

I created a compilation video of the pride flags and their meanings to celebrate pride month, this year.
{% youtube 3tr8IjpNh9w %}

##<b><center><b>Happy pride month, everyone!<br/>Stay proud!</b></center></b>
Supercharging a Web Devs Toolbox
Tags: javascript, webdev, vscode, video
Published: 2021-06-24 02:06:40

---
title: Supercharging a Web Devs Toolbox
published: true
date: 2021-06-03 00:17:53 UTC
tags: javascript,webdev,vscode,video
canonical_url: https://www.aaron-powell.com/posts/2021-06-03-supercharging-a-web-devs-toolbox/
---

I recently gave a talk at the [Microsoft Reactor](https://developer.microsoft.com/reactor/?WT.mc_id=javascript-29304-aapowell) showing off a bunch of tools that I think are super powerful when doing web development that some folks might not know of.

You can catch the recording on YouTube.

{% youtube 1QQVQ8vTUXU %}
JS Project
Published: 2021-06-03 00:13:05

After working with JS during this unit, I can easily say that the more I dive into the course, the more I feel the creativity flow through my veins! Each and each project I feel like I learn so much more to do with Full stack development! 

My JavaScript app was made for people who play fighting games. Its hard to memorize all of those pesky move inputs and not to mention the matchup information too, so I created an API notebook for people to keep track of their notes for a character or a specific matchup so that during a tournament or even during any point playing, you can easily jot down and read notes on your specified characters gameplay! At the moment I only have Mortal Kombat 11 characters on file but I do plan to expand! Thank you for taking the time to read my post! To React!
How to reset the primary key sequence when it falls out of sync in Postgres?
Tags: database, sql, postgres
Published: 2021-07-15 23:45:01

---
title: How to reset the primary key sequence when it falls out of sync in Postgres?
published: true
date: 2021-06-03 00:00:00 UTC
tags: database, sql, postgres
canonical_url: https://www.ankursheel.com/blog/reset-primary-key-sequence-out-of-sync-postgres
---


## The Problem

When we insert a new row in a table with a sequential primary key, we get a "23505: duplicate key value violates unique constraint" error.

This implies that a record already exists for the next number being returned for the sequence.

The reason this happens is that the primary key sequence is out of sync with the table rows.

## Assumptions

-   The table name is "**_table"_**
-   The column with the issue is "**_id_**."

## Validate that the sequence is out-of-sync

Before we reset the sequence, let us make sure that it is out of sync.

```sql
SELECT nextval(PG_GET_SERIAL_SEQUENCE('"table"', 'id'));

SELECT
    CURRVAL(PG_GET_SERIAL_SEQUENCE('"table"', 'id')) AS "Current Value",
    MAX("id") AS "Max Value"
FROM "table";
```

**Line #1:** We make a call to **_nextval_** because if we call **_currval_** before calling **_nextval_** in the current session, it will give us an error similar to "**_ERROR: currval of sequence "table_id_seq" is not yet defined in this session_**".

**Line #3-6:** Gets the value most recently obtained by **nextval** for this sequence in the current session along with the maximum value for **_id_** in **_table_**.

Our sequence is out-of-sync when the **_Current Value_** is less than **_Max Value_**.

### What does PG_GET_SERIAL_SEQUENCE do?

`PG_GET_SERIAL_SEQUENCE('"table"', 'id')` can be used to get the sequence name.

Using this, we can avoid hard-coding the actual sequence name, which helps avoid any incorrect assumptions about the sequence name.

_Note that the table name is in double-quotes, surrounded by single quotes._

## The Fix

```sql
SELECT SETVAL(
    (SELECT PG_GET_SERIAL_SEQUENCE('"table"', 'id')),
    (SELECT (MAX("id") + 1) FROM "table"),
    FALSE);
```

This will set the sequence to the next available value higher than any existing value for "**_id_**" in **_table_**. Further inserts will not result in a "duplicate key value violates unique constraint" error.

## References

-   [Sequence Manipulation Functions](https://www.postgresql.org/docs/current/functions-sequence.html)