Categories
Database Development

Postgres query performance – hash aggregate costly operation

I’m running Postgres 9.6.6 and I have a relatively simple query, however, I’m finding that it is slow with the hash aggregation function which is the most costly operation: select program_schedule_source_count.full_name, program_schedule_source_count.country, sum(program_schedule_source_count.displays) as displays, program_schedule_source_count.source_id, program_schedule_source_count.source_region from program_schedule_source_count where program_schedule_source_count.original_title = ‘How I Met Your Mother’ and program_schedule_source_count.show_type in (‘SM’, ‘SE’) and program_schedule_source_count.start_date between […]

Categories
Development

login system not working using php and mysql

so im trying to get my login working which is using php and mysql. i dont no what to replace (mysqli_fetch_array) because before i was using md5 password and changed it to password hash. what i want the code to basically do is when the users correct email and password is inputted the page is […]

Categories
Development

Fuzzy matching a string in SQL

I have a User table, that has id, first_name, last_name, street_address, city, state, zip-code, firm, user_identifier, created_at, update_at. This table has a lot of duplication like the same users have been entered multiple times as a new user, so example id first_name last_name street_address user_identifier ——————————————————— 11 Mary Doe 123 Main Ave M2111111 ——————————————————— 21 […]

Categories
Development Laravel MySQL

laravel stored procedure migration syntax error when calling

I have stored procedure migration in laravel for mysql DB. This is the stored procedure: DROP PROCEDURE IF EXISTS `select_total_raised_jobs`; delimiter ;; CREATE PROCEDURE `select_total_raised_jobs` (IN cid int) BEGIN DROP TABLE IF EXISTS tmp_results; CREATE TEMPORARY TABLE tmp_results AS SELECT COUNT(jobs.id) AS TotalJobs, DATE(jobs.created_at) AS created_at, users.id AS userID, concat( users.first_name,’ ‘,users.last_name) as full_name, jobs.driver_id […]

Categories
Development HTTP Java Javascript JSON Website

Parse JSON data from a website with HTTP request with javascript

I’ve used package sniffer to get a specific endpoint, which gave me a direct JSON url. Now I want to get for all usernames from this JSON format.For eg. it goes like this: {“node”:{“id”:”1428809588″,”username”:”kafeterijabg”,”full_name”:”\u041a\u0430\u0444\u0435\u0442\u0435\u0440\u0438\u0458\u0430\u00ae”,”profile_pic_url”:”https://instagram.fbeg5-1.fna.fbcdn.net/vp/65f96409e2a6c5b9b72cda956aa0dfea/5E638B5F/t51.2885-19/s150x150/64620072_350924665805634_2914908438809018368_n.jpg?_nc_ht=instagram.fbeg5-1.fna.fbcdn.net”,”is_private”:false,”is_verified”:false,”followed_by_viewer”:true,”requested_by_viewer”:false,”reel”:{“id”:”1428809588″,”expiring_at”:1572193230,”has_pride_media”:false,”latest_reel_media”:1572095740,”seen”:1572031349,”owner”:{“__typename”:”GraphUser”,”id”:”1428809588″,”profile_pic_url”:”https://instagram.fbeg5-1.fna.fbcdn.net/vp/65f96409e2a6c5b9b72cda956aa0dfea/5E638B5F/t51.2885-19/s150x150/64620072_350924665805634_2914908438809018368_n.jpg?_nc_ht=instagram.fbeg5-1.fna.fbcdn.net”,”username”:”kafeterijabg”}}}} I’ve tried sending requests and parsing it to console but I’m getting “undefined”. function Get(yourUrl){ var Httpreq = new XMLHttpRequest(); Httpreq.open(“GET”,yourUrl,false); […]

Categories
Development

How to handle other fields returned in a GORM .Group

If I do a group on the “file_id” field how can I extract the “full_name” table as well? For example can I create a child struct in &result and put the return values in there? type fullname struct{ full_name string } type result struct{ file_id string full_name []fullname } db.Table(“example_table”).Select(“file_id, full_name, sum(length) as total”).Group(“file_id”).Scan(&result)