Category: Technology

  • Android app dev: Intent extras set in onBackPressed() misssing when back to onActivityResult()

    It’s funny how we spent about an hour trying to figure out why the Intent extras that we’re setting are not being sent back to onActivityResult(). If we only knew that the solution was as simple as moving one line of code.

    The call to super.onBackPressed() should be placed after setting Intent extras and after finishing the current activity. Like so:

  • Android app dev: Missing import org.apache.commons.lang3.text.WordUtils;


    I use a few instances of WordUtils.capitalizeFully() on an Android app that I’ve been working on. And there are times when the import org.apache.commons.lang3.text.WordUtils;
    breaks, sometimes after merging with some of my git branches.

    To fix this, what I do is open app/build.gradle and add the following line under dependencies:

    Hope this saves somebody else’s day 😆 I got the solution from How to add org.apache.commons.lang3 to AndroidStudio with gradle

  • Something to avoid when using Android RecyclerView

    When using Android’s RecyclerView, don’t use the same inflated XML layout file for items you intend to shuffle on the fly! Their contents will overlap.

    -CK

  • Android RecyclerView notifyItemChanged() IllegalStateException “Cannot call this method while RecyclerView is computing a layout or scrolling”


    If your Android app is crashing with error IllegalStateException “Cannot call this method while RecyclerView is computing a layout or scrolling”, you may try placing your notifyitemchanged inside a Runnable.

    Assuming you have a call to notifyItemChanged() inside onBindViewHolder() that is making your app crash with IllegalStateException, you may try something like this:

  • Ubuntu: Show current Git branch on Terminal prompt


    There are times when I keep running git status or git branch to check which branch I’m on and I just found that I could do something to show the name of my current Git branch on my Terminal prompt, thanks to a colleague.

    In the following screenshot I’m working in the directory “sample_app”, on Git branch that is named “static-pages”:

    ubuntu-terminal-prompt-git-branch-

    In Ubuntu, here’s how I did it.

    Create .bash directory in Home:
    mkdir ~/.bash

    Go to the new directory
    cd ~/.bash

    Clone the git-aware project from GitHub:
    git clone git://github.com/jimeh/git-aware-prompt.git

    Edit your .bashrc file. I use Vim editor for this:
    vim ~/.bashrc

    Add the following to the top of your .bashrc:

    If you want colored prompts, add the following to the bottom of your .bashrc:

    Otherwise, if you doon’t like colors, use this instead:

    Open a new Terminal tab or restart Terminal. Navigate to any directory that has a Git repository and your Ubuntu’s Terminal prompt should now show the current Git branch’s name.

  • Setup/update Ruby on OS X El Capitan 10.11.5

    I need to learn Ruby on Rails for my new job. I’m a little thrilled about this chance to learn a new language, and I’m trying to get started with it on my Macbook which runs OS X El Capitan 10.11.5. I already have Ruby here, I don’t remember if pre-installed though. It’s out of date and I wanted to upgrade, as this resource Getting Started with Rails recommends version 2.2.2 or higher.

    First step I took was to get RVM (Ruby Version Manager):
    curl -sSL https://get.rvm.io | bash -s stable --ruby

    Then I received this message:

    ” * To start using RVM you need to run source /Users/catzie/.rvm/scripts/rvm
    in all your open shell windows, in rare cases you need to reopen all shell windows.”

    And so I ran:
    source /Users/catzie/.rvm/scripts/rvm

    Then:
    rvm install 2.4

    Which returned this message:

    Already installed ruby-2.4.0.
    To reinstall use:

    rvm reinstall ruby-2.4.0

    Finally, I ran this:
    rvm use 2.4 --default

    My next step was to install SQLite3 on my OS X as per instructions found here on SQLite – Installation.

    I got this message after following the instructions:

    SQLite version 3.17.0 2017-02-13 16:02:40
    Enter “.help” for usage hints.
    Connected to a transient in-memory database.
    Use “.open FILENAME” to reopen on a persistent database.
    sqlite>

    More on this in the future.

    Reference: Can I upgrade to the current version of Ruby (2.2.3) on OS X v10.6.8?

  • Manila homemade cakes, cupcakes, cookies, brownies & more desserts at The Tiny Cakery

    Manila homemade cakes, cupcakes, cookies, brownies & more desserts at The Tiny Cakery

    Update: We have rebranded into Catzie’s Cakery.


    When I’m not busy tapping codes on my keyboard, I either watch anime or bake. And there’s this “tiny” baking business in Manila I’m running, and really have a good time baking for people – friends, family, and even people I haven’t met prior to handing over their ordered desserts.
    Last year I launched the official website: The Tiny Cakery, reaching my goal of completing it before year 2016 ends.

    Visit website: http://thetinycakery.catzie.net/
    Visit website: http://thetinycakery.catzie.net/

    Coding it wasn’t easy to me. It’s mostly front-end coding and the masonry grid layout gave me a lot of problem, and combining it with Slick Carousel did not make things simpler due to some conflict.

    Here’s an Instagram video demo of what it looked like shortly before I launched the site:

    It’s not a high-income business — no, it’s not even a medium-income business. I barely make anything with my The Tiny Cakery income. But I really like what I do there and I like the feeling of fulfilment it provides, so I keep doing it. The time when I needed to upload a price list came due to increased number of price inquiry, and I prepared a one-page website for it last year with a price list being its major component. I knew I had to develop a better website, with product grid including photos that will make people drool (lol), and more informative pages so they know right away how to order.

    I worked on the official website later last year in 2016. I won’t call it a “version 2.0” of the older website because I don’t really consider that “price list website” its “official website”.

    Catzie coding the Tiny Cakery websiteNext step would be a “baking schedule” calendar where customers will see which days I will be baking the goods, and which days are available for booking a pickup on what available locations in Metro Manila. And after this, I want to add an “Add to Cart” feature, initially with manual payments. I believe that even with manual payments, this will make our lives easier. Instead of long chats with customers, they can simply go to the site, select desired products, select date and time of pickup, and then confirm it with me. After that, they confirm orders by downpayment (standard procedure) and then meet up with me on the set schedule.

    Hoping 2017 brings us more freshly baked homemade desserts by The Tiny Cakery, and more convenient ways to order with the help of technology. <3