Làm Web với Django https://web.expressmagazine.net/ en Tìm hiểu, cài đặt và sử dụng PHP Code Sniffer https://web.expressmagazine.net/hoc-drupal-9/tim-hieu-cai-dat-va-su-dung-php-code-sniffer.html <span>Tìm hiểu, cài đặt và sử dụng PHP Code Sniffer</span> <span><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span>Fri, 02/10/2023 - 02:51</span> Fri, 10 Feb 2023 01:51:48 +0000 admin 1237 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-drupal-9/tim-hieu-cai-dat-va-su-dung-php-code-sniffer.html#comments Tìm hiểu về Microservices - Phần 2: Giao tiếp giữa các services https://web.expressmagazine.net/hoc-ve-laravel/tim-hieu-ve-microservices-phan-2-giao-tiep-giua-cac-services.html <span>Tìm hiểu về Microservices - Phần 2: Giao tiếp giữa các services</span> <span><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span>Wed, 11/02/2022 - 15:32</span> Wed, 02 Nov 2022 14:32:36 +0000 admin 1195 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-ve-laravel/tim-hieu-ve-microservices-phan-2-giao-tiep-giua-cac-services.html#comments Tập tành tìm hiểu Headless and Hybrid Drupal 101 https://web.expressmagazine.net/hoc-drupal-9/tap-tanh-tim-hieu-headless-and-hybrid-drupal-101.html <span>Tập tành tìm hiểu Headless and Hybrid Drupal 101</span> <span><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span>Sun, 10/30/2022 - 10:35</span> <div class="field field--name-field-attach field--type-file field--label-above"> <div class="field--label">Attach</div> <div class="field__items"> <div class="field--item"><span class="file file--mime-application-pdf file--application-pdf icon-before"><span class="file-icon"><span class="icon glyphicon glyphicon-file text-primary" aria-hidden="true"></span></span><span class="file-link"><a href="https://web.expressmagazine.net/sites/default/files/2022-10/hybrid-drupal.pdf" type="application/pdf; length=1265133" title="Open file in new window" target="_blank">hybrid-drupal.pdf</a></span><span class="file-size">1.21 MB</span></span></div> </div> </div> Sun, 30 Oct 2022 09:35:48 +0000 admin 1147 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-drupal-9/tap-tanh-tim-hieu-headless-and-hybrid-drupal-101.html#comments Tìm hiểu Install NodeJS trong khóa học Node JS (P4) https://web.expressmagazine.net/hoc-ve-node-js/tim-hieu-install-nodejs-trong-khoa-hoc-node-js-p4.html <span>Tìm hiểu Install NodeJS trong khóa học Node JS (P4)</span> <span><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span>Fri, 10/07/2022 - 16:46</span> Fri, 07 Oct 2022 14:46:06 +0000 admin 1089 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-ve-node-js/tim-hieu-install-nodejs-trong-khoa-hoc-node-js-p4.html#comments Hướng dẫn create a link/URL with querystrings set/get from parameters https://web.expressmagazine.net/hoc-drupal-9/huong-dan-create-linkurl-querystrings-setget-parameters.html <span>Hướng dẫn create a link/URL with querystrings set/get from parameters</span> <span><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span>Sun, 08/28/2022 - 04:33</span> Sun, 28 Aug 2022 02:33:11 +0000 admin 1067 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-drupal-9/huong-dan-create-linkurl-querystrings-setget-parameters.html#comments Tập tành Cookie Services: How to Handle Cookies in Drupal & Symfony https://web.expressmagazine.net/hoc-drupal-9/tap-tanh-cookie-services-how-handle-cookies-drupal-symfony.html <span property="schema:name">Tập tành Cookie Services: How to Handle Cookies in Drupal &amp; Symfony</span> <span rel="schema:author"><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span property="schema:dateCreated" content="2022-07-31T11:04:18+00:00">Sun, 07/31/2022 - 13:04</span> Sun, 31 Jul 2022 11:04:18 +0000 admin 1057 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-drupal-9/tap-tanh-cookie-services-how-handle-cookies-drupal-symfony.html#comments Làm sao Disable Clicking Inside a Div with CSS or JavaScript https://web.expressmagazine.net/hoc-tap-csscss3/lam-sao-disable-clicking-inside-div-css-or-javascript.html <span property="schema:name">Làm sao Disable Clicking Inside a Div with CSS or JavaScript</span> <span rel="schema:author"><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span property="schema:dateCreated" content="2022-05-23T07:21:00+00:00">Mon, 05/23/2022 - 09:21</span> Mon, 23 May 2022 07:21:00 +0000 admin 609 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-tap-csscss3/lam-sao-disable-clicking-inside-div-css-or-javascript.html#comments GraphQL is the better REST with 1 API Endpoint https://web.expressmagazine.net/hoc-ve-graphql/graphql-better-rest-1-api-endpoint.html <span>GraphQL is the better REST with 1 API Endpoint</span> <span><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span>Fri, 05/06/2022 - 11:19</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h2>GraphQL is the better REST</h2> <p>Over the past decade, REST has become the standard (yet a fuzzy one) for designing web APIs. It offers some great ideas, such as stateless servers and structured access to resources. However, REST APIs have shown to be too inflexible to keep up with the rapidly changing requirements of the clients that access them.</p> <p>GraphQL was developed to cope with the need for more flexibility and efficiency! It solves many of the shortcomings and inefficiencies that developers experience when interacting with REST APIs.</p> <p>To illustrate the major differences between REST and GraphQL when it comes to fetching data from an API, let’s consider a simple example scenario: In a blogging application, an app needs to display the titles of the posts of a specific user. The same screen also displays the names of the last 3 followers of that user. How would that situation be solved with REST and GraphQL?</p> <p>Check out this article to learn more about why developers love GraphQL.</p> <h2>Data Fetching with REST vs GraphQL</h2> <p>With a REST API, you would typically gather the data by accessing multiple endpoints. In the example, these could be /users/&lt;id&gt; endpoint to fetch the initial user data. Secondly, there’s likely to be a /users/&lt;id&gt;/posts endpoint that returns all the posts for a user. The third endpoint will then be the /users/&lt;id&gt;/followers that returns a list of followers per user.</p> <figure role="group" class="align-center"><img alt="With REST, you have to make three requests to different endpoints to fetch the required data. You’re also overfetching since the endpoints return additional information that’s not needed." data-entity-type="file" data-entity-uuid="cc5e7562-3b3a-4f6e-854e-4b3c23e3f16a" width="2078" height="1700" loading="lazy" class="lazyload" data-src="/sites/default/files/inline-images/Drupal%20Graphql%20with%20Angular-3.png" /><figcaption>With REST, you have to make three requests to different endpoints to fetch the required data. You’re also overfetching since the endpoints return additional information that’s not needed.</figcaption></figure><p>In GraphQL on the other hand, you’d simply send a single query to the GraphQL server that includes the concrete data requirements. The server then responds with a JSON object where these requirements are fulfilled.</p> <figure role="group" class="align-center"><img alt="Using GraphQL, the client can specify exactly the data it needs in a query. Notice that the structure of the server’s response follows precisely the nested structure defined in the query." data-entity-type="file" data-entity-uuid="302fe2e7-5cfe-4f4e-88e3-82c308e1625e" width="1566" height="946" loading="lazy" class="lazyload" data-src="/sites/default/files/inline-images/Drupal%20Graphql%20with%20Angular-4.png" /><figcaption>Using GraphQL, the client can specify exactly the data it needs in a query. Notice that the structure of the server’s response follows precisely the nested structure defined in the query.</figcaption></figure><h2>No more Over- and Underfetching</h2> <p>One of the most common problems with REST is that of over- and underfetching. This happens because the only way for a client to download data is by hitting endpoints that return fixed data structures. It’s very difficult to design the API in a way that it’s able to provide clients with their exact data needs.</p> <blockquote> <p>“Think in graphs, not endpoints.” Lessons From 4 Years of GraphQL by Lee Byron, <a href="https://web.expressmagazine.net/hoc-ve-graphql">GraphQL Co-Inventor.</a></p> </blockquote> <h2>Overfetching: Downloading superfluous data</h2> <p>Overfetching means that a client downloads more information than is actually required in the app. Imagine for example a screen that needs to display a list of users only with their names. In a REST API, this app would usually hit the /users endpoint and receive a JSON array with user data. This response however might contain more info about the users that are returned, e.g. their birthdays or addresses - information that is useless for the client because it only needs to display the users’ names.</p> <h2>Underfetching and the n+1 problem</h2> <p>Another issue is underfetching and the n+1-requests problem. Underfetching generally means that a specific endpoint doesn’t provide enough of the required information. The client will have to make additional requests to fetch everything it needs. This can escalate to a situation where a client needs to first download a list of elements, but then needs to make one additional request per element to fetch the required data.</p> <p>As an example, consider the same app would also need to display the last three followers per user. The API provides the additional endpoint /users/&lt;user-id&gt;/followers. In order to be able to display the required information, the app will have to make one request to the /users endpoint and then hit the /users/&lt;user-id&gt;/followers endpoint for each user.</p> <h2>Rapid Product Iterations on the Frontend</h2> <p>A common pattern with REST APIs is to structure the endpoints according to the views that you have inside your app. This is handy since it allows for the client to get all required information for a particular view by simply accessing the corresponding endpoint.</p> <p>The major drawback of this approach is that it doesn’t allow for rapid iterations on the frontend. With every change that is made to the UI, there is a high risk that now there is more (or less) data required than before. Consequently, the backend needs to be adjusted as well to account for the new data needs. This kills productivity and notably slows down the ability to incorporate user feedback into a product.</p> <p>With GraphQL, this problem is solved. Thanks to the flexible nature of GraphQL, changes on the client-side can be made without any extra work on the server. Since clients can specify their exact data requirements, no backend engineer needs to make adjustments when the design and data needs on the frontend change.</p> <h2>Insightful Analytics on the Backend</h2> <p>GraphQL allows you to have fine-grained insights about the data that’s requested on the backend. As each client specifies exactly what information it’s interested in, it is possible to gain a deep understanding of how the available data is being used. This can for example help in evolving an API and deprecating specific fields that are not requested by any clients any more.</p> <p>With GraphQL, you can also do low-level performance monitoring of the requests that are processed by your server. <a href="https://web.expressmagazine.net/hoc-ve-graphql">GraphQL uses</a> the concept of resolver functions to collect the data that’s requested by a client. Instrumenting and measuring performance of these resolvers provides crucial insights about bottlenecks in your system.</p> <h2>Benefits of a Schema &amp; Type System</h2> <p>GraphQL uses a strong type system to define the capabilities of an API. All the types that are exposed in an API are written down in a schema using the GraphQL Schema Definition Language (SDL). This schema serves as the contract between the client and the server to define how a client can access the data.</p> <p>Once the schema is defined, the teams working on frontend and backends can do their work without further communication since they both are aware of the definite structure of the data that’s sent over the network.</p> <p>Frontend teams can easily test their applications by mocking the required data structures. Once the server is ready, the switch can be flipped for the client apps to load the data from the actual API.</p> </div> <div class="field field--name-field-video field--type-video-embed-field field--label-hidden field--item"><div class="video-embed-field-provider-youtube video-embed-field-responsive-video form-group"><iframe width="854" height="480" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/T571423fC68?autoplay=1&amp;start=0&amp;rel=0"></iframe> </div> </div> <div class="field field--name-field-category field--type-entity-reference field--label-above"> <div class="field--label">Category</div> <div class="field--item"><a href="/hoc-ve-graphql" hreflang="en">Học về GraphQL</a></div> </div> <div class="field field--name-field-image field--type-image field--label-above"> <div class="field--label">Image</div> <div class="field--item"> <img src="/sites/default/files/2022-05/endpoint.JPG" width="1132" height="639" alt="GraphQL is the better REST with 1 API Endpoint" loading="lazy" typeof="foaf:Image" class="img-responsive" /> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field__items"> <div class="field--item"><a href="/tags/lam-web-voi-django.html" hreflang="en">Làm Web với Django</a></div> </div> </div> <div class="field field--name-field-background-image field--type-image field--label-above"> <div class="field--label">Background image</div> <div class="field--item"> <img src="/sites/default/files/2022-06/31_0.jpg" width="3500" height="1800" alt="GraphQL is the better REST with 1 API Endpoint" loading="lazy" typeof="foaf:Image" class="img-responsive" /> </div> </div> <div class="user-comment-area pt-50"> <div class="comment-form pt-90"> <h4>Add new comment</h4> <div class="comment__form form--square"><drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=578&amp;2=comment&amp;3=comment" token="_bD-oYqj5h09JcI2nUgHkY4QFjaK5CQuBVlezDnBXf8"></drupal-render-placeholder></div> </div> </div> Fri, 06 May 2022 09:19:50 +0000 admin 578 at https://web.expressmagazine.net Rò rỉ bộ nhớ do phải lưu các Observable để subscribe https://web.expressmagazine.net/hoc-ve-angular/ro-ri-bo-nho-do-phai-luu-cac-observable-de-subscribe.html <span property="schema:name">Rò rỉ bộ nhớ do phải lưu các Observable để subscribe</span> <span rel="schema:author"><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span property="schema:dateCreated" content="2021-09-05T02:16:13+00:00">Sun, 09/05/2021 - 04:16</span> Sun, 05 Sep 2021 02:16:13 +0000 admin 485 at https://web.expressmagazine.net https://web.expressmagazine.net/hoc-ve-angular/ro-ri-bo-nho-do-phai-luu-cac-observable-de-subscribe.html#comments Phần 2 - Firebase Cloud Firestore cùng học và tìm hiểu - tháng 8.2021 https://web.expressmagazine.net/hoc-ve-firebase/phan-2-firebase-cloud-firestore-cung-hoc-va-tim-hieu-thang-82021.html <span>Phần 2 - Firebase Cloud Firestore cùng học và tìm hiểu - tháng 8.2021</span> <span><a title="View user profile." href="/user-profile/admin" lang="" about="/user-profile/admin" typeof="schema:Person" property="schema:name" datatype="">admin</a></span> <span>Sat, 08/28/2021 - 09:22</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><h2>10 điểm hạn chế của Firebase</h2> <p>Mặc dù đây là một nền tảng tuyệt vời, nhưng <a href="https://web.expressmagazine.net/hoc-ve-firebase">Firebase</a> cũng có một số nhược điểm. Tôi sẽ phân tích ngay bên dưới để bạn có cái nhìn đa chiều hơn về nền tảng này nhé. </p> <ul><li>Không phải là mã nguồn mở</li> <li>Người dùng không có quyền truy cập mã nguồn</li> <li>Firebase không hoạt động ở nhiều quốc gia</li> <li>Chỉ hoạt động với Cơ sở dữ liệu NoSQL</li> <li>Truy vấn chậm</li> <li>Không phải tất cả các dịch vụ Firebase đều miễn phí</li> <li>Firebase khá đắt và giá không ổn định</li> <li>Chỉ chạy trên Google Cloud</li> <li>Thiếu Dedicated Servers và hợp đồng doanh nghiệp</li> <li>Không cung cấp các API GraphQL</li> </ul><h2>Không phải là mã nguồn mở</h2> <p>Firebase không phải là một tùy chọn mã nguồn mở để phát triển ứng dụng di động. Điều này khiến nó trở thành một lựa chọn không tối ưu cho nhiều nhà phát triển. Người dùng không thể sửa đổi mã nguồn Firebase. Theo tôi thì đây là hạn chế lớn nhất của Firebase và ngăn cộng đồng cải tiến sản phẩm.</p> <p>Xem phần 1 qua đường link sau: <strong><a href="https://web.expressmagazine.net/hoc-ve-firebase/phan-1-firebase-cloud-firestore-tu-hoc-va-tim-hieu-firebase.html" rel="bookmark">Phần 1 - Firebase Cloud Firestore tự học và tìm hiểu Firebase</a></strong></p> <h3>Người dùng không có quyền truy cập mã nguồn</h3> <p>Đây là một hạn chế lớn khác của Firebase cho người dùng. Việc không có quyền truy cập vào mã nguồn có thể khá khó khăn đối với một số nhà phát triển. Đặc biệt, đối với các ứng dụng lớn, việc chuyển sang các nhà cung cấp khác không phải là một nhiệm vụ dễ dàng và để thực hiện việc này, toàn bộ Backend sẽ cần được xây dựng lại từ đầu.</p> <h3>Firebase không hoạt động ở nhiều quốc gia</h3> <p>Firebase là một Subdomain của Google. trang Web chính thức của nó là https://firebase.google.com và bị chặn ở nhiều quốc gia. Theo tôi được biết, Google cùng với các dịch vụ khác của Google bị chặn và không thể truy cập được ở nhiều quốc gia, trong đó có Trung Quốc.</p> <h3>Chỉ hoạt động với Cơ sở dữ liệu NoSQL</h3> <p>Cả Firestore và Firebase Realtime Database đều cung cấp cấu trúc NoSQL. Chúng không có tùy chọn nào để sử dụng cơ sở dữ liệu quan hệ.</p> <p>Mặc dù Firebase đã thực hiện những cải tiến đáng kể trên Cloud Firestore so với RTDB, nhưng việc chạy các truy vấn phức tạp vẫn là một thách thức đối với một số người dùng nhất định.</p> <p>Với Firebase, người dùng không thể xử lý nhanh chóng việc di chuyển dữ liệu tương tự như cơ sở dữ liệu SQL đơn giản. Firebase sử dụng JSON và hầu như không có tính năng SQL nào. Vì vậy, việc di chuyển từ cơ sở dữ liệu sẽ không dễ dàng.</p> <h3>Truy vấn chậm</h3> <p>Không phải tất cả cơ sở dữ liệu đều lý tưởng cho mọi trường hợp sử dụng và Cloud Firestore cũng không ngoại lệ. Mặc dù đó là một giải pháp tuyệt vời để mở rộng ứng dụng của bạn, cung cấp hỗ trợ truy vấn ngoại tuyến và cập nhật thời gian thực, nhưng nó cũng có những hạn chế như:</p> <ul><li>Kích thước yêu cầu API tối đa 10 MiB.</li> <li>Không có truy vấn tổng hợp gốc.</li> <li>Giới hạn kích thước tài liệu là 1 MiB.</li> <li>Kết nối đồng thời tối đa 1M.</li> <li>Truy vấn hiệu suất chậm.</li> </ul><h3>Không phải tất cả các dịch vụ <a href="https://web.expressmagazine.net/hoc-ve-firebase">Firebase</a> đều miễn phí</h3> <p>Các chức năng đám mây chỉ khả dụng trên gói Blaze và người dùng không thể dùng thử dịch vụ trong gói Spark.</p> <p>API Cloud Vision trong tính năng học máy cũng không khả dụng trong gói Spark miễn phí của nền tảng này.. Dịch vụ này chỉ có sẵn cho người dùng của gói Blaze và tính phí 1,5 USD/ k API.</p> <h3>Firebase khá đắt và giá không ổn định</h3> <p>Firebase là một nền tảng phát triển ứng dụng di động có nhiều tính năng nhưng cũng là một nền tảng đắt tiền đối với một số người. Nó cung cấp một gói miễn phí nhưng có hạn chế nhất định. </p> <p>Firebase cung cấp nhiều tính năng hữu ích hơn nhưng giá cũng sẽ cao hơn so với một nhà cung cấp IaaS thuần túy. Nói chung, tôi cho rằng việc tự lưu trữ một ứng dụng sẽ rẻ hơn so với sử dụng Firebase.</p> <p>Trước khi sử dụng Firebase, tôi khuyên bạn hãy so sánh chính xác chi phí trả trước của việc thiết lập một cụm tại nhà cung cấp IaaS và chi phí đang thực hiện để duy trì máy chủ so với chạy ứng dụng trực tiếp trên Firebase. </p> <p>Một khía cạnh khác khiến Firebase trở nên đắt đỏ là nó là một công nghệ độc quyền. Firebase phải bù đắp khoản đầu tư kỹ thuật cho cơ sở người dùng của nó. </p> <p>Firebase cung cấp dịch vụ theo mô hình định giá dựa trên mức sử dụng và không có cách nào để giới hạn giá cả. Không có bảng giá cố định cho nền tảng và việc theo dõi mức độ sử dụng tài nguyên có thể là một vấn đề phức tạp.</p> <p>Việc ước tính chi phí của Firebase có thể khó khăn đối với một số người dùng, đặc biệt là khi không thể dự đoán được các yêu cầu về khả năng mở rộng. Việc định giá rất phức tạp và Firebase có giá cụ thể cho mọi tính năng.</p> <p>Theo thông tin tôi được biết, Firebase từng cung cấp gói Flame. Đó là gói có giá cố định 25 USD / tháng. Nhưng nó đã được gỡ bỏ vào tháng 1/ 2020.</p> </div> <div class="field field--name-field-video field--type-video-embed-field field--label-hidden field--item"><div class="video-embed-field-provider-youtube video-embed-field-responsive-video form-group"><iframe width="854" height="480" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/czfPU8uNdEw?autoplay=1&amp;start=0&amp;rel=0"></iframe> </div> </div> <div class="field field--name-field-category field--type-entity-reference field--label-above"> <div class="field--label">Category</div> <div class="field--item"><a href="/hoc-ve-firebase" hreflang="en">Học về Firebase</a></div> </div> <div class="field field--name-field-image field--type-image field--label-above"> <div class="field--label">Image</div> <div class="field--item"> <img src="/sites/default/files/2021-08/Ph%E1%BA%A7n%202%20-%20Firebase%20Cloud%20Firestore.jpg" width="1080" height="1350" alt="Phần 2 - Firebase Cloud Firestore" loading="lazy" typeof="foaf:Image" class="img-responsive" /> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field__items"> <div class="field--item"><a href="/tags/lam-web-voi-django.html" hreflang="en">Làm Web với Django</a></div> </div> </div> <div class="user-comment-area pt-50"> <div class="comment-form pt-90"> <h4>Add new comment</h4> <div class="comment__form form--square"><drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=475&amp;2=comment&amp;3=comment" token="SZT7ErUrZHW5e6R22LxE0zGG9BQfe1szAm3_QR2bCqY"></drupal-render-placeholder></div> </div> </div> Sat, 28 Aug 2021 07:22:36 +0000 admin 475 at https://web.expressmagazine.net