| Welcome, Guest |
You have to register before you can post on our site.
|
| Forum Statistics |
» Members: 20,104
» Latest member: noah2013
» Forum threads: 21,740
» Forum posts: 22,604
Full Statistics
|
| Online Users |
There are currently 671 online users. » 0 Member(s) | 666 Guest(s) Applebot, Baidu, Bing, Google, Yandex
|
|
|
| PC - Terra Nil |
|
Posted by: xSicKxBot - 03-31-2023, 02:17 PM - Forum: New Game Releases
- No Replies
|
 |
Terra Nil
Terra Nil, from eco-warriors Free Lives (Broforce) and recycled publisher Devolver Digital, presents players with the task of environmental rejuvenation. Begin with the water system, slowly purify the soil, and cultivate pioneer greenery. Embark on more ambitious tasks, restore biodiversity, fix the climate, introduce wildlife, and finally recycle all the structures you used to get there, leaving the environment pristine.
Each region of the game has its own flavour and procedural generation palette. Yet even within a region, no two playthroughs will be the same.
Navigate sprawling, verdant, hand-painted environments where everything but the rocks move and breathe. A meditative soundtrack and stunning audio palette will accompany your efforts. Publisher: Devolver Digital Release Date: Mar 28, 2023
https://www.metacritic.com/game/pc/terra-nil
|
|
|
| PC - Terraformers |
|
Posted by: xSicKxBot - 03-30-2023, 09:20 PM - Forum: New Game Releases
- No Replies
|
 |
Terraformers
Terraformers is an expansive colony builder and resource management game.
Explore the Red Planet, develop spectacular cities, spread life and terraform the planet with ambitious projects.
Send your leaders to mysterious locations and be the first to discover rich resource depots, giant crystal caves and stunning natural wonders.
Found new cities on craters and in lava Tubes. Make them thrive and meet your population's rising demands.
Mine the rare metals of Mars, manufacture them into advanced goods and set up an effective transport system between your ever-growing cities. Publisher: Goblinz Studio Release Date: Mar 09, 2023
https://www.metacritic.com/game/pc/terraformers
|
|
|
| [Tut] ChatGPT 50 News Not to Miss (March 2023) |
|
Posted by: xSicKxBot - 03-29-2023, 11:54 PM - Forum: Python
- No Replies
|
 |
ChatGPT 50 News Not to Miss (March 2023)
Anything new about ChatGPT this week (end of March 2023)? Not much. Only these 50 stories… 
Recommended: Free Download ChatGPT Prompting Cheat Sheet
Petition Against AI Research
Some big-time celebs ( Musk, Wozniak, and more) have signed a petition to put a hold on the development of AI systems stronger than GPT-4. I’m really curious to hear what other people think about this. On the one hand, I get where they’re coming from, but even if it did happen, would it really make any difference? I kinda doubt it, to be honest.
Link
Google Brain’s 2006 Concept
Google Brain had an incredible concept back in 2006! You could chat with Google and use it to search for things and even pay for them. Just imagine if they had implemented this incredible idea back then! It’s mind-blowing to think about! 
Link
OpenAI Invests in Humanoid Robot
OpenAI has put their money into NEO, a humanoid robot from 1X. They are confident it will have a great influence on the future of work. ChatGPT and robots could be arriving sooner than expected. Their goal is to construct robots with human-level dexterity. 
Link, Link
ChatGPT: A Code Interpreter for Data Analysis
ChatGPT is an incredible code interpreter that can help you complete university assignments in no time! It can scan databases and analyze the data, create visualizations, and even allow you to play with data using plain English! It also supports file uploads and downloads. This would have been a lifesaver during my university days! 
Link
AI Comes to Webflow – Get Your Website Built!
Webflow is taking a leap forward with AI! Now you can quickly build components using Artificial Intelligence. I’m especially excited about this since I use Webflow to design websites for people.
Link
ChatGPT Plugin: Your Personal Recipe and Shopping Assistant
ChatGPT Plugin is your personal assistant to help you find the perfect restaurant, recommend delicious recipes, compile all the necessary ingredients, and even purchase them using Instacart! 
Link
Expedia Plugin is the Best for Booking Flights  
Expedia has outdone themselves with their new plugin – it’s already better than any website out there for booking flights! It can help you find flights, resorts, and activities to do! 
Link
Writing to Create with Plugins
The plugin speaks English plainly and simply. We’re at a stage now where if you know how to write, you can create amazing things with plugins! 
Link
Unlock the Power of ChatGPT with the Retrieval Plugin
The Retrieval plugin provides ChatGPT with an incredible memory ! All you need to do is wear a microphone throughout the day, transcribe the audio, and give it to ChatGPT – it will remember all the information you said. With the Retrieval plugin, you can instantly recall anything you need! There are countless useful applications for this revolutionary technology. 
Link
ChadCode Plugin: Revolutionizing Coding!
The ChadCode plugin is revolutionizing coding! It allows you to quickly search across your files and create GitHub issues in an instant. The possibilities are endless, and it truly changes coding for the better! 
Link
AI-Built iOS Game on App Store
The first GPT-4-generated iOS game is now available on the App Store! Mate had no experience with Swift; all code was completely AI-generated. It won’t be long until the App Store is flooded with AI-built games – it’s only a matter of time! 
Link
Real-time Emotion Detection with AI – Endless Possibilities   ?
Real-time emotion detection with AI is now possible! While I’m not entirely sure of its use cases, I can imagine people coming up with some crazy ideas for this technology.   
Link
Voice Chat with Llamas on Macbooks
Stay connected with your furry friends through voice chat on your Macbook Pro! We won’t have to type anymore, as we can just chat with Artificial Intelligence (AI) like Jarvis. I wrote about this in my newsletter – no need to type out your messages anymore!
Link
Earthquake Imagery in Midjourney Subreddit
People in the Midjourney subreddit have been creating realistic-looking images of an earthquake that never occurred – it’s unbelievable! 
Link
Mark Cuban Proposes Training AI Models with Liberal Arts Majors –   
Mark Cuban made an interesting comment suggesting that people with liberal arts or other non-engineering degrees could train AI models for specific use cases and tasks. This idea could potentially lead to significant financial gains if successful. What do you all think about this proposal?   
Link
Investing in AI: Emad Mostaque on GPT-4 Competitor
Emad Mostaque, CEO of Stability AI, estimates that building a GPT-4 competitor could cost anywhere between 200-300 million, provided the right people are in place. He also noted that it would take a minimum of 12 months to build an open-source GPT-4, and an immense amount of focus and hard work. 
Link, Link
The Impact of Midjourney on 3D Artists
A 3D artist opened up about how their job has been transformed since the release of Midjourney. They can now create a character in only two to three days, compared to the weeks it would take before. Though they don’t necessarily love it, they even admit that Midjourney does a better job than they can do. It’s sadly thought-provoking to read, as one can imagine how enjoyable it used to be for them to make art. This change is going to have a significant impact on many people in various creative fields. 
Link
Developer Builds iOS App in a Few Hours
This lad built an entire iOS app , including payments , in a few hours! It was a relatively simple app, but had sooo many use cases, enabling him to get proof of concepts out in a single day. Crazy times ahead! 
Link
AI-Powered 3D Animations – The Future of Design?   
Someone is currently learning how to create 3D animations using AI. As this technology gets refined, I can imagine it becoming a streamlined process and making a lot of people some serious money.   
Link
New Innovation: Conversation Enhancing Earpiece
These folks are constructing an earpiece that will provide you with conversation topics and questions when speaking to someone. Just imagine taking this along to a job interview or a date !
Link
AI-Powered Website Building is Here!
Have you ever dreamed of having a website that’s exactly what you want without having to do any of the work? Well, now it’s possible with AI-powered website building! This demo looks so amazing – website building is going to be so much easier and it’s crazy! 
Link
The Future of AI-Assisted Conversations
Put on your glasses and let AI take the reins! As technology advances, it’s becoming increasingly difficult to tell when someone is being assisted by AI in conversations. So get ready for a whole new world of AI-assisted conversations!
Link
Pope Drip: The Laughable Image
The Pope is drippin’  I’ve been dying of laughter for days because I genuinely thought it was real the first time I saw it!
Link
AI Generators Replacing Models: Levi’s Diversity Move
Levi’s is striving for greater diversity in their advertising by turning to AI image generators instead of hiring diverse models. It’s likely that this kind of technology will become more and more common, and could potentially spell trouble for models in the long run, as AI image generators are getting increasingly realistic. 
Link
AI Model Agency Creates 100% AI-Generated Images 
Someone created an AI model agency to create images of models wearing custom outfits—all 100% AI generated! 
Link
ChatGPT Launches Stylish Landing Page
ChatGPT has launched a sleek and stylish landing page, and it looks ! It’s sure to impress all visitors. 
Link
Investor Shares Hilarious AI Story
This investor recounts a funny story about how he spoke to a founder who took all of his advice and fed it to GPT-4, an advanced natural language processing algorithm. They even used Eleven Labs’ AI-generated answers! Hilarious stuff! 
Link
Artificial Intelligence & Blender 
Someone hooked up the GPT-4 artificial intelligence to Blender 3D animation and the results are unbelievable! The combination of AI and 3D animation is pushing the boundaries of creativity.
Link
Kanye Raps Freestyle for Guy
This guy had the honor of getting Kanye West to rap one of his verses!  
Link
GPT4 Saves the Day: A Dog’s Miraculous Recovery!
When doctors were unable to diagnose what was ailing the pup, GPT4 came to the rescue and proved to be spot-on with its suggested causes. Who would’ve thought it was possible?! It’s truly amazing!
Link
GPT-4 Learns at Lightning Speed
A research paper suggests that GPT-4 can improve its performance by up to 30% simply by having it consider “why were you wrong.” Taking this feedback into account, the AI is capable of generating new prompts for itself, propelling the pace of its learning to lightning-fast speeds. 
Link
GPT-4 and Replit: Breaking Down the Technological Barrier
You can literally ask GPT-4 for a plugin idea, have it code it, and then watch it go live on Replit! It’s gonna be so unbelievably easy to create new types of single-use apps soon, especially if you have a niche use-case. And you can do this with practically no coding knowledge – the technological barrier to solving problems using code is vanishing before our eyes! 
Link
Open-Source AI Form Builder Coming Soon!
Say goodbye to tedious form-building by hand! We’re excited to announce that a new open-source AI form builder is coming soon! This state-of-the-art technology will make it easier and faster than ever to create forms. It’s gonna be pretty neat! 
Link
AI Videos That Look Real
Create entire videos of talking AI people: When this technology gets better, we won’t be able to tell the difference between what’s real and what’s AI! 
Link
The Cityscape of Dreams 
Someone created a cityscape using AI and then asked Chatbot GPT-3 to write the code to port it into virtual reality. From words to wondrous virtual worlds!
Link
The Power of GPT-4: Writing an Entire Book 
Someone managed to get GPT-4 to write an entire book – and while it may not be amazing, it’s still quite impressive! With the advent of helpful plugins and progress to GPT-5 and GPT-6, this accomplishment will likely become even easier and of higher quality in the future.
Link
Request an App with a Single Prompt – The Future of App Development?  
Have you heard about Replit’s new software that allows you to literally request an app and have it built for you? It’s unbelievable! As AI continues to improve, we may see whole functioning apps being built with a single prompt. This could be world-changing!  
Link
OSS AI: Langchain’s Open-Source Achievements 
Langchain is really knocking it out of the park with their open-source AI plugins. I’m so excited to see what the future holds!
Link
Building with Langchain Just Got Easier!
Langchain makes it easy and powerful to develop on their platform. Whether you’re a beginner or an experienced engineer, you’ll find that building with Langchain is fast, reliable, and easy. So, why not give it a try? 
Link
Create 3D Scenes with Text in Real Time
Create stunning 3D scenes in no time with the power of text! With this revolutionary editing technique, making complex 3D scenes is easier than ever before. 
Link
GPT-4’s Emotional Genius: An Entrepreneur’s Opportunity for Fortune
GPT-4 is proving to be incredibly adept at recognizing the many nuances of human emotions and states of mind – it’s so effective that it can even help to resolve conflicts between couples . Reports have been cropping up about its effectiveness as a therapeutic tool – good, ethical or otherwise – and there is undeniably great potential to help many people without breaking the bank. All that’s needed now is for an ambitious entrepreneur to seize the opportunity and create a successful business around GPT-4 to make a fortune .
Link
GPT-4: The AI Emotion Wizard 
You can use plugins to process video clips, so many websites instantly becoming obsolete
Link, Link
Writing Plugins with ChatGPT
Writing plugins for ChatGPT is a breeze! Just describe the API you want in plain English, and ChatGPT will take care of the rest 
Link, Link
Replacing Siri with ChatGPT – A Clever iOS Shortcut   
Check out this clever lad who created an iOS shortcut that replaces Siri with ChatGPT! With this shortcut, users can interact with ChatGPT instead of Siri, adding a unique twist to their virtual assistant experience.   
Link
We (Finxter) also have an interesting article (+video) on the topic:
Recommended: Create a Siri Alternative with ChatGPT (No Code!)
Integrate Chatbot and Zapier for Endless Possibilities  
Zapier allows you to integrate more than 5000 apps, turning your possibilities into an infinite playground. By combining Chatbot and Zapier, you can create an array of unique use cases that can be further enhanced with other apps. 
Link
 A Glimpse of AGI?
We’ve likely already seen the paper discussing how GPT-4 displays signs of artificial general intelligence (AGI), but here’s a link just in case. It states, “We believe that it could reasonably be viewed as an early (yet still incomplete) version of an AGI system.”
Link
Also check out our full guide on AGI:
Recommended: Artificial General Intelligence (AGI) – Is ChatGPT It?
Mind-blowing AI Agent Creates Subtasks and Solutions
This guy made an AI agent that can break down a task into sub-tasks and come up with solutions for each part. It’s totally insane to watch it in action – I highly suggest catching the clip below. Here’s the link to the “paper” and his summary of how it all works.
Link, Link
Make Remote Job Interviews a Breeze with This Clever Tool!  
There’s now an awesome tool that can help you ace remote job interviews with ease. It listens in to the interview and provides you with suggestions on what to say – making those nerve-wracking virtual interviews a piece of cake! 
Link
Perplexity Launches New Mobile App: A ChatGPT Alternative for Instant Answers with Cited Sources 
Perplexity has just released their new mobile app – a cutting-edge ChatGPT alternative featuring instant answers and cited sources. Get the app now and access on-the-go answers in a flash! 
Link
Download your ChatGPT cheat sheet here:
Recommended: Free Download ChatGPT Prompting Cheat Sheet
These news items were collected from this Reddit thread. Shoutout to /u/lostlifon!
https://www.sickgaming.net/blog/2023/03/...arch-2023/
|
|
|
| PC - Bleak Faith: Forsaken |
|
Posted by: xSicKxBot - 03-29-2023, 11:53 PM - Forum: New Game Releases
- No Replies
|
 |
Bleak Faith: Forsaken
Explore the last remnants of civilization in this vast, unforgiving, and interconnected world. Learn what is left of its history. Discover pockets of civilization in the perpetually expanding Omnistructure. Lose yourself in a journey unlike any other.
Rich in atmosphere and rife with danger, be prepared to be immersed in a new world unlike any you've experienced before. Not every path is paved and catered to you, so be prepared to run, climb, leap, to ascend in Bleak Faith. Publisher: Archangel Studios Release Date: Mar 10, 2023
https://www.metacritic.com/game/pc/bleak-faith-forsaken
|
|
|
| [Tut] How I Built an English Dictionary App with Django |
|
Posted by: xSicKxBot - 03-29-2023, 04:46 AM - Forum: Python
- No Replies
|
 |
How I Built an English Dictionary App with Django
As we all know, Django is a Python framework used for building complex web applications. Yet, it can also be used for building simple ones. In this tutorial, I’m going to show you how I built an English dictionary app, a simple Django project for beginners.
It takes time for a beginner to fully understand how Django works. But the key is consistency. If you keep building projects, you will gradually know enough to be dangerous with Django.
Scroll to the end to see the full code on GitHub!
A Dictionary App? 
A dictionary is an application used to get a particular word’s meaning. No matter how proficient we are in English, some words are far beyond our understanding. There are also words we may not know how to pronounce efficiently, especially those originating from a different language.
Furthermore, we may want to know a synonym or antonym of a given word. This is where a dictionary comes in handy. With a dictionary, we get to know not only the meaning of a word but how it is pronounced, what parts of speech it belongs to, and how it is used in a sentence. Students, no doubt, appreciate the importance of having a dictionary.
How Will We Get The Data?
How will we build this dictionary app so that when users search for a particular word, they get the meaning?
We have two options. Either we use PyDictionary, a Python module and an API that scrapes an online dictionary website or we perform the web scraping ourselves. None of these methods comes without a drawback.
Recommended: Is Web Scraping Legal?
The drawback is the challenge that comes with web scraping. Many websites sometimes change their HTML structures to prevent people or bots from accessing their content. So, if an API is not actively maintained, it can quickly become useless. This is the case with PyDictionary. Therefore, we are going to perform web scraping.
Doing so will undoubtedly gain some valuable experience in web scraping, a very broad concept in Python programming. Still, we are at the mercy of website owners. They can change the HTML structures of their websites unexpectedly.
Prerequisites
This tutorial assumes you are familiar with Python, HTML, and Bootstrap. If not, please you are required to have at least a basic knowledge before attempting this project. Basic knowledge of Django, though not required, can speed up the learning process.
Getting started
Create a new folder for this project. Then you do the following:
- Create a virtual environment
python3 -m venv .venv
- Activate the virtual environment
source .venv/bin/activate
- Install the required libraries in the virtual environment
pip install django tzdata requests bs4
- Create a
requirements.txt file to keep a record of the module versions.
pip freeze > requirements.txt
Creating Django Project and Application
i. Creating the project
django-admin startproject project . This creates a folder called project in the current directory.
ii. Creating the application
python3 manage.py startapp dictionary The manage.py file is an executable file used to run Django commands
iii. Applying migrations
python3 manage.py migrate
iv. Checking to see if the installation was successful
python3 mange.py runserver
Once you see the above image, you are good to go.
Registering the App
- In
settings.py file This step is important whenever an app is created. Navigate to the project folder. Open the settings.py file and scroll down to the INSTALLED_APPS section.
# Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # custom app 'dictionary', ]
We have registered the app in the settings.py file. The settings.py file is used to configure the whole project.
- In the
urls.py file Open the urls.py file in the project folder and add this:
from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('dictionary.urls')), ]
We have registered the app-level URL. Let’s now create it.
Creating the App URL
This will be done inside the dictionary folder. Create a urls.py file inside the folder and add this:
from django.urls import path
from . import views urlpatterns = [ path('', views.homeView, name='home'), path('search', views.searchView, name='search'),
]
“from . import views” tells Django to import the views.py file residing in the dictionary folder.
The empty string indicates the home page URL which is http://127.0.0.1:8000/ if you are using the local server.
This is where users will be directed when the web page is opened.
For the 'search' string, the URL will be http://127.0.0.1:8000/search. We will be creating two functions in the views.py file as indicated.
Notice the name argument in the path() function, this is another way to refer to the URLs in the template files without using the exact URLs.
Creating Views
In this file, we are going to perform the web scraping we mentioned earlier. The first function, the homeView() is fairly simple. We just render the index.html page once the app is opened.
from django.shortcuts import render
import requests
from bs4 import BeautifulSoup as bs # Create your views here. def homeView(request): return render(request, 'index.html')
But the searchView() function is a little bit complex. We want to display three things when a user searches for the meaning of a word: meaning, synonyms, and antonyms.
So, we perform web scraping on two online dictionary websites. The first will display the meaning and the second will display the synonyms and antonyms.
def searchView(request): word = request.GET['search'] response = requests.get(f'https://dictionary.com/browse/{word}') response2 = requests.get(f'https://thesaurus.com/browse/{word}') if response: soup_1 = bs(response.text, 'html.parser') meaning = soup_1.find_all('div', {'value': '1'}) meaning_1 = meaning[0].getText() else: word = f'Sorry, we couldn\'t find your word {word} in our records.' meaning = '' meaning_ = '' if response2: soup_2 = bs(response2.text, 'html.parser') synonyms = soup_2.find_all('a', {'class': 'css-1kg1yv8 eh475bn0'}) synonym_list = [] for i in range(len(synonyms)): synonym_list.append(synonyms[i].text.strip()) antonyms = soup_2.find_all('a', {'class': 'css-15bafsg eh475bn0'}) antonym_list = [] for i in range(len(antonyms)): antonym_list.append(antonyms[i].text.strip()) else: synonym_list = '' antonym_list = '' results = { 'word': word, 'meaning': meaning_1, 'synonyms': synonym_list, 'antonyms': antonym_list } return render(request, 'search.html', results)
We import the requests module which uses the get() method to scrape the contents of the two websites.
Recommended: My First Python Get Request
The result is a cruel HTML code staring at you. BeautifulSoup, invaluable for web scraping does its job well to pull the data out of the HTML content. This now makes it possible to search the parsed data.
For our first search using the find_all() method from BeautifulSoup, we want a text wrapped in a div tag with the value 1. This is where the website owners kept the meaning of a particular word on the dictionary.com website.
So, we use the getText() method to get the text.
The second and third searches look similar to the first but instead of a div, we search in a tag. The words were kept in a tag to make it easy for visitors to be redirected to that particular word if they want to find the definition.
Instead of searching for a value, we search for a CSS class. We then append the results to their respective variables. If you are new to web scraping, you may wonder how we know where those particular words reside.
The answer is found in a browser’s developer tools, preferably Chrome Developer Tools. This is the reason I suggest familiarizing yourself with HTML before attempting this project.
Finally, we render the results on the search.html page. Notice the else statements. This is run if the word is not found on the website. Let’s now create the HTML files.
Creating Templates
Create a folder named templates in the current directory (not in the project or app folder). Then go to the settings.py file to let Django know of this development. In the file, import the os module. Then scroll to the TEMPLATES section and add this:
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], # add these 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, },
]
Then create three files in the templates folder:
base.html,
index.html, and
search.html.
The main HTML files will inherit from the base.html file. Open the base.html file and add the following:
<!DOCTYPE html>
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dictionary App</title> <!-- CSS only --> <!-- we are getting bootstrap5 from the CDN --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet">
</head> <body> <div class="container mt-4"> <div class="row"> <div class="mt-4 p-5 bg-success text-white rounded mb-3"> <h1>Django English Dictionary</h1> </div> <div class="col-md-12"> {% block content %} <!-- here we will inject the content of every page that inherits from the base page --> {% endblock %} </div> </div> </div>
</body> </html>
Then, in the index.html add the following:
<!-- the index page is inheriting from the base page -->
<!-- the extends tags are used for inheriting from the base page -->
{% extends 'base.html' %} <!-- the block content tags for containing content of the page -->
{% block content %} <form action="search"> <div class="input-group"> <input type="text" required class="form-control" name="search" placeholder="Search your favorite word......."> <div class="input-group-append"> <button class="btn btn-success" type="submit"> Search </button> </div> </div> </form> {% endblock %}
Recall in the searchView() function, we send a GET request to get the word input by our user from a form that bears the name 'search.' Can you now see it in the form?
There will be a problem if you use it otherwise. Finally, add the following to the search.html file.
<!-- SEARCH.HTML -->
{% extends 'base.html' %}
{% block content %} <div> <h2 align="center"> {{ word | title }} </h2> <br> <p> <b>Meaning: </b>{{meaning}} </p> <br> <p> <b>Synonyms: </b> {{ synonyms }}
</p>
<br>
<p> <b>Antonyms: </b> {{ antonyms }} </p> <p><a href="{% url 'home' %}>Home</a></p> </div>
{% endblock %}
We use Django templating language to render the results of the searchView() function to the HTML. Alright, we are done. Run the server once again and you should see something similar to the images below.
That is the index.html web page. Once you search for a word, the search.html page is displayed as you can see below.
Do you see how each of the pages inherits everything in the base.html file?
Conclusion
We have successfully come to the end of this project. I strongly believe you have learned a lot of things you can apply to your projects. If certain things aren’t clear you may wish to read other project articles.
The full code can be found on my GitHub page https://github.com/finxter/django_dictionary. Have a wonderful day.
Recommended: How I Built a Weather App Using Three Python Frameworks
https://www.sickgaming.net/blog/2023/03/...th-django/
|
|
|
| [Tut] PHP QR Code Generator with phpqrcode Library |
|
Posted by: xSicKxBot - 03-29-2023, 04:46 AM - Forum: PHP Development
- No Replies
|
 |
PHP QR Code Generator with phpqrcode Library
 by Vincy. Last modified on March 28th, 2023.
QR code (Quick Response code) is a machine-readable pictorial format containing black and white squares. It is used for storing information like URLs, product ID, etc. It is a type of matrix barcode or a two-dimensional barcode.
It is a convenient form of storing and retrieving simple data and has become even more popular with the advent of smartphones. The camera in the smartphone can act as a reader and read the QR code and help to decipher the data stored in it.
This article gives many examples if you want a solution to generate QR codes in PHP. There are a lot of PHP libraries available to generate QR codes. This article uses the PHP QR code library.
1. Quick example
This quick example returns the QR code to the browser in one line. It produces the output as a PNG stream.
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php'; // Displays QR Code image to the browser
QRcode::png('PHP QR Code :)');
Installing PHP QR code library
Download the latest library version and extract it into your application vendor folder. The source code downloadable in this article has the library.
All the examples in this article have the code to include the suitable library file to use its feature.
In a previous article, we have seen code for a PHP QR code generator using the tc-lib-barcode library.

2. Display the QR code using an HTML image
To display the QR code using an HTML image tag, link the HTML image source to the PHP file that returns the QR code PNG data.
The generate.php file returns the QR code in the below code using the PHP QrCode library. The HTML image refers to this file to show the QR code in the browser.
show-qr-code-in-HTML-img/generate.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php'; // Displays QR Code image to the browser
QRcode::png('PHP QR Code :)');
<?php
require_once __DIR__ . '/../vendor/phpqrcode/qrlib.php'; // outputs image as PNG that can be refered to a HTML image 'src'
QRcode::png('PHP QR Code :)');
?>
show-qr-code-in-HTML-img/view.php
<img src="generate.php" />
2. Passing arguments to the QR code generator
Passing parameters to a QR code generator helps to perform dynamic processing about the parameter.
For example, we can pass a contact id to retrieve contact information to bundle it with the QR code output.
This example shows how to send parameters and process them in the QR generator.
The view.php file prepares the QR code parameter in PHP. Then, it sends it to the generate.php in query. This URL with the QR code parameter is specified to an HTML image source.
show-qr-code-in-html-img/view.php
<?php
// initialize PHP parameter to send to the QR code generator
$QRParameter = 1234;
?>
<img src="generate.php?id=<?php echo $QRParameter; ?>" />
In this generate.php file, it does simple manipulation to the passed argument. It prefixes a string with the GET parameter received and bundles the manipulated line to the QR code PNG.
show-qr-code-in-html-img/generate.php
<?php
if (empty($_GET['id'])) { echo "<b>ERROR:</b> Bad request. Required parameters are missing."; exit;
} else { require_once __DIR__ . '/../vendor/phpqrcode/qrlib.php'; $inputString = $_GET['id']; // Do not return anything to the browser ob_start("callback"); // Process the input string $codeText = 'DEMO - ' . $inputString; // end of processing $debugLog = ob_get_contents(); ob_end_clean(); // outputs QR code as a PNG data QRcode::png($codeText);
}
?>
3. Save the QR code on the server
This example saves the generated QR code on the server.
It defines the QR code data and the png file name suffix in an array. Then, it uses them while creating the target to save the QR code.
save-qr-code-in-server.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php'; // how to configure silent zone (frame) size
$qrContent = array('content' => 'Contact information', 'slug' => 'contact-info'); $target = "uploads/qr-code-dir/";
$filePath = $target . 'ouput-qr-code-' . $qrContent['slug'] . '.png'; if (!file_exists($filePath)) { QRcode::png($qrContent['content'], $filePath);
}
?>
<img src="<?php echo $filePath; ?>" />
4. Configure QR code ECC Level, Zoom factor, and Frame size
The PHP QRCode Library defines constants for different ECC levels, Zoom factor, and Frame size. These factors are used for the following purposes when generating a QR code.
This program creates QR codes in L, M, Q, and H levels with appropriate QR constants.
- ECC level is the allowed percentage of damage without affecting reading data.
- Zoom factor is the allowed resolution that can be changed based on the use cases.
- Silent zone Frame size – The silent or quiet zone frame size varies based on different matrices. Setting the QR code above or equal to 4 blocks is recommended.
qr-code-ecc-level.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php';
require_once __DIR__ . '/vendor/phpqrcode/qrconst.php'; $qrContent = 'Demo data to bundle into a QR code'; $target = "uploads/ecc-level/"; // generating QR code in the 4 ECC level
QRcode::png($qrContent, $target . 'l.png', QR_ECLEVEL_L);
QRcode::png($qrContent, $target . 'm.png', QR_ECLEVEL_M);
QRcode::png($qrContent, $target . 'q.png', QR_ECLEVEL_Q);
QRcode::png($qrContent, $target . 'h.png', QR_ECLEVEL_H); ?>
<img src="<?php echo $target; ?>l.png" />
<img src="<?php echo $target; ?>m.png" />
<img src="<?php echo $target; ?>q.png" />
<img src="<?php echo $target; ?>h.png" />
This program adds the zoom factor 1 to 4 with the QR_ECLEVEL_L ECC constant.
qr-code-pixel-zoom-factor.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php'; $qrContent = 'Demo data to bundle into a QR code with zoom factor'; $target = "uploads/pixel-zoom-qr-code/"; // generating QR code with 4 ECC level and zoom factor
QRcode::png($qrContent, $target . 'l_1.png', QR_ECLEVEL_L, 1);
QRcode::png($qrContent, $target . 'l_2.png', QR_ECLEVEL_L, 2);
QRcode::png($qrContent, $target . 'l_3.png', QR_ECLEVEL_L, 3);
QRcode::png($qrContent, $target . 'l_4.png', QR_ECLEVEL_L, 4); ?>
<img src="<?php echo $target; ?>l_1.png" />
<img src="<?php echo $target; ?>l_2.png" />
<img src="<?php echo $target; ?>l_3.png" />
<img src="<?php echo $target; ?>l_4.png" />
This program creates QR codes with all these factors ECC, Zoom, and Frame constants of the library.
silent-zone-frame-size.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php'; $qrContent = 'Demo data to bundle into a QR code with frame size'; $target = "uploads/pixel-zoom-qr-code/"; // generating // frame config values below 4 are not recommended !!!
QRcode::png($qrContent, $target . 'l_3_4.png', QR_ECLEVEL_L, 3, 4);
QRcode::png($qrContent, $target . 'l_3_6.png', QR_ECLEVEL_L, 3, 6);
QRcode::png($qrContent, $target . 'l_3_10.png', QR_ECLEVEL_L, 3, 10); // displaying
?>
<img src="<?php echo $target; ?>l_3_4.png" />
<img src="<?php echo $target; ?>l_3_6.png" />
<img src="<?php echo $target; ?>l_3_10.png" />
5. Add phone, email, and contact info to a QR code
This section has PHP examples to create QR codes to attach contact information. It prepares the QR code content with the “tel:”. “sms:” and “mail:” links and attaches it to the QR code.
add-phone-to-call.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php';
$target = "uploads/qr-code-phone/";
$phone = '(091)700-001-710';
// attache phone to call
$qrContent = 'tel:' . $phone;
QRcode::png($qrContent, $target . 'phone-to-call.png', QR_ECLEVEL_L, 3);
?>
<img src="<?php echo $target; ?>phone-to-call.png" />
add-phone-to-text.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php';
$target = "uploads/qr-code-phone/";
$phone = '(091)700-001-710';
// Attach the phone to text
$qrContent = 'sms:' . $phone;
// generating
QRcode::png($qrContent, $target. 'phone-to-text.png', QR_ECLEVEL_L, 3);
?>
<img src="<?php echo $target; ?>phone-to-text.png" />
Attaching an email adds the mail subject and body as part of the mail recipient data. But the subject and the body parameters are optional.
add-recipient-to-send-mail.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php';
$target = "uploads/qr-code-phone/";
$recipient = 'vincy@example.com';
$mailSubject = 'Enquiry';
$mailBody = 'Post enquiry content';
// Prepare QR content with email recipient, subject and body
$qrContent = 'mailto:' . $recipient . '?subject=' . urlencode($mailSubject) . '&body=' . urlencode($mailBody);
// Attach maileto link to the QRCode
QRcode::png($qrContent, $target. 'mail.png', QR_ECLEVEL_L, 3);
?>
<img src="<?php echo $target; ?>mail.png" />
This QR code example creates a v-card to bundle with the QR code. It includes basic details with the v-card.
This library allows adding more details to the QR code. For example, it can attach a contact avatar to a QR code.
In a previous article, we have seen how to generate and download a v-card for contact information.
save-vcard-to-qr-code.php
<?php
require_once __DIR__ . '/vendor/phpqrcode/qrlib.php';
$target = "uploads/qr-code-phone/";
// Contact details
$name = 'Example1';
$phone = '(091)700-001-711';
// QR code content with VACARD
$qrCode = 'BEGIN:VCARD' . "\n";
$qrCode .= 'FN:' . $name . "\n";
$qrCode .= 'TEL;WORK;VOICE:' . $phone . "\n";
$qrCode .= 'END:VCARD';
// Attaching VCARD to QR code
QRcode::png($qrCode, $target. 'vcard-qr-code.png', QR_ECLEVEL_L, 3);
?>
<img src="<?php echo $target; ?>vcard-qr-code.png" />
Download
Popular Articles
↑ Back to Top
https://www.sickgaming.net/blog/2023/03/...e-library/
|
|
|
|
|
|