Restdb.io – Super Simple, Low Code CMS and Database Backend for Web Apps

If you need a quick and easy way to create a CMS (content management system) or a database backend for an app, then Restdb.io will amaze! Here are some features:

  • super developer-friendly with crystal clear documentation
  • affordable and even has a free plan
  • example code for popular programming languages, including client side JavaScript and server side NodeJS, which makes it quick to get up and running
  • webhooks whenever a record is created, updated or deleted
  • codehooks to run custom code before and after a record is created, updated or deleted, e.g. for data normalizing and validation. codehooks also support scheduled tasks like cron jobs.
  • auto-generate test data to seed a table
  • ability to import data from a CSV file
  • native and custom field validation
  • non-technical users can log in and add/edit/delete records using intuitive forms and controls without seeing any developer features
  • ability to upload and host images and files

Below is a tutorial on how to create a simple CRUD (Create, Read, Update, Delete) app using Restdb.io with a PHP backend.

1. Log in to Restdb.io account and create a table (collection)

After you log in, you’ll need to be in Developer Mode to create a table. When creating fields in the table, Restdb.io offers numerous field property options including native and custom field validation.

2. Add or import data

To populate the table, you can

  • Add data field by field, row by row
  • Import data from a CSV file
  • Auto-generate data by clicking on the Test Data tab

Using the Test Data option, I chose to generate 5 rows which gave me this.

3. Get sample CRUD code

Click on [Table] > API Docs and choose a language to see sample code for

  • getting records (using HTTP GET method)
  • creating a record (using HTTP POST method)
  • update a record (using HTTP PUT method)
  • delete a record using (HTTP DELETE method)

PHP

The sample PHP CRUD code provided by RestDB.io requires the use of the HttpRequest PEAR PECEL HTTP_Request extension. To avoid having to install this dependency, you can just use cURL which is included with PHP.

NodeJS

Below is a screenshot using NodeJS using the Request library.

JavaScript using jQuery AJAX

You can also perform CRUD actions using client-side JavaScript but you need to set up CORS (cross-origin resource sharing). The example below shows JavaScript using jQuery AJAX.

For client-side JavaScript, you need to generate a CORS API key. The screenshot below shows a CORS API key (redacted) that allows connections from any origin server but only allows the GET method to read data.

In the screenshot above, the API key would only work for the “people” table / collection. To have one key work for all tables / collections, use “/**” instead.

4. PHP: Create a file to test reading from the database

I created a test file called read-curl.php which uses cURL to connect to the remote database.

After uploading it to my web host, opening the file in a browser shows me the data in JSON format, as expected, which you can see live at http://zabuun.com/restdb.io/read-curl.php

You can also test the API by installing Postman (free), entering a query in the form of a REST URL, and entering your API key as an HTTP header.

4. JavaScript (jQuery + AJAX): Create a file to test reading from the database

I created a test file called read.html with the following code. This code uses the CORS key for cross-origin resource sharing.

After uploading it to my web host, opening the file in a browser shows me the data in JSON format, as expected, which you can see live at http://zabuun.com/restdb.io/read.html

If you have JSON data as in the example above, you can use Handlebars.JS to format the output in HTML.

5. Query data

When reading data from RestDB , you will often want to filter data based on conditions rather than retrieve an entire collection (all records). RestDB supports many MongoDB-like query syntax. Read the docs. Here’s an example of RestDB queries for equivalent relational DB SQL queries.

SQLRestDB
SELECT * FROM usershttps://<db-name>.restdb.io/rest/users?q={}
SELECT id, user_id, status FROM users/rest/users?q={}&h={"$fields": {"user_id": 1, "status": 1} }
SELECT * FROM users WHERE status = “A”/rest/users?q={ "status": "A" }
SELECT * FROM users WHERE status != “A”/rest/users?q={"status":{"$not":"A"}}
SELECT * FROM users WHERE status = “A” AND age = 50/rest/users?q={ "status": "A", "age": 50 }
SELECT * FROM users WHERE status = “A” OR age = 50/rest/users?q={ "$or": [ { "status": "A" } ,{ "age": 50 } ] }
SELECT * FROM users WHERE age > 25/rest/users?q={ "age": { "$gt": 25 } }
SELECT * FROM users WHERE age < 25/rest/users?q={ "age": { "$lt": 25 } }
SELECT * FROM users WHERE age > 25 AND age <= 50/rest/users?q={ "age": { "$gt": 25, "$lte": 50 } }
SELECT * FROM users WHERE user_id like “%bc%”/rest/users?q={ "user_id": {"$regex" :"bc"}}
SELECT * FROM users WHERE user_id like “bc%”/rest/users?q={ "user_id": {"$regex" :"^bc"}}
SELECT * FROM users WHERE status = “A” ORDER BY user_id ASC/rest/users?q={ "status": "A" }&sort=user_id&dir=1
SELECT * FROM users WHERE status = “A” ORDER BY user_id DESC/rest/users?q={ "status": "A" }&sort=user_id&dir=-1
SELECT COUNT(*) FROM users/rest/users?q={}&h={"$aggregate":["COUNT:"]}
SELECT COUNT(*) FROM users WHERE age > 30/rest/users?q={"age":{"$gt": 30}}&h={"$aggregate":["COUNT:"]}
SELECT * FROM users LIMIT 1/rest/users?q={}&max=1
SELECT * FROM users LIMIT 5 SKIP 10/rest/users?q={}&max=5&skip=10

You can also aggregate data, e.g. min, max, avg, count, groupby, etc, using aggregation and grouping functions. Read the docs.

If you already have an entire JSON dataset and you want to query against it, you can use JSONata. JSONata is a lightweight query and transformation language for JSON data. 

6. Auto-generate a web form

If you want to create a web form for public use, you can have restdb.io auto-generate one for you, complete with JavaScript validation and code to publish the data to your restdb.io database. See an example at

http://zabuun.com/restdb.io/form.html

7. Filesystem

Below is a screenshot of my remote filesystem on a shared GoDaddy server. The error.log file is auto-generated.

8. Create users with editor access

If you work with other developers or editors, you can give them role-based access to your restdb.io account to manage data. An editor, for example, will not see the developer features and can simply add records using a user-friendly web form like shown below.

Simple, Yummy Eggs

How to make these yummy eggs

  1. Put a couple tablespoons of olive oil in an 8 inch pan on medium heat
  2. Put in 4 eggs making sure not to break the yolk
  3. Sprinkle salt and pepper. Cumin is good, too.
  4. Using a flipper, inspect the bottom of the eggs along the perimeter occasionally until it’s slightly brown and the egg pancake, if you will, is firm. Personally, I like my egg yolks half cooked.
  5. Remove to a plate

Eating method

Personally, I don’t like to break the yolk cuz that’s messy. I’d eat the egg white separately and each entire egg yolk separately.

Easily Highlight Text in a Screenshot Using Photoshop

Let’s say you’ve taken a screenshot of some text and you’d like to highlight part of the text. By using different blending modes, this becomes an easy task. Here’s how to do it.

1. Open the screenshot containing text in Photoshop and select the text you want to highlight

2. Create a new layer and fill it with yellow

3. Change the blending mode to darken or any other one you like to create the highlighted text.

Here, I’ve chose the Darken blend mode.

This is the result.

Easily break up (till) dirt with a tiller

Mantis Tiller and Mid-Tine Tillers

I’ve tried various types of tillers that you can rent from Home Depot. The light duty mantis tillers and mid tine are really only good for soft dirt.

MTA Rear Tine Tiller
(Model # FRC800K1A-656912)

This tiller is heavy duty and can break up hard clay BUT both the wheels and the tines move forward so unless the tines are partially underground breaking the dirt, you can easily be pulled forward and lose control of the machine. Though this is a heavy duty machine, I find it less easy to control compared to the Barreto Hydraulic tiller.

Barreto Hydraulic Tiller
(Model # E1320HX)

This tiller is big and heavy but it’s easy to use, easy to control, and will destroy clay and hard dirt. The rear tines move in the opposite direction of the wheels so the machine never runs away from you moving you forward out of control. It’s the most expensive to rent, but the time savings and ease of use make it worth it. I personally recommend this tiller over all the others.

Delish Egg Scramble

Last week I made an egg sandwich with spinach, smoked sliced beef brisket, cheddar cheese and ciabatta bread. It was good but messy as the ingredients kept falling out as I’d eat it. Also, it wasn’t easy tasting all of the ingredients with every bite since they’d move around while holding the sandwich.

Since the sandwich would end up all mixed up in your mouth and stomach, I figured why not just mix all the ingredients up in a pan. It turns out this was not only much easier to cook and eat but also tastier as you could taste more of the ingredients.

Here’s the recipe:

Ingredients:

  • pita bread (available at Costco)
  • potatoes (optional)
    • pre-cooked tater tots
    • pre-cooked chopped baby potatoes
  • chopped tomatoes
  • diced onions
  • diced red, green and yellow bell pepper (can get it pre-diced and frozen)
  • diced jalapeno peppers
  • baby spinach
  • shredded cheddar cheese
  • pre-cooked smoked sliced beef brisket (available at Costco)
  • 3 eggs
  • maybe broccoli?

Instructions:

  1. If the bread is a bit hard, warm it up in the microwave for 50 secs to soften it.
  2. Pour / spray cooking on in a pan and turn the heat up to medium
  3. Put in all ingredients except eggs and mix for a minute or so
  4. Put in eggs and mix for a minute.

I prefer my eggs half cooked with the yolk still wet so I’d turn off the heat and transfer everything to a play in time for the yolk to remain wet.

To eat, you can stuff the pita bread with the egg scramble though it may be hard separating the two sides of the bread without breaking it. Otherwise, just rip pieces of pita bread and scoop up some of the eggs scramble with it as you would for curry.

To save time in the morning, prepare everything the night before.

  1. Add all ingredients except eggs in a zip lock bag and put in freezer
  2. In the morning, transfer frozen ingredients to a bowl and defrost in microwave
  3. Transfer defrosted ingredients to a pan and cook
  4. Put in eggs, mix and cook to desired doneness

High Pile, Plush Shag Rug

Trying to find a thick, plush rug with high pile can be difficult with so many options but inaccurate advertising. Here’s my experience and recommendations for comfy carpet.

Thomasville Shag Rugs

Basically, all of the Thomasville Shag rugs are good, if not the best. They are definitely the best value.

  • Thomasville Bali Shag Rug
    I felt this rug at Costco and it’s definitely thick, soft and super dense.
  • Thomasville Marketplace Luxury Shag
    I personally have this rug. It’s definitely high pile and soft but not as soft at the Bali Shag rug. I like the edges of this rug more than the Bali shag rug, though.
  • Thomasville Marketplace Savoy Shag Rug
    I haven’t felt this rug but it’s got a lot of good reviews and is by Thomasville.

NewBlueFX Chroma Key to Easily Remove Green Screen in Video

This article explains how to remove a green background in a video using Corel VideoStudio Ultimate 2018 and the NewBlueFX Chroma Key.

When applying a chroma key to a video in VideoStudio, you have two options:

  1. using Corel VideoStudio’s native chroma key feature
  2. using the NewBlueFX Chroma Key filter

Native Corel VideoStudio Chroma Key Feature

To use VideoStudio’s native chroma key feature,

  1. select a video on the timeline,
  2. open the Options panel,
  3. click the Effect tab,
  4. check the “Apply Overlay Options” checkbox, and
  5. adjust the settings.

From my experience, this feature doesn’t work well for imperfectly lit backgrounds. Unless you are filming in a professional studio, the chroma key results will likely be poor.

NewBlueFX Chroma Key Filter

For better chroma key results, you can use the NewBlueFX Chroma Key filter. Disable the native VideoStudio chroma key by unchecking the “Apply Overlay Options” checkbox described in the previous steps. This will minimize confusion due to the application of multiple chroma keys. To use the NewBlueFX Chroma Key, do this:

  1. crop your video to remove any areas outside of the green screen. If you don’t, the background will be gray instead of transparent.
  2. click on the FX Filter button
  3. select NewBlue Video Essentials II in the filter dropdown
  4. drag the Chroma Key filter to the video in the timeline
  5. if the native VideoStudio chroma key panel is visible, close it by clicking the x button in the top right corner of the panel
  6. select the “Chroma Key” filter and then click the “Customize Filter” button

The NewBlue Chroma Key control panel will appear.

  1. Uncheck “Show in preview window” to improve performance
  2. Uncheck “Use keyframes” to apply the same chroma key settings for the entire video. Unless you need to apply different settings for different sections of the video, you don’t need to use keyframes.
  3. If your background is green, leave the “Default – Green” button selected.
  4. Check the “Show Mask” checkbox to show a black mask for any color in the video other than green
  5. Adjust the Sensitivity value until the subject is completely black and the background is completely white. If it’s difficult to use the radial slider, just enter numeric values.
  6. Drag the slider to scrub through the video to see if any section of the video shows a partially gray background or white subject. If it does, further increase the sensitivity setting.
  7. Uncheck the “Show Mask” checkbox to remove the mask and to see the video in color. If you see some of the green background spilling over on the subject (usually around a person’s hair), adjust the “Erase Spill” value.
  8. Click OK to save and exit the Chroma Key panel.
Some of the green background is spilling over around the subject’s hair. Increase the “Erase Spill” value to fix this.

Improve Performance When Working with Large Videos in Corel VideoStudio

Nowadays, videos can be recorded at 4K resolution which is great for visual quality but bad for editing performance. To fix this, you can enable some settings in Corel VideoStudio under Settings > Performance as follows.

These settings will cause VideoStudio to generate a smaller version of a large video file so speedier editing. In the example settings above, if the source video is greater than 720 x 480, then a proxy file will be created in a SmartProxy folder. On my system, that folder is at

C:\Users\abdul\Documents\Corel VideoStudio Pro\21.0\SmartProxy

As an example, let’s compare the original video size to the proxy video size. In VideoStudio, if we select a video and view it’s properties, we see that its size is 636 MB.

If we look at the SmartProxy folder, it is currently empty. Now, if we drag the video to the timeline, VideoStudio will create a proxy file containing a lower quality version of that video. You can see the progress of the proxy file creation under Settings > Smart Proxy Manager > Smart Proxy Queue Manager.

When the proxy file has been created, you can inspect its size. As you can see, the size is only 56 MB. That’s a reduction of 91%!

If the proxy file is still too large, you can tweak the proxy file settings to produce a lower quality file, e.g. instead of 1920 x 1080 frame size, you can choose 640 x 360.

You can also tweak the audio and video compression settings.

If you are unsure whether VideoStudio is actually using the proxy files instead of the original files, you can look for a specific icon on each video in the timeline. If there is a black and white icon as shown below, then the proxy video is being used.