productivity – Is there any way to show a timer that shows how long a chrome window has been open?

This would be useful for those wanting to track on long they’re spending on various tasks (assuming they start the task in a new chrome window). It’s simple and avoids the need to do any other manual logging.

A google search didn’t seem to provide useful information. An extension for this would be great, sadly searched chrome webstore but couldn’t find anything. Not sure if I missed something tho.

Thanks for any help

productivity – Monitor your terminal / file change activity

I’m trying to monitor all my activity to optimize productivity and I’m wondering if a system already exists to do so or how to set one up otherwise.

For example, I want to record the programs I execute on the command line and then track the diffs to my files to see how many times I run certain tests and patterns of test updates and code rewriting.

Essentially, I just want to track what I’m doing and figure out how to do it faster.

One hypothesis is that the 2 seconds it takes to run my unit test actually turns into 20 seconds on average because I forget what I was going to do depending on the test output.

Any ideas on how to set this up?

unit testing – Building a GTD Productivity App Designed through Test Driven Development (TDD)

First, thanks so much for looking at my code. Over the past decade, I have tried every task management apps imaginable. I finally realized that the only way I would ever find my perfect productivity system is if I build it myself.

To this end, I am creating ClearHeadTodo, a productivity app that seeks to bring the GTD model of productivity using entirely rust if possible.

While for now i’m only focused on the Command Line Interface (CLI) my ultimate goal is to make this a modular piece of software where the core productivity system works no matter what medium you are utilizing (GUI or CLI)

The Question: Control Flow Best-Practices for Testing and Scalability

The Code: 2 Main Files
For now, most of this work is broken into two files (lib.rs and main.rs respectively)

  • lib.rs contains the main logic for the Task List
  • While main.rs contains the CLI struct which the user actually interacts with to alter the task objects.

Current Code Status
For right now, users can only create tasks. Tasks have a name, priority, and completion status.

  • This is all loaded to and from a vector using a .csv to reduce database complexity

I’m very proud to say that everything works from all my testing, however, now that the code is all together, it feels… difficult to scale the code base since the main command loop is basically just a huge match statement.

I want to use best-practices like the result data type, but i am having trouble formatting the code in such a way that would propagate the result of each function properly to the end of the main command line.

Specifically, whenever i try using the ?, it throws an error saying that i’m not using the proper type (even though you can see there are several results in this code)

Operation all work is done through just running the main rust build with any arguments,
so cargo run create_task will create a new task which can be shown with `cargo run list_task
Main.rs

use std::io::{self, Write};
use std::io::stdout;
use clear_head_todo::TaskList;
use clear_head_todo::PriEnum;
use std::path::Path;

pub struct CLI{
    pub pattern: Option<String>,
    pub index: Option<String>,
    pub input: Option<String>,
    pub task_vec: TaskList
}

impl CLI {
        pub fn parse_arguments(&mut self) {
            match self.pattern.as_ref().unwrap_or(
                &"no command given".to_string()) as &str{
            "create_task" | "create" | "ct" | "new_task" | "new" =>
                self.task_vec
                .create_task(),
            "list_tasks" | "lt" | "list" | "list_all" =>
                self.task_vec.print_task_list(std::io::stdout()).unwrap_or(()),
            "remove_task" | "remove" | "rt" | "delete_task" | "delete" =>
                self.task_vec
                .remove_task(
                    self.index.as_ref()
                    .unwrap()
                    .to_string()
                    .parse::<usize>()
                    .unwrap(), 
                    io::stdout())
                    .expect("invalid index"),
            "complete_task" | "complete" | "mark_complete" =>
                self.task_vec.tasks(
                self.index.as_ref()
                .unwrap()
                .parse::<usize>()
                .unwrap())
                .mark_complete(),
            "change_priority" | "cp" | "new_priority" | "np" =>
                self.task_vec.tasks(
                self.index.as_ref()
                .unwrap()
                .parse::<usize>()
                .unwrap())
                .change_priority(
                        &self.input.as_ref().unwrap()(..)),
            "rename_task" | "rename" | "name" | "r" =>
                self.task_vec.tasks(
                self.index.as_ref()
               .unwrap()
               .parse::<usize>()
               .unwrap())
               .rename_task(
                    self.input.as_ref()
                   .unwrap()),
            _ => return
            };
    }
    pub fn cli_list_tasks(&self, mut writer: impl std::io::Write){
        self.task_vec.print_task_list(writer).unwrap_or(());
    }
}
fn main() {

    println!("starting program");
    
    let mut main_cli: CLI = CLI{
        pattern : std::env::args().nth(1),
        index: std::env::args().nth(2),
        input: std::env::args().nth(3),
        task_vec: TaskList{
            tasks: vec!()
        }
    };

    main_cli.task_vec.load_tasks("tasks.csv").unwrap();
    
    main_cli.parse_arguments();

    main_cli.task_vec.load_csv("tasks.csv").unwrap();
    
}

#(cfg(test))
mod tests {
    use super::*;

    #(test)
    fn cli_creation_test () {
        let mut test_cli = CLI {
            pattern: None, 
            index: None,
            input: None,
            task_vec: TaskList{tasks: vec!()}, 

        };
        assert!(test_cli.pattern == None);
        assert!(test_cli.index == None);
        assert!(test_cli.input == None);
        assert!(test_cli.task_vec.tasks.len() == 0);
        test_cli.parse_arguments();
    }

    #(test)
    fn cli_task_creation_test () {
        let mut test_cli = CLI {
            pattern: Some("create_task".to_string()), 
            index: None,
            input: None,
            task_vec: TaskList{tasks: vec!()}, 

        };
        test_cli.parse_arguments();
        assert!(test_cli.task_vec.tasks.len() == 1);
        assert!(test_cli.task_vec.tasks(0).name == "Test Task");
        assert!(test_cli.task_vec.tasks(0).completed == false);
        assert!(test_cli.task_vec.tasks(0).priority == PriEnum::Optional);
    }

    #(test)
    fn cli_task_list_test () {
        //let mut good_result = Vec::new();
        let mut test_cli = CLI {
            pattern: Some("list_tasks".to_string()), 
            index: None,
            input: None,
            task_vec: TaskList{tasks: vec!()}, 

        };

        test_cli.parse_arguments();
    }
}


Lib.rs (logical center of the app)

use std::error::Error;
use std::io::{Error as OtherError, ErrorKind};
use std::fmt;
use csv::Reader;
use csv::Writer;
use std::path::{Path, PathBuf};
use std::env;
use std::str::FromStr;
use serde::ser::{Serialize, SerializeStruct, Serializer};
use serde::Serialize as AltSerialize;

pub struct TaskList {
    pub tasks: Vec<Task>
}

#(derive(PartialEq))
#(derive(Debug))
#(repr(u8))
#(derive(AltSerialize))
pub enum PriEnum {
    Critical = 1,
    High = 2,
    Medium = 3,
    Low = 4,
    Optional = 5,
}

impl fmt::Display for PriEnum {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        let printable: &str = match *self {
            PriEnum::Critical => "Critical",
            PriEnum::High => "High",
            PriEnum::Medium => "Medium",
            PriEnum::Low => "Low",
            PriEnum::Optional => "Optional"
        };
        write!(f, "{}", printable)
    }
}

impl Serialize for Task {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> 
    where
            S: Serializer, 
        {
            let mut s = serializer.serialize_struct("Task", 3)?;
            s.serialize_field("name", &self.name)?;
            s.serialize_field("priority", &self.priority)?;
            s.serialize_field("completed", &self.completed)?;
            s.end()
        }
}
 
pub fn parse_priority(expr: &str) -> Result<PriEnum, String> {
    match expr.to_ascii_lowercase().trim() {
        "1" | "critical" | "crit" | "c" => Ok(PriEnum::Critical),
        "2" | "high" | "hi" | "h" => Ok(PriEnum::High),
        "3" | "medium" | "med" | "m" => Ok(PriEnum::Medium),
        "4" | "low" | "lo" | "l" => Ok(PriEnum::Low),
        "5" | "optional" | "opt" | "o" => Ok(PriEnum::Optional),
        "" => Ok(PriEnum::Optional), //defaults to this
        _ => Err(format!("Invalid priority value")),
    }
}

#(derive(PartialEq, Debug))
pub struct Task {
    pub name: String,
    pub completed: bool,
    pub priority: PriEnum, 
}

impl TaskList {
    //load tasks from either tasks.csv or testTasks.csv using the file_name
    pub fn load_tasks(&mut self, file_name: &str) -> Result<(), Box<dyn Error>> {
        let pathbuf = env::current_dir().unwrap().join("data").join(file_name);
        let mut rdr: Reader<std::fs::File> = Reader::from_path(pathbuf)?;
        for result in rdr.records() { 
            let record = result?;
            let new_task = Task {
                name: record(0).to_string(),
                completed: FromStr::from_str(&record(2))?,
                priority : parse_priority(&record(1))?,
            };
            self.tasks.push(new_task);
        }
        Ok(())
    }

    pub fn load_csv(&mut self, file_name: &str) -> Result<(), Box<dyn Error>> {
        let pathbuf = env::current_dir().unwrap().join("data").join(file_name);
        let mut wtr: Writer<std::fs::File> = Writer::from_path(pathbuf)?;
        for index in 0..=self.tasks.len()-1{
            wtr.serialize::<_>(&self.tasks(index)).unwrap();
        }
        Ok(())
    }

    pub fn create_task(&mut self) {
        let new_task: Task = Task {
            name: String::from("Test Task"),
            completed: false,
            priority: PriEnum::Optional,
        };
        self.tasks.push(new_task);
    }
    
    pub fn print_task_list(&self, mut writer: impl std::io::Write)->
    Result<(), std::io::Error> {
        if self.tasks.is_empty()==true{
            return Err(OtherError::new(ErrorKind::Other, "list is empty"));
        } else{
            for index in 0..=self.tasks.len()-1 {
                writeln!(writer, "{index},{name},{priority},{completed}",
                        index = index,
                        name = self.tasks(index).name,
                        priority = self.tasks(index).priority,
                        completed = self.tasks(index).completed)?;
            }
        }
        Ok(())
    }
    
    pub fn remove_task(&mut self, index: usize, mut writer: impl std::io::Write) -> 
    Result<(), std::io::Error>  {
        if index < self.tasks.len() {
            writeln!(writer, "Deleted {name} Task", 
                     name = self.tasks(index).name)?; 
            self.tasks.remove(index);
            return Ok(());
        }
        else {
            return Err(OtherError::new(ErrorKind::Other, "Invalid Index for Deletion"));
        }
    }

} //end 'impl TaskList'
 

impl Task {
    pub fn rename_task(&mut self, new_task_name: &String) {
        self.name = new_task_name.to_owned();
    }
    
    pub fn mark_complete(&mut self) {
        self.completed = true;
    }
    
    pub fn change_priority(&mut self, new_priority: &str) {
        let new_pri = parse_priority(new_priority);
        match new_pri {
            Ok(i) => self.priority = i,
            Err(err) => println!("{}", err),
        };
        
    }
   
} //end 'impl Task'

#(cfg(test))
mod tests {
    use super::*;
    
    #(test)
    fn task_creation_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();
        let test_task = &test_task_list.tasks(0);
        assert!(test_task.name == "Test Task");
        assert!(test_task.completed == false);
        assert!(test_task.priority == PriEnum::Optional);
        assert!(&test_task_list.tasks(0) == test_task);
    }
    
    #(test)
    fn task_rename_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();         
        let test_task = &mut test_task_list.tasks(0);
        test_task.rename_task(&"Changed Name".to_string());
        assert!(test_task.name == "Changed Name");
    }
    
    #(test)
    fn task_completion_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();
        let test_task = &mut test_task_list.tasks(0);
        test_task.mark_complete();
        assert!(test_task.completed == true);
    }
    
    #(test)
    fn task_successful_removal_test() {
        let mut test_task_list = TaskList{tasks: vec!()};
        let mut good_result = Vec::new();
        test_task_list.create_task();
        test_task_list.remove_task(0, &mut good_result).unwrap();
        assert!(test_task_list.tasks.is_empty());
        assert_eq!(&good_result(..), "Deleted Test Task Taskn".as_bytes());
    }
    
    #(test)
    fn task_removal_fail_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        let mut bad_result = Vec::new();
        let error = test_task_list.remove_task(0, &mut bad_result).unwrap_err();
        assert_eq!(error.to_string(), "Invalid Index for Deletion");
    }

    #(test)
    fn task_reprioritize_test() {
        let mut test_task_list = TaskList{tasks: vec!()}; 
        test_task_list.create_task();
        let test_task = &mut test_task_list.tasks(0);
        println!("{}", test_task.name);
        test_task.change_priority("4");
        assert!(test_task.priority == PriEnum::Low);
        test_task.change_priority("3");
        assert!(test_task.priority == PriEnum::Medium);
        test_task.change_priority("2");
        assert!(test_task.priority == PriEnum::High);
        test_task.change_priority("1");
        assert!(test_task.priority == PriEnum::Critical);
        test_task.change_priority("6");
        assert!(test_task.priority == PriEnum::Critical); //should NOT change on bad input
    }
    
    #(test)
    fn task_print_fail_test(){
        let test_task_list = TaskList{tasks: vec!()};
        let mut bad_result = Vec::new();
        let error = test_task_list.print_task_list(&mut bad_result).unwrap_err();
        assert_eq!(error.to_string(), "list is empty");
    }
    #(test)
    fn task_print_full_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        let mut good_result = Vec::new();
        test_task_list.create_task();
        test_task_list.print_task_list(&mut good_result).unwrap();
        assert_eq!(&good_result(..), "0,Test Task,Optional,falsen".as_bytes());
    }
    
    #(test)
    fn load_from_csv_sucessful_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        test_task_list.load_tasks("testTasks.csv").unwrap();
        let test_task = &test_task_list.tasks(0);
        assert!(test_task.name == "test csv task");
        assert!(test_task.completed == false);
        assert!(test_task.priority == PriEnum::Optional);
    }

    #(test)
    fn load_from_csv_fail_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        let error = test_task_list.load_tasks("bad_file").unwrap_err();
        assert!(error.to_string().contains("(os error 2)"));
    }
    
    #(test)
    fn load_to_csv_successful_test(){
        let mut test_task_list = TaskList{tasks: vec!()};
        test_task_list.create_task();
        test_task_list.tasks(0).rename_task(&"test csv task".to_string());
        test_task_list.load_csv("testTask.csv").unwrap();
        let rdr = Reader::from_path(
            env::current_dir().unwrap().join("data").join("testTasks.csv").as_path())
            .unwrap();
        let mut iter = rdr.into_records();
        if let Some(result) = iter.next() {
            let record = result.unwrap();
            assert_eq!(record, vec!("test csv task", "Optional", "false"));
        }
    }

}

Again, Thank you for taking the time to look at this, everything should run if you put these in a cargo project, if even cargo test fails, please send me the error code

productivity – Window Manager for Mac

I’ve always been a Mac user, but when my Mac died I borrowed a Chromebook. Chrome has an awesome extension that manages windows to let you see all windows and their own tabs in one view, merge or save windows, close windows or tabs directly from that page, see which app is playing an audio or video, and more. I can’t find anything like it for Mac. This is crucial since I frequently have close to 100 tabs open for research. The link below shows what I mean. Is there anything similar for Macs??

https://chrome.google.com/webstore/detail/cluster-window-tab-manage/aadahadfdmiibmdhfmpbeeebejmjnkef?hl=en

macos: productivity tips when using the Screen Sharing app

I'm a big fan of the Magic Mouse double finger swipe and tap to quickly switch between full screen windows, but this gesture functionality is lost using macOS through a fullscreen Screen Sharing.app window.

Could you add a modifier to all these Mission Control gestures? So, on my physical Mac, I can only use regular gestures, and on the screen that Mac shares, I could press, for example control enable these gestures on the screen to share Mac?

Or maybe the other way around?

productivity: generate bogus meetings in Google Calendar

Is there a tool to create fake Google Calendar meetings that seem credible based on my free / busy schedule? I don't want to spend time outside of meetings doing a pointless task that computers could do, so I'd like to automate this. If nothing exists, then maybe someone can recommend an algorithm or some existing software that I can modify to do it.

Context:

Other people put a lot of meetings on my Google Calendar. It tends to 30 hours a week of meetings if I don't do something about it. There is a cultural solution: more asynchronous work, meeting agendas and not including people who don't have something to contribute. But in the meantime, I fill my calendar with "bogus meetings" – blocked time to get the job done, so people can't schedule vendor sales calls in the middle of my schedule flow state.

I would prefer that these meetings do not overlap with regular meetings, they are created in credible patterns (they should not all be 30m) and maybe schedule some open spaces so that people are not completely unable to reserve my time.

productivity: two monitors v. one panoramic monitors (programming)

I have read many articles written by experts in their respective graphic or gaming domains on this topic. Most say that the widescreen is the future. I am not convinced.

I can't find much about what is more productive from a purely programming point of view. Both settings are better than a single low aspect ratio monitor, which does not allow you to see as much information. However, arguably a screen is all you should need if you are using shortcuts like Alt-Tab effectively.

Strengths of the duel screen:

  • Apparently better multitasking with a second dedicated physical display.
  • Two full screen apps will be seen on two separate screens
    Better than two split-screen apps on a single widescreen
    display.

Widescreen strengths:

  • There is no gap between screens, some find this useful. I am not sure why.
  • Fewer head turns. I thought ultra wide screens probably have the same problem, so this point is dumb.
  • If you're running an app or watching a video, a single widescreen will give you a more enjoyable and possibly more productive experience.

Some may respond with humor, "why not two wide-screen monitors." That is technically in the category of two monitors.

My Unix settings:.

Monitor 1: Terminal (left), web browser (right).
Monitor 2: Emacs, multiple files can be opened next to each other.

I need help putting this on a label. This is more a question of programming productivity.

I wonder what your productivity tricks are?

Hi everyone!!

I just joined this forum and I have to say it looks amazing!

So, I'm currently trying to find out how the lives of busy entrepreneurs can be made much easier ;]

That's why I have 2 very simple questions:

1. As an entrepreneur like you, what are the 2 most important problems you face when trying to be as productive as possible?

2. Regarding your self-discipline and time management in this matter, what would you want more than anything else?

Thank you very much in advance, I hope to read your answers!

productivity in frames

My friends and I simply wonder if there is any method to follow to compare which framework is best for the developer. For example, how to measure the speed to complete a job in each frame. If there is any type of template to choose from, since we cannot prove ourselves, it would really help, since we are stuck.

ide – Completion of the AI ​​code: improvements in real-life productivity

I've been reading interesting material about AI-based autocomplete (for example: (Deep TabNine)(1)) The value proposition is that by integrating these tools into an IDE, developer productivity will improve.

My question is: has anyone used any of these tools in large projects for a significant period of time? If so, what was your experience, where there were real productivity improvements? Eager to hear positive or negative experiences.