PHP SQL Cursor (New)
Read more at http://www.phpclasses.org/package/9948-PHP-Execute-database-queries-like-Android-SQL-Cursor.html
This infographic was first published on The Software Guild. It has been republished here with permission from its creators.
A technology stack or tech stack for short refers to a set of technologies, software, and tools that are used in the development and deployment of sites, apps, and other digital products.
For example, a classic technology stack is the LAMP stack. The LAMP stack is traditionally used for creating an environment for running PHP applications. The stack is made up of the following technologies: Linux (the environments OS), Apache (the HTTP server), MySQL (the database), and PHP (the server-side programming language).
The infographic below provides you with an exceptional introduction to technology stacks. It covers:
A text version of the infographic can be found over at The Software Guild blog, in case you have trouble reading the image-based infographic in this post.
Theres also an interactive version of the infographic, and its a terrific educational resource that you can lean on for your tech presentations, meetings, lectures, workshops, and more.
Use the following HTML markup to embed the infographic on your site. Please include attribution to thesoftwareguild.com when using the graphic.
<a href="http://www.thesoftwareguild.com/build-your-own-technology-stack"><img src="http://www.thesoftwareguild.com/wp-content/uploads/Technology-Stack-Infographic.png" alt="Build Your Own Technology Stack Infographic" width="800px" border="0? /></a>
Interested in learning the in-demand skills required to become a developer? The Software Guilds coding bootcamps help apprentices gain experience building full-stack applications from start to finish using .NET/C# or Java.
With locations in Akron, Minneapolis, and Louisville, The Software Guild provides an intensive learning environment to teach you the hands-on skills required to begin a successful development career.
Learn more by checking out the guide to The Software Guild for an in-depth look at the curriculum, format, application process, and everything else you need to know.
The post A Guide to Technology Stacks (Infographic) appeared first on WebFX Blog.
A Progressive Web Apps is a web application which takes advantage of modern browser features and can be added to your homescreen, behaving just like a native application.
In this tutorial we’re going to show you everything you need to know about PWAs, step by step, with practical examples and a demo app. To not start from scratch, we are going to use the selfie app we made recently, and make it progressive.
In its core a progressive web app isn’t any different from a normal website – it’s made of HTML, CSS and JavaScript, and lives in the browser. What separates PWAs from regular websites is a list of 10 key concepts that need to be fulfilled. Here they are, taken directly from the Google Developers website.
Following these guidelines will ensure that your app works well not only when viewed in the browser, but also when started separately via a home screen shortcut. You may find the wording Google has chosen rather confusing, but don’t worry, we will explain the rules one by one later in the tutorial.
The concept of PWAs shouldn’t be confused with:
All of the aforementioned technologies wrap HTML apps and package them into executable files, be it an .apk, .exe or anything else, which then have to be downloaded from the respective app store and installed on the user’s device.
PWAs don’t require installation and aren’t available (yet) in Google Play or the iTunes App store. To download a PWA you need to simply visit it’s website and then save it to the home screen as a shortcut. Developing and maintaining separate iOS and Android versions is no longer an issue, but browser support needs to be taken into consideration.
Most progressive web apps work with native APIs and service workers, technologies that deal with sensitive data and need to be handled with caution. That’s why every PWA has to be served through a HTTPS connection.
If you don’t have access to a server with a SSL certificate, the easiest way run projects in a secure environment is via GitHub Pages or a similar service. Any GitHub repository can be hosted directly over HTTPS, and both GitHub and GitHub Pages are free for public repos.
This is where we’ve chosen to host our demo: https://tutorialzine.github.io/pwa-photobooth/.
For simple testing on a local server, you can also try Ngrok. Its a tiny tool that allows you to tunnel any currently running localhost to a secure public URL. Ngrok is free and available for Windows, Mac, and Linux.
Essentially, what this means is that PWAs should use web technologies that are widely supported and work equally well on as many browsers as possible. As we all know, in the world of web development this is close to impossible, but still there are things we can do to cover a larger user base.
For example, in our PhotoBooth app we use the getUserMedia() API for accessing the hardware camera on a device. Its support in different browsers is quite inconsistent – Safari doesn’t support it at all, the browsers that do support it need prefixes and differ in usage.
To ensure more people can actually use our app, we cover all the prefixes:
navigator.getMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia );
We also show an error if none of the prefixes work:
if (!navigator.getMedia) { displayErrorMessage("Your browser doesn't have support for the navigator.getUserMedia interface."); } else { // Use Camera API }
Fallbacks and polyfills should be provided where possible. The same principles go for the CSS and HTML code.
The app should look nice on all devices, no matter their screen size. Our app has a fairly simple UI so we’ve used only a couple of media queries to control font-size, paddings, margins, etc.
Don’t be afraid to use CSS libraries and frameworks such as Bootstrap, as they make it really easy to form grids, and deal with typography and general responsiveness.
This is an important one. Using service workers allows your app to work even when there is no internet connection available.
Some apps can be cached only partially: UI is cached and available offline, dynamic content still needs access to a server.
Others, like our PhotoBooth demo, can be cached in their entirety. All of the source code and resources will be saved locally and the app will work offline and online exactly the same way. Here is the code that makes the magic happen:
This is an oversimplified usage of Service Workers, use with caution in commercial projects.
First we need to make a service worker JavaScript file, and define the logic behind it.
// Install the service worker. this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { // The cache will fail if any of these resources can't be saved. return cache.addAll([ // Path is relative to the origin, not the app directory. '/pwa-photobooth/', '/pwa-photobooth/index.html', '/pwa-photobooth/assets/css/styles.css', '/pwa-photobooth/assets/fonts/MaterialIcons-Regular.woff2', '/pwa-photobooth/assets/js/script.js', '/pwa-photobooth/assets/icons/ic-face.png', '/pwa-photobooth/assets/icons/ic-face-large.png', '/pwa-photobooth/manifest.json' ]) .then(function() { console.log('Success! App is available offline!'); }) }) ); }); // Define what happens when a resource is requested. // For our app we do a Cache-first approach. self.addEventListener('fetch', function(event) { event.respondWith( // Try the cache. caches.match(event.request) .then(function(response) { // Fallback to network if resource not stored in cache. return response || fetch(event.request); }) ); });
Then we need to link that service worker to our HTML.
<script> // Register Service Worker. if ('serviceWorker' in navigator) { // Path is relative to the origin, not project root. navigator.serviceWorker.register('/pwa-photobooth/sw.js') .then(function(reg) { console.log('Registration succeeded. Scope is ' + reg.scope); }) .catch(function(error) { console.error('Registration failed with ' + error); }); } </script>
Now all of the files in our project will be saved in the user’s browser. Any JavaScript variables and object should also be saved in the localStorage or IndexDB where possible.
Right now Service Workers are supported in Chrome, Firefox and Opera. Safari and Edge are also working towards adopting them, and we hope that in the future they will be available in every browser.
When building PWAs, it’s recommended to follow a design concept called app-shell architecture. It sounds very complicated but essentially boils down to this: the app is separated into two major components: the shell and the content.
The shell contains all the static UI elements such as a header, menus, drawers, etc. When we cache an app, the shell should always be saved on the device, because we want it to be available at all times. That way when a user with no internet connection opens the app, they won’t see an empty screen or a running dinosaur – they will see the cached app interface and an appropriate error message.
The content resides within the shell. It can also be cached but it isn’t necessary to do so as content is usually dynamic, changes frequently and can be different on every single page load.
Once cached, our PWA will always load from the local storage. However, if we change the service worker sw.js in any way, on the next page load the new version will be downloaded and installed.
this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1.0.1').then(function(cache) { // ... }) ); });
Using service worker updates we can re-download resources, delete old cache, or completely change the service worker logic. You can learn more about the SW Update process from this Google Developers article – here.
By adding a Web Manifest to our app we can provide various information about it and change the way it is displayed on people’s devices. It allows apps to be saved to the home screen with a custom icon, to be started in a separate browser window, and a lot of other cool stuff.
The Web Manifest takes the form of a simple JSON file:
{ "name": "Progressive Web App: PhotoBooth", "short_name": "PhotoBooth", "description": "Simple Progressive Web App for taking selfies.", "icons": [{ "src": "assets/icons/ic-face.png", "type": "image/png", "sizes": "72x72" }, { "src": "assets/icons/ic-face-large.png", "type": "image/png", "sizes": "144x144 256x256" }], "start_url": "index.html", "display": "standalone", "background_color": "#fff", "theme_color": "#fff", "orientation": "portrait" }
Most of the properties are self explanatory so we will cover only the more important ones. To see the full Web manifest format and all the available fields go here.
To register the manifest we have to link it to our HTML:
<!-- Web Manifest --> <link rel="manifest" href="manifest.json">
Safari doesn’t support the Web Manifest standard yet but we can define app-like behavior with this Apple-specific meta tag:
<!-- Meta tag for app-like behaviour in iOS --> <meta name=”apple-mobile-web-app-capable” content=”yes”>
Push notifications aren’t limited to native apps any more. Thanks to service workers and the Push API, web applications can also send messages to the Android notification bar. Not all apps will benefit from having this feature, but when used properly notifications can really help engage users.
This topic goes beyond the scope of our tutorial, as Push Notifications are quite complicated and deserve a full lesson on their own. If you still want to implement notifications to your web app, here are some of the best learning resources available:
By default any website can be manually saved to the home screen using the Add to Home Screen button from the Chrome browser menu. However, it might be rather difficult to make users “install” our app this way, since most people don’t know about that feature at all.
Thankfully, there is a way for your app to prompt users to save it with a simple installation pop-up. To prevent developers from abusing these pop ups, there isn’t any way to programmatically show them. Instead, they will appear on their own when an app fulfills a series of requirements:
We have all of the above covered, so when a user visits our app’s website a couple of times, they will get this prompt:
The entire installation process of our app is in this simple prompt. The install happens instantly, and once saved the PhotoBooth will be available to launch from a home screen icon, behaving exactly like a native app.
Anyone with a web browser has access to PWA apps and they can be shared simply via their URL. No third party tools are required for finding or installing them.
If an app runs in standalone mode, it’s also advisable to add in-app share buttons, since the browser address bar and menus aren’t visible.
Our PWA is now complete. We can test how well it follows the PWA rules with an official Google-made tool called Lighthouse. It recreates possible scenarios and tests the app thoroughly. Here is what it tells us about the PhotoBooth:
We passed!
If you want to find more PWAs to play with, go to pwa.rocks. They offer a nice collection of games and useful tools, showcasing the great power of Progressive Web Apps.