Categories
Mastering Development

Mysql query loop, resulting row of one query in where statement of next query

I have a read only table to calculate relationship between people DROP TABLE IF EXISTS `reference`; CREATE TABLE IF NOT EXISTS `reference` ( `self` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `brother` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, `mom` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, `wife` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, PRIMARY KEY […]

Categories
Linux Mastering Development

Using regular expressions (regex) in sed

This is a specific example of a general subject I fail to grasp. For years, I have used regex and sed to find/replace all occurrences of a string in all the files in a directory recursively, using something like this: #FIND $GLOBALS[‘timechecks’] and REPLACE with completely_different_string shopt -s globstar dotglob; for file in /var/www/**/*; do […]

Categories
Mastering Development

importing PHP MySql database

I’m trying to import database to phpmyadmin the error is :- “”Error Static analysis: 3 errors were found during analysis. Variable name was expected. (near ” ” at position 5) Variable name was expected. (near ” ” at position 26) Unrecognized statement type. (near “Host” at position 0) SQL query: Host: localhost (Version: 5.6.16) # […]

Categories
CMS Joomla Mastering Development

What is the simplest way to clear a group’s cache in Joomla via php, when caching disabled?

So background: I’m making a caching plugin that clears our site and CDN caches when content is saved. In this instance, I want to clear the site cache for one group. My original attempt looked something like this: $cache = JFactory::getCache(‘cachegroup’); $cache->clear(); That didn’t work. I did some research and saw SharkyKZ in the Joomla […]

Categories
User Help Web Apps

Google custom script times out

This script is used to download pdf attachments from my starred emails in my gmail and names and sorts them into folders in my google drive. It always times out for whatever reason. Any ideas to adjust it so it can finish quicker? var GMAIL_LABEL = ‘Sales’; var GDRIVE_FILE = ‘sales/$y/$sublabel/$sublabel_$m-$d-$y_$mc_$ac.$ext’; /* ————- no changes […]

Categories
Mastering Development

Optimizing SQL query that measures date difference

I am running an SQL SELECT query that potentially could retrieve thousands and tens of thousands of records. I will keep it concise: I need to get only records whose timestamp does not exceed 30 days ago. I currently have 2 queries. One obviously faster than the other, and I’d like to know if it […]

Categories
Mastering Development

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘laravel.users’ doesn’t exist

I want to use the login implemented by default by laravel. My database isn’t called “laravel” and I don’t want to call it in that way, is there a way to do that and still make it work? By default it asks for the “laravel” database which of course doesn’t exist cause I called my […]

Categories
Mastering Development

Json field triggered — No Dialect mapping for JDBC type: 1111 from nativeQuery

I have a native query to select datafrom database, I’m using postgrsql, hibernate and spring boot with java … I’m trying to find an user according to some criterias in where clause but i get the “No Dialect mapping for JDBC type: 1111” error caused by the json field, how can i overcome this error? […]

Categories
Database Development

calculate running balance of debit credit using union all

i’m making account statement for which i need that account balance before today and with each transaction row of debit or credit plus and minus from initial opening balance on the basis debit/credit amount rules…. for this i’m using this approach SELECT ‘1’AS VoucherNo,”AS DocumentDate,’Opening’ AS Description,isnull(SUM(JournalDetials.Debit),0)AS Debit, isnull(SUM(JournalDetials.Credit),0)AS Credit,(isnull(SUM(JournalDetials.Debit),0)-isnull(SUM(JournalDetials.Credit),0))[Balance], ”as JournalTransationStatus FROM JournalDetials INNER […]

Categories
Database Development

calculate running balance of debit credit using union all

i’m making account statement for which i need that account balance before today and with each transaction row of debit or credit plus and minus from initial opening balance on the basis debit/credit amount rules…. for this i’m using this approach SELECT ‘1’AS VoucherNo,”AS DocumentDate,’Opening’ AS Description,isnull(SUM(JournalDetials.Debit),0)AS Debit, isnull(SUM(JournalDetials.Credit),0)AS Credit,(isnull(SUM(JournalDetials.Debit),0)-isnull(SUM(JournalDetials.Credit),0))[Balance], ”as JournalTransationStatus FROM JournalDetials INNER […]