teleren/devto huggingface dataset:
How to Dynamically Generate Requirements.txt file for Python Apps
Tags: python, beginners
Published: 2022-10-16 03:08:49

Hey everyone, this is just a quick tutorial on how you can generate requirements.text file for your Python project. If you haven't been keeping track of all your imports and you haven't been maintaining a virtual environment.

So I started off this project. It's got quite a few imports. Some of these are built in modules, but you can see there's a couple of ones like Selenium and Rich.

And in this test file, I also have some other modules and I don't have a requirements.text file and I haven't generated a virtual environment.

So if I were to manually create a requirements.text file, I would have to manually do that. But I'm pretty lazy, so I don't want to do that. The best way that I've seen to do this is using a module called Pipreqs.

And Pipreqs, what it does is it has a look at your project. It has a look at all your imports, then it automatically generates the requirements.text for you. So I'm going to go ahead and show you how easy it is to get started with that.

First thing I'm going to do is create a virtual environment. You don't need to do this. I'm just doing it so I can show off the install of Pipreqs. So to create the virtual environment,

```
pip -m pip install venv
```

And this generates my Python virtual environment. Basically, this is just a Python environment that doesn't have any Python modules installed in it.

```
source VIRTUAL_ENV_NAME/bin/activate
```

So to activate that virtual environment, I go vm scripts and then activate.
Okay, so now let's get started with Pipreqs. And to install Pipreqs, it's just a pip install Pipreqs.

```
pip install pipreqs
```


And once you have `pipreqs` installed, all you need to type is `pipreqs`. 

```bash
# generate requirements.txt
pipreqs
```

And it's going to automatically create your `requirements.text` file. So there it is right there. Click it and you can see that it automatically detected all the modules that I'm using in my project.

Now in regards to the version, I'm not actually sure how it determines which version it should be using. I think it just puts in the latest version unless you have the module already installed on your system.

Then it probably looks at the one that's installed locally and determines it that way. I'm not sure. But if you know, let us know in the comments below.

And just looking at the Pipreqs documentation, you can see it's basically everything I went over. There's a couple other options here available to you.

But I mostly just use this for quickly installing the requirements.text file. It's really easy and convenient. And I find myself using it on quite a few projects nowadays.
Introduction to NodeJS
Published: 2022-10-16 02:53:58

Before Starting learning NodeJS or Blindly following any tutorial it is very crucial to know what is NodeJs  ? For what purpose it is used for and with tonnes of option why we should go with NodeJS . So without any delay let's dive into it. 😀

**What is NodeJS ?**
NodeJS is a cross-platform runtime environment for running JavaScript applications outside the browser.So what does it mean. I will explain this in very simple way.

So before NodeJS one can't run JavaScript Code to our system.Now don't confuse here.Before NodeJS developers can write JS Code but in order to see the Working they have to run it on the Browser like we will do when we initially learning HTML, CSS , JavaScript and somehow even now. 

So, When NodeJS was Introduced one can run Javascript code outside the Browser i.e. in our Terminals in any Operating System.

Thus,
NodeJS is a program that also contains a runtime environment. It can run JavaScript code, and it exposes a number of tools to JavaScript standard to the Node environment.

**For what Purpose we use NodeJS ?**

Node.js is widely used for creating  back-end of applications. 
**For Example :** Express.js which is a NodeJS web application framework used to build the back-end of classic web applications.
Also, it is used for server-side programming and non-blocking backend API services.


**Why you Choose NodeJS from Tonnes  of Back-End Development Tools ?**

So, here I am not Saying that NodeJS is the best for Backend Development and other are less efficient than this.But if someone who is a Front-End Developer, Javascript Developer, ReactJS Developer or know Javascript Libraries and Framework then NodeJS is boon for him/her as they don't need to learn any new language.
While learning or writing NodeJS one cann't say that we are learning some new syntax as it's totally familiar to them . So with this a Developer can work on both Front-End and Back-End by learning just one Language.

Node.js follows a single threaded model  which means there is no possibility of Deadlocks in this.

Moreover , Node.js is built on Google Chrome's V8 JavaScript Engine, so its library is very fast in code execution.

That's all about it's Introduction. I will come up with more Blogs related to MERN Technology soon.
Why we use single page application frameworks and which framework is best for web development
Tags: javascript, react, angular, node
Published: 2022-10-16 02:50:07

There are many reasons to use a Single Page Application framework for web development. Some of the benefits include: 

- SPAs can improve the performance of your web application by reducing the amount of data that needs to be transferred between the server and the client. This can result in a faster and more responsive user experience.

- SPAs can make your web application more scalable and easier to maintain. This is because there is less code to manage and update.

- SPAs can provide a more fluid and interactive user experience, similar to a desktop application.

There are many different Single Page Application frameworks available, so it is important to choose one that is best suited to your needs. Some of the most popular SPAs include AngularJS, ReactJS, and VueJS.
CLRS - Foundations - 1
Tags: algorithms, clrs, programming
Published: 2022-10-16 02:43:37

#### The Roles of Algorithms in computing 

Page _5 - 10_

- What is algorithm ?
  - An algorithm is any well-defined computational procedure that takes
some value, or set of values, as input and produces some value, or set of values, as
output.

-Learned about how algorithms is playing a crucial role in development of humanity 
 - The Human Genome Project has made great progress toward the goals of identifying all the 100,000 genes in human DNA, determining the sequences of the 3 billion chemical base pairs that make up human DNA, storing this information in databases, and developing tools for data analysis. _Just think about it !_
<hr>
- What is data structure ?
 - A data structure is a way to store and organize data in order to facilitate access and modifications


- Learned about parallelism 

- An brief introduction to **NP**-complete problems and why are they so interesting 
 - No one knows whether or not efficient algorithms exist for NP-complete problems. Second, the
set of NP-complete problems has the remarkable property that if an efficient algorithm exists for any one of them, then efficient algorithms exist for all of them
Automate send email using nodejs
Tags: machinelearning, javascript, node, android
Published: 2022-10-16 02:26:34

Node.js is a powerful tool for automating email sending. With a few simple lines of code, you can set up a node script to send an email automatically.

To start, you will need to create a file called "sendEmail.js" and include the following code:

var nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: 'yourEmail@gmail.com',
    pass: 'yourPassword'
  }
});

var mailOptions = {
  from: 'yourEmail@gmail.com',
  to: 'receiverEmail@gmail.com',
  subject: 'Sending Email using Node.js',
  text: 'That was easy!'
};

transporter.sendMail(mailOptions, function(error, info){
  if (error) {
    console.log(error);
  } else {
    console.log('Email sent: ' + info.response);
  }
});
Automate instagram with nodejs
Tags: javascript, node, android, beginners
Published: 2022-10-16 02:21:07

Assuming you already have a node.js server set up, you can automate your instagram posts with the instagram-node module.

First, install the module with npm:

npm install instagram-node

Next, create a new file called instagram.js and require the module:

var ig = require('instagram-node').instagram();

Now, you will need to configure the module with your instagram access token. You can get this by creating a new instagram application and following the directions here:

https://www.instagram.com/developer/authentication/

Once you have your access token, set it in the instagram.js file:

ig.use({ access_token: 'YOUR_ACCESS_TOKEN' });

Now you are ready to start making calls to the instagram API. For example, to get a list of recent media for a user, you would use the user_self_media_recent method:

ig.user_self_media_recent(function(err, medias, pagination, remaining, limit) {
  // your code here
});

There are many other methods available in the instagram-node module that you can use to automate your instagram posts. For more information, check out the module's github page:

https://github.com/instagram/instagram-node
Docker vs Kubernates
Tags: webdev, programming, productivity, python
Published: 2022-10-16 02:13:28

Docker and Kubernetes are two of the most popular container orchestration platforms. They are both open source and have a large community of users and developers.

Docker is the older of the two platforms and has been around since 2013. It is a lightweight platform that is easy to install and use. Docker containers can be run on any Linux server.

Kubernetes is a more complex platform that was originally developed by Google. It is designed to run on a cluster of servers and can be used to manage a large number of containers.

Both Docker and Kubernetes have their own strengths and weaknesses. Docker is simpler to use and is more suited for development and testing environments. Kubernetes is more complex but is more scalable and can be used for production deployments.
Lvgljs, write lvgl with javascript
Published: 2022-10-16 01:41:38

Here is my project lvgljs, you can write lvgl by javascript, click the following links to enter the project
https://github.com/Sxs7513/lvgljs

you can write code like this

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

code Runing on Real Device

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/py2khxb2l9r0mxs9de7d.jpg)
HacktoberFest
Tags: opensource, beginners
Published: 2022-10-16 01:19:07

At the beginning of the last week I finished up a few of my larger assignments for other courses and began to really take a better look at the issues that were open to choose from when it came to Hacktoberfest. I and my class mates have been tasked by our open source development teacher to create 4 PRs to be accepted into Hacktoberfest, each one of an increasing complexity/difficulty.

## Issue hunting
At first glance I was pleasantly surprised at how many issues seemed to be opened, but once I took a slightly closer look I realized the vast majority of open issues that I would feel comfortable contributing to were already taken by somebody else. In fact it seemed like for the first 80 pages of Hacktoberfest issues with the "good first issue" tag all of the ones I felt I could work on were already spoken for by somebody else! I even changed the way that I filtered my issue search several times, eventually opting to permanently drop the "good first issue" tag in an attempt to further expand the pool of possible repositories to contribute to.

This is a feeling I still have now as I look through repositories, I have come to realize that the majority of my time working on this challenge will not be spent solving problems but rather finding problems that I can solve.

## My First Issue
In any case, I eventually came across a repository that I thought would make for a good first PR to test the waters and at least get started. There is a repository called the Clueless-Community Web-UI-Kit where a community of young devs have taken it upon themselves to create a beginner friendly project for anyone to contribute some HTML/Tailwind CSS components according to some guidelines specified in a given issue.

One of their open issues at the time of my coming across their repository was that of creating a Tutorial Markdown where there would be links to helpful starting point for learning HTML, CSS and how to work with git. I chose to take on [this issue](https://github.com/Clueless-Community/web-ui-kit/issues/6) and I drafted a Tutorial MarkDown of my own.

## My PR
After creating [my first Hacktoberfest PR](https://github.com/Clueless-Community/web-ui-kit/pull/25) one of the project maintainers told me to add a few more images for a bit of a nicer visual presentation, after I did it was accepted and is now used as a page to help new developers when getting started on contributing to the repository.
Izyum refactoring
Published: 2022-10-16 01:15:02

## Overview 
My task for this week was to refactor izyum and also use some new git techniques such as interactive rebase, squash commit and editing of the previous commit. 

## Refactoring potention
Izyum has a lot of space for improvement in terms of code refactoring. The first and most obvious thing was the fact that all code was contained in a single [index.ts ](https://github.com/Myrfion/izyum/blob/main/src/index.ts) file, which is a really bad practice. The combination of facts that it is a school project with deadlines and sometimes I can be pretty bad in terms of time management made the codebase to be a mess.

## Plan
Initially, I wanted to do the following things
- extract constants to the separate file
- separate the business logic of handling txt/md to the class in the separate file
- extract functions for file system used in the separate class 
- use some popular libraries to handle user input
- something else which might come to my mind on the way

## How it was
The first thing I decided to do was to use the command npm package to handle user input and put the configuration of possible user inputs in the separete [file](https://github.com/Myrfion/izyum/blob/main/src/program.ts). After that, I extracted constants to their own [file](https://github.com/Myrfion/izyum/blob/main/src/utils/contants.ts). The next thing was to extract the business logic. I decided to put functions which help to handle functionality related to the file system in the [files.ts ](https://github.com/Myrfion/izyum/blob/main/src/utils/files.ts) and created a file called [generated-file.ts](https://github.com/Myrfion/izyum/blob/main/src/generated-file.ts) which contains so-called class `GeneratedFile`. 

## Some other improvements 
During the rafactoring, I realized that I have pretty bad development experience which was partially because I used `common.js` inputs which for some reason disabled the good IntelliSense that you can achieve developing with the typescript. After some time playing with [tsconfig](https://github.com/Myrfion/izyum/blob/main/tsconfig.json)
file I managed to make it work. The last thing I also decided to do on the way was to add a prettier configuration to the project to have consistent code formatting for all repo contributors. 

## Rebasing 
After I was done with refactoring which took me about 7 commits I started the procedure of interactive rebasing with the `-i` flag on the `git rebase` and after some magic with editing setting `squash` to all commits except the first one which was `pick` and renaming using `git commit --amend` I was ready to merge changes in the `main` branch. 

## Final thoughts
Izyum has still a lot of space for improvement in terms of the code quality and development process. I want to add unit tests to it, so I would be sure that I don't break any key functionality and put it on the CI. The interactive rebasing turned out to be a pretty powerful thing to organize commits and overall git history.
Vì sao kỹ năng là một phần trong yêu cầu công việc?
Tags: vieclamtphcmtaivieclamtot, vieclamtphcm, timvieclamtphcm, vieclamtot
Published: 2022-10-16 01:14:45

Kỹ năng là một phần quan trọng trong yêu cầu công việc vì nó sẽ giúp bạn hoàn thành công việc hiệu quả. Nếu bạn nêu hai kỹ năng cứng và kỹ năng mềm trong CV, bạn sẽ có cơ hội cạnh tranh hơn cho vị trí mà bạn muốn ứng tuyển. 
Bạn nên nêu hai kỹ năng này trong CV như thế nào? 
+ Kỹ năng cứng sẽ bao gồm nhóm thông tin liên quan đến kiến thức, kinh nghiệm và kỹ năng chuyên môn liên quan đến nghề nghiệp mà bạn học được ở trường hoặc tích lũy trong công việc. 
+ Kỹ năng mềm như giao tiếp, thuyết trình, tư duy phản biển, lập luận, sáng tạo… sẽ là những hoạt động mà bạn có đời sống hoặc trường học.

Bạn có đang tìm [việc làm TPHCM](https://www.vieclamtot.com/viec-lam-tp-ho-chi-minh
), hãy tham khảo chi tiết hơn ngay link bên dưới >> 
[https://www.vieclamtot.com/viec-lam-tp-ho-chi-minh
](https://www.vieclamtot.com/viec-lam-tp-ho-chi-minh
)#vieclamtphcmtaivieclamtot, #vieclamtphcm, #timvieclamtphcm, #vieclamtot, #tuyendungvieclamtphcm, #tuyendungtphcm, #vieclamhcm, #tuyendunghcm
Java: เพิ่ม Root Cert เพื่อเรียก API SSL ที่มี Cert ของตัวเอง
Published: 2022-10-16 00:55:51

เวลาเราเขียน Java รันบน Application Server เช่น Tomcat หรือ Glassfish ถ้าเราเรียกหรือทำงานเกี่ยวกับพวก SSL Cert ที่เราสร้างเอง (จาก EJBCA) มันจะ Error ประมาณว่า มันทำ SSL Handcheck กันไม่สำเร็จ 

เพราะว่าใน Java มันก็ต้องมีการใส่ Root CA เพื่อให้ Trust SSL Cert นั้นด้วย เราสามารถแก้ได้ดังนี้

- เช็คให้ชัวร์ว่า Application Server ของเรารันด้วย Java ในเครื่องเวอร์ชันไหน (ในเครื่องอาจมี Java หลายเวอร์ชัน)
- เข้าไปที่ folder security ของ Java Home เช่น ถ้า Java 11 ใน Windows ก็เข้าที่ C:\Program Files\Java\jdk-11.0.11\lib\security  มันจะมีไฟล์ชื่อ cacerts อยู่
- เอา cert ของเรา (ของเราได้จาก EJBCA เป็น .jks) มา export เป็น .cert โดยใช้โปรแกรม KeyStore Explorer หรือถ้าได้ Cert ของ Root ที่เป็น .DER มาก็ได้ 

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


- เพิ่ม cert นั้นเข้า cacerts ของ Java **กำหนด -alias ให้ตรงกับใน .jks ของเราด้วยนะ** 

```
keytool -import -alias alias -keystore path-to-jre/lib/security/cacerts -file path-to-certificate-file
```
เช่น

```
keytool -import -alias xxxxxx -keystore "C:\Program Files\Java\jdk-11.0.11\lib\security\cacerts" -file "D:\certs\mycert.cer"
```
- มันจะมี default password เป็น changeit
**ลองใช้โปรแกรม KeyStore Explorer เปิดเข้าไปดูใน cacerts หรือ ไฟล์ cert ของเราได้**
DevStore : A small utility for programmers.
Tags: git, cpp, programming
Published: 2022-10-16 00:51:49

Hi guys, I recently started a new project called DevStore, I intended to make it a small project that I thought I would stop developing at v0.1.0 like all projects but this one isn't like those projects, I find it difficult remember all the passwords for GPG keys, SSH keys, etc so I wrote as a quick little command line tool that would help with but now I see it has much more potential, I am looking for more people to help develop it and work on it because I'm still new to C++ and my code isn't "satisfactory", any volunteers?

<edit>
https://github.com/abdulh4ni/DevStore
</edit>
The complicated (Not really) compiling of Boost on Windows for MinGW-W64.
Tags: boost, cpp, cmake
Published: 2022-10-16 00:41:12

If you use C++ you've probably stumbled upon Boost, a community driven program which creates tons of libraries that are very useful, some of them have even been added to C++ like the filesystem library which has been included since C++17, now I know you're not here to learn about boost but more about how to compile it so let's get to that.

First of all, pick a folder to keep the temporary folders, I like to use C:\temp for my temporary folders and C:\SDKs or C:\libs for my libraries. Once in your temporary folders location, download the version of boost you prefer, for this tutorial I'll be using Boost 1.80.0, you can download it and unzip it using these simple commands:
```bash
mkdir C:\temp\boost-b2
mkdir C:\{your-preferred-libraries-location}\boost
wget https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.zip
tar -xf boost_1_80_0.zip # Yes this works on Windows or PowerShell at least.
cd boost_1_80_0/tools/build
```
once in the tools/build folder you'll want to use the bootstrap.bat file supplied with the download to setup Boost.

```powershell
.\bootstrap.bat gcc

# And now we build
.\b2.exe --prefix="C:\boost-b2" install
```

And now for the fun part. (Not very fun)
You'll have to return to the C:\temp\boost_1_80_0 folder, and compile the libraries for MinGW using this command
```powershell
b2 --build-dir="C:\temp\boost_1_80_0\build" --build-type=complete --prefix="C:\{your-preferred-libraries-location}\boost" toolset=gcc install
```
This will take a while so find something to do while it's compiling.
Once it's done, you can add C:\SDKs to your system environment variables so that CMAKE can easily find Boost. You can also get rid of every folder we created in the C:\temp folder.

Now you can use the Boost library easily! The include folder is C:\{your-preferred-libraries-location}\boost\include\boost-1_80 and libraries are stored at C:\{your-preferred-libraries-location}\boost\lib. Happy hacking.
Codecademy CS104 Final Project: Pipelining Simulation
Tags: beginners, programming, python, architecture
Published: 2022-10-16 00:15:57

For my final project in the Codecademy CS104 course I wrote a program that simulates a simplified version of pipelining in a CPU taking instructions in assembly language.

##Project Requirements
The project was to build a Python program that simulates some of the functionalities of a CPU.

##My Program
To keep the simulation simple it has no branching and does not do the write-back.

The assembly instructions input the length, width and height of a box then calculate the box's Volume and Surface Area. 


The code can be found here [at GitHub.](https://github.com/acasagranda/CPU-Project)
Writing better documentation
Tags: documentation, php
Published: 2022-10-16 06:43:25

---
title: Writing better documentation
published: true
date: 2022-10-16 00:00:00 UTC
tags: documentation, php
canonical_url: https://jamessessford.com/blog/documentation
---

Over the past couple of months I've been asked at work to write more documentation.

This isn't a bad thing. I think even if you take away the instant benefits for the team/business and focus solely on yourself, it provides a sometimes easier way to refresh yourself on the inner workings of something than source diving a whole project/branch/feature to try and remember something.

I think the biggest problem I had with writing documentation was consinstency.

If I was using Word or a program like it, I'd have to remember all of the styles I was using for sections/headings etc and make sure I'd remembered to follow them throughout a sometimes lengthy document and that quite often left me in a state where I didn't want to even start writing, coupled with the fear of having to get a correct table of contents and page numbering right was also crippling.

## Enter Ibis

[Ibis](https://github.com/themsaid/ibis) is a fantastic tool created by [Mohamed Said](https://twitter.com/themsaid) that allows you to create a PDF document based on a directory of [Markdown](https://www.markdownguide.org/basic-syntax/) and image files.

## What's different?

Now I can write my documentation in an environment I have much more control over - Markdown and CSS.

As the [repo](https://github.com/themsaid/ibis) explains, it comes with two themes which are completely editable to the look and feel you wish to go for with your documentation and enforce consistency throughout.

It also allows you to add a cover image and automatically generates a clickable table of contents for your document, with all pages numbered correctly.