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


Struggling to remove "viral Pandemic conspiracy video"
News 09 May-2020

FacebookYouTube and other social networks are struggling to remove a viral video that includes various conspiracy theories about the coronavirus pandemic, highlighting the challenges that come with moderating dangerous content online.

The nearly 26-minute video is part of a series of clips being released ahead of a documentary called Plandemic that the filmmakers say "will expose the scientific and political elite who run the scam that is our global health system." It includes claims that have been debunked and makes other allegations without evidence. 

Facebook, Twitter and Google-owned YouTube are taking steps to remove the video or reduce its spread, the companies said. But despite these efforts, Plandemic videos continue to pop up. Some Facebook users were sharing the video in public groups but linking to other sites that aren't as well known as YouTube, or to the documentary's website. 

Two simple searches on YouTube on Friday morning found nine copies of the video, with a combined 295,000 views. After CNET contacted YouTube with links to the copies, all but one were removed for violating community guidelines. 

Of the nine copies, the one that remained up is a reaction video, underscoring the complications platforms like YouTube face moderating posts that contain conspiracy theories. YouTube's policies allow some videos citing conspiracy theories to remain up if the purpose of the clips is to debunk misinformation. But this reaction video replays the Plandemic video virtually in full, adding commentary that fails to clearly debunk the claims. However, at 42 minutes long, verifying that this kind of video violates YouTube's policies is more nuanced than simply identifying a cut-and-dried copy. 

The original video features Judy Mikovits, a controversial former medical researcher who repeats conspiracy theories about the coronavirus pandemic, including the idea wearing a mask could make you sick because it could expose you to your own "reactivated coronavirus expressions." Mikovits' comments conflict with advice from the US Centers for Disease Control and Prevention, which says everyone should wear a face cover to protect others in case you're infected with the virus that causes COVID-19. 

"Suggesting that wearing a mask can make you sick could lead to imminent harm, so we're removing the video," a Facebook spokesperson said in a statement.

Mikovits, a vocal critic of Dr. Anthony Fauci, the nation's leading expert on infectious diseases, also suggested the virus had been engineered, saying it wasn't a "natural occurrence." Scientists widely believe the virus jumped from animals to human beings, and the US Intelligence Community took the unusual step of publicly saying it believed the virus wasn't "manmade or genetically modified."

The video includes allegations that coronavirus deaths are higher than they should be because doctors are being incentivized to say their patients died from the virus to get money from a national health insurance program. There is no evidence that case numbers are being inflated.

A YouTube spokesman said the company will remove videos that include "medically unsubstantiated diagnostic advice for COVID-19." Plandemic videos racked up a combined 4.7 million views on YouTube on Monday and Tuesday, according to BuzzSumo, a social media tool.

Twitter said it was blocking the hashtags #PlagueOfCorruption and #Plandemicmovie from its trending section. Mikovits tweeted a separate video in which she urged President Donald Trump to end the lockdown and stop requiring people to wear masks, calling the face coverings "dangerous."

Twitter said Mikovits' tweet didn't violate its rules against harmful coronavirus misinformation but said the link to her video was marked as unsafe, which limits its spread. (Twitter displays a notice that posts may contain "potentially sensitive content" depending on each user's settings.) The video Mikovits shared had more than 1 million views on YouTube and is currently still up. Twitter also marked a link to the documentary's website as unsafe. Twitter said it wasn't removing the links because users are refuting claims made in the Plandemic video and the links serve as context. The full Plandemic video could be found on Twitter as recently as late Thursday afternoon without having to click on an external link. Twitter said parts of the video may violate its rules but didn't offer more details.

Keeping the video off social media has proven to be a game of content moderation whack-a-mole for tech firms. Social networks have been trying to combat misinformation by directing users to more trustworthy sources including the CDC and the World Health Organization.

Mikki Willis, the filmmaker behind Plandemic, said in an email that he doesn't plan to appeal the takedowns of the videos, but added that he was "working on a strategy to bypass the gatekeepers." The producers of the video have encouraged viewers to download a copy of the video and upload it to social media platforms.


Collected From CNET

Apple Watch saved their Life : 5 people share

No one noticed Toralv Østvang fall and hit his head on the bathroom floor that night, except for his Apple Watch. Kacie Anderson used her watch to get out of her car after a near fatal accident left her and her 9-month-old baby trapped inside. The only warning sign Heather Hendershot had that something was seriously wrong with her body came from her wrist.

These stories and more have one common thread. In September of 2014, when Apple CEO Tim Cook introduced the first Apple Watch, he didn't exaggerate when he said it was the most personal device the company had ever created. Since its launch, the Apple Watch has become a fitness coach, a health monitor and a constant way to stay connected. And for some users, it has been much more.

For these people, it even changed their lives.



Toralv Østvang, 68, Oslo, Norway 

Longtime tech reporter Torav Østvang has tested his share of Apple devices, but none have left more of a mark than the Apple Watch.

In February 2019, Østvang was staying with friends just outside of Oslo, Norway, where he lives. When he went to bed just after midnight, he wore his Apple Watch Series 4 so he could test a sleep app. He has no memory of his fall later that night or how he got back to his bed.

"The first thing I remember was lying in bed, having a terrible pain in my head," Østvang says. "I touched my face and felt blood." He drifted in and out of consciousness until he awoke to a lit room and three policemen standing above him.

Sometime around 4 a.m., he had got up to go to the bathroom when he experienced a sudden drop in blood pressure. He fainted and landed face first on the bathroom floor. His collapse triggered the fall detection feature on the Apple Watch (a new feature on the Series 4), which automatically notifies emergency services if it doesn't perceive any movement after a minute of detecting a hard fall.

"Nobody heard my fall," he says. "My friend and his wife didn't hear anything about it until the police car came to their door."

After getting the alert, the local police contacted his wife who was able to give them the full address of where her husband was staying.

"They could see the GPS coordinates of where I was, but they couldn't see exactly which apartment I was in," Østvang says.

They immediately took him to a nearby hospital. He had suffered three fractures to his face, and his chin bone had been pressed in. Though he's cautious to say the Apple Watch saved his life, he does admit that it saved him from needing surgery.


Kacie Anderson, 26, Fort Lauderdale, Florida 

It was the peak of rush hour on a rainy Friday night in Maryland, just a few days before Christmas. Kacie Anderson was on her way home with her 9-month-old son Parker in the backseat when she stopped at a busy intersection along the highway. Her husband was only a few cars behind her.

"I was actually looking out the window when all of a sudden I felt this huge force on the left side," says Anderson. "My face hit the steering wheel, came back, hit the front of my headrests, and then it flung me back forward into the side window."

They had been hit by a drunk driver going 62 mph.

Now playing: The Apple Watch has been life changing for these four...


"The first thing I could think of was, 'Is Parker OK?' I could hear him screaming," she says. "I could smell gas leaking in the car, but I couldn't see at all." She reached around for her phone to call for help, but the crash had sent everything airborne and she couldn't find it. While she was searching, her hand bumped up against her wrist and she remembered she was wearing her Apple Watch. She hit the digital crown and said, "Siri, call 911."

By the time her husband reached the scene of the wreck, the ambulance had already arrived. "They were able to tell where I was, without me even really knowing," Anderson says. "I don't know that anybody would have been able to approach the car, it's such a busy street."

Kacie later wrote a letter to Tim Cook, thanking him for the Apple Watch that she credits with getting her out of that wreck. She was contacted by Apple to feature her story along with others in the Apple Watch Real Stories campaign video later that year.


Heather Hendershot

Heather Hendershot, 27, Pomona, Kansas

At 26, Heather Hendershot didn't think she had to worry about her health. She was young, athletic and had no previous medical conditions.

After putting her kids to bed one night, she was sitting on the couch with her husband when she heard a beep on her Apple Watch. She looked down to see a notification saying her heart rate was above 120 beats per minute.

"I thought the watch had to be wrong because I couldn't feel my heart racing," she says. "I didn't feel like anything was wrong at all."

In 2017, the Apple Watch added the high heart rate notifications to the watch, which let users know when their heart spiked above a certain level. Though Hendershot's heart rate continued to rise throughout the night, she still didn't feel any symptoms. The next morning her husband insisted that she make a precautionary visit to the urgent care clinic.

While there, they conducted strep throat and flu tests. Both came back negative, but her heart rate was so high that they decided to monitor her further.

"It was until I heard the doctors mention ICU that I realized how serious the whole situation was," she says.

Doctors diagnosed her with hyperthyroidism, a condition where the thyroid gland produces excess thyroxine hormone. If left untreated, it could lead to life-threatening complications.

"I am not someone who checks their heart rate randomly," Hendershot says. "So I'm very confident that I wouldn't have been able to detect it without the Apple Watch."


Jason Saucier

Jason Saucier, 45, Orlando, Florida 

Jason Saucier hadn't been feeling like himself for a few weeks, but he didn't know how serious it was until his Apple Watch sounded the alarm.

"As soon as I put my watch on, it made a sound that I've never heard before," he says. "I looked down and it said that I was in aFib."

In addition to its high heart rate alert, the watch also tells you if it detects that your heart rhythm may be indicative of atrial fibrillation, a type of heart condition that can increase your risk of stroke and other serious heart complications.

He still went to work that morning, but continued to get the same alert throughout the day. He also had some trouble breathing, but it wasn't until several of his coworkers mentioned he looked white as a ghost that he finally decided to go to the emergency room.

"As soon as I got there, the cardiac team got right on me and said that I was close to going into cardiac arrest," says Saucier.

The doctors confirmed what the watch had been telling him, he was in aFib. They kept him overnight at the hospital, but he transitioned out of aFib and they were able to discharge him the following day.  

Exactly one week later, the same notification popped up on his Apple Watch.

"I got home from work, had dinner and I was sitting on my couch and just couldn't catch my breath," he says.

This time Saucier listened to his watch and immediately returned to the emergency room. He remained in aFib for three days, and kept him in the hospital for two additional days as they monitored his response to a new heart medication. 

He hasn't received any more alerts from his Apple Watch since that second episode in September 2019. He credits the new medication, but he continues to use the Apple Watch to keep tabs on his heart.

"It's like a safety blanket," he says. "I think it's probably going to be an ongoing thing for me for the rest of my life. And it's good that I have this watch to help me monitor it." 


George Kometiani, 32, Brooklyn, New York

His weight had been creeping up on him for years, but it wasn't until he hit 30 that George Kometiani really felt his nearly 300 pounds start to take a toll on his health.

"It was hard to go up the stairs, my knees started making a clicking sound because of the pressure," he says. "And then the snoring came in."

His doctor at the time warned that if he didn't lose 30 pounds, his snoring, which was affecting his sleep, would likely worsen and require medical intervention.

He decided to take on the challenge of losing weight. He started by changing his eating habits and substituting takeout at his desk to healthier options, and as soon as he did, the pounds began to melt off. He was surprised at how quickly he lost the first 30 pounds, but he also lost muscle mass, which wasn't what he intended, and his snoring was not going away.

"This is when the Apple Watch kicked in," he says.

Kometiani made a conscious effort to close his move ring -- the red circle on the Watch that indicates calories burned -- every day, and he started paying attention to the exercise challenges that would pop up on his screen. The day after a tough workout for example, the Apple Watch would push him to match the success of the previous day. Which he did, over and over again.

"It really helped me understand how much effort I needed to put into my day," says Kometiani. "Those little things from a nonjudgmental, disconnected point of view really help."

Within a year of starting his health kick, Kometiani had lost 100 pounds. His snoring disappeared along with his other health issues: joint pain, backaches, headaches. And he was a lot happier.

"You don't understand how many weight limitations you have around you … I couldn't even ride a rollercoaster," he says. "Now I feel like I can do anything."

Though these stories are just from the people I spoke to, a quick Google search will yield dozens more like them. In September 2018, ZDNet writer Jason Perlow described his own experience with the Apple Watch after it detected he was in aFib. 

And I had my own minor health scare detected by the Apple Watch. In October 2018, while I was testing the ECG feature in the Series 4 alongside a medical EKG at the University of San Francisco Medical Center, both devices saw that I had an early heart beat. While it is ultimately harmless, Dr. Gregory Marcus at UCSF Medical Center let me know that it's something I should watch out for going forward.

If you or anyone you know have been impacted by the Apple Watch, please share your story with us in the comments section below. 


Collected From CNET

Smartphone comparison : iPhone SE vs. Pixel 3A, Galaxy S10E, Galaxy A51

Apple on Wednesday announced its latest iPhone SE for 2020, a budget phone that serves as a sequel to its sleeper hit from 2016, the original iPhone SE. In fact, the new iPhone SE largely follows Apple's original 2016 recipe. Featuring a physical home button, wireless charging and the A13 Bionic processor, the $399 device is the most affordable iPhone in Apple's lineup today, offering modern hardware and iOS 13 features to a more cost-conscious set of consumers.

But Apple's foray into budget phones is not without company. For years Android devices have covered this price market and two of the best devices in this category were released last year: Google's Pixel 3A and the Samsung Galaxy S10E. The $399 Pixel 3A features a headphone jack and has a great Night Sight-enabled camera that shoots great photos in the dark. Meanwhile, the $600 Galaxy S10E has a superfast Snapdragon 855 chip and a long-lasting battery, and can wirelessly charge other phones and accessories. Samsung more recently launched the Galaxy A51, another phone that costs $399 and has impressive camera specs (there is a 5G variant that costs $499).iphone-se-homepage-1

The new iPhone SE.

  Apple iPhone SE (2020) Google Pixel 3A Samsung Galaxy S10E Samsung Galaxy A51
Display size, resolution 4.7-inch Retina HD; 1,334x750 pixels 5.6-inch gOLED; 2,220x1,080 pixels 5.8-inch AMOLED; 2,280x1,080 pixels 6.5-inch FHD AMOLED; 2,400x1,080 pixels
Pixel density 326ppi 441ppi 438ppi 405ppi
Dimensions (inches) 5.45 x 2.65 x 0.29 in. 6.0 x 2.8 x 0.3 in. 5.6 x 2.8 x 0.27 in. 6.2 x 2.89 x 0.31 in.
Dimensions (millimeters) 138.4 x 67.3 x 7.3mm 151.3 x 70.1 x 8.2mm 142 x 70 x 7.9mm 157.5 x 73.4 x 7.9mm
Weight (ounces, grams) 5.22 oz.; 148g 5.19 oz.; 147g 5.3oz.; 150g 6.06 oz.; 172g
Mobile software iOS 13 Android 9.0 Android 9.0 Android 10
Camera 12-megapixel 12.2-megapixel 12-megapixel (wide-angle), 16-megapixel (ultrawide-angle) 48-megapixel (standard), 12-megapixel (wide-angle), 5-megapixel (macro), 5-megapixel (depth sensing)
Front-facing camera 7-megapixel 8-megapixel 10-megapixel 32-megapixel
Video capture 4K 4K 4K 4K
Processor Apple A13 Bionic 2.0GHz octa-core Qualcomm Snapdragon 670 Octa-core Qualcomm Snapdragon 855 2.3GHz octa-core
Storage 64GB, 128GB, 256GB 64GB 128GB, 256GB 128GB
RAM Not disclosed 4GB 6GB, 8GB 4GB
Expandable storage No No Up to 512GB Up to 512GB
Battery Not disclosed 3,000 mAh 3,100 mAh 4,000 mAh
Fingerprint sensor Home button Back Power button In-screen
Connector Lightning USB-C USB-C USB-C
Headphone jack No Yes Yes Yes
Special features Water resistant (IP67); dual-SIM capabilities (nano-SIM and e-SIM); wireless charging AR in Google Maps, Timelapse video shooting Wireless PowerShare; hole punch screen notch; water resistant (IP68); Fast Wireless Charging 2.0 Dual-SIM capabilities
Price off-contract (USD) $399 (64GB), $449 (128GB), $549 (256GB) $399 $750 $399
Price (GBP) £419 (64GB), £469 (128GB), £569 (256GB) £399 £669 £329
Price (AUD) AU$749 (64GB), AU$829 (128GB), AU$999 (256GB) AU$649 AU$1,199 UK price converts to AU$650


Margins of CSS
Course - 05 May-2020

CSS margin properties are used to create space around elements, outside of any defined borders.

With CSS, you have full control over the margins. There are properties for setting the margin for each side of an element (top, right, bottom, and left).

Margin - Individual Sides

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

  • margin-top
  • margin-right
  • margin-bottom
  • margin-left

All the margin properties can have the following values:

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

Tip: Negative values are allowed.


Set different margins for all four sides of a <p> element:

p {
  margin-top: 100px;
  margin-bottom: 100px;
  margin-right: 150px;
  margin-left: 80px;


Margin - Shorthand Property

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

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

  • margin-top
  • margin-right
  • margin-bottom
  • margin-left

So, here is how it works:

If the margin property has four values:

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


Use the margin shorthand property with four values:

p {
  margin: 25px 50px 75px 100px;

If the margin property has three values:

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


Use the margin shorthand property with three values: 

p {
  margin: 25px 50px 75px;

If the margin property has two values:

  1. margin: 30px 60px;
  2. top and bottom margins are 30px
  3. right and left margins are 60px


Use the margin shorthand property with two values: 

p {
  margin: 30px 60px;

If the margin property has one value:

  1. margin: 30px;
  2. all four margins are 30px


Use the margin shorthand property with one value: 

p {
  margin: 30px;


The auto Value

You can set the margin property to auto to horizontally center the element within its container.

The element will then take up the specified width, and the remaining space will be split equally between the left and right margins.


Use margin: auto:

div {
  width: 400px;
  margin: auto;
  border: 1px solid green;

The inherit Value

This example lets the left margin of the <p class="ex1"> element be inherited from the parent element (<div>):

Use of the inherit value:
div {
  border: 1px solid red;
  margin-left: 100px;

p.ex1 {
  margin-left: inherit;