What is Hackers' Pub?

Hackers' Pub is a place for software engineers to share their knowledge and experience with each other. It's also an ActivityPub-enabled social network, so you can follow your favorite hackers in the fediverse and get their latest posts in your feed.

0
0

???

"그래, 직접 만나보니까 진짜 굉장하더라. 세상에 소문 그대로였다니까? 세상에 어떻게 3살만에 집을 살수가 있지? 불로소득만으로? 일을 하나도 안하는데 소득이 2곳에서 들어오고 있더라니까? 만나보지는 못했는데, 개인 운전사랑 조리사도 있다고 하더라고. 이야... 정말 굉장했어... 정말... 역시 돈을 쉬게 하면 안돼... 파이프라인을 여기저기 만들어야 한다니까?

아, 그리고 조언도 받았어. 관세전쟁에 대비한 어드바이스였는데, 전통적 투자자산은 영향이 클 수밖에 없으니까 리스크 헷지 차원에서 '주식'에 투자하라더라. 무슨 종목이냐고? 'C져'인데... 응? 검색해도 안나온다고? 뭘 검색한거야? 나스닥? 거길 왜?

0
0
0
0
0

[단독] 국민의힘 의총서 쓴소리…"단일화 절박한데 다 어디 갔나"
김문수 국민의힘 대선 후보와 한덕수 전 국무총리의 단일화를 촉구하기 위해 모인 국민의힘 의원총회에서 당내 절박함을 지적하는 쓴소리가 나온 것으로…
news.sbs.co.kr/news/endPage.do

0
0
0
1

[단독] 국민의힘 의총서 쓴소리…"단일화 절박한데 다 어디 갔나"
김문수 국민의힘 대선 후보와 한덕수 전 국무총리의 단일화를 촉구하기 위해 모인 국민의힘 의원총회에서 당내 절박함을 지적하는 쓴소리가 나온 것으로…
news.sbs.co.kr/news/endPage.do

0
0
0
0
0

물론 이러다가 단일화하는 드라마틱 연출은 유구한 전통이었다. 다만 문제는, 보수쪽 피로도도 상당히 누적되어 있어서 이렇게 갈등인 모습이 늘어지게 되면 되려 리스크로 작용할지도 모른다는 느낌.

RE: https://bsky.app/profile/did:plc:de27rm6eyuf5ez6gmvjdmilq/post/3loiea6v6mk2n

0

Hundreds of thousands of Computers won't be able to upgrade to Windows 11, but that shouldn't make them eWaste.

Kudos to the @kde team for this amazing initiative!

endof10.org/

0
0
0

I'm asking people to please, read this carefully.

Lina is such a kind soul and good friend, it crushes me so much having had to see what she's been going through.

And I'm so incredibly angry at Luna, who I once thought was a friend for directly putting her through this all while playing the victim and using her own struggles as excuses.

I just want this to all be over so Lina and Cyan can look to a brighter and happier future together.

https://vt.social/users/lina/statuses/114453525309759623
0
0
0
1
0
0
0
1
0
0
1
0
0
0

세계적인 극우파 약진…그 뒤엔 ‘기독교 우파 조직’과의 결탁이 있다 khan.co.kr/article/20250503110
"실제로 1990년대 이후 미국 기독교 우파 단체들이 유럽의 동료들을 전략적으로 지원하고 자금과 이념적 틀을 제공해왔다. 특히 유럽에서 기독교 우파의 입김이 강해진 영역이 반젠더, 반낙태, 반페미니즘인데 여기에는 미국 기독교 우파 단체의 유럽 지부나 네트워크 조직들이 깊이 관여하고 있다."

0
0
0

今天是5/6,我的室內溫度計已經連續三天觀測到30℃以上。請問各位象友,你們是否已經開冷氣了?

0
0
0

Next.js 서버 액션은 서버 데이터를 가져오는 용도로 사용하기에 적합하지 않다. React 공식문서에서는 다음과 같이 말하고 있다.

Server Functions are designed for mutations that update server-side state; they are not recommended for data fetching. Accordingly, frameworks implementing Server Functions typically process one action at a time and do not have a way to cache the return value.

서버 액션이 여러 호출되면 바로 실행되는 대신 큐에 쌓이고 순차적으로 처리된다. 이미 실행된 서버 액션은 이후 취소할 수 없다.

이에 서버 액션을 데이터 가져오기로 활용하면 끔찍해지는 UX가 생길 수 있는데, 예를 들어 페이지의 목록 검색 화면에서 검색 후 데이터를 가져오는 상황에 않았다고 다른 화면으로 네비게이션이 불가능한 것은 일반적인 경험이 아니다.

이러면 RSC를 통해 무한 스크롤을 구현하지 못하는가? 에 대해서 의문이 생길 수 있는데 여기에 대해서 대안을 발견했다.

function ServerComponent({ searchParams }) {
  const page = parseInt((await searchParams).page ?? "1", 10)
  const items = await getItems(page)
  return (
    <Collection id={page}>
      {items.map(item => <InfiniteListItem key={item.id} {...items} />)}
    </Collection>
  )
}
"use client"

function Collection({ id, children }) {
  const [collection, setCollection] = useState(new Map([[id, children]]))
  const [lastId, setLastId] = useState(id)
  if (id !== lastId) {
    setCollection(oldCollection => {
      const newCollection = new Map(oldCollection)
      newCollection.set(id, children)
      return newCollection
    })
    setLastId(id)
  }
  return Array
    .from(collection.entries())
    .map(
      ([id, children]) => <Fragment key={id}>{children}</Fragment>
    )
}

대충 이런 꼴이다. 이러고 page를 증가시키거나 감소시키는건 intesection observer나 특정 엘리먼트의 onClick 이벤트 따위를 의존하면 된다. 이러면 데이터 가져오기 패턴을 RSC 형태로 의존할 수 있다. InfiniteListItem는 서버컴포넌트, 클라이언트컴포넌트 무엇으로 구현하더라도 상관없다. 가령 아래와 같은 식:

function ServerComponent({ searchParams }) {
  const page = parseInt((await searchParams).page ?? "1", 10)
  const { items, hasNext } = await getItems(page)
  return (
    <div>
      <Collection id={page}>
        {items.map(item => <InfiniteListItem key={item.id} {...items} />)}
      </Collection>
      {hasNext && (
        <IntersectionObserver nextUrl={`/?page=${page + 1}`} />
      )}
    </div>
  )
}

검색 조건이나 검색어에 따라 상태를 초기화시키려면 다음과 같이 표현하면 된다.

function ServerComponent({ searchParams }) {
  const page = parseInt((await searchParams).page ?? "1", 10)
  const query = parseInt((await searchParams).query ?? "")
  const { items, hasNext } = await getItems(page, query)
  return (
    <div>
      <Form action="/">
        <input name="query" />
        <button />
      </Form>
      <Collection id={page} key={query}>
        {items.map(item => <InfiniteListItem key={item.id} {...items} />)}
      </Collection>
      {hasNext && (
        <IntersectionObserver nextUrl={`/?page=${page + 1}&query=${query}`} />
      )}
    </div>
  )
}

매우 PHP스럽고, 암묵적이기도 하다. 다만 RSC의 데이터 가져오기 패턴을 활용하면서 기존 컴포넌트를 최대한 재사용할 수 있게 된다는 점이 좋다.

2
0
0
0
0

星展銀行好瘋,推銷看我手機沒接馬上改打工作電話,長話短說一直說我掛不掉,明天還要再打來問我要不要保,那保險內容我看了真的很還好呀 :ablobrage:
總之先把個人資料的工作電話給改掉....

0
0
0
0
0
0

戲腳友人回港之前,大家討論咗好耐電影。
有一晚我地討論,到底電影最重要嘅係咩?我地都覺得最重要係好睇。

無論創作團隊想討論啲咩深刻議題都好,先用任何敍事手法講好咗個故事應該係最大原則,喺呢個基礎上再去傳遞滲透想講嘅各種大道理完全無問題,但唔好本末倒置。實在反感某啲電影連講好故事嘅能力都無,就想藉住套戲教觀眾點做人,未盡好本份就有泰山壓頂嘅說教味撲面而來,加劇咗觀影時嘅不適感,直白地表達嗰種反感就係:故仔都未撚拍好就想教我做人,你係邊位?

我成日覺得有啲創作人係好有趣,佢地好似以娛樂其他人為恥,係咪因為太怕作品受歡迎就被鞭撻娛樂至死呢?但明明一個作品由無到有到推上戲院,種種都牽涉商業行為,唔賣座就好難有下一套,點解對於娛樂性豐富嘅作品,有咁多人避之唯恐不及?

係咪因為好單純咁將娛樂與低俗掛咗鈎?

如多人從之則為俗,咁當好多人怕俗時候,呢種心態又係咪另類嘅俗氣?

RE: https://www.threads.com/@tsao_shih_han/post/DJS7lwbydHU

0

昨天回家發現我家長輩,又被騙了⋯⋯。
被朋友以來路不明的「神奇乳膏」抵債,聲稱塗了以後能讓白髮變黑、改善失智症狀,還說有「醫生保證」、「美國人體實驗」等背書。
結果我們深入查證後,發現這些產品可能來自被政府勒令停產、違反GMP規定、使用過期原料的藥廠。
決定完整整理相關經驗分享給大家,請大家一定要幫家中的長輩把關!
來路不明的產品不僅造成財物損失,更可能影響身體健康!!

完整經驗分享請見:
next-able.com/20250506-2/

0
0

Next.js 서버 액션은 서버 데이터를 가져오는 용도로 사용하기에 적합하지 않다. React 공식문서에서는 다음과 같이 말하고 있다.

Server Functions are designed for mutations that update server-side state; they are not recommended for data fetching. Accordingly, frameworks implementing Server Functions typically process one action at a time and do not have a way to cache the return value.

서버 액션이 여러 호출되면 바로 실행되는 대신 큐에 쌓이고 순차적으로 처리된다. 이미 실행된 서버 액션은 이후 취소할 수 없다.

이에 서버 액션을 데이터 가져오기로 활용하면 끔찍해지는 UX가 생길 수 있는데, 예를 들어 페이지의 목록 검색 화면에서 검색 후 데이터를 가져오는 상황에 않았다고 다른 화면으로 네비게이션이 불가능한 것은 일반적인 경험이 아니다.

이러면 RSC를 통해 무한 스크롤을 구현하지 못하는가? 에 대해서 의문이 생길 수 있는데 여기에 대해서 대안을 발견했다.

function ServerComponent({ searchParams }) {
  const page = parseInt((await searchParams).page ?? "1", 10)
  const items = await getItems(page)
  return (
    <Collection id={page}>
      {items.map(item => <InfiniteListItem key={item.id} {...items} />)}
    </Collection>
  )
}
"use client"

function Collection({ id, children }) {
  const [collection, setCollection] = useState(new Map([[id, children]]))
  const [lastId, setLastId] = useState(id)
  if (id !== lastId) {
    setCollection(oldCollection => {
      const newCollection = new Map(oldCollection)
      newCollection.set(id, children)
      return newCollection
    })
    setLastId(id)
  }
  return Array
    .from(collection.entries())
    .map(
      ([id, children]) => <Fragment key={id}>{children}</Fragment>
    )
}

대충 이런 꼴이다. 이러고 page를 증가시키거나 감소시키는건 intesection observer나 특정 엘리먼트의 onClick 이벤트 따위를 의존하면 된다. 이러면 데이터 가져오기 패턴을 RSC 형태로 의존할 수 있다. InfiniteListItem는 서버컴포넌트, 클라이언트컴포넌트 무엇으로 구현하더라도 상관없다. 가령 아래와 같은 식:

function ServerComponent({ searchParams }) {
  const page = parseInt((await searchParams).page ?? "1", 10)
  const { items, hasNext } = await getItems(page)
  return (
    <div>
      <Collection id={page}>
        {items.map(item => <InfiniteListItem key={item.id} {...items} />)}
      </Collection>
      {hasNext && (
        <IntersectionObserver nextUrl={`/?page=${page + 1}`} />
      )}
    </div>
  )
}

검색 조건이나 검색어에 따라 상태를 초기화시키려면 다음과 같이 표현하면 된다.

function ServerComponent({ searchParams }) {
  const page = parseInt((await searchParams).page ?? "1", 10)
  const query = parseInt((await searchParams).query ?? "")
  const { items, hasNext } = await getItems(page, query)
  return (
    <div>
      <Form action="/">
        <input name="query" />
        <button />
      </Form>
      <Collection id={page} key={query}>
        {items.map(item => <InfiniteListItem key={item.id} {...items} />)}
      </Collection>
      {hasNext && (
        <IntersectionObserver nextUrl={`/?page=${page + 1}&query=${query}`} />
      )}
    </div>
  )
}

매우 PHP스럽고, 암묵적이기도 하다. 다만 RSC의 데이터 가져오기 패턴을 활용하면서 기존 컴포넌트를 최대한 재사용할 수 있게 된다는 점이 좋다.

2
0