Nono.MA

NOVEMBER 30, 2022

A new Getting Simple episode with Zach Kron is in the making and will be released soon, including a full video with two camera feeds.

NOVEMBER 28, 2022


Creating grids with native HTML5 and the "display: flex" CSS property.


See transcript ›

NOVEMBER 27, 2022

I've been testing imaginAIry over the past few days to generate images using Stable Diffusion locally with the Apple Silicon M1 chip.

I see these implementations as a great move, as they require "a CUDA-supported graphics card or M1 processor" and can be run on any of the new MacBooks.

NOVEMBER 25, 2022


In Live 90, we connected via SSH to a Raspberry Pi and took some photos with the Pi Camera, and then trained YOLOv7 on a dataset of hand sketches and detected drawings, text, and arrows from several pages of one of my sketchbooks.


You can spread the word by liking and sharing this tweet.

If this is something that interests you, please let me know on Twitter or, even better, on the Discord community.

Thanks for watching.

See you next week!

Chapters

NOVEMBER 24, 2022


In Live 89, we saw an overview of TensorFlow Signatures and did a hands-on demo to implement them as well as to understand Python decorators.


You can spread the word by liking and sharing this tweet.

If this is something that interests you, please let me know on Twitter or, even better, on the Discord community.

Thanks for watching.

See you next week!

Chapters

NOVEMBER 21, 2022


How to encode an image dataset to reduce its dimensionality and visualize it in the 2D space.


See transcript ›

NOVEMBER 20, 2022

I started the Getting Simple podcast with the AT2020USBi microphone. I upgraded to the Shure SM58 and the Zoom H6 recorder after some time, which greatly improved the quality. And then I started using the Shure SM7B (with the CL-1 CloudLifter) and the Zoom Podtrak P4 recorder. I still carry with me the Shure SM58 when traveling as these are less bulky and more resistant.

NOVEMBER 19, 2022

My iPhone X screen has been malfunctioning for several months. It would swipe, tap, and type without any understandable cause. I went ahead and decided to get someone to fix it. They changed the screen but the replacement screen wasn't working properly; touches would do nothing even when everything was rendering. The repair service guy, with my phone half open, told me he had to put my phone back as it was, even taking out the new battery he had just installed and putting back in my old one. The result was that now my old screen is working normally, which may mean the screen wasn't broken but misplaced. It may have shifted slightly due to the phone falling and simply disassembling the phone and putting it back together may have fixed those issues.

The swipes and taps would drain the battery as this would happen even when the phone was locked. I'm not sure if you can imagine how bad the experience of using this phone was. What kept me using this phone was that this wasn't a persistent error but an issue that would only express itself at random. I was never able to figure out what was causing the issue.

I'm supposed to go back to replace my battery and screen when a new replacement piece is available at the store. But now I think I'm good with my iPhone as it is.

NOVEMBER 18, 2022

Here's a way to encode a Laravel site request as JSON to log it via Laravel's logging mechanism, using the Log class from the illuminate/support package1.

// Log parameters in a get request
Route::get('a-view', function(Request $request) {
  \Log::info(json_encode(request()->server()));
  return view('your.view');
});

// Log parameters in a get request and redirect
Route::get('redirect', function(Request $request) {
  \Log::info(json_encode(request()->server()));
  return redirect('/some/page');
});

  1. The service provider of Laravel's Log class is Illuminate\Support\Facades\Log

NOVEMBER 17, 2022

"Oops!, something went wrong."

Yesterday, I came across an error while trying to ScreenShare with my reMarkable 2 tablet.

The device continuously lost connection to the screen-sharing session.

I restarted the reMarkable desktop app as well as my computer, but the error persisted.

I went to the app and logged out from my reMarkable account and, when I tried to log back in, I found the following error while trying to get a one-time code from reMarkable's website.

There could be a misconfiguration in the system or a service outage. We track these errors automatically, but if the problem persists feel free to contact us. Please try again.

I think the only error going on was that I clicked the "Get a one-time code" button three times in a row, invalidating so the former authorization tokens of my requests.

I let it sit for a bit and then click once more on the button. I could now log in, obtain an access code, and log the desktop app back into my account.

But the ScreenShare error persisted.

Solution

After a few minutes, the reMarkable 2 tablet displayed a message in its bottom-right corner saying an update had been downloaded and was ready to be installed.

I went ahead, updated the device, and screen-shared once again.

The issue was solved. I could screen share.

NOVEMBER 16, 2022

Here's how to translate 3d points in Python using a translation matrix.


To translate a series of points in three dimensions in Cartesian space (x, y, z) you first need to "homogenize" the points by adding a value to their projective dimension—which we'll set to one to maintain the point's original coordinates, and then multiply our point cloud using NumPy's np.matmul method by a transformation matrix constructed from a (4, 4) identity matrix with three translation parameters in its bottom row (tx, ty, tz).

Steps

Here's a breakdown of the steps.

  • Import the NumPy Python library
  • Define a point cloud with Cartesian coordinates (x, y, z)
  • Convert the points to homogeneous coordinates (x, y, z, w)
  • Define our translation parameters (tx, ty, tz)
  • Construct the translation matrix
  • Multiply the homogenized point cloud by the transformation matrix with NumPy's np.matmul

Code

# translate.py
import numpy as np

# Define a set of Cartesian (x, y, z) points
point_cloud = [
    [0, 0, 0],
    [1, 0, 0],
    [0, 1, 0],
    [0, 0, 1],
    [1, 1, 1],
    [1, 2, 3],
]

# Convert to homogeneous coordinates
point_cloud_homogeneous = []
for point in point_cloud:
    point_homogeneous = point.copy()
    point_homogeneous.append(1)
    point_cloud_homogeneous.append(point_homogeneous)

# Define the translation
tx = 2
ty = 10
tz = 100

# Construct the translation matrix
translation_matrix = [
    [1, 0, 0, 0],
    [0, 1, 0, 0],
    [0, 0, 1, 0],
    [tx, ty, tz, 1],
]

# Apply the transformation to our point cloud
translated_points = np.matmul(
    point_cloud_homogeneous,
    translation_matrix)

# Convert to cartesian coordinates
translated_points_xyz = []
for point in translated_points:
    point = np.array(point[:-1])
    translated_points_xyz.append(point)

# Map original to translated point coordinates
# (x0, y0, z0) → (x1, y1, z1)
for i in range(len(point_cloud)):
    point = point_cloud[i]
    translated_point = translated_points_xyz[i]
    print(f'{point} → {list(translated_point)}')

NOVEMBER 12, 2022

If you try to serialize a NumPy array to JSON in Python, you'll get the error below.

TypeError: Object of type ndarray is not JSON serializable

Luckily, NumPy has a built-in method to convert one- or multi-dimensional arrays to lists, which are in turn JSON serializable.

import numpy as np
import json

# Define your NumPy array
arr = np.array([[100,200],[300,400]])

# Convert the array to list
arr_as_list = arr.tolist()

# Serialize as JSON
json.dumps(arr_as_list)
# '[[100, 200], [300, 400]]'

NOVEMBER 11, 2022

Here's the error I was getting when trying to return a NumPy ndarray in the response body of an AWS Lambda function.

Object of type ndarray is not JSON serializable

Reproduce the error

import numpy as np
import json

# A NumPy array
arr = np.array([[1,2,3],[4,5,6]])
        .astype(np.float64)

# Serialize the array
json.dumps(arr)
# TypeError: Object of type ndarray is not JSON serializable

Solution

NumPy arrays provide a built-in method to convert them to lists called .tolist().

import numpy as np
import json

# A NumPy array
arr = np.array([[1,2,3],[4,5,6.78]])
        .astype(np.float64)

# Convert the NumPy array to a list
arr_as_list = arr.tolist()

# Serialize the list
json.dumps(arr_as_list)

NOVEMBER 10, 2022

Earlier this week, Amazon AWS announced yet another service release, this time called Resource Explorer.

AWS Resource Explorer [is] a managed capability that simplifies the search and discovery of resources, such as Amazon Elastic Compute Cloud (Amazon EC2) instances, Amazon Kinesis streams, and Amazon DynamoDB tables, across AWS Regions in your AWS account. AWS Resource Explorer is available at no additional charge to you.

Start your resource search in the AWS Resource Explorer console, the AWS Command Line Interface (AWS CLI), the AWS SDKs, or the unified search bar from wherever you are in the AWS Management Console. From the search results displayed in the console, you can go to your resource’s service console and Region with a single step and take action.

To turn on AWS Resource Explorer, see the AWS Resource Explorer console. Read about getting started in our AWS Resource Explorer documentation, or explore the AWS Resource Explorer product page.

NOVEMBER 9, 2022


How to use TensorFlow inside of a Docker container.


See transcript ›

NOVEMBER 7, 2022


How to sort a Vue.js view by different attributes and toggle different view modes.


See transcript ›

NOVEMBER 5, 2022

You can now integrate state-of-the-art image generation capabilities directly into your apps and products through our new DALL·E API. You can get started here.

You own the generations you create with DALL·E.

We’ve simplified our Terms of Use and you now have full ownership rights to the images you create with DALL·E — in addition to the usage rights you’ve already had to use and monetize your creations however you’d like. This update is possible due to improvements to our safety systems which minimize the ability to generate content that violates our content policy.

Sort and showcase with collections.

You can now organize your DALL·E creations in multiple collections. Share them publicly or keep them private. Check out our sea otter collection!

We’re constantly amazed by the innovative ways you use DALL·E and love seeing your creations out in the world. Artists who would like their work to be shared on our Instagram can request to be featured using Instagram’s collab tool. DM us there to show off how you’re using the API!

—The OpenAI Team

Three methods for interacting with images

DALL-E’s Images API provides three methods for interacting with images.

  1. Creating images from scratch based on a text prompt
  2. Creating edits of an existing image based on a new text prompt
  3. Creating variations of an existing image

The guide covers the basics of using these three API endpoints with useful code samples.

To see them in action, check the DALL·E preview app.

NOVEMBER 4, 2022


In Live 86, we continued training a decision forest algorithm to classify penguins by species with the tensorflow_decision_forests Python framework on the Palmer Penguins dataset, we saw how to run TensorFlow inside of Docker and a few tricks to create containers and manage them, and briefly looked at TensorFlow signatures, which are supported by TensorFlow Lite since version 2.7.0 and let us export different named operations in a single model that can be executed in C++, Java, and Python.

Here are links to most of the things we covered.


You can spread the word by liking and sharing this tweet.

If this is something that interests you, please let me know on Twitter or, even better, on the Discord community.

Thanks for watching.

See you next week!

Chapters

NOVEMBER 3, 2022

Here's how to run TensorFlow inside of a Docker container.

# Start a Docker container
# with an interactive bash session
docker run -it python:3.9-slim bash

# Install TensorFlow and TensorFlow I/O
pip install tensorflow tensorflow-io

# Run TensorFlow in Python
python -c "import tensorflow as tf;\
print(tf.constant(42) / 2 + 2);\
print(tf.convert_to_tensor([1,2,3]))"
# tf.Tensor(23.0, shape=(), dtype=float64)
# tf.Tensor([1 2 3], shape=(3,), dtype=int32)

This approach is useful when you don't want to install TensorFlow locally or create a Python environment, or simply when it's hard or not possible to install TensorFlow in your local runtime.

Docker makes it quick to execute TensorFlow commands in Python on any machine running Docker.

If you don't need an interactive session and can define your Python code directly, you can use this one-liner.

docker run -it python:3.9-slim \
bash "-c" "pip install tensorflow tensorflow-io;\ 
python -c 'import tensorflow as tf; \
print(tf.constant(42) / 2 + 2); \
print(tf.convert_to_tensor([1,2,3]))'"
# tf.Tensor(23.0, shape=(), dtype=float64)
# tf.Tensor([1 2 3], shape=(3,), dtype=int32)

NOVEMBER 2, 2022

You can get tomorrow's date in TypeScript with the Date class.

// Create a date
const tomorrow = new Date()

// Set date to current date plus 1 day
tomorrow.setDate(tomorrow.getDate() + 1)
// 2022-11-03T09:55:29.395Z

You could change that + 1 to the time delta you want to go backward or into the future.

// Create a date for Jan 2, 2020
const aDate = new Date(Date.parse("2020-01-02"))

// Go back in time three days
aDate.setDate(aDate.getDate() - 3)
new Date(aDate)
// 2019-12-30T00:00:00.000Z

// Go back in time three days
aDate.setDate(aDate.getDate() - 3)
new Date(aDate)
// 2019-12-27T00:00:00.000Z

// Go forward in time forty days
aDate.setDate(aDate.getDate() + 40)
new Date(aDate)
2020-02-05T00:00:00.000Z

OCTOBER 31, 2022


How to hide un-compiled Vue templates while loading.


See transcript ›

OCTOBER 30, 2022

A blank canvas presents endless possibilities.

Taking pictures is chaotic, here's how I edit them.

OCTOBER 29, 2022

Internal temp. high. Allow it to cool. Sony ZV-E10

While capturing and recording video for an extended time1, the Sony ZV-E10 camera heats up, displays the following warning message, and shuts down.

Internal temp. high.
Allow it to cool

I'm capturing video from the ZV-E10's HDMI output with an Elgato HD60 S+ video capture device and a Micro HDMI to HDMI cable2

Of course, this is a considerable limitation when my intended use is recording video for long-form podcast interviews of up to four hours and live streaming on YouTube for hours at a time3.

The solution

When this happened, I had the Auto Power OFF Temp. setting set to Standard. You can set this to High to let the camera heat up more without shutting down. You'll see the following warning.

The temperature of the device may rise to prioritize recording time. Would you like to change this setting?

To allow the camera to heat up a bit more without shutting down, go to your ZV-E10's Setup1's page 1/5 Menu Settings and choose the Power Setting Option. Then follow these steps.

How to avoid ZV-E10 from heating up.

You should now see the High setting has been chosen.

ZV-E10 High Power Setting Option.

Did it work?

On my end, I can now stream with the ZV-E10 without it shutting down. Either way, I'll soon buy an AC adapter to prevent the battery from heating up while I stream 4K video into my computer.

I hope this helped!


  1. In the Standard Power Setting Option, it didn't last more than 30–35 minutes for me. 

  2. The Sony ZV-E10 has a micro HDMI output which outputs video at 2160p (4K, UHD), 1080p (HD, 1K), and 720p. But it also has a USB-C port that can be used as a 720p USB Streaming output to charge the camera. 

  3. This happened to me while streaming Live 85. After I switched the camera on at minute 12:00, it was able to go with the USB-C charging and streaming for 27 minutes, up to minute 39:00. I believe I was able to stream for 42 continuous minutes from minute 44:30 til minute 1:26:00 after removing the USB-C charging cable. The logic may be that the camera heats up even more if you're outputting HDMI and charging it simultaneously. 

OCTOBER 28, 2022


How to build a website with the Next.js React framework and TypeScript.

# TL;DR
npx create-next-app@latest --ts
cd my-app
npm run build
npm start
# ready - started server on 0.0.0.0:3000, url: http://localhost:3000

See transcript ›

OCTOBER 27, 2022

I encountered the following error while trying to run a Python script and import TensorFlow Lite 2.10.0 runtime's interpreter, i.e., tflite_runtime.interpreter.

python -c "from tflite_runtime.interpreter import Interpreter; print(Interpreter)"
# ImportError: /lib64/libm.so.6: version `GLIBC_2.27' not found
# (required by /var/lang/lib/python3.8/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so)

As of October 25, 2022, tflite-runtime versions 2.8.0, 2.9.1, and 2.10.0 return the same error.

The issue was solved by downgrading to tflite-runtime version 2.7.0.

python -c "from tflite_runtime.interpreter import Interpreter; print(Interpreter)"
# <class 'tflite_runtime.interpreter.Interpreter'>

I haven't found a way to make tflite-runtime 2.10.0 work. If you do, please let me know!

OCTOBER 26, 2022

Q&A with Nono — How to Start a Podcast

Hi Friends—

I recently had a conversation with Steve — who wants to build a YouTube channel about the joy of making and listening to music, emphasizing health and well-being — where I shared tips on producing a podcast, building an audience, booking guests, content formats, motivation, goals, and other insights from five years of podcasting.

This episode may be helpful if you're thinking of starting a podcast or YouTube channel or if you want to learn about my podcasting workflow.

Steve’s questions (below) acted as a guide for our conversation.

  • How do you stay motivated to regularly produce your podcast?
  • What do you feel is the best way to approach people you would like to interview or connect with?
  • What methods have worked for you to attract, build, and sustain an audience?
  • Do you know anyone who might be willing to talk with me and guide me further on producing a successful YouTube channel or podcast, especially regarding the arts?
  • Are there any books, articles, or other materials that might help me on my journey? This one didn’t make it into the episode. But I recommended Atomic Habits by James Clear to establish a content creation and publication cadence.
  • Do you have any other advice that would be helpful to someone like me?

Remember that you can submit your questions at gettingsimple.com/ask.

Warmly,
Nono



Steve and Nono Martínez Alonso.

Chapters

00:00 · Introduction
00:58 · Start
01:55 · Steve's idea
03:45 · Passion for music
04:37 · Podcasting
05:20 · Motivation
08:04 · Recording and editing
09:07 · Guests
11:40 · Building an audience
14:01 · Long-form conversations
15:34 · Process
17:33 · Goals
21:51 · Evergreen content
24:14 · Monetization
25:38 · Start lean
29:30 · Outline
31:59 · First episodes
33:17 · Outro

Want to see older publications? Visit the archive.

Listen to Getting Simple .