IMG-LOGO

Tutorial

IMG
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!

Downloads

  • 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

Namespaces

  • 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

  • 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

  • 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

Views

  • 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

Libraries

  • 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

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

Events

  • 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

News

IMG
Some good news : Coronavirus
News 26 Mar-2020

Coronavirus is affecting people across the world, but there are many reasons to be hopeful.

Right now the coronavirus pandemic and COVID-19 are all anyone can talk about, and you're not alone if you feel overwhelmed or find yourself focusing on worst-case scenarios. So let's take a second, breathe deep and look at some of the positive things going on in these strange times.

Keep in mind that the coronavirus pandemic -- which has killed thousands, amid hundreds of thousands of cases worldwide -- is far from over and you should continue to play your part to look after yourself and others. Here's how to protect yourself from coronavirus, how to prepare for quarantine and how to keep your spirits up. Remember, there are many reasons not to sink into worry or fear. We'll keep updating this page with encouraging, reassuring and uplifting news about medical progress, government support and people uniting to help each other. 

 

More and more countries are containing the spread

Many countries around the world are in the midst of coronavirus outbreaks, and if you live in any of these places you should continue to follow the guidelines. The results are reassuring: In countries that have acted fast and taken social distancing seriously, the spread of the virus has been dramatically slowed or even contained.

  •  China is reporting a drastic reduction in new cases, although this was achieved using extensive lockdown measures.
  •  Singapore managed to contain the spread of the virus by acting fast, without imposing the draconian measures seen in China.
  •  Hong Kong and Taiwan were able to tackle the virus thanks to their experience with SARS in 2002, teaching the world valuable lessons about investing time and resources into dealing with an outbreak.

gettyimages-1207933893

Even when things seem bleak, people are helping each other.

Ziad Ahmed/NurPhoto via Getty Images

We're working on a cure

Scientists around the world are looking for a coronavirus vaccine. It's essential not to rush this process, and it will take months or even years to develop the vaccine and make sure it's safe. But the work has begun and some promising avenues have already been identified.

  •  Researchers have a head start as the SARS-CoV-2 pathogen is similar to coronaviruses we've encountered before, including the SARS virus that struck in 2002.
  •  Clinical trials of potential vaccines are underway in China, testing methods of stimulating our immune system to fight the virus.
  •  The first US clinical trials for a potential vaccine have begun in Seattle. Biotech company Moderna has taken a piece of the genetic code for the pathogen's S protein -- the part that's present in other coronaviruses, like SARS -- and fused it with fatty nanoparticles which can be injected into the body.
  •  Imperial College London is designing a similar vaccine using coronavirus RNA, its genetic code.
  •  Pennsylvania biotech company Inovio is generating strands of DNA it hopes will stimulate an immune response. 
  •  Johnson & Johnson and French pharmaceutical giant Sanofi are both working with the US Biomedical Advanced Research and Development Authority to develop vaccines. Sanofi's plan is to mix coronavirus DNA with genetic material from a harmless virus, while Johnson & Johnson will attempt to deactivate SARS-CoV-2 and switch off its ability to cause illness.
  •  In the meantime, existing antiviral drugs may have an effect on the new coronavirus, such as remdesivir or the anti-flu drug favipiravir.

People do recover

Around the world, many are recovering from the infection. Often this is thanks to the hard work of medical staff and the people who support them.

  •  Doctors in India have reported success in treating infected patients with a mixture of drugs usually used to tackle HIV, swine flu and malaria.
  •  In China and Japan, doctors have had promising results using blood plasma from people who have recovered from COVID-19 to treat newly infected patients. This well-established medical technique could even be used to boost the immunity of people who are at risk of catching the disease. 
  •  A 103-year-old Chinese woman is reported to have recovered, due to the fact she had no other major underlying health conditions.

CORONAVIRUS UPDATES

Testing is improving 

Newer, faster tests are also being developed around the world. With all this medical research, we're understanding the virus better and learning how to deal with it.

  •  Researchers at Johns Hopkins are working on a coronavirus screening test that checks nasal swabs and could analyze hundreds of people in a day. The test results come back in 24 hours, which they're hoping to shorten to a few hours.
  •  In South Korea, the spread appears to have slowed thanks to widespread testing, including drive-thru tests and phone box-style testing booths.

The environment is getting a break

The slowdown in production, transportation and sales is having a huge impact on the economy and on the finances of workers. But one side effect of the reduction in manufacturing and vehicle traffic is a reduction in pollution. 

  •  China's lockdown led to a 25 percent decrease in CO2 emissions when compared with the same period in 2019.
  •  Satellite imagery shows startling reductions in air pollution over countries where traffic has been limited.
  •  Researcher Marshall Burke from Stanford University calculated that the reduction in emissions in China in January and February could save as many as 77,000 lives. To put that number into context, that's more than 20 times the number of people who died from coronavirus in that time.

gettyimages-1207931137

Even amid the pandemic, there are small moments of friendship and solidarity. In Jounieh in Lebanon, students used a drone to deliver flowers on Mother's Day. 

Joseph Eid/AFP via Getty Images

Support is available

As people stay away from work and many businesses close their doors temporarily, we all face uncertainty and stress. Governments have pledged to support citizens and businesses with subsidies, loans, suspensions of tax and rent, and other measures. These are some of the initial measures being taken around the world that may ease your mind, or inspire you to contact your representative to press for more help. 

  •  Australia is paying AU$750 (around $445 or £380) to all citizens on a lower income, and offering loans to small and medium-sized businesses.
  •  Denmark is subsidizing 75% of workers' salaries. 
  •  France has promised no company will be allowed to fail as a result of the pandemic, freezing tax and rent payments for small businesses and expanding the welfare system for workers.
  •  Germany has pledged at least 500 billion euros ($550 billion) in loan guarantees. 
  •  Italy has promised help for families and one-off 500 euro payments to self-employed people.
  •  Spain has announced a 200 billion euro rescue package in loans for small businesses, and is freezing mortgages and utility bills for individuals. 
  •  Sweden is subsidizing 90% of workers' salaries if they're affected by coronavirus.
  •  The UK is guaranteeing 80% of workers' salaries and providing limited sick pay to those who are self-employed.
  •  The US is close to passing legislation to give $1,200 to most American adults and $500 to most children, as part of a stimulus package that also includes loans to business and local and state governments, funds for hospitals and more unemployment insurance. Also, you also have extra time to file your tax return because Tax Day has been moved to July 15.

img-8846

In Orinda, California, three sisters share some good will during the lockdown. 

Self-isolation doesn't have to be isolating

If you're stuck at home, there are plenty of ways to keep yourself entertained, informed and connected.

gettyimages-1208029127

Fitness trainer Joe Wicks is teaching physical education classes live via YouTube.

The Body Coach via Getty Images

People are coming together

If we're going to get through this, it'll be because we all came together and helped each other. Many of us are finding ways to bring out the best in ourselves and our communities, resisting misinformation and divisiveness.

  •  Many have joined volunteer mutual aid groups to support the vulnerable in their own community. When the UK government called for volunteers, over a quarter of a million people signed up in a single day.
  •  People and businesses are creating online resources to help ease the tension and inconvenience of quarantine, many of them free or discounted.
  • Apple, Facebook and other companies are donating millions of face masks held in case of wildfires or other needs.
  •  Cuban doctors traveled to Italy to help deal with the spread of the disease. 

Colledted From CNET

IMG
Big asteroid 1998 OR2 will safely fly Earth in April ( Video )
News

Big asteroid 1998 OR2 will safely fly by (imagery + orbit animation)

A large and  "potentially hazardous" asteroid is poised to fly by Earth next month, but don't worry — it poses no threat to Earth.

Asteroid (52768) 1998 OR2 will make a close approach to Earth on April 29. The hefty space rock has an estimated diameter of 1.1 to 2.5 miles (1.8 to 4.1 kilometers), or about the width of the isle of Manhattan. 

While an asteroid that size could wreak havoc if it crashed into Earth — prompting some alarmist and misinformed media reports — this asteroid poses no threat. 

 

See the Video Click Here

 

 

See the Video Click Here

 

Collected from https://www.space.com/

 

IMG
Enable Google Play store Dark Theme to All Android Devices
News

Google Play has added the anticipated Dark theme for all Android devices. The new move comes months after Google initially started rolling out the Dark theme for select users. The official Google Play account on Twitter has announced the latest development. Dedicated Theme settings are available within Google Play to let users switch between Dark and Light themes with a tap of a button. In the recent past, apps such as WhatsApp and Instagram also brought dedicated dark themes to their apps to provide users with an ease of accessing content in a low-light environment.

As per the official announcement posted on Twitter, Google Play has expanded the rollout of the Dark theme to all Android devices. All you need to do is to visit Google Play on your Android device and then go to Settings > Theme to select whether you want the existing Light theme or switch it over to the Dark theme.

For users who have an Android 10 device, there is a System default option that lets Google Play match with the system theme and change the theme accordingly. This means if you've selected the system-wide dark mode on your Android 10 device, Google Play will automatically switch to the Dark theme or vice versa once the System default option is selected from the Theme settings.

 

In September last year, Google kicked off the rollout of the Dark theme update for the Play store. The update was, however, limited mainly to devices running Android 10.

Google hasn't provided any details about the Google Play version that has added the Theme settings to enable the Dark theme.. Nevertheless, Gadgets 360 was able to see the change on the Play store version as low as 19.1.27.

 

Collected 

 

Course

IMG
List of HTML
Course - 15 Mar-2020

HTML List Example

Example

<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

 

Example - Disc

<ul style="list-style-type:disc;">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

 

Example - Circle

<ul style="list-style-type:circle;">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

Example - Square

<ul style="list-style-type:square;">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

Example - None

<ul style="list-style-type:none;">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

 

Ordered HTML List

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.

The list items will be marked with numbers by default:

Example

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>
 

Ordered HTML List - The Type Attribute

The type attribute of the <ol> tag, defines the type of the list item marker:

Type      Description

type="1"              The list items will be numbered with numbers (default)

type="A"             The list items will be numbered with uppercase letters

type="a"              The list items will be numbered with lowercase letters

type="I"               The list items will be numbered with uppercase roman numbers

type="i"               The list items will be numbered with lowercase roman numbers

Numbers:

<ol type="1">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

Uppercase Letters:

<ol type="A">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

Lowercase Letters:

<ol type="a">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

Uppercase Roman Numbers:

<ol type="I">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

Lowercase Roman Numbers:

<ol type="i">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

HTML Description Lists

HTML also supports description lists.

A description list is a list of terms, with a description of each term.

The <dl> tag defines the description list, the <dt> tag defines the term (name), and the <dd> tag describes each term:

 

Example

<dl>
  <dt>Coffee</dt>
  <dd>- black hot drink</dd>
  <dt>Milk</dt>
  <dd>- white cold drink</dd>
</dl>

Nested HTML Lists

List can be nested (lists inside lists):

 

Example

<ul>
  <li>Coffee</li>
  <li>Tea
    <ul>
      <li>Black tea</li>
      <li>Green tea</li>
    </ul>
  </li>
  <li>Milk</li>
</ul>

Note: List items can contain new list, and other HTML elements, like images and links, etc.

 

Control List Counting

By default, an ordered list will start counting from 1. If you want to start counting from a specified number, you can use the start attribute:

 

Example

<ol start="50">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

Horizontal List with CSS

HTML lists can be styled in many different ways with CSS.

One popular way is to style a list horizontally, to create a navigation menu:

 

Example

<!DOCTYPE html>
<html>
<head>
<style>
ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #333333;
}
 
li {
  float: left;
}
 
li a {
  display: block;
  color: white;
  text-align: center;
  padding: 16px;
  text-decoration: none;
}
 
li a:hover {
  background-color: #111111;
}
</style>
</head>
<body>
 
<ul>
  <li><a href="#home">Home</a></li>
  <li><a href="#news">News</a></li>
  <li><a href="#contact">Contact</a></li>
  <li><a href="#about">About</a></li>
</ul>
</body>
</html>
 

Projects