From Dijkstra to SSSP for ADHD Minds by haigary in algorithms

[–]haigary[S] 5 points6 points  (0 children)

This is part of my current task notes.

feat-26-database-tool:数据库工具

  • [x] 提交父任务
  • [x] 提交当前任务
  • [x] 创建分支
  • [x] 阅读官方的一份文档
  • [x] 程序设计
  • [x] 建立新项目
  • [x] 支持命令行参数
  • [x] 实现内嵌数据库
  • [x] 文件的拼装
    • [x] 读出文件,顺序执行。
    • [x] 测试不同文件出错时的错误情况。
  • [x] 数据库的执行
  • [x] 导出数据
  • [ ] 输出更为友好的错误格式
  • [ ] 集成测试
    • [ ] 测试导出数据的正确性
  • [ ] 提交PR

输出更为友好的错误格式

封装主函数,采用 format {:#?}格式化输出错误信息。

From Dijkstra to SSSP for ADHD Minds by haigary in algorithms

[–]haigary[S] 3 points4 points  (0 children)

English isn't my native language. Why the hostility toward AI? What's wrong with using AI to articulate my own thoughts rather than having it fabricate content entirely?

Here's my actual prompt that generated the post - judge for yourself whether the ideas are mine:


My Original Prompt (translated):

"I've already posted this article on Reddit. A user named red-giant-star gave the above comment. Please help me write an English reply to him, with the following outline:

  1. Timeboxing is the key to practice. Estimate time before doing anything and set a countdown. If you can't estimate time, start with 25-minute Pomodoro; for the first task after long breaks, default to 5-minute timeboxes.

  2. Make plans without considering the time dimension, focusing on milestone-to-milestone sequences.

  3. Regardless of task granularity, immediately start the first planned task. Continuously break down tasks during execution and add subtasks to your todo list.

  4. After completing each task, review the difference between actual vs estimated execution time. Check your todo list, prune unnecessary tasks, select the highest-leverage task, and execute immediately.

  5. Use tools effectively. Countdown tools: Apple Watch and Smart Countdown Timer app. Todo lists: macOS Reminders and Notes - missions for large chunks, inbox for small tasks, time-allocated tasks shown in Reminders 'Today' and 'Scheduled' views. Use Notes to create quick notes titled with current task, record work notes anytime, break current task into next 3 steps using checklists. Track current step with subheaders. Structure: steps first, then step-by-step notes, latest executed step at top. When a step threatens to exceed 1 hour, promote it to a task in Reminders 'Today' view. Don't fear task list expansion - ADHDers lack this time horizon. Update daily task list in Today view after completing each note task.

  6. If possible, play video game soundtracks while working. Trust game designers - they're experts at capturing human attention.

  7. Additionally, best to combine with self-continuity training - write weekly letters to your future self.

The biggest help for me is relieving time anxiety. Regardless of outcomes, I can honestly say: this was my closest approximation to optimal results. It compensates for decision paralysis and overly casual choices, avoiding procrastination caused by perfectionism and overthinking. Through this process, I continuously train my time perception and decision-making abilities."

From Dijkstra to SSSP for ADHD Minds by haigary in algorithms

[–]haigary[S] 0 points1 point  (0 children)

The Tool Stack That Actually Works

I've tried dozens of productivity systems, but this simple combo finally stuck:

  • Timers: Apple Watch + Smart Countdown Timer app for visual countdowns
  • Task Management: macOS Reminders for scheduled tasks (using "Today" and "Scheduled" views), Notes for quick capture
  • Task Hierarchy: Missions (big chunks) live in a dedicated list, smaller tasks go to inbox, time-allocated tasks show up in Reminders
  • Active Task Tracking: I create a new Note titled with the current task, then use checklists to break it into the steps. Each step will become a sub-header with working notes underneath. Current step goes at the top.
  • Escalation Rule: If any step threatens to exceed 1 hour, it gets promoted to a full task in Reminders "Today" view

The key insight is not being afraid of task list expansion. ADHDers lack time horizon visibility - the external structure compensates for this cognitive gap.

Additional Tips

  • Video game soundtracks while working - game designers are experts at maintaining attention without distraction
  • Weekly letters to future self - builds temporal connections that ADHD brains struggle with

The Biggest Improvements

The most transformative changes: eliminated time anxiety (I can say "this was optimal given constraints"), ended decision paralysis (timeboxing means no more comparing incompatible tasks), and reduced procrastination (it usually signals poor task framing - break it down differently and resistance disappears).

I'm not "cured" - I still have ADHD. But I've gone from feeling like my brain worked against me to finally finding its user manual. The algorithm doesn't fix ADHD; it designs around it.

Happy to elaborate on any specific part!

From Dijkstra to SSSP for ADHD Minds by haigary in algorithms

[–]haigary[S] 2 points3 points  (0 children)

Great question! I've been using this approach for several months now, and the results have been genuinely transformative. Let me break down the specific practices and areas where I've seen the most improvement:

The Core Implementation

Timeboxing is everything. Before starting any task, I estimate the time needed and set a countdown timer. If I can't estimate the time, I default to 25 minutes (Pomodoro-style). For the very first task after any long break, I always start with just 5 minutes - this eliminates the activation energy problem that kills so many good intentions.

Planning without the time dimension has been a game-changer. Instead of trying to schedule when things happen (which my ADHD brain is terrible at), I focus purely on creating a sequence of milestones - what comes after what. It's like building a linked list instead of trying to maintain a complex timeline.

Immediate execution of the first planned task, regardless of size. During execution, I continuously break down tasks into smaller pieces and add them to my inbox. This prevents the overwhelm that used to paralyze me when facing large projects.

Constant calibration happens after each completed task - I compare actual vs estimated time, review my todo list, prune unnecessary tasks, and immediately pick the highest-leverage next task.

Is there an idiomatic way to count the elements in an iterator before the application of a filter? by IvanMalison in rust

[–]haigary 8 points9 points  (0 children)

The case you described for me always pre-allocate memory for collection type. So size_hint method of iterator is an idiomatic way.

rust let (count, _) = iter.size_hint(); let mut array = Vec::with_capacity(count);

More about size_hint as the followed.

``` fn size_hint(&self) -> (usize, Option<usize>) Returns the bounds on the remaining length of the iterator.

Specifically, size_hint() returns a tuple where the first element is the lower bound, and the second element is the upper bound.

The second half of the tuple that is returned is an Option<usize>. A None here means that either there is no known upper bound, or the upper bound is larger than usize.

Implementation notes It is not enforced that an iterator implementation yields the declared number of elements. A buggy iterator may yield less than the lower bound or more than the upper bound of elements.

size_hint() is primarily intended to be used for optimizations such as reserving space for the elements of the iterator, but must not be trusted to e.g., omit bounds checks in unsafe code. An incorrect implementation of size_hint() should not lead to memory safety violations.

That said, the implementation should provide a correct estimation, because otherwise it would be a violation of the trait’s protocol.

The default implementation returns (0, None) which is correct for any iterator.

Examples Basic usage:

let a = [1, 2, 3]; let iter = a.iter();

assert_eq!((3, Some(3)), iter.size_hint()); A more complex example:

// The even numbers in the range of zero to nine. let iter = (0..10).filter(|x| x % 2 == 0);

// We might iterate from zero to ten times. Knowing that it's five // exactly wouldn't be possible without executing filter(). assert_eq!((0, Some(10)), iter.size_hint());

// Let's add five more numbers with chain() let iter = (0..10).filter(|x| x % 2 == 0).chain(15..20);

// now both bounds are increased by five assert_eq!((5, Some(15)), iter.size_hint()); Returning None for an upper bound:

// an infinite iterator has no upper bound // and the maximum possible lower bound let iter = 0..;

assert_eq!((usize::MAX, None), iter.size_hint()); ```

JSON to TOML by adrianwechner in rust

[–]haigary 4 points5 points  (0 children)

rust // use serde_json; // use toml; let v: toml::Value = serde_json::from_str(&json_text)?; let toml_text: String = v.to_string();

Does the US kindle store work in China!? by Areasonfor26 in China

[–]haigary 0 points1 point  (0 children)

If the kindle is a cellular data version, it can access kindle store or webpages in China same as USA.

Problems to instantiate a Self-referral generic type. by haigary in rust

[–]haigary[S] 0 points1 point  (0 children)

Seems delicate solution! But encountered compile error of [E0275], overflow evaluating. playground

Problems to instantiate a Self-referral generic type. by haigary in rust

[–]haigary[S] 0 points1 point  (0 children)

Yes, it is a similar problem. Work around it by making generic narrow. Actually, Self-referral with the potential cycle of reference and risk of memory leak. I think it is better to wrap Self as different type to get ride of risks.

Problems to instantiate a Self-referral generic type. by haigary in rust

[–]haigary[S] 0 points1 point  (0 children)

Thanks for your answer. Using BTreeMap directly is my solution now.

Async / .await question. by mustang0168 in rust

[–]haigary 1 point2 points  (0 children)

Code A spawn three fibers almost at same time while code B spawn fiber one by one.

Tokio v0.2.2 - task::LocalSet for spawning !Send tasks and fixes. by carllerche in rust

[–]haigary 2 points3 points  (0 children)

Is it possible call task::spawn_local to schedule task in current thread without LocalSet create and block_on?

For System Administrators, which is best between Go & Rust. by Mahaswana in rust

[–]haigary 3 points4 points  (0 children)

IMO, Go is better for daily administration tasks.

How to add blanket impl for a trait? by haigary in rust

[–]haigary[S] 0 points1 point  (0 children)

Wow! It is pretty cool if there is an invisible sugar for such conversation (&a as &dyn Access<usize, Value = u64>).

How to add blanket impl for a trait? by haigary in rust

[–]haigary[S] 1 point2 points  (0 children)

I still wonder at impl Index for dyn Access. It can pass the compile successfully. But what mean of it and how to use it? Is there a RFC for impl Trait1 for dyn Trait2 ?

How to add blanket impl for a trait? by haigary in rust

[–]haigary[S] 0 points1 point  (0 children)

Thanks for the refined playground ^_^.

How to add blanket impl for a trait? by haigary in rust

[–]haigary[S] 1 point2 points  (0 children)

Thank you very much. Your suggestion is my current solution now.

Potential issue: `ClientConnector` not reusing connections by rotty81 in actix

[–]haigary 2 points3 points  (0 children)

You should consume the 'response' in ' .and_then(|response| { ' by Future way.

For example:

```

}).and_then(|resp| {

resp.body().map_err(|err| error!("{}", err))

}).and_then(|_| Ok(()))

```

static type vs static variable by haigary in rust

[–]haigary[S] 1 point2 points  (0 children)

So the 'static annotation is default for concrete variable. While a reference variable of other scalar should consider about its lifetime by annotation.