Skip to content
Paras Gupta

Jan 3 - Daily Programming Diary

Diary, Programming1 min read

13:20

Starting late today. Don't know what to do so I'll just set up the 404 page for this website. The 404 page in development looks pretty cool. I'll be going with a minimal setting for now. After all, the theme is called minimal-blog-theme.

14:40

After an hour of searching for inspiration, I finally completed the 404 page and it looks awesome.
Now would be a good time to start today's Leetcode challenge, Day 3. I read the question earlier and it has to deal with backtracking or something like that since the constraint is 1<=n<=15.

15:00

Okay, yeah! Backtracking it was. So what I did was checking the solution for all values that can be placed in the vector. Then if it executes till the end, then incrementing the count. Neat!

beautiful-arrangement.cpp
1int countArrangement(int n) {
2 vector<bool> occupied(n + 1, false);
3 int count = 0;
4 back_tracking(n, occupied, 1, count);
5 return count;
6}
7
8void back_tracking(int n, vector<bool> occupied, int index, int &count) {
9 if (index == n + 1) {
10 count++;
11 }
12
13 for (int i = 1; i < n + 1; i++) {
14 if (occupied[i] == false && (index % i == 0 || i % index == 0)) {
15 occupied[i] = true;
16 back_tracking(n, occupied, index + 1, count);
17 occupied[i] = false;
18 }
19 }
20}
15:50

Time to complete the Raahee email feature on report. The user needs to know if their post has been taken down. Using mailgun and custom email content. I miss SQL and her joins 😆

I need a break!

19:30

Did today's Go. Explored conditionals and loops, scoping and defer statement. ❤️
I'm having a difficult time trying to get the hang of the syntax. := ?

21:30

Fixed the banner on this website, the abstraction with Gatsby plugins is too much. At least give an interface to deal with things. 😤

Getting back on reviewing the PR, and merging the code. Will fix the community page.

23:30

Done with the community page file upload fix. Encountered a new bug that can affect users already in DB.

The current implementation of App and Website signup are different regarding the user doc in DB. Will have to make something to fetch users in auth and store them as a document. Thinking about using Node.js firebase-admin for that.

23:55

Okay, wow! Found a workaround using DOM.

  1. Opened the firebase auth page.

  2. Since all the values in table use mat-cell-wrapper class, I fetched all the values, and stored it in an array using let allValues = document.querySelectorAll(".mat-cell-wrapper")

  3. Then every 5th value contains the UID, so map over the array and get innerText for every 5th value. This is done by

    1// let allValues = document.querySelectorAll(".mat-cell-wrapper")
    2let UIDs = []
    3let emails = []
    4allValues.forEach((value, index) => {
    5 if (index % 5 === 4) {
    6 UIDs.push(value.innerText)
    7 } else if (index % 5 === 0) {
    8 emails.push(value.innerText)
    9 }
    10});
    11
    12copy(UIDs); // To copy to clipboard

Gonna create docs for each user after consulting with Mansi. Then we can give the user an option to update their profile. 🎉

💤✨ Bye!

EOD Checklist

  • Go
  • Leetcode January Challenge
  • Codechef Long Challenge
  • Raahee
  • This blog
© 2022 by Paras Gupta. All rights reserved.
Theme by LekoArts