This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION refresh_all_materialized_views() | |
RETURNS VOID AS $$ | |
DECLARE | |
matview RECORD; | |
total_views INTEGER; | |
views_processed INTEGER := 0; | |
BEGIN | |
SELECT COUNT(*) INTO total_views FROM pg_matviews; | |
FOR matview IN (SELECT schemaname, matviewname FROM pg_matviews) | |
LOOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this is the method | |
//R.id.frame should be R.id.name_of_your_frame_layout | |
public void goToFragment(Fragment fragment) { | |
FragmentTransaction transaction = getFragmentManager().beginTransaction(); | |
transaction.replace(R.id.frame, fragment); | |
transaction.addToBackStack(null); | |
transaction.commit(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in my example im creating a json object from json array | |
JSONObject object = jArr.getJSONObject(i); | |
//getting an JSONArray from JSONObject | |
JSONArray roleJSONArray = object.getJSONArray("roles"); | |
//This is where i check the null json object if "location" value comes null | |
//Step 1: check if its null using isNull | |
if(object.isNull("location")){ | |
//override the key value from location to another value | |
object.put("location", "N/A"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So as im learning Flask and PostgreSQL, and i have been learning to host the Flask app into Heroku and i found some of these tiny tips for you guys to know because it | |
may be hard for you guys who are beginners like me to maneouver in this envirinment | |
ENABLE LOGGIN IN HEROKU | |
heroku logs --tail | |
TO ALLOCATE YOUR DABATABASE IN HEROKU CLI (COMMAND PROMPT RECEIVING HEROKU COMMANDS) | |
heroku pg:psql "POSTGREAPP NAME" --app ""database name" |