Skip to main content

Posts

Showing posts from February, 2020

Some SQL query situation, Doctrine/Eloquent on Laravel

https://www.sitepoint.com/laravel-doctrine-best-of-both-worlds/ https://stackoverflow.com/questions/30231862/laravel-eloquent-has-with-wherehas-what-do-they-mean Object Relation mapping is hard as fk, so even with Active Record or Data Mapper, ORM ... It somehow sometime eager load / relation seem not work as expected. => Try figure out why condition / filter on whereHas, hasOne()... not work. ex. hasOne(UserReview, 'shop_id', 'shop_id')->orderby('created_at', 'desc')->take(1); Try use raw query first. It is somehow / maybe SQL, relational DB knowledge wrong, not Eloquent bug. https://songmeanings.com/songs/view/57458/ https://stackoverflow.com/questions/48445480/mysql-order-by-from-subquery-lost-by-group-by https://www.quora.com/Can-I-sort-faster-if-I-convert-strings-to-numbers https://stackoverflow.com/questions/16620169/do-algorithms-sort-integers-and-strings-with-the-same-time-consistency select max(id) group by for ie.

Some notes on customer requirement and developer forget business logic

I am some how a forgetful man. So many time I forget business logic (often in unfamiliar Japanese). And I am lazy to find backlog task (often translated and not 100% as it be). Some beautiful and clean website + logo https://www.br.de/nachrichten/ Remember  br Ã¥ ? documentary ? https://www.youtube.com/watch?v=jLd6QO7Z7m4 Oven  method exploitation, may be many application ie. resoldering. Doctrine optimize query. It seem as Eloquent you can have Raw custom query. This guy use JOIN twice (?) for cut lazy loading (additional query ?) https://stackoverflow.com/questions/31262489/optimizing-a-doctrine-query-to-prevent-additonal-queries https://stackoverflow.com/questions/55611005/laravel-improve-performance-when-having-multiple-eager-loading-queries https://laravel-news.com/eloquent-eager-loading https://medium.com/@kouipheng.lee/laravel-eloquent-lazy-vs-eager-loaded-803852c59e1c https://www.mysqltutorial.org/mysql-exists/ Oh back to Google trans contribution ref

Some Cool Job Description

M. Fowler say JS may be weird... I believe it cool but for sometime and for now no matter  it cool or hot but JD have it :) 8+ years of experience designing and building a production-level web application, including:     Great experience across the board with a strong depth of knowledge in JavaScript (Node.js and React)     Great practical experience with containers (Docker, Kubernetes)     Practical experience with cloud (AWS)     Deep architectural understanding of highly scalable web applications     Understanding of website lifecycle from a performance point of view     Great creative and innovative problem-solving skills     Initiative and the ability to work independently and in a team     Interest to learn more about new technologies (such as languages and frameworks)     Initiative and the ability to work independently and in a team     Interest to learn more about new technologies (such as languages and frameworks) Your Skills and Experience If you have som

React, ng (Angular), Ionic etc catch up

What is the right action ? You act immediately To act instantly is to see actually 'what is' Intelligence is to see something very clearly and act instantly 1. Critical environment, health, food issues. 2. Psychological, mental, social issues. 3. Technical, economy, traffic safety issues and advancement. 4. Others, unknown like gaming, dictionary app ... https://www.martinfowler.com/bliki/ThreePillars.html https://help.github.com/en/github/authenticating-to-github/removing-sensitive-data-from-a-repository https://www.simicart.com/blog/progressive-web-apps-examples/ https://nationswell.com/easy-ways-help-environment/ Not all of these apps above have excellence software and / or ratting but at least it gave our awareness about what going on. https://aqicn.org/map/world/ Symfony vs Laravel 9:12 So I have to figure out when sf fit, otherwise pick lv. https://www.merixstudio.com/blog/laravel-vs-symfony-clash-frameworks/ Redis https://stackoverflow.com/

Notes on Redis Laravel

Actual data store and cache should be synchronized using the third approach you've already described in your question. As you add data to your definitive store (i.e. your SQL database), you need to enqueue this data to some service bus or message queue, and let some asynchronous service do the whole synchronization using some kind of background process. You don't want get into this cases (when not using a service bus and asynchronous service): - Make your requests or processes slower because the user needs to wait until the data is both stored in your database and cache. - Have the risk of a fail during the caching process and not being able to have a retry policy (which is usually a built-in feature in a service bus or some message queues). Also, this failure can end up in a partial or complete cache corruption and you won't be able to automatically and easily schedule some task to fix this situation. BTW, you won't be always on this case (if a key isn't ex

MySQL/MariaDB create view error Illigal mix of collations

https://dba.stackexchange.com/questions/170610/how-to-retrieve-the-query-i-used-to-create-a-view SHOW CREATE VIEW not work since it will dump create command within CONVERT() Example:  CREATE ALGORITHM=UNDEFINED DEFINER=`user`@`%` SQL SECURITY DEFINER VIEW `ViewFollowAndFollowerCount` AS select `t1`.`user_id` AS `user_id`,`t4`.`user_name` AS `user_name`,`t2`.`followCount` AS `followCount`,`t3`.`followerCount` AS `followerCount`,`t1`.`created_at` AS `follow_created_at` from (((`UserFollowData` `t1` left join `ViewFollowCountGroupByUserId` `t2` on((`t1`.`user_id` = `t2`.`user_id`))) left join `ViewFollowCountGroupByFollowUserId` `t3` on((`t1`.`user_id` = `t3`.`follow_user_id`))) left join `UserData` `t4` on((convert(`t1`.`user_id` using utf8mb4) = `t4`.`user_id`))) I got error something like: "Illegal mix of collations " This caused by CONVERT() on dump /export (?) when convert collation ie. to utf8mb4... Detail here https://bugs.mysql.com/bug.php?id=54278 So to f

Some AWS lambda functions

import json from urllib.request import Request, urlopen def lambda_handler(event, context): #webhookurl webhookurl = "https://hooks.slack.com/services/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" # ec2 detail = event['detail'] instance_id = detail['instance-id'] instance_state = detail['state'] messe = "msg here" if instance_id == "i-000d520e3ec8d6f97" : messe = "STG" elif instance_id == "i-0e2b0157636751cc7" : messe = "sest" elif instance_id == "i-018fcaabe46773e38" : messe = "prod" elif instance_id == "i-06fcd00b94795927c" : messe = "live" elif instance_id == "" : messe = "STG02" # (attachmen if instance_state == "stopped": slack_message = { "attachments": [ {

Tools for write documentation in HTML/webpage and or other format

Some sites work without JS https://www.webdesignerdepot.com/2018/01/8-sites-that-work-just-fine-without-js-thank-you/ You know what? Amazon and Twitter can work without JS! I'm not biased and not a fan of choices (please read J. Krishnamurti) or comparison. But anyway I love simple, clean way of represent knowledge, information. In college, you can see many book, especially technical book are written in a very clear and easy to understand way, event it's problem is complex and or complicated. Art or psychological, social science ... are different ? Some simple and amazing website content: https://martinfowler.com/ Tools for write HTML, XML, code (certainly with highlight)... From M. Fowler book - Patterns of EA Architecture. See Colophon section: This is the first book that I wrote using XML and related technologies. The master text was written as a series of XML documents using trusty TextPad. I also used a home-grown DTD. While I was working I used XSLT to gener