- https://github.com/VeryGoodOpenSource/very_good_cli (It will nicely genearate a project with all the basic setup, but with bloc state management, you can simply replace with any other state management library)
Riverpod or Bloc
/** | |
* Checks if the current network is connected to the internet and validated. | |
* Validation indicates the network is functional (e.g., it can be used for browsing). | |
* | |
* @return True if the network is connected, has internet capability, and is validated; false otherwise. | |
*/ | |
private fun Context.isInternetFunctional(): Boolean { | |
val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
val network = connectivityManager.activeNetwork | |
val networkCapabilities = connectivityManager.getNetworkCapabilities(network) |
import Head from 'next/head'; | |
import PropTypes from 'prop-types'; | |
const MetaWrapper = (props) => { | |
const { | |
title, | |
description, | |
type, | |
imageUrl, | |
contentUrl, |
import config | |
from google.cloud import speech, texttospeech | |
import gradio as gr | |
import io | |
import openai | |
import os | |
from playsound import playsound | |
openai.api_key = config.OPENAI_API_KEY ## API Key from ChatGPT stored in a config.py file in same directory | |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "./cloud_creds.json" ## Path to service account credentials JSON from Google Cloud Platform |
# Hat tip to Kaushik Gopal for some of this | |
# make zsh tab completion fix capitalization errors for directories and files | |
# i don't know if this is required anymore | |
# autoload -Uz compinit && compinit | |
# 0 -- vanilla completion (abc => abc) | |
# 1 -- smart case completion (abc => Abc) | |
# 2 -- word flex completion (abc => A-big-Car) | |
# 3 -- full flex completion (abc => ABraCadabra) |
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
Riverpod or Bloc
It is a common scenario that we often forget out database password. When we try to log in to our mysql DB, we face the following error message. If we use a password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
If we don't use a password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
package demo; | |
import java.io.Serializable; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.LinkedHashMap; | |
import java.util.List; |