initViews()

Google I/O 2023

It’s that time of the year. I’m surprised that Google announced the event this early.

New Home

My wife and I are proud homeowners today. After 3 years in the making, we finally got the keys to our new house.

Diablo Immortal on Linux

I was able to run Diablo Immortal on Linux, despite only being available on iOS, Android, and Windows. I know for a fact that I needed Wine to be able to run a Windows environment or application in Linux. But, I just found out you need to install Lutris too.

For future reference, the steps are below. I am on Fedora.

  1. Install Wine
sudo dnf install wine
  1. Install Lutris
sudo dnf install lutris

If Lutris won’t start, try installing it via Flatpak.

  1. Install Winetricks
sudo dnf install winetricks
  1. Visit this Lutris Battle.net link and click on Install. It should display a dialog and click on continue. And just proceed and follow instructions.
  2. It took some time to figure out the perfect settings to run Battle.net, I was able to get a reference from this Reddit post. The settings that worked for me were, check the image below. Take note of the Wine version and the settings below it.
  • Latest Lutris Proton runner
  • DXVK Version 1.10L
  • VKD3D Version 2.6
  • D3D Extras Version 2
  • DXVK NVAPI Version 0.5.3

And after all that, Battle.net should run after signing in.

My first contribution to Google/Android

I just had my first GitHub contribution to Android/Google merged into their codebase. I have never thought of taking my free time to contribute to open source in my over > 11 YOE.

lawgimenez/agp-v7.4.1

It’s not much of a contribution though, it’s just an update to the latest Android Gradle plugin. But nevertheless, I contributed and I’m proud of myself.

Bought ThinkPad T480

Yesterday I bought a ThinkPad T480 for 17,000 PHP or ~315 USD. It has 512 SSD storage and 16GB RAM which is a very good specification-to-price ratio.

The screen resolution is underwhelming though with only 1366x768, compared to my Macbook Pro with Retina.

But the machine is decent enough to work on Android Studio and some light programming.

Leftover Android Studios

Thanks to this Reddit post, I just found out that you could remove unused Android Studio cache or leftover versions.

I saved around ~4GB of storage.

Books I've Read this 2022

I haven’t read that many books this year. For 2023, I hope I would be able to improve my reading habit.

The following below are the books I’ve read (finished).

My 2022 Favorite Tracks

It’s that time of the year to recap my favorite music, visuals, and records for this year, in no particular order or category.

Denzel Curry

Denzel Curry has been my favorite hip-hop artist post-Kdot (Kendrick Lamar). I first heard of him with his project with Kenny Beats called Unlocked.

This track is fire, but his overall album is underwhelming for me.

Botch

The last time I heard of Botch, I was about to finish high school. For me, they are one of the pioneers of a sub-genre of hardcore called mathcore, calculuscore, or whatever. I’m excited about their upcoming album if there is any.

Drug Church

I just discovered this band this year. This might be for me the track of the year.

Hot Water Music

I’m a huge fan of Hot Water Music. Also, Chuck Ragan is one of my favorite vocals in punk.

Kehlani

Fire but I sense a little occult vibe.

Spiritworld

Speaking of occult vibe. These guys for me put out the album of the year called DEATHWESTERN.

Vein.fm

I liked the whole album and this visual should win MTV’s hard rock video of the year. There’s no MTV awards anymore I think.

Inclination

Inclination is starting to become the flag bearers of straight-edge hardcore. Look at all the X on everyone’s hands. This track is fire. But the rest of the album is kind of anti-vax, right-wingish. Not my kind of politics.

Ab-Soul

This beat is sick. This might not be Ab-Soul’s best lyrically.

Kendrick Lamar

This is automatic.

Rise Against

I like the track but the visual is so cringe.

Gang Called Speed

The most popular hardcore band this 2022. Runner up album of the year for me.

Asap Rocky

Visual of the year.

Special Mentions

My Personal Feedbin Reader - v0.2.1

The name of my personal Feedbin reader is called FeedMe. The more I worked on it the more it feels like this is not an RSS reader app, but a food or recipe app.

v0.2.1 Release

I finally fixed the format alignment in the feed view.

And, the mark as read button is now located at the bottom. For easier reach with anyone who has small hands.

There is still more work to do and I am currently enjoying iterating on the fixes, improvements and features.

My personal Feedbin Reader - v0.2

In three days, I developed my own Feedbin Reader since the official one is not written in native. In other words, it feels so slow.

First commit was on December 7, 2022.

The app is written in SwiftUI and I am just blown away by how fast you could create an iOS app. Compared with Storyboarding or UIKit.

I open sourced for my future reference.

There’s still so much to work on it, so many bugs and critical ones but for now, it is functional for my everyday use. Shoutout to Feedbin for having such an amazing API.

Philippines Top 10 In Pivoting to Clean Energy

According to MIT, the Philippines is one of the countries pivoting towards clean energy. Perhaps we are the only one throughout Southeast Asia? Good to know our leaders here, and past, are not climate change deniers.

Updating old Android codebase

An old client of mine contacted me to fix some bugs and the tricky part was that I have to update an Android codebase that hasn’t been updated in 3 years.

I have updated com.android.tools.build:gradle from v3.6.4 to v4.2.2.

And from v4.2.2 to v7.3.1.

This is how old the codebase is.

GCF on Hacker News

In high school, in me and my brother’s room, I had a vandal of a phrase on my wall saying

On the streets saving the scene from the forces of evil

It came from Good Clean Fun’s hardcore album of the same name. It was one of my favorite albums growing up.

About 2 weeks ago, I came upon a username issa on Hacker News and was talking about some hardcore riffs. The post was about How to write a hardcore riff. When I saw the username, the first thing that came to my mind was Good Clean Fun. And straight up asked him. And I was right.

The awesome part is that he still remembered my email way back in 2007-ish. I interviewed him back then through email.

Thank you Issa and to Good Clean Fun for making my high school soundtrack awesome!

Android Studio Render Problem

If you encounter a Render Problem issue on your Android Studio, like the one below.

The solution I came up with is to use the Material Styles as your app theme.

<style name="AppTheme" parent="@style/Theme.Material3.Light">
</style>

Reddit Gift

Reddit made an error with their Premium and in turn, they gifted me with 21,000 coins. I would never expect them to even respond or solve this issue.

Android Job Post Nostalgia

Just found this photo of a newspaper ad for an Android Developer job post. This was my first break in the mobile development industry.

This was published back in October 2011. I emailed them my application and was interviewed the next month. And was hired, if I remember correctly, the same month in November that year.

Amazing, I still have that email sent saved.

This is the source code of the app I developed for the demo for the technical interview.

I am eternally grateful to this company for giving me my big brake in the industry.

Xcode 14.1 Beta 3 New Splash?

I just saw this new Xcode splash screen for the first time. This popped up on Xcode 14.1 Beta 3. I’m surprised this wasn’t included in Xcode 14.0?

Had to confirm it on Reddit.

One of the Top Mobile Developers in Cebu

Before this gets purged on the internet or LinkedIn. Back in 2018, someone messaged me on LinkedIn that I was chosen as one of the top mobile developers in Cebu.

Flattered of course. Thanks! But unfortunately, the project was scrapped.

Weekend Project: ImageDownloader.py

My personal project for this weekend is to migrate my portfolio from my old WordPress blog to my current one.

Export

First, I exported my content using WordPress admin. And was saved into a lwgmnzme.wordpress.com-2022-09-25-02_03_10 folder in XML format.

WordPress XML to Markdown

I then used this handy library for migrating all the pages to Markdown.

Curl Option

At first I was downloading each image individually, and it seems I have more than 50 images to process. So this is not an option.

curl https://lwgmnzme.files.wordpress.com/2021/02/simulator-screen-shot-iphone-12-pro-2021-02-27-at-17.22.11.png > image1.png

Python Script

Time to brush up my Python skills once again. I downloaded the requests Python library.

sudo pip3 install requests

The plan is to be able to input several URLs and maybe prompt a shortcut key or something to cue the script that it’s time to download the images.

Or better yet look for the png URLs inside the .md file? Seems like the most logical option for me.

Initial commit

import requests

file = open("index.md", "r")
line = file.read()
print("Read = %s" % (line))

So far, so good.

Find all the png files

The next step is to find all the URL images with .png extensions. Time to use Regex I guess.

Update the scripts.

import requests
import re

file = open("index.md", "r")
line = file.read()

result = re.findall(r'(https?://[^\s]+)', line)
print(result)

Looks promising. Let’s loop through it.

import requests
import re

file = open("index.md", "r")
line = file.read()

results = re.findall(r'(https?://[^\s]+)', line)

for result in results:
	print(result)

Much clearer. Okay, let’s try downloading each one of them. But, wait I noticed an extra ) character on the results. The hell.

Maybe I should remove the extra ?w= while I’m at it too.

import requests
import re

file = open("index.md", "r")
line = file.read()

results = re.findall(r'(https?://[^\s]+)', line)

for result in results:
	indexOfPng = result.find("?")
	updatedResult = result[:indexOfPng]
	print(updatedResult)

Not the most elegant of solutions but it worked.

Get the filename

The plan is to get the filename from the URL and use it for saving as a file.

import requests
import re
import os
from urllib.parse import urlparse

file = open("index.md", "r")
line = file.read()

results = re.findall(r'(https?://[^\s]+)', line)

for result in results:
	indexOfPng = result.find("?")
	updatedResult = result[:indexOfPng]
	# Get the filename
	parse = urlparse(result)
	print(os.path.basename(parse.path))

Time to download

I was having a IsADirectoryError trouble. And it seems that I need to filter out to download only files coming from a wordpress.com domain.

Final code

import requests
import re
import os
from urllib.parse import urlparse
from urllib.request import urlopen

file = open("index.md", "r")
line = file.read()

results = re.findall(r'(https?://[^\s]+)', line)

for result in results:

	# Filter only Wordpress domains
	if "wordpress.com" in result:
		# print(result)
		# Create folder
		if not os.path.exists("images"):
			os.makedirs("images")

		# Remove unnecessary characters in the URL
		indexOfPng = result.find("?")
		updatedResult = result[:indexOfPng]
		# print(updatedResult)

		# Get the filename
		parse = urlparse(result)
		filename = os.path.basename(parse.path)

		# Create a file path
		filePath = os.path.join("images", filename)
		print(filePath)

		request = requests.get(updatedResult)
		with open(filePath, "wb") as file:
			file.write(request.content)

Just happen to see this picture again in my photo library and I am still amazed at how strong my wife is. These were her medications after her C-section.

I can’t even take two medicines in a day without losing my shit.

So proud of her!

SwiftUI: How to use NavigationStack inside the .toolbar

First, why do I mostly find a solution after posting a Stackoverflow question?

So most examples and tutorials only use NavigationStack and NavigationLink inside a List. I’m surprised by how nobody seems to implement using the .toolbar modifier.

The solution was a little straightforward I found out.

Instead of NavigationView, you use the new and shiny NavigationStack. And use .navigationDestination() instead of NavigationLink.

@State private var goToSettings = false

NavigationStack {
   ZStack {
      // Some more codes
   }
   .toolbar {
      Button(role: .destructive, action: {
         goToSettings = true
      }) {
         Label("Settings", systemImage: "gearshape.fill").foregroundColor(colorForeground)
      }
   }
   .navigationDestination(isPresented: $goToSettings, destination: {
       SettingsView()
    })
}

I need to get more familiar with SwiftUI’s modifiers as it is still a little confusing for me.

BuildException Error

Updated last night to the latest Android Studio Dolphin build but encountered this annoying build error from the JetBrains IDE.

Invalidating cache and restarting seems to not work. Jetbrains seems to be clueless too.

This bug has already taken much of my time. This is annoying.

Edit: September 17 at 9:14PM

It seems that the error went away after declining the “standalone script” option in Android Studio.

Compiling iOS Project in GitHub Actions

While setting up YAML with GitHub Actions, it seems the build failed.

These are the steps I took to integrate GitHub Actions in our iOS project. It seems for CI/CD to work we have to create a Package.swift file in our project. Currently, we do it manually through Xcode’s Swift Package Manager.

To create this Package.swift file, we need to run swift package init in the command line and it will create the following files.

swift package init
Creating library package: iOS
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/iOS/iOS.swift
Creating Tests/
Creating Tests/iOSTests/
Creating Tests/iOSTests/iOSTests.swift

After, I opened Package.swift file and added the libraries inside the dependencies bracket.

dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "https://github.com/scinfu/SwiftSoup", branch: "master"),
        .package(url: "https://github.com/onevcat/Kingfisher", branch: "master"),
        .package(url: "https://github.com/realm/realm-cocoa", branch: "master"),
        .package(url: "https://github.com/optonaut/ActiveLabel.swift", branch: "master"),
        .package(url: "https://github.com/mixpanel/mixpanel-swift", branch: "master"),
        .package(url: "https://github.com/BastiaanJansen/toast-swift", branch: "main")
    ],

After saving, run swift package resolve in the command line. Swift will then fetch the libraries and compile them. Swift will also create a file called Package.resolved.

Also, as of September 15 using macos-latest as the runner in GitHub Actions won’t work. So I have to use macos-12 instead. I got this answer from here.

Push to git repo. xcodebuild is now working and seems to be fetching the libraries now but threw another error about my “provisioning profiles not found”. I don’t need those profiles setup for now, I just want GA to compile our iOS project successfully.

So, I updated the run command in our YAML file.

- name: Build
     run: xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -scheme OnlineJobsPH
     working-directory: ./iOS

Build successful. Yay!

OnlineJobs is iOS 16 Ready

I just compiled our codebase to the latest Xcode 14 RC and everything looks good during testing. I am still not sure how I feel about the new iPhone 14’s Dynamic Island. It seems like a huge black unknown mass floating on the top. I am on a simulator though so, take my opinion with a grain of salt.

With that being said, time to publish this build today and for Apple to review.

Our Son Turned 4

Our kid turned 4 this week. We came back to the hotel where he was still tiny. Where we had to request a crib for our room.

But now we can’t believe he’s 4 now!

Sorry for the table shot, but I captured this perfect moment of them hugging. Our son is on the autism spectrum but it doesn’t mean he won’t show his appreciation and love to us.

The next day’s aftermath, he can’t wait to play with his new toys.