SQLite Notes - Part 2

Part 1 From the SQLite FAQs: SQLite will easily do 50,000 or more INSERT statements per second on an average desktop computer. But it will only do a few dozen transactions per second. In the Python sqlite3 module, any transaction1 needs to be committed before changes are saved in the database (Source). This is achieved by calling con.commit() on the connection object. I ran a quick and dirty test in Python to understand the performance impact of commit frequency....

September 21, 2022 · 2 min

Kindle, Remote Assets, and EPUBs

I recently created an HTML file, converted it to EPUB, and sent it to my Kindle. While the files were loading correctly (including images) in both formats on my desktop, the Kindle would not display the images. Instead, it was showing a thumbnail of a camera as a placeholder. Presumably, the issue lay with how the Kindle was handling the EPUB. Some preliminary research took me to Kindle Direct Publishing’s image guidelines....

September 9, 2022 · 2 min

SQLite Notes

SQLite is an embedded database that is much loved by the developer community for its speed and relative simplicity. I finally got around to using it for a personal project and have documented (and maybe will keep documenting?) some of its idiosyncracies as I learn them along the way. Enabling Foreign Key Support From the SQLite documentation: Foreign key constraints are disabled by default (for backwards compatibility), so must be enabled separately for each database connection....

August 18, 2022 · 1 min

CORS, Preflight Requests, and OPTIONS Method

Background In working on a .NET backend recently, we ran into the following error whenever a request was made from the browser: Cross Origin Rrequest Blocked: The Same Origin Policy disallows reading the remote resource at <backend-deployment-url>. (Reason: CORS header 'Access-Control-Allow-Origin' missing). Status Code: 405. It is worth noting that the GET/POST requests were wroking fine using curl. CORS, Preflight Requests, and the curious case of 200 OK From the MDN Web Docs...

April 24, 2022 · 3 min

Video Player Prefabs in Unity

TL;DR If you are instantiating multiple video players in Unity as Prefab objects, make sure you generate their respective RenderTexture's at runtime. RenderTexture API Multiple VideoPlayer objects rendering onto the same texture may cause issues in use-cases where you need individual VideoPlayer objects to respond differently. What Happened I recently had to build for the use-case where a single scene in Unity would contain multiple video players....

February 22, 2022 · 2 min

S3 Presigned URLs and Unity

I recently learnt that you can share objects in private S3 buckets by using pre-signed URLs. The [S3] object owner can share objects with others by creating a presigned URL - using their own security credentials to grant time-limited permission to download the objects. Source: S3 User Guide This functionality has been really useful in getting a VideoPlayer GameObject in Unity to directly play a video hosted on S3....

February 15, 2022 · 1 min