teleren/devto huggingface dataset:
Facebook SPY - Python CLI Tools for scraping Facebook
Tags: python, scraper, selenium, facebook
Published: 2023-10-13 20:26:42

### I would like to share with you one of the biggest projects I have ever worked on.

Facebook Spy is a tool for scraping data from Facebook profiles, pages, and search results.
For example, you can scrape all posts from a given Facebook account, and download images and videos.

### Info!
For more details and visualization check README or Documentation

Repository: [Facebook Spy on GitHub](https://github.com/DEENUU1/facebook-spy)
Documentation: [Facebook Spy Documentation](https://deenuu1.github.io/facebook-spy/)


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

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

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

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

## Facebook Spy offers the following functionalities:

- Login: Perform a secure two-step verification process to log in to your Facebook account with enhanced security settings or log in to your Facebook account using the default login method.
- Data Scraping: Retrieve details such as friend lists, images, recent locations, videos, reels, reviews, posts, likes, groups, events, and more.
- Local Web Application: Run a local web application to browse scraped data, create notes for specific user profiles, and easily search for details on the web.
- Video Downloader: Download all scraped videos from a Facebook account or simply by adding the provided URL.
- Visualize Connections: Create a graphical representation of connections between different Facebook profiles based on their friendships.
- Utilize an Open-Source Language Model: Use a free open-source language model to generate a concise summary of a Facebook user's information based on the scraped data.
- Friend Crawler: Initiate a friend crawler for a specified Facebook account, gather data about friends, and continue the process for subsequent users in the queue.
- Data Export: Save scraped data for a specified Facebook user to a PDF file for documentation and analysis.
- Parallel Scraping: Run scrapers in parallel to expedite the data collection process.
- Data Storage: Save all scraped data to JSON files and a database.
Partition arrays in Javascript using reduce.
Tags: javascript
Published: 2023-10-13 20:23:56

Suppose you have to partition an array of number given some predicates, how would you procede ?

I want for example, partition an array given the following predicates :

```js
 [
    (x) => x % 3 == 0, 
    (x) => x % 4 == 0
 ]
```

Below the partition function. 

The nice thing is that we do all the treatment in one pass, without relying on the filter method.

Thanks to the **reduce** method.

```js
function  partition(data, predicates = []) {
  const lp = predicates.length;
  return data.reduce((buckets, element) => {
    for (j = 0; j < lp; j++) {
      if (predicates[j](element)) {
        buckets[j].push(element);
      }
    }
    return buckets.map(t => t.sort((x,y) => x - y));
  }, 
  // Here we create as many arrays (buckets) as predicates
  // This array of 'buckets' constitute the accumulator
  // of the reducer.
  [...Array(lp)].map(() => []));
}

const a = [16,8,1,27,3,2,4,6,9,11]

console.log(
  partition(a, [
    (x) => x % 3 == 0, 
    (x) => x % 4 == 0
  ])
)


```

You can play with it here [Partition](https://flems.io/#0=N4IgZglgNgpgziAXAbVAOwIYFsZJAOgAsAXLKEAGhAGMB7NYmBvEAXwvW10QICsEqdBk2J4wAVzTViEegAI5ABwwAnGTPoAKACYZiGCkpUxtEanvhyAvHOQBdAJRzgAHTQKhcYnKiLrRkzMLOHxYNABzYkIAbjcFY2JxFXddfXxjbXFqGE1NACMsgGsYYjhDGFgcBicrAD5nOIU5MFoVOU1efwAGaLlOgB4fRV7eAGpRp1d3JoUIMHbFDKDGOGReO00KmCriB0nGmYUC6mLStbt8RXE4Qk3KkQdY6ZnWA7lX57kEpPdj05CsBhFJpvHU5MR8HBWsRcgAPCgATxq9VhcgAtHIkY9Guw5I0APT4uQACRgxjkAHcYHJqMYLHIMHA5IC0AiGSoVBgEUzGQFTOYVgSiQAVQgQHkcrlyWjzADkfxKcFlNPoXggiUY4MI1Iw1Go4iw4igelaQul8yi1IyWWpEikGjQjWQ+BdAEFJQjNL4HBdAcDNMjbI5sWgPm5PN4MP5kABGABsFAAHBQYxQAEwAdgoAGZ0xQACwUBMAThTMbsbnDqtosFCtHCmkayjU6tkaE0Blsb00sMDqIApHJs9YbF1DN3e9YUXJB-mR3Iuo1HG4HJW0JQQHAttI2wgeGmAKyILporrHtgcECYHB4fDUOACGj0RjMHhsOysIA)

Result :

```js

[ [ 3, 6, 9, 27 ], [ 4, 8, 16 ] ]

```


Don't hesitate to comment, correct or enhance.
RecursionError in SQLAlchemy SerializerMixin
Published: 2023-10-13 20:17:18

The error, typically originating from the serializer.py file, specifically in lines such as:

```
File ".../sqlalchemy_serializer/serializer.py", line 120, in __call__
    return self.serialize(value)
File ".../sqlalchemy_serializer/serializer.py", line 171, in serialize
    if isinstance(value, types):

```

**Decoding the Causes**
1. Recursive Serialization Pitfalls
The SerializerMixin library aims to simplify the serialization of SQLAlchemy objects. However, if your data model involves circular relationships, the serialization process might unintentionally trigger an infinite recursion loop.

2. Misleading isinstance Check
The isinstance check in the serialize method could be misleading. It's paramount to ensure that this check aligns seamlessly with your model definitions and doesn't inadvertently lead to circular references.

3. Circular References in Model Architecture
Inspect your SQLAlchemy model definitions, such as those for User and Item. Circular references in relationships or hybrid properties can be a breeding ground for the recursion error.

**Tactical Steps for Resolution**
1. Scrutinize Serialization Logic
Dive into your serialization logic, especially within the serialize method. Detect any recursive calls or situations that might trigger an infinite loop. 

2. Rigorous Model Definition Review
Conduct a meticulous review of your SQLAlchemy model definitions. Scrutinize relationships and hybrid properties to ensure they're configured correctly.

3. Dependency Check and Update
Verify that you're leveraging the latest versions of SQLAlchemy and SQLAlchemy SerializerMixin. Compatibility issues might be addressed by updating your dependencies.

4. Isolation Testing
Create a minimalistic test scenario where you attempt to serialize a basic object using SerializerMixin in isolation from your main application. 

**Conclusion**
Understanding these common errors and their root causes is crucial for effective management of this error.
Linear Regression or Random Forest for AirBnB?
Published: 2023-10-13 20:13:26

The choice between linear regression and random forest regression for predicting booking prices on Airbnb depends on several factors, including the nature of your data, the relationship between your features and the target variable, and your modeling goals. Let's discuss the strengths and weaknesses of each approach to help you make an informed decision:

1. Linear Regression:
   - Strengths:
     - Simplicity: Linear regression is a simple and interpretable model. It assumes a linear relationship between the independent variables and the target variable.
     - Speed: Training a linear regression model is typically faster than more complex models like random forests.
     - Interpretability: You can easily interpret the coefficients of the features to understand their impact on the predicted price.

   - Weaknesses:
     - Assumption of Linearity: Linear regression assumes a linear relationship between the predictors and the target. If the relationship is not linear, the model may underperform.
     - Limited Complexity: Linear regression cannot capture complex, non-linear patterns in the data, which may be present in the Airbnb booking price prediction problem.

2. Random Forest Regression:
   - Strengths:
     - Non-linearity: Random forest regression can capture non-linear relationships between the features and the target variable. It is capable of modeling complex interactions.
     - Robustness: Random forests are less sensitive to outliers and noise in the data compared to linear regression.
     - Feature Importance: Random forests can provide insights into feature importance, helping you understand which features are most influential in predicting prices.

   - Weaknesses:
     - Complexity: Random forests are more complex models, and their predictions may not be as easily interpretable as those of linear regression.
     - Overfitting: Without proper hyperparameter tuning, random forests can overfit the training data, leading to poor generalization performance.
     - Computationally Intensive: Training a random forest can be computationally intensive, especially with a large number of trees.

Ultimately, the choice between linear regression and random forest regression should be based on empirical evaluation using your specific dataset. You can start by trying both models and assessing their performance using techniques such as cross-validation and metrics like Mean Absolute Error (MAE), Mean Squared Error (MSE), or Root Mean Squared Error (RMSE). Additionally, consider the interpretability requirements of your application and whether you value a simpler model (linear regression) or a more complex one (random forest) that may capture non-linear patterns more effectively.

In practice, it's also common to explore other regression algorithms like gradient boosting (e.g., XGBoost or LightGBM) and neural networks, as they may offer competitive performance depending on the dataset and the problem at hand.
Data Visualization
Tags: datascience, datavisualization, dseafrica, datamining
Published: 2023-10-13 20:13:01

**What is data visualization?**
Data visualization is transferring and changing information into some chart and visual stuff that we use it to make recognizing patterns in big datasets easier.
Visualizing data is one of the important part in data science which shows that data should be visualized after processing and modeling to help us make clear results. Also, data visualization is a part of the data architecture system, which maps the flow of data and provides a plan for data management, while documenting the assets of an organization.
Data Visualization has a very important role at analyzing data. For example, when a data scientist is writing advanced predictive analytics algorithms, visualizing the outputs is important to monitor the results and ensure that the models are working correctly. Because It is more simple to get result with visualization of the complicated algorithms than numerical outputs.
Totally, Data Visualization is a form of relation which show density and complexity of data in plots. The Pictures give us the ability to compare data and use them for analyzing the process in a more simple way.
**We know that data visualization is important but why?**
Data visualization, using visual data, provides a quick and effective way to communicate information.  It helps businesses to recognize which factors affect on the customer’s behavior and which region needs to be proved. Therefor, not only you can make the data more useful for beneficiaries, but also predict the sales rate with data comprehension and visualization.
**What are the features of data visualization?**
It is accurate, useful, efficient and scalable.
**What are the types of analysis for data visualization ?**
There are 3 types of analysis for data visualization:
- Univariate analysis: Here we use a special feature for analyze all the dimension and features of data. One of the best and most efficient single feature plots for input the information about data distribution is distribution piece. When we want to analyze the effect on the output variable according to the input, we should use the distribution chart.
- Bivariate analysis: comparing data between two features means we have a bivariate analysis.
- Multivariate analysis: here we compare more than two variables.

**What are the different data visualization models?**
At first the only way to visualize data was to use a Microsoft Excel to turn data into a table, bar chart or any other chart. we can use this method for out visualization but there are better ways for this work:
- Infographics
- Bullet charts
- Thermal maps
- Time series graphs
- Line charts
- Tree diagrams
- Area charts
- Bubbly clouds
Tips to get your Google Cloud certification for beginner
Tags: gcp, cloud, productivity, career
Published: 2023-10-13 20:02:14

**Article outline**
If you’re into software engineer or as developer then you have probably heard of Cloud or Google Cloud. To help you get started with Google Cloud check out to [learn more](https://cloud.google.com/)


**Why get Google Cloud certified**

- 87% of Google Cloud certified users feel more confident in cloud skills.
- More than 1 in 4 of Google Cloud certified individuals took on more responsibility or leadership roles at work.

Planning to taking Google cloud certification for your career 

**Select the Certification Paths:** Google Cloud offers various certifications, such as Associate, Professional, and Specialization certifications. Choose the one that aligns with your career goals and current skill level. Some popular options include the Google Cloud Associate Cloud Engineer, Professional Cloud Architect, and Professional Data Engineer certifications.

**Review Exam Guides:** Google provides detailed exam guides for each certification, which outline the topics and skills that will be tested. Review these guides to understand what you need to study.

**Training and Learning:** Google Cloud provides various resources, including documentation, online courses, and hands-on labs. You can use platforms like Coursera, Udemy, and Pluralsight for structured courses. Additionally, [Google's Cloud](https://www.cloudskillsboost.google/) offers hands-on labs for practical experience.

**Hands-on Practice:** Practical experience is key. Create a Google Cloud account (you may be eligible for free credits) and practice setting up different services, deploying applications, and managing resources. This hands-on experience is invaluable.

**Use Practice Exams:** There are many practice exams available online that mimic the real certification exam. These can help you get a feel for the types of questions and the time pressure.

**Community or Webinars session:** Join online study groups or forums where you can discuss topics with others who are also preparing for the same certification. Sharing knowledge and experiences can be very helpful.

**Others tips**
- Don't overwhelm yourself with resources 
- Focus on basic concept of cloud 
- Have Good plan about your [Examination](https://www.webassessor.com/) (online or Onsite) {I prefer the onsite Examination}
- Don't jumpstart the certification process within short time plan
How to edit any text on any page
Tags: html, development, website, javascript
Published: 2023-10-13 19:45:55

Did you know that you can edit any text on any page?

You can put any page into edit mode, which allows you to edit any text as if it were a text editor.

There is a `document.designMode` property that controls whether the entire document is editable.

It can be useful for creating mockups and taking screenshots by any non-technical people to suggest some changes based on existing functionality.

You can use it to create mems and take screenshot 😁.

## Simple (bookmarklet) version

You can create a bookmarklet to toggle edit mode on any page:

1. Right click on the bookmark bar -> `'Add this page to favorites'`
2. Edit this bookmark -> right click and select `'Edit'`
3. Update name & URL - copy and paste the following code into the URL field:

![edit bookmark](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i1yh1wvx9s69repo9afn.png)

```javascript
javascript:(function() { document.designMode = document.designMode === 'off' ? 'on' : 'off'; })();
```

## Developer version

Right click on any page -> `Inspect` (open Dev Tools) -> `Console` -> `document.designMode = document.designMode === 'off' ? 'on' : 'off'`

![toggle design mode in Dev Tools](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i02kzszscgxqv7sefp3o.png)

------

Both methods should work in all major browsers.

[Documentation on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode)


> **For non-technical users:** this only changes the page on your computer and all changes disappear when you refresh the page.
HTML Forms
Tags: html
Published: 2023-10-13 19:40:33

An HTML form is used to collect user input. The HTML `<form>` element creates an HTML form for user input. The `<form>` element is a container for different types of `<input>` elements, such as text fields, checkboxes, radio buttons, submit buttons, etc.

Using forms can be a good way to collect input data to use somewhere else.

## Text Fields
The Description for `<input type="text">` from [W3 schools](https://www.w3schools.com/html/html_forms.asp) says:

> 
"Displays a single-line text input field" 

As shown here
![Here I am using the form text field element to create a basic form with no CSS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rjgr0b0tczxfixc94w6.png)

```
 <h2>HTML Forms</h2>

    <form action="/action_page.js">
        <input type="text" id="fname" name="fname" placeholder="John"><br>
        <input type="text" id="lname" name="lname" placeholder="Doe"><br><br>
    </form>
```
The text field input type can be used to collect information like user names, passwords, etc.

## CheckBoxes
The Description for `<input type="checkbox">` from [W3 schools](https://www.w3schools.com/html/html_forms.asp) says:

> 
"Displays a checkbox (for selecting zero or more of many choices)" 

As shown here
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11r14wk9j6z9ofdgqok9.png)

```
 <form action="/action_page.php">
  <input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
  <label for="vehicle1"> I have a bike</label><br>
  <input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
  <label for="vehicle2"> I have a car</label><br>
  <input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
  <label for="vehicle3"> I have a boat</label><br><br>
  <input type="submit" value="Submit">
</form> 
```
The checkbox input type can be used to make multiple-choice questions.
Need advice ~ Solo Dev. vs Design UI&UX
Tags: solo, developer, ui, ux
Published: 2023-10-13 19:22:13

Hi guys,

I'm just a solo developer and I have some ideas as side projects.
Some of 'em should run with team, some of 'em can be done as solo. 
In anyway I need to design apps. Maybe as MVP I could go with only UX but I even need some advice about it.

Here's the point of this post, how could I get over _design_ problem? I'm widely open for any tips.
論文
Published: 2023-10-13 15:35:33

論文代寫是一種有爭議的做法，涉及僱用某人代表學生或客戶撰寫論文，然後將其作為自己的作品提交。 這個過程通常會掩蓋論文的真實作者身份，從而引起學術界內外的道德和實踐擔憂。 在本文中，我們將深入研究論文代寫的世界，探討其道德困境、現實世界的影響以及圍繞該行業正在進行的爭論。

論文代筆的機制

論文代寫通常涉及以下步驟：

客戶請求：學生或個人向代寫服務或自由撰稿人提出客製化論文的請求。 客戶指定主題、長度和任何其他要求。
**_[論文](https://hkproessay.com/)_**

作家分配：代寫服務或作家將專案分配給專門研究該主題的專業作家。
畢業 論文 代 寫
研究和寫作：作者根據客戶的指示進行研究並撰寫論文，通常遵循嚴格的截止日期。

交付：論文完成後，將交付給客戶，如有必要，客戶可以要求修改。

提交：客戶將論文作為自己的作品提交，通常不會透露它是代寫的。

道德兩難

圍繞論文代筆的道德考量是爭論的核心。 以下是一些關鍵問題：

學術誠信：主要道德問題之一是違反學術誠信。 代寫論文可能會破壞教育體系，因為學生可以透過自己未完成的作業獲得學分。

欺騙：論文代寫涉及欺騙，因為客戶將作品當作自己的作品展示。 這種欺騙行為削弱了學術機構內部的信任，並阻礙了對學生技能和知識的準確評估。

機會不平等：能夠負擔代筆服務的學生比無法負擔代寫服務的同儕擁有不公平的優勢。 這造成了一個不公平的競爭環境，並使那些沒有經濟能力的人處於不利地位。

學習與技能發展：教育不僅關乎成績，還關乎獲取知識和培養批判性思考技能。 代筆繞​​過了教育的這一重要面向。

實際影響

雖然論文代寫具有嚴重的道德影響，但它也具有實際效果：

教育價值下降：當學生依賴代筆作家時，他們就會錯過發展研究、寫作和批判性思考等基本技能的機會。 這可能會阻礙他們未來的學術和職業成功。

學術標準的侵蝕：代寫論文的盛行會導致學術標準的降低並降低教育品質。

對就業市場的影響：由於代筆作家通常是收費的，他們可能會搶走依賴教育產業謀生的教育工作者、作家和研究人員的工作。

法律後果：雖然論文代寫的法律方面可能因司法管轄區而異，但某些情況可能涉及欺詐或侵犯版權，從而導致潛在的法律後果。

持續的爭論

論文代寫問題引發了關於如何解決其道德和實際挑戰的討論：

教育機構：許多教育機構引入了榮譽準則和學術誠信政策來打擊論文代寫。 這些政策可能包括對提交代寫作業的學生進行嚴厲處罰。

提高意識：提高對論文代筆後果的認識至關重要。 學生、教育工作者和家長需要了解道德兩難及其對學術和職業發展的影響。

替代評估方法：一些教育工作者正在探索替代評估方法，例如口試、小組專案和現實世界應用，以減少論文代寫的誘惑。

代筆服務的監管：有人呼籲對代筆服務進行監管，以追究其在學術不端行為中的責任。

結論

論文代筆仍然是一個有爭議的問題，其道德和實踐影響引起了學術界的關注。 這種做法威脅學術誠信，貶低教育價值，並為學生創造不公平的競爭環境。 儘管正在採取措施解決這個問題，例如提高意識和更嚴格的學術政策，但隨著教育工作者、學生和社會努力尋找平衡學術嚴謹性和公平性的解決方案，圍繞論文代寫的爭論仍在繼續。
The Power of Server-Side Rendering in Next.js: Faster Loading, Better Performance by Anik routh
Tags: nextjs, nextjsserverside, javascript, seo
Published: 2023-10-13 19:19:06

Server-side rendering (SSR) is an effective approach for improving web application performance and loading speed. SSR allows you to render your React components on the server side before sending the HTML to the client in the context of Next.js, a popular React framework. This can result in faster initial page loads and improved SEO.

Here’s an example of how you can use server-side rendering in Next.js to achieve faster loading and better performance:

**1. Setup:**
Make sure you have Node.js and npm installed on your machine.

**2. Create a New Next.js Project:**
Open your terminal and run the following commands to create a new Next.js project:

`npx create-next-app my-ssr-app
cd my-ssr-app`

**3. Create a Server-Side Rendered Page:**

In your project’s pages directory, create a new file called ssr-page.js (or any other name you prefer).

```
// pages/ssr-page.js
import React from 'react';

const SsrPage = ({ serverTime }) => {
  return (
    <div>
      <h1>Server-Side Rendered Page</h1>
      <p>Server time: {serverTime}</p>
    </div>
  );
};

export async function getServerSideProps() {
  // This function runs on the server side and fetches data before rendering the page.
  const serverTime = new Date().toString();
  return {
    props: {
      serverTime,
    },
  };
}

export default SsrPage;
```

In this example, the getServerSideProps the function is responsible for fetching data on the server side before rendering the page. We're simply getting the current server time here.

**4. Start the Development Server:**
Run the following command to start the development server:

`npm run dev`

This will start the Next.js development server, and you should be able to access your application at http://localhost:3000.

1. Open your web browser and navigate to http://localhost:3000/ssr-page. You should see the "Server-Side Rendered Page" along with the server time displayed on the page.

2. The key takeaway here is that the getServerSideProps function is executed on the server side every time a request is made to the /ssr-page route. This allows you to fetch data, perform server-side computations, and customize the content of the page before it's sent to the client.

Server-side rendering can greatly improve initial page load times and provide better SEO, especially for dynamic content. However, it’s important to note that there are cases where static site generation (SSG) might be a more suitable choice, as it can provide even better performance in certain scenarios.

Remember to refer to the official Next.js documentation for more in-depth information and advanced usage: https://nextjs.org/docs/advanced-features/pages

Check out my Agency website and [click here.](https://www.devbucket.co)