When you use JSON to call an API - not a REST API, but something like JSON-RPC - you will usually want to encode one of several possible messages.
Your request body looks like this:
{
"type": "MessageWithA",
| import { readFile, writeFile } from 'fs/promises' | |
| import { existsSync } from 'fs' | |
| import { generateKeyPair, privateKeyToProtobuf, privateKeyFromProtobuf } from '@libp2p/crypto/keys' | |
| import { peerIdFromPrivateKey } from '@libp2p/peer-id' | |
| import type { PrivateKey } from '@libp2p/interface' | |
| import type { PeerId } from '@libp2p/interface' | |
| /** | |
| * Utility class for managing persistent libp2p peer IDs | |
| * |
| # Clear all Android packages and user data via ADB, by @noseratio | |
| # Run: powershell -f adb-clear-packages.ps1 | |
| # To get ADB: https://community.chocolatey.org/packages/adb | |
| # | |
| # Q: Why not a factory reset? | |
| # A: https://www.reddit.com/r/Android/comments/naetg8/a_quick_powershell_script_for_clearing_user_data/gxtaswl?context=3 | |
| $confirmation = Read-Host "This will clear all packages data and user files. Are you sure you want to proceed? (y|n)" | |
| if ($confirmation -ne 'y') { | |
| return |
If you, like me, resent every dollar spent on commercial PDF tools,
you might want to know how to change the text content of a PDF without
having to pay for Adobe Acrobat or another PDF tool. I didn't see an
obvious open-source tool that lets you dig into PDF internals, but I
did discover a few useful facts about how PDFs are structured that
I think may prove useful to others (or myself) in the future. They
are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.
WKWebView was first introduced on iOS 8. With Apple finally release a deadline for all apps to migrate away from UIWebView, this series and this post is here to help you explore the features of WKWebView. In this blog post you will create a simple web browser with some basic features such as displaying content, back and forward.
One of the most interesting things coming out with Xcode 11 is SwiftUI's PreviewProvider, which provides a way to preview the UI during development instantly on multiple devices, multiple settings at the same time.
To preview UIViewController and UIView, you need to download previewing code from NSHipster
Since we are making this browser with a navigation bar, our main UIViewController needs to be embedded inside a UINavigationController. Therefore the previewing code would be like this:
| extension UIWindow { | |
| /// Traverse the window's view hierarchy in the same way as the Debug View Hierarchy tool in Xcode. | |
| /// | |
| /// `traverseHierarchy` uses Depth First Search (DFS) to traverse the view hierarchy starting in the window. This way the method can traverse all sub-hierarchies in a correct order. | |
| /// | |
| /// - parameters: | |
| /// - visitor: The closure executed for every view object in the hierarchy | |
| /// - responder: The view object, `UIView`, `UIViewController`, or `UIWindow` instance. | |
| /// - level: The depth level in the view hierarchy. | |
| func traverseHierarchy(_ visitor: (_ responder: UIResponder, _ level: Int) -> Void) { |
Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.
This article is also on my blog, too.
Note: $ denotes the start of a command. Don't actually type this.
x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Ana| #!/bin/bash | |
| ############################################################################################################## | |
| ### 1. Name your profiles with the convention of ProjectName_TargetName_ConfigurationName.mobileprovision ### | |
| ### 2. Create a directory called CodeSign in your project directory ### | |
| ### 3. Move all your project's provisioning profiles into the CodeSign directory ### | |
| ### ### | |
| ### Running this script will update your project file to point to the correct UUIDs of each corresponding ### | |
| ### profile in your CodeSign directory. ### | |
| ############################################################################################################## |
| import android.content.Context; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import android.graphics.Canvas; | |
| import android.graphics.Color; | |
| import android.graphics.Paint; | |
| import android.graphics.SurfaceTexture; | |
| import android.os.Build; | |
| import android.text.TextPaint; | |
| import android.util.AttributeSet; |