CodeIgniter4: Upgrading from 3.x to 4.x
15 Feb-2020

CodeIgniter 4 is a rewrite of the framework and is not backwards compatible. It is more appropriate to think of converting your app, rather than upgrading it. Once you have done that, upgrading from one version of CodeIgniter 4 to the next will be straightforward.

The “lean, mean and simple” philosophy has been retained, but the implementation has a lot of differences, compared to CodeIgniter 3.

There is no 12-step checklist for upgrading. Instead, start with a copy of CodeIgniter 4 in a new project folder, however you wish to install and use it, and then convert and integrate your app components. We’ll try to point out the most important considerations here.

Not all of the CI3 libraries have been ported or rewritten for CI4! See the threads in the CodeIgniter 4 Roadmap subforum for an up-to-date list!

Do read the user guide before embarking on a project conversion!


  • CI4 is still available as a ready-to-run zip or tarball, which includes the user guide (though in the docs subfolder
  • It can also be installed using Composer


  • CI4 is built for PHP7.2+, and everything in the framework is namespaced, except for the helpers.

Application Structure

  • The application folder is renamed as app and the framework still has system folders, with the same interpretation as before
  • The framework now provides for a public folder, intended as the document root for your app
  • There is also a writable folder, to hold cache data, logs, and session data
  • The app folder looks very similar to application for CI3, with some name changes, and some subfolders moved to the writable folder
  • There is no longer a nested application/core folder, as we have a different mechanism for extending framework components (see below)

Class loading

  • There is no longer a CodeIgniter “superobject”, with framework component references magically injected as properties of your controller
  • Classes are instantiated where needed, and components are managed by Services
  • The class loader automatically handles PSR4 style class locating, within the App (application) and CodeIgniter (i.e. system) top level namespaces; with composer autoloading support, and even using educated guessing to find your models and libraries if they are in the right folder even though not namespaced
  • You can configure the class loading to support whatever application structure you are most comfortable with, including the “HMVC” style


  • Controllers extend \CodeIgniter\Controller instead of CI_Controller
  • They don’t use a constructor any more (to invoke CI “magic”) unless that is part of a base controller you make
  • CI provides Request and Response objects for you to work with - more powerful than the CI3-way
  • If you want a base controller (MY_Controller in CI3), make it where you like, e.g. BaseController extends Controller, and then have your controllers extend it


  • Models extend \CodeIgniter\Model instead of CI_Model
  • The CI4 model has much more functionality, including automatic database connection, basic CRUD, in-model validation, and automatic pagination
  • CI4 also has the Entity class you can build on, for richer data mapping to your database tables
  • Instead of CI3’s $this->load->model(x);, you would now use $this->x = new X();, following namespaced conventions for your component


  • Your views look much like before, but they are invoked differently … instead of CI3’s $this->load->view(x); you can use echo view(x);
  • CI4 supports view “cells”, to build your response in pieces
  • The template parser is still there, but substantially enhanced


  • Your app classes can still go inside app/Libraries, but they don’t have to
  • Instead of CI3’s $this->load->library(x); you can now use $this->x = new X();, following namespaced conventions for your component


  • Helpers are pretty much the same as before, though some have been simplified


  • Hooks have been replaced by Events
  • Instead of CI3’s $hook['post_controller_constructor'] you now use

Events::on('post_controller_constructor', ['MyClass', 'MyFunction']);, with the namespace CodeIgniter\Events\Events;

  • Events are always enabled, and are available globally

From Codeigniter forum


Tiktok Deal With Oracle
News 20 Sep-2020

US President Donald Trump has expressed his approval of a deal that would allow Chinese-owned video-sharing app TikTok to continue operating in the US.

Mr Trump told reporters he had given his "blessing" to a partnership between TikTok and US firms Oracle and Walmart.

The president had ordered the app to be banned in the US, citing national security concerns.

US security officials fear data collected by TikTok's owner may be handed to the Chinese government.

TikTok's owner, ByteDance, has denied accusations that it is controlled by or shares data with China's ruling Communist Party.

On Saturday, Mr Trump said the deal would ensure the data of the estimated 100 million Americans who use the app was safe, telling reporters: "The security will be 100%."

"I have given the deal my blessing," Mr Trump said as he left the White House ahead of an election rally in North Carolina. "I approve the deal in concept."

TikTok and ByteDance both welcomed President Trump's approval of a proposed deal, which would still need to be signed off by the Chinese government.

TikTok said the deal would ensure US national security requirements were fully satisfied, while ByteDance said it was working to reach an agreement that was "in line with US and Chinese law" as soon as possible.

Vanessa Pappas, TikTok interim chief executive, said in a video posted on Saturday that the app was "here to stay" in the US.


#WeAreTikTok and we are here to stay!

— TikTok (@tiktok_us) September 19, 2020


What is the proposed deal?

The deal would see the establishment of a new company, dubbed TikTok Global. That company would be headquartered in the US, possibly in the state of Texas, with a majority of American directors, a US chief executive and a security expert on the board.

Oracle and Walmart are expected to take significant stakes in the company, and ByteDance has agreed to security safeguards on the data of US users. TikTok's data would be stored by Oracle, which would have the right to inspect its source code.

President Trump said the new TikTok company will be "totally controlled by Oracle and Walmart". But in a joint statement on Saturday, Oracle and Walmart said they were together investing to acquire 20% of the newly formed TikTok Global business.

Of that 20% stake, Oracle will take 12.5%, while Walmart will take 7.5%, reports say.

The deal will see TikTok Global become majority-owned by American investors, but Bytedance will retain a share of the US operation.

This falls somewhat short of President Trump's demand for an outright sale of TikTok's US arm to an American company. That was the intention of an executive order Mr Trump signed in August.

However, Mr Trump did say the deal would provide new jobs and tax revenue for the country.

In their statement, Oracle and Walmart said TikTok Global would create more than 25,000 new jobs and pay more than $5bn (£3.8bn) in tax in the US.

This is not the deal that Donald Trump had envisioned - he had wanted the US arm of the company to be sold.

That's not quite what's happening here.

This is more like a joint venture between three companies. Oracle and Walmart would act as "trusted partners" safeguarding the data of US users.

But in the proposed deal TikTok's Chinese owner Bytedance would still own much of the new entity.

So what made Trump decide to approve it?

Well, he appears now to be satisfied that the security arrangements proposed. But it's more complex than that. The deal also proposes a $5bn education fund - and will reportedly create 25,000 US jobs.

This is not a done deal though, the Chinese government still has to approve it - and there's no guarantee that will happen.


Thank You

China Ban to sell 5G networks Kit in UK from Huawei

The U.K. announced Tuesday it will ban Huawei from its 5G networks, in a significant U-turn by the government that could significantly dent relations with China while appeasing the U.S.

Speaking in Parliament, U.K. Culture Secretary Oliver Dowden said mobile network operators in the country would be forced to stop buying equipment from Huawei by the end of the year. They will also be required to strip out Huawei gear from their infrastructure by 2027.

It’s a major reversal for the U.K., which in January gave Huawei restricted access to the country’s next-generation mobile networks. Under previous guidelines, mobile network operators were required to reduce the share of Huawei kit in noncore parts of their infrastructure to 35% by 2023.

But that decision was complicated by new sanctions imposed on Huawei by the U.S. in May. These restrictions mean the Chinese firm will no longer be able to source key chip equipment from trusted American suppliers. The U.K.’s National Cyber Security Center initiated an emergency review of Huawei shortly after the U.S. curbs were introduced.

Dowden said the move will delay the U.K.’s rollout of 5G mobile internet, which promises super-fast data speeds and increased network capacity. Banning procurement of new Huawei gear and reducing the Chinese vendor’s market share to zero by 2027 would result in an “accumulative delay” of up to three years and cost as much as £2 billion ($2.5 billion), he warned.

“This has not been an easy decision, but it is the right one for the U.K.’s telecoms networks, for our national security and our economy both now and indeed in the long run,” Dowden told lawmakers.


Collected From cnbc

UV light to kill coronavirus ?

With man-made hand sanitizer in short supply, many people are turning to what's been called "nature's hand sanitizer," or ultraviolet light. UV light is the latest popular tool in the ongoing race to find ways to prevent oneself from catching SARS-CoV-2, the virus that causes COVID-19

Disinfection by way of UV light is nothing new: The International Ultraviolet Association says it's been a useful technology for over 40 years, contributing to clean water and clean air. Many consumer devices also use UV light to disinfect things, such as self-cleaning UV light water bottles and UV-emitting cases that clean your dirty phone

When it comes to the coronavirus, though, things aren't so clear-cut. There are risks that come with using UV light devices, especially when using them on your skin. Before ordering the first UV light sanitizer you see, read up on the current evidence about UV light disinfectants and the potential risks of using them on yourself.  


How do UV light hand sanitizers work? 

A quick primer on UV light: UV light comes primarily from the sun, but there are also man-made sources of UV light, including tanning beds and the currently buzzed-about UV disinfection lamps. 

There are three classes of UV light: UV-A, UV-B and UV-C.

UV-A and UV-B light cause sunburns and premature skin aging, and exposure to both is associated with the development of skin cancer. UV-C light, which has the most energy of all three types, is the most harmful, but it fortunately doesn't reach the Earth's surface because our atmosphere absorbs it. 

There's man-made UV-C light, too: It's what's in the UV light sanitizers that companies claim kill the coronavirus. According to the National Academy of Sciences, it's probable that this is true, because UV light has been used to disinfect surfaces and water for a long time, and it's generally successful

It works because UV-C light is strong enough to destroy the genetic material -- either DNA or RNA -- of viruses and bacteria. There's no evidence right now that typical sun exposure can kill the coronavirus, so no, going outside on a sunny day won't reduce your risk of catching it.


Can UV light kill the coronavirus? 

Based on the available scientific evidence that UV light can destroy various viruses, it's probably true that UV light can kill SARS-CoV-2 -- but keep in mind that no published, peer-reviewed studies to date have looked specifically at the effect of UV light on the virus that causes COVID-19.

The National Academies of Sciences, Engineering and Medicine reported that ultraviolet light probably can kill the coronavirus. "UV light has been shown to destroy other coronaviruses, so it will probably work on the novel coronavirus," the website reads. This includes the deadly Middle Eastern respiratory syndrome coronavirus, aka MERS-CoV and severe acute respiratory syndrome-related coronavirus, or SARS.

But there's one huge caveat: "UV light damages human skin, so it should only be used on objects or surfaces," the NASEM continues. 

This means you should not use UV light as a hand sanitizer. Stick to washing your hands with soap and water (following proper hand-washing guidelines), or using an alcohol-based hand sanitizer when soap and water aren't available. 

The WHO echoes this, reporting on its coronavirus myth-busters webpage that people should not use UV lamps to disinfect their hands or other areas of skin, as UV radiation "can cause skin irritation and damage your eyes." 

"No UV light device should be a substitute for hand washing, mask-wearing and distancing."   

Dr. Tyler Hollmig, director of dermatological surgery at University of Texas Dell Medical School in Austin

Though scientists are working on ways to make these powerful disinfecting products safe for people to use, current devices are not safe to use on your body. This is partly because many (if not most) of these products are not FDA-approved or approved by any governing health agency, for that matter. 

This means what you see may not be what you get -- an extremely important consideration, because although very low-dose, far-range UV-C light may not harm humans or animals, using too powerful a dose too close to your skin can indeed be harmful. 

These devices "tend to come in many different shapes, sizes and strengths, and thus their antimicrobial ability may be variable," says Dr. Tyler Hollmig, director of dermatological surgery at University of Texas Dell Medical School in Austin. Consequences of using UV-C light on your body can include severe sunburn-like burns and retinal damage

Plus, Dr. Hollmig continues, as UV light devices "are often not cheap -- especially relative to more standard disinfectants that we know work -- these may not be the most efficacious way to clean. It is also worth at least just reinforcing the fact that no UV light device should be a substitute for hand washingmask-wearing and distancing." 


UV light hand sanitizers and skin health concerns

Dr. Hollmig helps break down UV light as it relates to skin health. UV light is classified into types based on wavelength, he says, with UV-A light (the longest wavelength) being most associated with skin aging and also with certain skin cancers, and UV-B light (middle wavelength) being associated with sunburn and most skin cancers. 

"UV-C light has the shortest spectrum of wavelengths, but is probably the most toxic," Dr. Hollmig says. "Fortunately, the atmosphere filters out UV-C, so our skin and eyes are typically not exposed to it." 

UV-C light is what's used by sanitizers to kill or inactivate microorganisms by destroying and disrupting their nucleic acids, Dr. Hollmig explains, so if the device is properly tested and properly used, it works to kill pathogens -- but something that powerful also has the potential to harm skin. Some potential problems? It can cause burns and is a known carcinogen (as is all UV light), Dr. Hollmig says.

All types of UV light, "including those reaching the Earth's surface from the sun and those emitted by tanning beds, have not been shown to be protective against the novel coronavirus and can certainly harm the skin," Dr. Hollmig says. "Additionally, since UV sanitizers employ UV-C light, which can be dangerous, care should be taken to avoid exposure to the skin and eyes. These devices are not designed to be used to disinfect the skin and can be dangerous if used improperly."

Other consumer devices that are intended to disinfect or purify a surface or substance like this PhoneSoap case should be safe to use if you follow the instructions carefully. Self-cleaning water bottles that use UV-C rays to kill germs like Larq should also be safe when used properly, because they typically only work when the cap is screwed on tight, so no UV-C light can leak out.   



Is UV light in buildings safe? 

Consumer devices aren't the only place to find UV light sanitization. Some brick-and-mortar businesses are installing UV light fixtures in their facilities in an attempt to completely disinfect the building and mitigate the risk of contracting COVID-19 through air or surfaces. 

Again, because UV light is the primary germ-killer in the natural environment, it makes sense to take this approach. This practice, called "ultraviolet germicidal irradiation," has long been used in hospitals where pathogens abound.

New York-based Magnolia Bakery is one such business, claiming to be the first business in the city to install human-safe UV light fixtures, including a portal through which all customers walk in an attempt to destroy any pathogens that may be living on the skin. In a press release, Magnolia Bakery says the dose is low enough to avoid health complications such as burns or eye irritation. 


The Healthe Cleanse Portal that Magnolia Bakery has installed in its New York locations. 

Healthe Lighting

While the effectiveness of environmental UV sterilization on surfaces such as floors has been confirmed, however, further research is needed about the safety of indoor UV light fixtures, as well as its efficacy at sterilizing clothes and human skin. 

Plus, the Centers for Disease Control and Prevention say UV light "germicidal effectiveness and use is influenced by organic matter; wavelength; type of suspension; temperature; type of microorganism; and UV intensity." To effectively kill viruses, UV-C light must be emitted in a range of 200 to 280 nanometers, which has potential for harm.  

That's a lot of stuff to consider, and something that manufacturers who are trying to quickly create UV lights may inadvertently (or purposely) ignore. It's happened before: In the past, the Federal Trade Commission called out manufacturers for making false claims about what their light-based products could do.

The International Ultraviolet Association concurs with the CDC, reporting that inactivation of viruses with UV light has been "demonstrated under controlled conditions in the laboratory," and that "the effectiveness of UV light in practice depends on factors such the exposure time and the ability of the UV light to reach the viruses in water, air, and in the folds and crevices of materials and surfaces."

In sum: Don't use any UV light devices directly on your skin. Be careful about using UV light devices on in-home surfaces. Do your research before going to establishments that have installed UV light fixtures. And definitely do not try to get any form of UV light (or any disinfectant, for that matter) inside of your body


Collected From CNET NEWS



Padding CSS
Course - 10 May-2020

The CSS padding are used to give space around an element's content, inside of any defined borders.

With CSS, you have full control over the padding. There are properties for setting the padding for each side of an element like :

(top, right, bottom, and left).

Individual Sides

CSS has properties for specifying the padding for each side of an element:

  1. padding-top
  2. padding-right
  3. padding-bottom
  4. padding-left

All the padding properties can have the following values:

  1. length - specifies a padding in px, pt, cm, etc.
  2. % - specifies a padding in % of the width of the containing element
  3. inherit - specifies that the padding should be inherited from the parent element

Note: Negative values are not allowed.

Set different padding for all four sides of a <div> element:  

div {
  padding-top: 50px;
  padding-right: 30px;
  padding-bottom: 50px;
  padding-left: 80px;


Shorthand Property

To shorten the code, it is possible to specify all the padding properties in one property.

The padding property is a shorthand property for the following individual padding properties:

  1. padding-top
  2. padding-right
  3. padding-bottom
  4. padding-left

So, here is how it works:

If the padding property has four values:

  1.        padding: 25px 50px 75px 100px;
  2. top padding is 25px
  3. right padding is 50px
  4. bottom padding is 75px
  5. left padding is 100px


Use the padding shorthand property with four values:

div {
  padding: 25px 50px 75px 100px;

If the padding property has three values:

  1. padding: 25px 50px 75px;
  2. top padding is 25px
  3. right and left paddings are 50px
  4. bottom padding is 75px


Use the padding shorthand property with three values: 

div {
  padding: 25px 50px 75px;


If the padding property has two values:

  1. padding: 25px 50px;
  2. top and bottom paddings are 25px
  3. right and left paddings are 50px


Use the padding shorthand property with two values: 

div {
  padding: 25px 50px;


If the padding property has one value:

padding: 25px;

  1. all four paddings are 25px


Use the padding shorthand property with one value: 

div {
  padding: 25px;


Padding and Element Width

The CSS width property specifies the width of the element's content area. The content area is the portion inside the padding, border, and margin of an element

So, if an element has a specified width, the padding added to that element will be added to the total width of the element. This is often an undesirable result.


Here, the <div> element is given a width of 300px. However, the actual width of the <div> element will be 350px (300px + 25px of left padding + 25px of right padding):

div {
  width: 300px;
  padding: 25px;