The Journey of #100DaysOfCode (@henna_dev)

#Day20 of #100DaysOfCode

I made good progress on BookLog App and also made some more bugs :stuck_out_tongue: I was finally able to sync my schema from Mobile to Atlas… although I am still in process of testing queries…

I am absolutely enjoying the process of discovery, understanding the concepts in more detail. More on the blog :smiley:

:sparkles: Twitter : https://twitter.com/henna_dev/status/1497705605217280002

2 Likes

#Day21 of #100DaysOfCode

Today was a fun day because it was Sunday :wink: Playstation, Cross-Stitch, and some coding. I managed to fix the errors I was stuck on for a while in both BookLog and Flashcards Project… :sunglasses:

:sparkles: Twitter : https://twitter.com/henna_dev/status/1498075039085645827

2 Likes

#Day22 of #100DaysOfCode

Today was a loooonnggg day. I took a break from BookLog Application :face_with_peeking_eye: and came back to my Flashcards Project which I am pretty excited to finish. Although I am very poor at designing :grimacing: I am still excited to create this Quiz =D I created an HTML Form CheatSheet today

:sparkles: Twitter: https://twitter.com/henna_dev/status/1498444729482162190

3 Likes

#Day23 of #100DaysOfCode

Today was a tiring day… Lots of things to do and soo little time to do it… :upside_down_face: Do you also feel there should be more than 24 hours a day… I wish I had better overlap with my favorite people…
I cant get enough of them… :face_with_open_eyes_and_hand_over_mouth: Today I continued with the Flashcard Project… I am really looking forward to completing my quiz project

:sparkles: Twitter: https://twitter.com/henna_dev/status/1498804742927048720

3 Likes

#Day24 of #100DaysOfCode

Today was fun and yet another tiring day… I had a good start… I walked in the rain :cloud_with_rain: to a cafe… Had my favorite breakfast :avocado: :coffee: and attended two office meetings :technologist: and came back in the rain… :cloud_with_rain:
I had a late start to work and ended up finishing late but experimenting with Query API was fun… :smiley:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1499169601350995973

3 Likes

#Day25 of #100DaysOfCode

Today was a good day full of good food… visa appointments… bug bashing and light reading on HTML Lists… :heart_eyes:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1499533773582573571

4 Likes

:tada: Excellent coding streak @henna.s! You’ve just unlocked the Committed Coder badge (which you can also use as a title in the forum):

Committed Coder

Participate in #100DaysOfCode challenge and share your daily learnings for 25 consecutive days.

Regards,
Stennie

4 Likes

#Day26 of #100DaysOfCode

Today was a tiring day… I am not as young as I once was and that hurts…(oooffff) lol but I still feel like a child inside :stuck_out_tongue:
I decided to come back to my BookLog App and finish it completely by tomrow, only if there were fewer bugs to fix :wink:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1499893476720320515

2 Likes

#Day27 of #100DaysOfCode

Today I had a great start to my day, went for a morning walk close to the sea, had a good breakfast and then cycled to the library and spent some good hours there… :two_hearts:

Edit: Me at the Sea :smiley:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1500261523998007302

2 Likes

#Day28 of #100DaysOfCode

Sunday rhymes with Funday and so eggjactly that way it was :stuck_out_tongue: Food Market Fun and Evening with a Fren

:sparkles: Twitter: https://twitter.com/henna_dev/status/1500616573609984000

2 Likes

#Day29 of #100DaysOfCode

Today was full of meetings… I could not get a lot done and the day did not end with a happy note. I spent time solving the error I was stuck at for a while… :slight_smile:

I got some suggestions from a Senior Developer, but I could not implement them in the app until late evening :unamused: :unamused: and the code did not work. Realm Queries is a little harder to understand :stuck_out_tongue: I will understand them soon…

I made some changes in the Add Book Fragment, I was suggested not to use transactions in Read queries, so I removed transaction code from all of them.

 private fun openDialogBox(nameList: ArrayList<Author>) {

        val builder: AlertDialog.Builder = AlertDialog.Builder(requireContext())
        builder.setTitle("Select Author/s")
        val selectedAuthors = BooleanArray(nameList.size)
        val stringAuthorList = nameList.map{it.name}.toTypedArray()
        builder.setMultiChoiceItems(stringAuthorList, selectedAuthors) { dialog, which, isChecked ->
            if (isChecked) {
                //when checkbox selected, add position
                selectedItems.add(which)
            } else if (selectedItems.contains(which)) {
                //when checkbox unselected
                //remove pos from list
                selectedItems.remove(which)
            }
        }
        builder.setPositiveButton("OK") { dialog, which ->

            selectedItems.forEach{
                Timber.d("Authors, ${stringAuthorList[it]}")
                nameList.forEach {author ->
                    if(stringAuthorList[it] == author.name){
                        bookObject.authors.add(author)
                    }
                }
//                realmClass.executeTransactionAsync({ realm ->
//                   realm.where(Author::class.java).equalTo("name", nameList[it]).findAll()
//                       .map{addAuthor ->
//                      bookObject.authors.add(addAuthor)
//                   }
//                }, {
//                    Timber.d("Author added successfully")
//                }, { throwable ->
//                    Timber.d("Error adding the author %s", throwable.localizedMessage)
//                })
            }
        }
            .setNegativeButton("Cancel", DialogInterface.OnClickListener{ dialog, id ->
                    dialog.dismiss()
            })

        builder.create().show()
    }

I didn’t feel like deleting the code, so I commented it :smiley: I changed the way I was processing the selected Authors, I used copyFromRealm to get the AuthorList in form of ArrayList that I passed to openDialogBox

The loadAuthors is called when I click on Text Button to add Book Author, it reads the list of authors in the database and displays it on a dialog for the user to select shown in above code.

    private fun loadAuthors() {
        var nameList = ArrayList<Author>()
        realmClass.executeTransactionAsync({
            val authorList = it.where(Author::class.java).sort("name").findAll()
             nameList = it.copyFromRealm(authorList) as ArrayList<Author>
//            authorList.toTypedArray().map { obj ->
//                nameList.add(obj.name)
//            }
        }, {
            if(nameList.size>0) openDialogBox(nameList)
            else {
                Toast.makeText(context, "Author List is empty, please add Author Name first", Toast.LENGTH_LONG).show()
            }
        }, {
            Timber.d("Error happened while reading Author List %s", it.localizedMessage)
            Toast.makeText(context, "Error happened while reading List, ${it.localizedMessage}", Toast.LENGTH_LONG).show()
        })
    }

Once the user selects the author index, it searches the list for a name that was selected and saves that to the bookObject.

When submit button is pressed, click listeners get called and save the book to realm database. The last part is giving errors and I have no clue how to solve, so I will continue tomorrow.

2022-03-07 22:42:42.517 14699-14699/? D/AddBookFragment: Error adding the bookObject to Database 'BookRealm' has a primary key, use 'createObject(Class<E>, Object)' instead.

I changed the code after above error to following

        addBinding!!.buttonAddBook.setOnClickListener{
                realmClass.executeTransactionAsync ({realm ->
                    val booktoAdd = realm.createObject(BookRealm::class.java, ObjectId())
                    booktoAdd.name = bookObject.name
                    booktoAdd.isRead = bookObject.isRead
                    booktoAdd.authors = realm.copyToRealm(bookObject.authors) as RealmList<Author>

                }, {
                    Timber.d("Book Object Added Successfuly")
                }, {throwError ->
                    Timber.d("Error adding the bookObject to Database %s", throwError.localizedMessage)
                })
        }

And this gives me a different error that I cannot solve

2022-03-07 23:42:34.721 5257-5257/? D/AddBookFragment: Error adding the bookObject to Database Attempting to create an object of type 'Author' with an existing primary key value '621a992338d6fd61a1126414'.

My Add BookFragment screen is as below:

Until Tomorrow… :performing_arts:

2 Likes

#Day30 of #100DaysOfCode

I cracked the error that I was stuck at for a long time, now finally the puzzle pieces are complete. I drafted part one on our forums, Stay Tuned for part two :wink:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1501342938785329155

2 Likes

#Day31 of 100daysofcode

Today I went to the office and we had loads of fun with colleagues… It was a day spent well :heart_eyes:
I continued with my BookLog application and talked about errors I faced and how I resolved them

Until tomorrow… :performing_arts:

3 Likes

#Day32 of #100DaysOfCode

Today was a productive day… I got up lazy as I was very tired from yesterday but the day went well :smiley:
I also managed to book my classes for Martial Arts :martial_arts_uniform: something that I am very excited to start :heart_eyes:

Today I came back to HTML as I also want to finish the Flashcards project soon.

:sparkles: Twitter: https://twitter.com/henna_dev/status/1502067350044090369

2 Likes

#Day 33 of #100DaysOfCode

Happy Friday :tada: always exciting to mark the end of the week and I ended on a high point… I and my Friend are fans of each other… :revolving_hearts: :stuck_out_tongue:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1502434278654849025

3 Likes

#Day 34 of #100DaysOfCode

Today was a lazy day… hehhehhe I started a new game on PS4 and it’s fun although I am still learning to fight. The evilest thing I did was kill the cutie elephant queen in “It Takes Two” I feel like a devil :smiling_imp:

I also managed to study Transformations in CSS :smiley:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1502797540303020040

5 Likes

Oh, nice! You are playing “It takes two” - I love the game!

34 days into it #100daysofcode! 1/3 there! Woohoo!
How does it feel @henna.s? It is said that do a thing for 21 days and it will become a habit.

Love reading your updates, looking forward to the next 66 days!

All the best!

3 Likes

#Day35 of #100DaysOfCode

Today was a long day… I was in Galway today to give a talk at the Leadership and Empowerment event :rocket: to celebrate International Women’s Day :tada: :smiley: … It was also 5-hour travel to and fro Galway :sweat_smile:

I am proud to say everybody loved :revolving_hearts: my talk and am super excited that we are back with in-person events.

Some highlights

I am 3 chapters away from finishing the CSS concepts before I complete the remaining parts of the Flashcards project … :confetti_ball: :tada:

I finished studying backface-visibility in CSS. It means if you want backside of the element to be visible or not.
You can set the following values for the backface-visibility property:

  • visible is used to make the backside of the element visible and mirrored through the front surface of the element. This is the default value.
  • hidden makes the backside invisible behind the front surface of the element.
  • inherit will allow you to inherit the value of the parent element.
  • initial sets the property to its default value;
  • unset is basically a combination of the initial and inherit values. The unset keyword sets the property value as inherit if the property is inherited from the parent element; otherwise, the value is set as initial

Too tired today, so I am skipping writing :frowning: I will continue this section in the CSS: Visibility Blogpost.

5 Likes

Thanks, Harshit, I absolutely adore the game as well… playing for the second time now… :smiley:

It feels great :heart_eyes: I am more focussed on what I am learning each day :wink: and I feel absolutely satisfied that I started this and @Kushagra_Kesav motivates me a lot and keeps me on track :smiley:

I can’t wait to see what all will I learn in next 66 days :wink:

Cheers, :performing_arts:

4 Likes

#Day36 of #100DaysOfCode

Today was Monday, as all Monday blues goes… :upside_down_face: I finished another CSS topic which totally jumbled up my brain… I will do some practice on this because its an interesting topic… Tomorrow I will do more Realm :blush:

:sparkles: Twitter: https://twitter.com/henna_dev/status/1503523626863243267

2 Likes