Byte-Sized Tech Tips Round-Up: Week 1

Steve Martinelli - Oct 17 '20 - - Dev Community

Populate a Cloudant database with Python

From

In just a few lines I was able to use the Cloudant Python SDK to quickly seed a database with 1400 entries from a YAML file.

Pro-tip: Make sure you're using the Replay429Adapter in your client or you'll surely hit a Rate Limit Error

import yaml
from cloudant import Cloudant
from cloudant.adapters import Replay429Adapter


username = "foo"
password = "bar"
url = "baz"
client = Cloudant(username, password, url=url, connect=True,
                  adapter=Replay429Adapter(retries=10, initialBackoff=0.01))

client.connect()
db = client.create_database("repos", throw_on_exists=False)

with open("repos.yaml", 'r') as stream:
    data_loaded = yaml.safe_load(stream)

    for entry in data_loaded['repos']:
        db.create_document(entry)
Enter fullscreen mode Exit fullscreen mode

Read more about the Cloudant DBaaS on IBM Cloud.

Expo and iOS

From


This week I was had a chance to play with expo. The application we're building in React will work on Android and iOS from the same JavaScript codebase. Expo also provides access to device capabilities like camera, location, notifications. Putting it all together was the iOS simulator functions of Xcode!

Read more about using Expo with iOS in the docs.

Bang-bang

From Nigel

I'm currently taking the Red Hat System Administration I
course in preparation of the Red Hat OpenShift I: Containers & Kubernetes course. One this I learned this week was the !! Bang-bang command. The !! Bang-bang command repeats the last command. It's especially helpful with commands that you forgot to put sudo in front of. For example:

$ yum update
Loaded plugins: priorities, update-motd, upgrade-helper
You need to be root to perform this command.

$ sudo !!
sudo yum update
Loaded plugins: priorities, update-motd, upgrade-helper
Enter fullscreen mode Exit fullscreen mode

Read more about bang bang commands.

API Connect Sandbox features

From


This week I hosted a workshop about API Connect. One thing I learned about this week was API Connect's Sandbox service. I had played with tools such as Postman before but the Sandbox service has great features such as adding collaborators and deploying your sandbox to a staging-like environment. Those really impressed me!

The collaborators of the project

Alt Text

The URL to our staging environment

Alt Text

Read more about API Connect.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .