teleren/devto huggingface dataset:
Rapid building with Rust on Windows for WLS2
Tags: rust, windows, wsl2, development
Published: 2023-10-08 05:23:51

## Fast Build on Windows for WLS2

This is a quick post y'all! less than 2m read!

> [Credit `markentier.tech` with their post here!](https://markentier.tech/posts/2022/01/speedy-rust-builds-under-wsl2/)

## Background

I have been struggling compiling on windows with incremental builds & they take forever. After doing lots of Googling I stumbled across the post from `markentier.tech`. After doing some testing my compile times on a [large project for Valheim](https://github.com/mbround18/valheim-docker) went from 3-5 minutes to 30 seconds. Back to those beautiful compile times like on my Linux dual boot!

## Setup 

1. Install `make` and `rsync`
2. [Copy the following `Makefile` into your repo](https://gist.github.com/mbround18/da7e141f8f75acb40281ac5860a04faf)
3. Run `make wsl.build`

## Conclusion

This moves your files into a temp directory on your Linux sub-system which allows it to compile directly without the jank of cross system. After compilation it `rsyncs` only the outputs needed to your target directory if you are using it docker builds or other.
SageMaker JumpStart: start experimenting with large language models in minutes!
Tags: aws, ai, llm, huggingface
Published: 2023-10-09 12:44:03

---
title: SageMaker JumpStart: start experimenting with large language models in minutes!
published: true
date: 2023-10-08 05:23:28 UTC
tags: aws,ai,llm,huggingface
canonical_url: https://julsimon.medium.com/sagemaker-jumpstart-start-experimenting-with-large-language-models-in-minutes-3b21e0b721fb
---

Experimenting with the latest and greatest models doesn’t have to be difficult. With [SageMaker JumpStart](https://aws.amazon.com/sagemaker/jumpstart/), you can easily access and experiment with cutting-edge large language models without the hassle of setting up complex infrastructure or writing deployment code. All it takes is a single click. In this particular video, I walk you through the process of deploying and testing the Mistral AI 7B model as an example.

{% youtube vQFuZUAFel4 %}

To get started, you simply need to navigate to the SageMaker JumpStart website and locate the Mistral AI 7B model. Once you find it, you can click on the model to select it. This will initiate the setup process, which takes care of all the required infrastructure for you. Once the setup is complete, SageMaker JumpStart provides a sample notebook and you can start testing the model immediately!

If you want to experiment with the latest state-of-the-art models like the Mistral AI 7B model, SageMaker JumpStart provides a hassle-free way to do so. Try it out and explore the possibilities of cutting-edge AI models with just one click!
managing an open source project: what i'm learning
Tags: opensource, management, github, learning
Published: 2023-10-08 04:59:07

As someone delving into the complexities of managing an open source project, I've realized it's not just about writing stellar code. The community around it plays a vital role too. Here's what I've gathered on how to manage a community-driven open source project.

### clear documentation is key

First and foremost, clear documentation can make or break your project. It helps newbies get on board and seasoned devs understand your thinking.

### regular engagement matters

Keeping an open channel of communication makes everyone feel heard. It's as much about building relationships as it is about building code.

### guidelines and templates are your friend

Having set guidelines and templates helps contributors know what you expect, which makes the whole process a lot smoother.

### governance isn't a dirty word

Decide how decisions will be made and who gets to make them. Transparency is key here.

### code reviews keep us honest

No one writes flawless code all the time. A thorough code review process ensures quality and cohesiveness.

### milestones keep us on track

A well-thought-out roadmap with achievable milestones helps keep everyone focused and aware of the bigger picture.

### recognition fuels enthusiasm

Acknowledging the hard work and contributions of community members fosters a sense of belonging and ownership.

### licensing isn't to be ignored

Selecting an appropriate open source license is crucial. It sets the rules of engagement for everyone involved.

### keep up with updates and patches

Regular updates, even minor ones, show that the project is alive and kicking, which encourages more contributions.

### troubleshooting should be collaborative

A community-driven approach to solving issues can yield quicker and more robust solutions.

What I'm learning is that managing an open source project is as much about people as it is about code. It's a journey and a learning curve, but one that's incredibly rewarding.

By the way, if you're keen on contributing to an innovative open source project, do check out and star our GitHub repository [WebCrumbs](https://github.com/webcrumbs-community/webcrumbs). It aims to be the Wordpress for React, and we'd love your support!
The rise of micro-frontends: Breaking down the monolith in frontend development
Tags: programming, architecture, webcomponents, ui
Published: 2023-10-08 04:53:54

You've heard of microservices, but have you heard of micro-frontends? If not, buckle up—this concept is changing the game in frontend development, making it easier to manage large and complex applications. 

### What are micro-frontends?

Micro-frontends extend the microservices architecture to the frontend realm. In a nutshell, they break down large frontend applications into smaller, manageable pieces, each responsible for a specific feature or set of features. 

### Why use micro-frontends?

1. **Scalability**: With micro-frontends, you can easily scale specific features without affecting the entire application.
2. **Flexibility**: This approach allows you to use multiple technologies, enabling your team to choose the best tool for each job.
3. **Independence**: Teams can work on different features concurrently, accelerating the development cycle.

### Key Principles

#### Isolation

Each micro-frontend should be a standalone unit, developed, tested, and deployed independently.

#### Composition

These isolated units are then composed into a unified frontend. You can even employ various composition techniques like server-side includes or client-side orchestration.

#### Communication

Micro-frontends should communicate with each other and the backend services via well-defined APIs, ensuring a seamless user experience.

#### Reusability

Components and modules can be reused across multiple micro-frontends, promoting DRY (Don't Repeat Yourself) principles.

### Challenges

- **Coordination**: With more independence comes the need for better coordination between teams.
- **Consistency**: Maintaining a unified user experience can be difficult.

### Conclusion

Micro-frontends offer an effective way to manage the complexity of large frontend applications. It's not a one-size-fits-all solution but, in the right context, it can bring significant advantages.

### Take Action Now

Fascinated by frontend development trends? Give a star to our GitHub repository [WebCrumbs](https://github.com/webcrumbs-community/webcrumbs), which aims to be the WordPress for React. Your support matters!

{% embed https://github.com/webcrumbs-community/webcrumbs %}
Advanced Usage of the useState Hook in React
Tags: react, code, webdev, javascript
Published: 2023-10-08 04:49:56

Hello Dev Community!

Today, let's deep dive into the useState hook, an essential piece of React's Hooks API. While many of you might already be using this for state management in your functional components, there are some advanced nuances and patterns that might be new. Let’s dive in!

**1. Lazy Initialization**

Instead of passing the initial state directly, you can pass a function to useState which it will run to get the initial state. This can be helpful when the initial state is computationally expensive.


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

**2. Functional Updates**

When the new state depends on the previous state, you can pass a function to setState. This ensures that the updates are reliable.


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

**3. Using Multiple State Variables**

Instead of using a single state object, sometimes it's clearer and more optimized to use multiple state variables. This ensures that each re-render only touches components that rely on changed data.


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

4. Custom Hooks

Encapsulate stateful logic into custom hooks to make your components cleaner and more reusable.

**In Conclusion**

The useState hook, while simple at its core, offers a plethora of advanced patterns and strategies that can help developers write cleaner, more efficient, and more maintainable React code. Embracing these advanced techniques can significantly enhance the quality and performance of your React applications.

Happy coding! 🚀
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jnm7n0nkgk1wl30dsjn.png)
React Component Composition - Why does it matter?
Tags: react, webdev, frontend, context
Published: 2023-10-08 04:24:51

In React there are a lot of flashy tools (hooks) that can do a lot of things for you. `useContext()` has seen a lot of love as a way to avoid 'prop drilling', but what if I told you there was another way?

If you are simply trying to avoid 'prop drilling' in React there is an incredible prop you can use to avoid that. The `children` prop is under used, but incredibly powerful. 

## Children Prop - What is it?

The children prop is *almost* self-explanatory. You use the prop in your component as such:

```JSX 
const Home = ({children}) => {
	return (
	<div>
		<h1>Welcome to My Blog</h1>
		{children}
	</div>
	)
}
```

It may not seem like it is doing much in this instance, but it can open up a world of opportunities to avoid that pesky 'prop drilling'. In this example Home component, you can display nested components inside the Home component and go multiple layers deep without passing props through each layer. Say you have a component 3 nested components deep; you can pass the `children` component to each of the 'parent' components and render each nested component as a child of the 'parent'. Here is what your App component could look like that in this instance:

```JSX
const App = () = {
return (
  <div>
   <Home>
    <Component1>
     <Component2>												 
      <DeepestComponent neededProps={/*whatever 					 
      variables, functions, or state you need*/} />
     </Component2>
    </Component1>
   </Home>
  </div>
)
}
```

In this example instead of rendering Component1 inside the Home component, and Component 2 inside Component1, and the DeepestComponent inside of Component2, you render the `children` prop inside each parent and use composition to your advantage. So, in this example you can avoid props drilling from App all the way down through Home, Component1, Component2, and finally the component that needs it, DeepestComponent. Instead, you just pass the props straight to the DeepestComponent from the App Component.

There are of course drawbacks to this method, like "What if I need to pass props from Component1 to DeepestComponent?" or any other issues where state is necessary at multiple levels. In these cases, use `useContext()`, but if you aren't encountering an issue like that, you can use Component composition to your advantage.

Sources Referenced:

[Using Composition in React to Avoid "Prop Drilling"](https://www.youtube.com/watch?v=3XaXKiXtNjw)
Flatiron School Curriculum on React Context and Children Props
Excellent blogs for Rust
Tags: rust, programming, learning
Published: 2023-10-08 03:25:17

[Mara's Blog](https://blog.m-ou.se/)

[Raph Levien’s blog](https://raphlinus.github.io/)

[Faster Than Lime](https://fasterthanli.me/)

[matklad](https://matklad.github.io/)

[Faultlore](https://faultlore.com/blah/)

[Lord's Blog](https://lord.io/)

[PoignardAzur](https://poignardazur.github.io/)

[Sam Sartor](https://samsartor.com/)

[Matt Brubeck](https://limpet.net/mbrubeck/)

[Alex Dixon](https://www.polymonster.co.uk/)

[Tavian's blog](https://tavianator.com/index.html)

[Kani Rust Verifier Blog](https://model-checking.github.io/kani-verifier-blog/)

[Nicholas Nethercote](https://nnethercote.github.io/)

[Billy Messenger's BlogBilly Messenger's Blog](https://billydm.github.io/blog/)
74. Search a 2D Matrix
Tags: leetcode, medium
Published: 2023-10-08 03:22:23

Problem: [74. Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/description/)

<strong>Approach</strong>
```java
/**
Definitely binary search

2 steps:
- search for which row the target should fall into 
- then search within that row for the target 


How to search for which row 
hasRow = false;
int rowIdx = -1;
leftRow and rightRow

while (leftRow <= rightRow) {
    int midRow;

    if (target within midRow) {
        hasRow = true;
        rowIdx = midRow;
    }

    if (target < midRow[0]) {
        right = midRow - 1;
    } else if (target > midRow[size - 1]) {
        left = midRow + 1;
    }
}

if not found row: return false;

else, find within the row

*/
```


```java

class Solution {
    public boolean searchMatrix(int[][] matrix, int target) {
        boolean hasRow = false;
        int rowIdx = -1;

        int leftRow = 0;
        int rightRow = matrix.length - 1;
        int columns = matrix[0].length;

        while (leftRow <= rightRow) {
            int midRow = (leftRow + rightRow) / 2;

            if (target >= matrix[midRow][0] && target <= matrix[midRow][columns - 1]) {
                hasRow = true;
                rowIdx = midRow;
                break;
            } else if (target < matrix[midRow][0]) {
                rightRow = midRow - 1;
            } else if (target > matrix[midRow][columns - 1]) {
                leftRow = midRow + 1;
            }
        }

        if (!hasRow) {
            return false;
        }

        int left = 0;
        int right = columns - 1;

        while (left <= right) {
            int mid = (left + right) / 2;

            if (target == matrix[rowIdx][mid]) {
                return true;
            } else if (target < matrix[rowIdx][mid]) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }

        return false;
    }
}
```
It was not "Good First Issue"
Tags: programming, machinelearning, datascience, python
Published: 2023-10-08 03:13:56

## Good First Issue
It's defined as an easy pickings from popular projects. OH! It was easy to pick, doesn't mean it was easy to work on. I really wanted to pick machine learning projects, and when I saw that [Dagshub](https://dagshub.com/) had some issues they wanted to fix, I jumped in. Crazy enough, I did not realize how big this project was. Okay, I am at best an intermediate with coding. I can look through modules and reverse engineer how each module links to one another. That being said, this one took a while. It was thousands of lines of code.

## Biting off More Than I Can Chew
Let's not get ahead of ourselves. Let's start from the beginning. Long ago, in a faraway land called Canada, I decided to challenge myself to work on machine learning, just because that's the field I want to be in. So the categories were all there:

- :white_check_mark: Machine Learning.
- :white_check_mark: Python coding.
- :white_check_mark: Hacktoberfest label.
- :white_check_mark: "Good First Issue."

It was all there, so what did I do? I commented and took the issue [Issue 366](https://github.com/DagsHub/client/issues/366). I mean, it sounded simple enough: update a function so that we can download all data with no arguments involved.

## Questioning My Choices
I realized this project was huge when I couldn't get it to work. I had to install, reinstall everything for the past few days until somehow, some miracle happened, and I was able to make it work. Now, once I got it to work, it was time to make the changes. After some extensive soul-searching and some very questionable pieces of coding, I was able to determine that this was the only thing I needed to do.

```fields = [field.name for field in self.datasource.fields if field.valueType == MetadataFieldType.BLOB]```

Now why did I say it was hard? It was because I was overwhelmed by the size of the project, and somehow, they asked me to get and import Python black and import modules from another file called MetadataFieldType. Then they realized that they were missing a proper **Contribute.md**, so they had to raise an issue. Which showed me that even a big company can find faults in a simple humble contributor like me.

But **I CANNOT EMPHASIZE** enough how hard it was to run it... I was ready to reformat my entire system from all the things I had to install just to run it properly. After everything was said and done, I was able to finish it and count my lucky stars.

All in all, that was a nice first experience! Now it's time for part 2... ON TO THE NEXT ONE!
全国省市区街道区域信息 API 接口
Published: 2023-10-08 03:10:10

全国省市区街道区域信息 API 接口

提供全国省市区街道区域信息。

![gugudata_api_cover](https://static.gugudata.com/api_china_regions_v2.jpg)

# 1. 产品功能

- 更新了最新的 12 位编码的行政区划编码格式；
- 三种行政区划编码格式，与国家规范一致，最新建议调用 v3 版本；
- 提供全国最新、最全的省市区镇街道区域信息；
- 每周校对、清洗、更新数据，第一时间同步更新区域信息变动；
- 可返回行政区划中心点地理坐标；
- 最小级别可以详细到镇、街道以及居委会/村级别，为国内区域单元最小级别；
- 全接口支持 HTTPS（TLS v1.0 / v1.1 / v1.2 / v1.3）；
- 全面兼容 Apple ATS；
- 全国多节点 CDN 部署；
- 接口极速响应，多台服务器构建 API 接口负载均衡。

# 2. API 文档

**API 详情地址:** [https://www.gugudata.com/api/details/chinaregions](https://www.gugudata.com/api/details/chinaregions)

**接口请求地址:** [https://api.gugudata.com/location/chinaregions](https://api.gugudata.com/location/chinaregions)

**返回格式:** application/json; charset=utf-8

**请求方式:** GET

**请求协议:** HTTPS

**请求示例:** https://api.gugudata.com/location/chinaregions?appkey=YOUR_APPKEY&regioncode=YOUR_VALUE&version=3

**接口测试:** [https://api.gugudata.com/location/chinaregions/demo](https://api.gugudata.com/location/chinaregions/demo)

# 3. 请求参数

|   参数名   | 参数类型 | 是否必须 |   默认值    |                             备注                             |
| :--------: | :------: | :------: | :---------: | :----------------------------------------------------------: |
|   appkey   |  string  |    是    | YOUR_APPKEY |                     付费后获取的 APPKEY                      |
| regioncode |  string  |    是    | YOUR_VALUE  | 需要查询的父级区域编码，传递 0 获取全国所有省级别数据；编码格式为 00000000，每两位分别对应省、市、区、镇/街道编码（注意：v2 版本会在国家 6 位行政区划标准代码后添加 00 两位编码以保持接口兼容，v3 版本为 12 位编码格式） |
|  version   |   int    |    是    |      3      | 当传递参数值为 2 时，调用 v2 版本的接口，regioncode 遵循国家行政区划代码标准，同时可返回新增区划中心点坐标。当传递参数值为 3 时，调用 v3 版本的接口（v1 版本主要为了兼容历史用户调用逻辑，新用户强烈建议调用 v3 接口） |

# 4. 返回参数

|            参数名            | 参数类型 |                             备注                             |
| :--------------------------: | :------: | :----------------------------------------------------------: |
|    DataStatus.StatusCode     |   int    |                        接口返回状态码                        |
| DataStatus.StatusDescription |  string  |                       接口返回状态说明                       |
| DataStatus.ResponseDateTime  |  string  |                       接口数据返回时间                       |
|  DataStatus.DataTotalCount   |   int    |             此条件下的总数据量，一般用于分页计算             |
|       Data.RegionCode        |  string  | 区域编码（在 v2 版本中，前六位为国家行政区划标准编码，镇/街道是没有国家标准编码的，对应的编码只是对应的序号。v3 版本中，为最新的 12 位国家行政区划标准编码。） |
|       Data.RegionName        |  string  | 区域名称（部分城市在“市”级别后没有“区”级别，会直接返回“镇/街道”信息，注意根据「区域级别」字段进行处理） |
|       Data.RegionType        |  string  | 区域级别，枚举值为：省/自治区/直辖市/特别行政区 | 市 | 区 | 镇/街道 ｜ 居委会/村 |
|      Data.CenterLonLat       |  string  | 新增区划中心点坐标，格式为 [经度,纬度]，地理坐标系为 GCJ-02。需要转换坐标系请调用[地理坐标系转换](https://www.gugudata.com/api/details/coordinateconverter)接口 |
<rant>I'm bored of reading copy writing...
Tags: watercooler
Published: 2023-10-08 02:59:33

I'm bored of reading copy on everyone's blog.

10 Steps to bla bla bla
Happy in 30 seconds or less
Generated Headline, authoritative body... ACTION ITEM

Writing doesn't feel personal anymore. Even when I read people writing their personal story, it reads like:

I grew up like sh*t.
I didn't let it stop me.
I won.

It's manufactured. It's fake. Even when it's true, it's not real.

Writing should be proactive.
It should evoke feelings and paint a picture.
It should arouse sensation.

Even technical blogging (at least for the web) should have some personality.

I love Wikipedia. But why is half of Medium written like it?

It would be great to go back to a time when everyone didn't have a masterclass in blogging and copy. I want to read walls of text, carefully drizzled with emphasis and character. I want perfect imperfection.

That kind of writing is probably great for those who just want to get to the point. Scroll to the header they need, scan first and last sentences— but then why write at all. 

I guess it works and I'm the minority of people who wants to relate to you and what you're saying in a meaningful way.

Where are YOU in _your_ writing?
TypeScript in WSL
Tags: opensource, linux, typescript, toml
Published: 2023-10-08 02:31:18

This week I got a chance to add some functionality to a new project written with Typescript.  The goal was to introduce functionality to use TOML files in order to provide config details at runtime, with the switch `-c` or `--config` overriding additional command line switches when executing the program and instead parsing the provided .toml file.  
While TS is not new territory for me, the particular program I worked on exposed me to a few new concepts and present some interesting challenges.  The [til-to-html](https://github.com/paulkim26/til-to-html) project utilized a runtime build tool, [Bun](https://bun.sh/), as well as Unzip, a tool provided by Ubuntu. This required that I work in Linux.  To do this on my Windows machine, I setup a new [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install) environment.  This was straightforward to install, as were the Bun and Unzip installs.  However being a brand new WSL environment it took some time to get the required tools functioning properly.  The main solution required to make unzip execute when needed was to add the /usr/bin/ directory to PATH in the ~/.bashrc file.  This got me to a place where I could build and execute a local version of the til-to-html program.
After this, it was clear sailing for the most part. First by adding some logic within the exisiting argument parser to recognize `-c` or `--config` command line arguments.  The great news was that TypeScript offers a toml module which made easy work of parsing the TOML file.  Literally as simple as using `toml.parse()` on the contents of the opened file. This provides a variable containing all arguments defined in the file, accesible as .version, .help, etc.  This made light work of passing all arguments included into the TOML file back into the exisiting code and continuing execution as if the arguments were passed by command line. Good fun and an excellent challenge for the week.