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
Best camera on any phone
News 19 May-2020

HUAWEI P30 Pro Factory Unlocked International Version 128GB Black from amazon

  • 3G HSDPA 800 / 850 / 900 / 1700(AWS) / 1900 / 2100 - 4G LTE band 1(2100), 2(1900), 3(1800), 4(1700/2100), 5(850), 6(900), 7(2600), 8(900), 9(1800), 12(700), 17(700), 18(800), 19(800), 20(800), 26(850), 28(700), 32(1500), 34(2000), 38(2600), 39(1900), 40(2300) - Hybrid Dual SIM (Nano-SIM, dual stand-by) > (ensure to check compatibility with your carrier before purchase)
  • 6.47 inches 1080 x 2340 pixels, 19.5:9 ratio (~398 ppi density) - Android 9.0 + EMUI 9.0 - IP68 dust/water resistant - Front/back glass, aluminum frame
  • 128GB + 8GB RAM - NM (Nano Memory), up to 256GB (uses SIM 2) - Non-removable Li-Po 4200 mAh battery - Hisilicon Kirin 980 Octa-core 2.6GHz
  • Rear Camera: 40 MP, f/1.6, 27mm (wide) + 20 MP, f/2.2, 16mm (ultrawide) + Periscope 8 MP, f/3.4, 125mm (telephoto) - Front Camera: 32 MP, f/2.0, (wide) - Video: 2160p@30fps
  • Unlocked cellphones are compatible with most of the GSM carrier ( Like T-Mobile or AT&T ) but please be aware that are not compatible with CDMA carriers ( Like Sprint or Verizon Wireless for example )

Product information

Product Dimensions 2.6 x 1.65 x 0.59 inches
Item Weight 1.1 pounds
ASIN B07Q2WPMNB
UNSPSC Code 43191501
Item model number 6901443293193
Batteries 1 Lithium ion batteries required. (included)
Customer Reviews

4.5 out of 5 stars    220 ratings


4.5 out of 5 stars
Best Sellers Rank #34,235 in Cell Phones & Accessories (See Top 100 in Cell Phones & Accessories)
#570 in Unlocked Cell Phones
Operating System Android
Computer Memory Size 8 GB
Other display features Wireless_display_on_website
Form Factor Smartphone
Manufacturer Huawei
Date First Available April 4, 2019

IMG
Warns password in Firefox "dangerous"
News

Mozilla has beefed up Firefox Lockwise, its password management tool, to tell you when you're making a more bonehead mistake than usual by reusing your passwords. Firefox already warned if a site you're logging into has suffered a data breach. But in Firefox 76, released Tuesday, the browser now also tells you when you're using that site's password on another website and prompts you to change it.

Reusing passwords is convenient for trying to remember them, but it's dangerously insecure. Once hackers discover passwords through data breaches, they often try those passwords all over the net with a type of attack called credential stuffing. Two-factor authentication eases the problem, though.

Lockwise will also generate and autofill new passwords more smoothly, Mozilla said. That better matches the standard abilities of password managers like LastPass, 1Password and BitWarden.

If you're not using a password manager, now is a good time to think about making the move. Password managers can be a big help if you're struggling to use unique, hard-to-guess passwords for dozens or hundreds of online services. Although many people use third-party password managers, browsers and built-in tools like Apple's iCloud Keychain are getting more sophisticated.

Services tied to one company's products aren't as useful if you stray from the fold, though. Chrome's password sync helps you on Android but not Firefox, and Apple's service doesn't work on Windows or Android.

PASSWORD PAINS

Microsoft's Edge and Google's Chrome also warn you about password breach problems that have been discovered.

For people who haven't set up a master password in Firefox to protect their passwords, Firefox 76 also will require you to type in your system password before seeing details. That'll make it harder for roommates or coworkers to snoop.

Also new in Firefox 76:

  • Support for a new picture-in-picture standard for web browsers that lets you keep a miniature video window visible even after you move to a different browser tab or program.
  • A technology called Audio Worklets that Mozilla sped into release to help smooth the use of Zoom, videoconferencing software that has surged in popularity during the COVID-19 pandemic.
  • Broader use of the WebRender technology, which Mozilla says makes Firefox dramatically faster at displaying web pages. WebRender isn't yet enabled on all PCs, including Linux or MacOS systems, but with Firefox 76 it's now active on more classes of Windows systems. It's now switched on for smaller-screen laptops with newer Intel chips.

Collected from CNET

IMG
Apple Watch saved their Life : 5 people share
News

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.

img-3785

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...

 10:59

"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.

image0

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."

jasonsaucier

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

Course

IMG
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

Example

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

Example

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

Example

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

Example

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.

Example

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;
}

Projects