OverIQhttps://overiq.com/sitenews/A blog about C programming, Python and Django.en-usSat, 17 May 2025 12:49:47 +0000Machine Learning Experts You Should Be Following Onlinehttps://overiq.com/machine-learning-experts-you-should-be-following-online/<p>One of the most fast evolving domains in today&#39;s tech savvy world is Machine Learning and<br> Deep Learning. An area expected to continue its vast growth and development also in the coming<br> years. Getting ourselves up-to-date with the latest on the advancement in technologies, the<br> trending news, industry patterns, and opinions of compelling figures can appear to be<br> overpowering.</p> <p>But one prime approach to remain educated is through Twitter, which has finally proved to be an<br> useful and engaging approach to remain circled into the insights of a portion of the top<br> personalities and spearheading scholars in AI, who utilize their records to voice their feelings on<br> the most recent news and industry rehearses.</p> <p>If you are someone interested to learn about the latest developments in this field, gain important<br> perspectives from the best brains and be future proof, then there cannot be a better way other<br> than following these Machine Learning experts and their successful journey. Beginners like me<br> have been highly inspired by these heroes of machine learning and can continue to look up to<br> their research work every day to explore more with their algorithms to increase our knowledge.<br> To kick you off, I have incorporated a summary of top 10 machine learning experts, profound<br> learning influencers and specialists whom you ought to follow online. This rundown is a blend of<br> business leaders, originators, specialists, entrepreneurs, scientists and columnists, every one of<br> whom welcome a kind interpretation of AI to the table.</p> <span id="1-andrew-ng" class="anchor-target"></span><h2 class="heading">1. <strong>ANDREW NG</strong> <a class="header-link" href="#1-andrew-ng">#</a></h2> <p>The most famous name in the book of AI enthusiast, Andrew Yan-Tak Ng is considered as the<br> most prominent mind in the domain of Machine Learning and Deep Learning in the present time.<br> The co-founder and chairman of Coursera and deeplearning.ai, is a british-born American<br> technology entrepreneur. He is presently mentoring in the department of Computer Science as an<br> Adjunct Professor at Stanford University.</p> <p>Educator Andrew was the head and helped to establish the Google Brain project and has already<br> worked as the Chief Scientist at Baidu. He is happily married to fellow AI influencer Carol<br> Reiley.</p> <p><img src="/media/uploads/2021/06/19/machine-1.PNG" loading="lazy" alt="" ></p> <p>His point is to democratize profound learning and give everybody on the planet admittance to top<br> notch schooling without any cost, the advantage we receive from Coursera. His online seminars<br> on AI and profound learning are exceptionally pursued by many students and professionals all<br> around the world. An extraordinary history of a scholarly analyst is what Andrew holds in this<br> field. He has more than 300 research papers published in the field of machine learning and<br> advanced mechanics. He is a beneficiary of esteemed honors like ICML Best Paper Award,<br> IJCAI Computers and Thought grant, ACL Best Paper Award and many more to fill the list.</p> <span id="2-michael-i-jordan" class="anchor-target"></span><h2 class="heading">2. <strong>MICHAEL I JORDAN</strong> <a class="header-link" href="#2-michael-i-jordan">#</a></h2> <p>Michael I Jordan, one of the most influential figures of the ML world, is presently working as a<br> Professor at UC Berkeley, and was a former Professor at MIT. His instructions, which are quite<br> similar to his examination advantages, are divided among Statistics and EECS. Statistics,<br> artificial intelligence, and deep learning are the areas that attract him most to explore with.</p> <p><img src="/media/uploads/2021/06/19/2-machine.PNG" loading="lazy" alt="" ></p> <p>Back in the 1980s, Jordan began creating recurrent neural networks as an intellectual model.<br> Lately, his work is less determined from a psychological viewpoint and more from the<br> foundation of conventional measurements. He assisted his work with advocating the utilization<br> of Bayesian organizations in AI applications, and is frequently credited as one of the guideline<br> scholars who brought the cover among measurements and AI to well known consideration. He is<br> an individual of ACM, ISBA, CSS, AAAI, ASA, IEEE, IMS and SIAM. His alumni and postdoc<br> understudies have also gone on to significantly impact the universe of ML, a few of whom show<br> up on this rundown Andrew Ng, David Blei and Zoubin Ghahramani. He recently completed an<br> enlightening Reddit AMA. Moreover, he has also been honored by the Institute of Mathematical<br> Statistics with the title of Medallion Lecturer and Neyman Lecturer.</p> <p>Statistics, the subfield of mathematics, is such a subject which plays a dominant role in every<br> step of Machine Learning and to add to your knowledge, let me tell you a huge number of<br> Statisticians are present who did really unexceptional experiments in this field. Machine<br> Learning deals with building different algorithms, systems, and models that learn from structured<br> data with the help of statistics, instead of normal programming instructions. Statistics has<br> ultimately proved itself to be the biggest game changer in the growth of a business in this 21st<br> century. A broad topic to be understood in depth on how the process of Statistical Analysis<br> actually works for Machine Learning on business case scenarios. To help you out learn more,<br> check out the blog on <a href="https://www.excelr.com/blog/data-<br> science/statistical-analysis/the-ultimate-guide-to-statistical-analysis-for-data-science-6-step-<br> framework"><strong>Statistical Analysis</strong></a><strong>.</strong></p> <span id="3-kirill-eremenko" class="anchor-target"></span><h2 class="heading">3. <strong>KIRILL EREMENKO</strong> <a class="header-link" href="#3-kirill-eremenko">#</a></h2> <p>The organizer and CEO of SuperDataScience, an online instructive gateway for Data Scientists,<br> Kirill Eremenko is a well-known data science entrepreneur whose central goal is to simplify<br> complex problems with the vision of turning into the greatest learning entrance for Data Science<br> fans.</p> <p>Additionally, the online portal highlights many investigation courses going from apparatus based<br> courses, for example, Python, R Programming, Tableau to complete tutorials for Machine<br> Learning A-Z and prologue to Data Science. Some of his best course structure education by<br> Kirill includes Deep Learning, a detailed guide from A-Z and the Hands-On Artificial Neural<br> Networks. He is also a Udemy Instructor holding the best reviews among all.</p> <p><img src="/media/uploads/2021/06/19/3-machine.PNG" loading="lazy" alt="" ></p> <p>This was my first openness to profound learning and trust me, their course is genuinely stand-out<br> with incredible accentuation on the instinctual level of comprehension with involved coding<br> instructional exercises on Supervised and Unsupervised Deep Learning. What&#39;s more, as of late,<br> I got the opportunity to peruse his book , Confident Data Skills that assists the readers with<br> understanding the total information science work process from start till the finish of ventures, all<br> with zero level of coding.</p> <span id="4-sebastian-thrun" class="anchor-target"></span><h2 class="heading">4. <strong>SEBASTIAN THRUN</strong> <a class="header-link" href="#4-sebastian-thrun">#</a></h2> <p>Another exceptionally famous name on our rundown, Sebastian Thrun is presently the CEO of<br> Kitty Hawk Corporation and the Co-founder of the widely used online course platform, Udacity.<br> Sebastian is an entrepreneur from Germany who established the Google X Lab and Google’s<br> self-driving group. He drove the task from the beginning and is broadly viewed as a pioneer with<br> regards to self-sufficient vehicles. Google’s self-driving car project is presently headed by him.<br> He has fostered various self-governing mechanical frameworks in his profession.<br> His understanding of AI is that people won’t get replaced by the applications of AI but rather it<br> would add to our capabilities.</p> <p><img src="/media/uploads/2021/06/19/4-machine.PNG" loading="lazy" alt="" ></p> <p>He is well-experienced in the teaching profession too as he is working as the Adjunct Professor<br> at both Stanford University and Georgia Tech. He is profoundly incorporated into the scholastic<br> side of machine learning also, as we would anticipate from an individual of Sebastian’s height.<br> The Popular Science magazine named him as Brilliant 5 back in 2005. He has additionally been<br> granted the Max-Planck-Research Award in 2011.</p> <span id="5-andreas-kretz" class="anchor-target"></span><h2 class="heading">5. <strong>ANDREAS KRETZ</strong> <a class="header-link" href="#5-andreas-kretz">#</a></h2> <p>At whatever point we talk about information science, the vast majority will in general think that<br> it&#39;s tied in with building cool AI models and making great expectations. In all actuality, building<br> models is only a piece of the entire work process and information designing (otherwise known as<br> handyman of information science) is the urgent piece of this work process that upholds<br> information science projects. Without a steady and strong information designing pipeline and<br> stage, it&#39;ll be a difficult opportunity to try and get information to play out any examination at the primary spot.</p> <p><img src="/media/uploads/2021/06/19/5-machine.PNG" loading="lazy" alt="" ></p> <p>Andreas is genuinely a specialist on his own with regards to information designing and<br> developing large information stages to help information science projects.</p> <p>He is a data engineer and information science stage designer, building information science stages<br> that cycle and investigate crazy measures of information consistently. He is an information<br> designing evangelist situated in Germany, who consistently shares information designing<br> instruments, methods, and abilities regularly through live recordings that cover themes like the<br> broadness of occupation alternatives in information science to ongoing Apache Spark coding<br> meetings.</p> <span id="6-terry-sejnowski" class="anchor-target"></span><h2 class="heading">6. <strong>TERRY SEJNOWSKI</strong> <a class="header-link" href="#6-terry-sejnowski">#</a></h2> <p>The most popular teacher at the University of California, San Diego, belonging to the Biological<br> Sciences department as well as the Francis Crick Professor at the Salk Institute. He is also an<br> Investigator at the Howard Hughes Medical Institute, and one of the pioneers of Neural<br> Networks. His spearheading commitments to the field of AI incorporate his co-creation of<br> Boltzmann machines with Geoffrey Hinton.</p> <p><img src="/media/uploads/2021/06/19/6-machine.PNG" loading="lazy" alt="" ></p> <p>On account of his work in demonstrating and figuring mind function, he is one of just ten living<br> researchers to have been chosen for every one of the three public foundations (Medicine, Science<br> and Engineering) from back in the 1980&#39;s. He is presently a counsel to Obama’s $100 million<br> BRAIN drive, which grows new instruments for planning neural circuits. Terry is known to the<br> world as the creator of the calculation for Independent Component Analysis that has been<br> broadly utilized in AI and sign preparation. He is the recipient of the Hebb Prize by the<br> International Neural Network Society in 1999 for his dedication and commitments to learning<br> calculations. Indeed, in the year 2002 he was also awarded IEEE’s Neural Network Pioneer<br> Award. In 2017, he was chosen for the National Academy of Inventors.</p> <span id="7-geoffrey-hinton" class="anchor-target"></span><h2 class="heading">7. <strong>GEOFFREY HINTON</strong> <a class="header-link" href="#7-geoffrey-hinton">#</a></h2> <p>It’s unbelievably difficult to summarize the profession of any of these phenomenal personalities<br> in a couple of sentences, however with Hinton, this demonstrates especially testing. Thirty years<br> prior, Hinton was at that point positively shaping profound learning, co-creating Boltzmann<br> machines, backpropagation, and contrastive uniqueness. However, it wasn&#39;t until the registering<br> power figured out how proportional to satisfy the needs of profound discovery that Hinton really<br> started to get the more extensive acknowledgment outside of the scholarly community he<br> merited.</p> <p><img src="/media/uploads/2021/06/19/7-machine.PNG" loading="lazy" alt="" ></p> <p>In 2004, he helped to establish Neural Computation and Adaptive Perception, a handpicked,<br> welcome just gathering of specialists from across the fields of physical science, neuroscience and<br> designing. He additionally established DNNResearch, which was procured by Google a year ago.<br> From that point forward, he&#39;s been dealing with the purported Google &quot;Cerebrum&quot; neural organization venture, and serving to significantly improve Google&#39;s picture<br> acknowledgment and Android&#39;s sound acknowledgment abilities.</p> <span id="8-zoubin-ghahramani" class="anchor-target"></span><h2 class="heading">8. <strong>ZOUBIN GHAHRAMANI</strong> <a class="header-link" href="#8-zoubin-ghahramani">#</a></h2> <p>A prominent Professor and researcher of Information Engineering at Cambridge University,<br> Ghahramani is an distinguished individual belonging to the Adjunct Faculty at the Gatsby<br> Computational Neuroscience Unit at UCL. He has added to the fields of Bayesian ways to deal<br> with Artificial Intelligence, man-made reasoning, insights, data recovery, bioinformatics, and<br> computational engine control. He completed his doctorate from the University of Massachusetts<br> Institute of Technology at the Department of Brain and Cognitive Sciences , under the<br> supervision of Tomaso Poggio and Michael I. Jordan.</p> <p><img src="/media/uploads/2021/06/19/8-machine.PNG" loading="lazy" alt="" ></p> <p>He started a startup in the year 2014 named as Geometric Intelligence that focuses on item or<br> situation acknowledgment. In the later years, Uber started implementing Geometric Intelligence<br> and he finally joined Uber&#39;s A.I. Labs in 2016. Publishing more than 250 research papers in the<br> domain of Machine Learning, he was chosen Fellow of the Royal Society (FRS) in the year<br> 2015.</p> <p>He was as of late granted $750,000 by Google for The Automatic Statistician, a task driven by<br> Ghahramani which investigates an open-finished space of conceivable factual models to find a<br> decent clarification of the information, and afterward creates an itemized report with figures and<br> normal language text.</p> <span id="9-yann-lecun" class="anchor-target"></span><h2 class="heading">9. <strong>YANN LECUN</strong> <a class="header-link" href="#9-yann-lecun">#</a></h2> <p>A French computer scientist working mostly in the field of mobile robotics, computer vision,<br> machine learning, Yann LeCun and his amigos concocted the convolutional neural networks that<br> make picture acknowledgment work. In his professional life, Yann holds the position of Director<br> of AI Research at Facebook.</p> <p>Yann centers around AI and its applications, including vision, discourse, language, information<br> mining, and bioinformatics. Likewise, Yann considers PC vision, portable advanced mechanics,<br> and computational neuroscience.</p> <p><img src="/media/uploads/2021/06/19/9-machine_hEabyY.PNG" loading="lazy" alt="" ></p> <p>On following him on Twitter for 45-minute narratives on profound gains from Radio Canada in<br> French, he says these are astonishing, yet he has his own questions. There are many intriguing<br> articles about the eventual fate of assembling, for example, that are written in English. Yet,<br> there&#39;s a great deal of French.</p> <span id="10-james-cham" class="anchor-target"></span><h2 class="heading">10. <strong>JAMES CHAM</strong> <a class="header-link" href="#10-james-cham">#</a></h2> <p>I believe that from our viewpoint, the messy mystery around AI right now is that no one<br> understands what they are doing. James Cham keeps it genuine.</p> <p>James Cham is a Partner at speculation firm Bloomberg Beta and a beginning phase VC fixated<br> on the new universe of work. He works really hard scattering a few fantasies about AI and<br> furthermore collapsing a portion of the publicity.<br> One can cherish his point about how everybody is centered around the central issues like what<br> will machine learning mean for the fate of work, yet nobody is zeroing in on the bare essential<br> execution stuff, which is the thing that&#39;s needed for AI to affect the fate of work. It&#39;s very much an objective of my blog to help fill in those holes and clarify how organizations can really utilize ML in the present time and place to improve their organizations.</p> <p><img src="/media/uploads/2021/06/19/10-machine.PNG" loading="lazy" alt="" ></p> <p>Another extraordinary point he made on the Too Embarrassed to Ask digital recording is that the<br> second that we sort something out, it simply turns into another element. Sorting out some way to<br> toast bread was outrageously troublesome, Cham said. Also, individuals discussed a robot that<br> would really sort out precisely how to get bread perfectly. Also, the second it&#39;s feasible, it&#39;s a toaster oven, and I imagine that is valid about a great deal of innovation. He doesn&#39;t compose or Tweet a ton however when he gives a meeting, it merits your time.</p> <hr> <span id="author-bio" class="anchor-target"></span><h4 class="heading">Author Bio <a class="header-link" href="#author-bio">#</a></h4> <p>Senior Data Scientist and Alumnus of IIM- C (Indian Institute of Management - Kolkata) with over 25 years of professional experience Specialized in Data Science, Artificial Intelligence, and Machine<br> Learning. PMP Certified ITIL Expert certified APMG, PEOPLECERT and EXIN Accredited Trainer for all modules of ITIL till Expert Trained over 3000+ professionals across the globe Currently authoring a book on ITIL &quot;ITIL MADE EASY&quot;.</p> <p><img src="/media/uploads/2021/06/19/ram-2-1.jpg" loading="lazy" alt="" ></p> <p>Conducted myriad Project management and ITIL Process consulting engagements in various organizations. Performed maturity assessment, gap analysis and Project management process definition and end to end implementation of Project management best practices Social Profile Links.</p> <p>Twitter account URL- <a href="https://twitter.com/ramtavva?s=09" rel="nofollow" >https://twitter.com/ramtavva?s=09</a><br> Facebook Profile URL- <a href="https://www.facebook.com/ram.tavva" rel="nofollow" >https://www.facebook.com/ram.tavva</a><br> Linked In Profile URL <a href="https://www.linkedin.com/in/ram-tavva/" rel="nofollow" >https://www.linkedin.com/in/ram-tavva/</a></p> https://overiq.com/machine-learning-experts-you-should-be-following-online/4 Ways to Prepare for the AP Computer Science A Examhttps://overiq.com/4-ways-to-prepare-for-the-ap-computer-science-a-exam/<p>The AP Computer Science A is a course and exam offered to high schoolers as an option to earn an equivalent of a Computer Science college semester. It essentially covers the basics of object-driven programming paradigm based on the Java programming language, such as problem detection and solution, creating algorithms, and programming concepts. It also introduces data ideas and abstraction procedures.</p> <p>If you want to jumpstart your college degree in Computer Science, this article will give a few pointers on how to best prepare for the exam.</p> <span id="training-program-for-ap-computer-science-a-exam" class="anchor-target"></span><h2 class="heading">Training Program for AP Computer Science A Exam <a class="header-link" href="#training-program-for-ap-computer-science-a-exam">#</a></h2> <p>The training program for the AP Computer Science A exam should be simple, straightforward, and tackle such areas of computer programming as:</p> <ul> <li>Computing: at the very basic level, you need to establish connections between concepts in computing</li> <li>Abstractions: learn how to apply abstractions, one of the key concepts in object-oriented programming, in modeling and computation</li> <li>Communication: understand how to communicate ideas on technology and computation Skills application: design a program that solves a real-life problem or performs a task</li> <li>Analysis: learn to analyze computational work; it’s essential for picking up on someone else&#39;s code or mistakes in your own</li> <li>Collaboration: learn how to work in a team; it’s a must for any programmer but also helps to study and become a professional</li> </ul> <p>You get more information from the article, <a href="https://codegym.cc/groups/posts/ap-computer-science-a-exam">&quot;Where to Learn and How to Pass the AP Computer Science A Exam&quot;</a> </p> <span id="how-to-prepare-for-the-ap-computer-science-a-practice-test" class="anchor-target"></span><h2 class="heading">How to Prepare for the AP Computer Science A Practice Test? <a class="header-link" href="#how-to-prepare-for-the-ap-computer-science-a-practice-test">#</a></h2> <p>According to the official data from the <a href="https://apstudents.collegeboard.org/about-ap-scores/score-distributions">College Board</a>, about 70% of students achieved a passing score back in 2020. That’s a good percentage meaning that it’s relatively easy to achieve a passing grade. It all depends on how much you want to get it and how much effort you’re willing to put into the preparation.</p> <p>Here are a few ideas on how to prepare for the AP Computer Science A exam.</p> <span id="1-learn-the-course-framework-and-the-exam-structure" class="anchor-target"></span><h3 class="heading">1. Learn the course framework and the exam structure <a class="header-link" href="#1-learn-the-course-framework-and-the-exam-structure">#</a></h3> <p>You can check out the College Board’s web page to learn about the course and exam structure, framework, and guidelines. It also notes the percentage of the grade you can get for each exam unit.</p> <p>In brief, the AP Computer Science A exam duration is three hours; it has two sections both taking half of the time frame and being equally judged for the exam results scoring:</p> <ul> <li>Free-response. Here you’ll have just four questions but they need broad answers.</li> <li>Multiple choice. Here you need to pick the right answer in forty questions.</li> </ul> <p>Note that there’s another one-semester equivalent course and exam – AP Computer Science Principles. This exam has two parts:</p> <ul> <li>Multiple choice. Here you have two hours to answer 70 questions.</li> <li>Performance task. Here you get at least 12 hours to create a program and give a written and video response.</li> </ul> <span id="2-get-familiar-with-the-topics-included-in-both-ap-computer-science-exams" class="anchor-target"></span><h3 class="heading">2. Get familiar with the topics included in both AP Computer Science Exams <a class="header-link" href="#2-get-familiar-with-the-topics-included-in-both-ap-computer-science-exams">#</a></h3> <p>The training program for the AP Computer Science A Exam is quite simple in that it covers the basic skills in programming since the course itself requires only prior knowledge of English and algebra. First of all, you can cover the primary levels of the course which are:</p> <p>For the A exam:</p> <ul> <li>Writing Classes</li> <li>Types and Objects</li> <li>Arrays</li> <li>Boolean Expressions</li> <li>Recursion</li> <li>Inheritance </li> </ul> <p>For the Principles exam:</p> <ul> <li>Algorithms in Programming</li> <li>Data</li> <li>Creative Development</li> <li>Computing Systems and Networks</li> <li>Impact of Computing</li> </ul> <span id="3-make-the-preparation-process-more-fun-with-codegym" class="anchor-target"></span><h3 class="heading">3. Make the preparation process more fun with CodeGym <a class="header-link" href="#3-make-the-preparation-process-more-fun-with-codegym">#</a></h3> <p>Since AP Computer Science includes Java programming, CodeGym is a good option to fit into your preparation routine. The platform offers 1200+ tasks to help you learn object-oriented programming concepts and practice the Java language.</p> <p>CodeGym can make your training fun and entertaining because of the gamified environment of learning and a lot of practical tasks. In fact, 80% of the Java course is practice-based.</p> <p>At the primary level, the course covers the following topics:</p> <ul> <li>Boolean expressions, if statements, and iteration</li> <li>Primitive data types and using objects</li> <li>Introduction to objects: writing objects, their lifetime, etc</li> <li>Writing classes and using constructor</li> <li>Basics of OOP</li> <li>Arrays and ArrayList </li> </ul> <span id="4-watch-ap-computer-science-videos-on-youtube" class="anchor-target"></span><h3 class="heading">4. Watch AP Computer Science videos on YouTube <a class="header-link" href="#4-watch-ap-computer-science-videos-on-youtube">#</a></h3> <p>You can seek help on YouTube by watching AP Computer Science tutorial videos. A lot of software engineers and educators have their own channels and gladly share their knowledge.</p> <p>A few good examples are:</p> <ul> <li>The <a href="https://www.youtube.com/user/collegeboard">College Board</a> channel</li> <li><a href="https://www.youtube.com/channel/UCcabW7890RKJzL968QWEykA">CS50 lectures</a></li> <li>From the Advanced Placement channel <ul> <li><a href="https://www.youtube.com/watch?v=FHdU8zpnIY4&amp;list=PLoGgviqq4845xKOY11PnkE7aqJC7-bYrd">33 video lectures on AP Computer Science A</a></li> <li><a href="https://www.youtube.com/watch?v=VbYB_3uSXIc&amp;list=PLoGgviqq4844vbwcKegJgIxSQyVHDzSXT">5 video lectures on AP Computer Science Principles</a></li> </ul></li> </ul> <span id="conclusion" class="anchor-target"></span><h2 class="heading">Conclusion <a class="header-link" href="#conclusion">#</a></h2> <p>Training for the AP Computer Science Exams can be easier if you have a solid plan – a training program. To build this plan, first learn the knowledge and skills the exams require, i.e. what units the exam consists of and the exam structure.</p> <p>Then, study the required material and look up some videos on YouTube to learn about the real-world experience and programming skills.</p> <p>You can also boost your training sessions with a practical course that offers hands-on experience with coding.</p> https://overiq.com/4-ways-to-prepare-for-the-ap-computer-science-a-exam/Finance Assignment Online Help for the Busy and Tired Students: Get Help from Expertshttps://overiq.com/finance-assignment-online-help-for-the-busy-and-tired-students-get-help-from-experts/<p>Handling finance homework can be a burden too heavy to carry for many students. It can be boring. It can contain long collections of problems in one, as well as gradually increase your awareness of the key concepts and ideas throughout the course. </p> <p>Financing homework also requires maximum attentiveness and good concentration. But here is the point we want to make – even if you consider yourself an absent-minded person and lack the ability to focus, any assignment in finance is solvable on the condition that you have the desire and a little bit of patience for working at a writing task. One of the tried and true ways to get reliable assistance in this is to partner with academic writing services such as APlusEssay.com. On <a href="https://aplusessay.com/finance-assignment-help.html" rel="nofollow" >https://aplusessay.com/finance-assignment-help.html</a>, you will get finance assignment help and be able to take something from experts into your own writing. </p> <p>Now, the pieces of advice that we are going to give here might not be radically different from tips given for solving homework in other disciplines. But still, if you take them seriously and try them out in your own studying routine, fruits will soon appear. Will it be effortlessly? Probably, not. But it can teach you a few valuable lessons.</p> <p>So, here we go with the tips and tricks to handle college tasks in finance. Check them out!</p> <span id="tip-1-make-the-most-of-technology" class="anchor-target"></span><h2 class="heading">Tip #1. Make the most of technology. <a class="header-link" href="#tip-1-make-the-most-of-technology">#</a></h2> <p>How lucky we are today that there is no need for us to count figures in every task in our brains. Now, most of the work is done by mobile applications and software designed to make mathematical operations easier and involve the human only at several stages. Apps such as iMathematics Pro, MathRef, and Digits would be great solutions for much of your finance homework and allow you to save time. </p> <span id="tip-2-get-a-perfect-workplace" class="anchor-target"></span><h2 class="heading">Tip #2. Get a perfect workplace. <a class="header-link" href="#tip-2-get-a-perfect-workplace">#</a></h2> <p>The environment in the place where you usually study determines how successful you will solve all the necessary assignments and how fast you will do it. But here there are no universal formulas since every one of us has got their own preferences and learning styles. Some are used to studying with some background music on, some need total silence. Others try to keep a perfect order on the table while others (‘creative’ people) can tolerate mess. Whatever you choose, try to make this place inspiring, where it will be easy to focus on the assignments and devote all of you to work. </p> <span id="tip-3-understand-the-task" class="anchor-target"></span><h2 class="heading">Tip #3. Understand the task. <a class="header-link" href="#tip-3-understand-the-task">#</a></h2> <p>Too simple, as some would say? Still, realizing what particularly is required from you in a certain task in finance studies is the good half of success. Specify what you didn’t get at first, consult a teacher, use the help of reliable service for finance assignment help online. This advice has endless benefits – you skip doing tons of extra work and don’t get to lose points, focus on the smaller parts of the learned material, and do not get distracted. So, better get a full knowledge of what to do before you actually write anything. </p> <p>What concerns professional help, today it’s normal to turn to good services when there is no time for solving all college tasks, especially if the subject is not your major. All you have to do to get finance assignment help is to write a message like ‘Could you do my finance task for me, please?’ and pick the author for writing this academic paper. Yes, the best thing is to solve finance homework on your own but APlusEssay.com, for instance, can be a good Plan B and an online support team that can deal with any type of academic work – coursework, review, research proposal, equations, and much more. </p> <span id="tip-4-set-the-realistic-timing" class="anchor-target"></span><h2 class="heading">Tip #4. Set the realistic timing. <a class="header-link" href="#tip-4-set-the-realistic-timing">#</a></h2> <p>There are times when you have all deadlines set in stone. But it often depends on us how soon we are ready to submit the paper and rest in peace. As one of the most effective (yet, most neglected) ways of coping with academic assignments, planning has its special place and has the power to make learning stress-free. Imagine: you are confident of your progress, divide the assignment into do-able parts, and live a blameless student’s life instead of working by fits and starts and still not doing enough. </p> <p>The skill to manage your time and create plans is a valuable one so why not train it while doing finance homework?</p> <span id="tip-5-create-a-reward-stimulus" class="anchor-target"></span><h2 class="heading">Tip #5. Create a reward stimulus. <a class="header-link" href="#tip-5-create-a-reward-stimulus">#</a></h2> <p>No, this is not about a Twix at every second page read. But it can still work if you create smart rewards – having fun with friends the whole next day or doing practically anything that motivates you. In reality, the fact that you managed to fulfill the promise o do a certain part of the work by the assigned time is already a good reward. But the main point about this system is feeling good about what you have accomplished – creating pleasurable associations and memories will result in even more inner motivation for you to finish it. <br> As you can see, the given tips aren’t hard to bear. If you haven’t thought of tips to help you deal with finance homework, we graciously give them to you for free and enjoyable use!</p> <span id="get-finance-assignment-help-today-and-never-regret-it-learning-from-expert-writers-is-worth-it" class="anchor-target"></span><h2 class="heading">Get Finance Assignment Help Today and Never Regret It: Learning from Expert Writers Is Worth It <a class="header-link" href="#get-finance-assignment-help-today-and-never-regret-it-learning-from-expert-writers-is-worth-it">#</a></h2> <p>As a kind of afterword, we point we wanted to make about using any service for finance assignment help – whether it is APlusEssay.com or any other decent place – is the opportunities for learning you have there. In the end, all the grades at college will be forgotten. Diplomas will be opened rarely in the lifetime. But what will truly remain with you is the skills. The experience. <br> So, don’t run for cheap academic help – use authentic samples, check the credibility of sources, and take after the best writers in the world such as those who are available on APlusEssay.com.</p> https://overiq.com/finance-assignment-online-help-for-the-busy-and-tired-students-get-help-from-experts/Top 9 Machine Learning Algorithms for Data Scientistshttps://overiq.com/top-9-machine-learning-algorithms-for-data-scientists/<p>For most of the beginners, the machine learning algorithms seem to be uninteresting or boring to learn further about. Up to some extent, this stands true but in many cases, you might stumble upon a few-page description for each algorithm and it can turn out to be time-consuming in order to figure out each and every detail. If you have a strong desire to become a Machine Learning expert then you actually need to brush up your knowledge related to it as there is no other way around. In this article, we will be talking about the 8 most common algorithms in simple words including a brief overview along with some useful links. So, let&#39;s begin!</p> <span id="1-conditional-random-fields-crfs" class="anchor-target"></span><h2 class="heading">#1 Conditional Random Fields (CRFs) <a class="header-link" href="#1-conditional-random-fields-crfs">#</a></h2> <p>This algorithm is used to simulate a sequence of an RNN which can be used in conjunction with an RNN algorithm. They can also be used in various tasks of structured prediction as in image segmentation. The algorithm models each element of the sequence so that the neighbors are affecting the component labels in the sequence and not all the labels are independent of each other. You can use CRF for the sequence of sequences in text, image, time series, and DNA.</p> <p><strong>Useful websites:</strong></p> <ul> <li> <a href="https://sklearn-crfsuite.readthedocs.io/en/latest/">sklearn-crfsuite</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li> YouTube playlist on conditional random fields</li> <li> <a href="http://blog.echen.me/2012/01/03/introduction-to-conditional-random-fields/">Introduction to Conditional Random Fields</a></li> </ul> <span id="2-convolutional-neural-networks" class="anchor-target"></span><h2 class="heading">#2 Convolutional Neural Networks <a class="header-link" href="#2-convolutional-neural-networks">#</a></h2> <p>In practical, all the modern achievements in the field of machine learning can be achieved by dint of convolutional neural networks that are used for image classification, image segmentation, and object detection. It was invented by Jan Lekun in the early 90s, networks have convolutional layers that act as hierarchical object extractors. You can use it to work with text and even for working with graphics.</p> <p><strong>Useful websites:</strong></p> <ul> <li> <a href="https://keras.io/applications/">Keras Documentation</a></li> <li> <a href="https://github.com/kuangliu/torchcv">TorchCV: a PyTorch vision library mimics ChainerCV</a></li> <li> <a href="https://github.com/chainer/chainercv">ChainerCV: a Library for Deep Learning in Computer Vision</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li> <a href="https://adeshpande3.github.io/A-Beginner%27s-Guide-To-Understanding-Convolutional-Neural-Networks/">A Beginner’s Guide To Understanding Convolutional Neural Networks</a></li> </ul> <span id="3-principal-component-analysis-pcasvd" class="anchor-target"></span><h2 class="heading">#3 Principal Component Analysis (PCA)/SVD <a class="header-link" href="#3-principal-component-analysis-pcasvd">#</a></h2> <p>This is one of the most important machine learning algorithms which allows you to reduce the dimension of the data by losing the amount of information. The algorithms are used in multiple areas like object recognition, computer vision, data compression and much more. The computational of the principal components are reduced to calculating the eigenvalues and eigenvectors of the covariance matrix of the original data and to the singular decomposition of the data matrix. You can express several signs though one, merge, speak and work already with a simpler model. Of course, it is not possible to avoid information loss but the PCA method will help you to minimize that. SVD is the way to calculate the ordered components.</p> <p><strong>Useful websites:</strong></p> <ul> <li> <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.svd.html">scipy.linalg.svd</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li> <a href="https://arxiv.org/pdf/1404.1100.pdf">A Tutorial on Principal Component Analysis</a></li> </ul> <span id="4-decision-trees" class="anchor-target"></span><h2 class="heading">#4 Decision Trees <a class="header-link" href="#4-decision-trees">#</a></h2> <p>This is one of the most common machine learning algorithms which is used in statistics and data analysis for predictive models. The structure represents the leaves and branches. Attributes of the objective function widely depend on the branches of the decision tree where the values of the objective function are stored in the leaves and the remaining nodes contain attributes for which the cases differ. In order to classify a new case, you need to go down the tree to the leaf and give the appropriate value. The ultimate goal is to create a model that predicts the value of the target variable based on several input variables.</p> <p><strong>Useful websites:</strong></p> <ul> <li><a href="http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html">sklearn.ensemble.RandomForestClassifier</a></li> <li><a href="https://xgboost.readthedocs.io/en/latest/">XGBoost Documentation</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li><a href="https://arxiv.org/abs/1407.7502">Understanding Random Forests: From Theory to Practice</a></li> </ul> <span id="5-feed-forward-neural-networks-ffnn" class="anchor-target"></span><h2 class="heading">#5 Feed-Forward Neural Networks (FFNN) <a class="header-link" href="#5-feed-forward-neural-networks-ffnn">#</a></h2> <p>In general, there are unit-level logistic regression classifiers. Multiple layers of scales are separated by non-linearities like sigmoid, tanh, cool new selu and relu + softmax. They are also known as multilayer perceptrons as FFNN can be used to classify and learn without a guide as autoencoders. The algorithm can be used to train a classifier or extract the functions as autoencoders. </p> <p><strong>Useful websites:</strong></p> <ul> <li> <a href="http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html#sklearn.neural_network.MLPClassifier">sklearn.neural_network.MLPClassifier</a></li> <li> <a href="http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPRegressor.html">sklearn.neural_network.MLPRegressor</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li> <a href="http://www.deeplearningbook.org/contents/mlp.html">FFNN</a></li> <li> <a href="http://www.deeplearningbook.org/contents/autoencoders.html">Autoencoders</a></li> </ul> <span id="6-k-means-clustering" class="anchor-target"></span><h2 class="heading">#6 K-Means Clustering <a class="header-link" href="#6-k-means-clustering">#</a></h2> <p>This is everyone&#39;s favorite uncontrolled clustering algorithm. The k-means algorithms are the simplest but inaccurate clustering method in its classical implementation. The method splits the set of elements of a center space into a previously known number of clusters k. This algorithm minimizes the standard deviation at the points of each cluster. Here, the basic idea is that at each iteration the center of mass is recalculated for each cluster that you get in the previous step. Then, the vectors are divided into the clusters again according to which the new centers were closed in the selected metric.</p> <p><strong>Useful websites:</strong></p> <ul> <li> <a href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html">sklearn.cluster.KMeans</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li> <a href="https://www.youtube.com/watch?v=hDmNF9JG3lo">Video on clustering</a></li> <li> <a href="https://www.datascience.com/blog/k-means-clustering">Introduction to K-means Clustering</a></li> </ul> <span id="7-logistic-regression" class="anchor-target"></span><h3 class="heading">#7 Logistic Regression <a class="header-link" href="#7-logistic-regression">#</a></h3> <p>It is limited to linear regression with non-linearity after applying weights and hence the output limit is close to 1 and 0 in case of the sigmoid. Also, the cross-entropy loss functions are optimized using the gradient descent method. Logistic regression is used for classification and not regression. It is the same as a single-layer neural network and when learned using optimization techniques like gradient descent or L-BFGS, it is called &#39;maximum entropy classification method&#39;.</p> <p><strong>Useful websites:</strong></p> <ul> <li> <a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html">sklearn.linear_model.LogisticRegression</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li><a href="https://www.youtube.com/watch?v=-la3q9d7AKQ">Logistic Regression | Classification</a></li> </ul> <span id="8-support-vector-machines-svm" class="anchor-target"></span><h2 class="heading">#8 Support Vector Machines (SVM) <a class="header-link" href="#8-support-vector-machines-svm">#</a></h2> <p>It is a linear model similar to linear and logistic regression. The difference between them is that it has a margin-based loss function which you can optimize the loss function by using optimization methods i.e. SGD or L-BFGS. The most unique thing that SVMs can do is to study classifier classifiers as it can be used to train the classifiers and even regressors.</p> <p><strong>Useful websites:</strong></p> <ul> <li><a href="http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html">sklearn.svm.SVC</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li> <a href="https://www.youtube.com/watch?v=eHsErlPJWUU">Support Vector Machines</a></li> <li> <a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html">sklearn.linear_model.SGDClassifier</a></li> </ul> <span id="9-recurrent-neural-networks-rnns" class="anchor-target"></span><h2 class="heading">#9 Recurrent Neural Networks (RNNs) <a class="header-link" href="#9-recurrent-neural-networks-rnns">#</a></h2> <p>This model sequences by applying the same set of weights at time t and input at time t of the aggregator recursively. Pure recurrent neural networks are rarely used now but it is analogs. For instance - LSTM and GRU are the most up to date in most sequence modeling problems. LSTM is used instead of a simple dense layer in pure RNN. Use this network for any task of text classification, machine translation, and language modeling.</p> <p><strong>Useful websites:</strong></p> <ul> <li><a href="https://github.com/tensorflow/models">Models and examples built with TensorFlow</a></li> <li><a href="https://github.com/wabyking/TextClassificationBenchmark">A Benchmark of Text Classification in PyTorch</a></li> </ul> <p><strong>Detailed Guide:</strong></p> <ul> <li><a href="http://cs224d.stanford.edu/">Deep Learning for Natural Language Processing</a></li> <li>RNN Articles</li> </ul> <span id="the-road-ahead" class="anchor-target"></span><h4 class="heading"><strong>The Road Ahead</strong> <a class="header-link" href="#the-road-ahead">#</a></h4> <p>It may sound unpleasant but you have to try a lot of different algorithms and check their effectiveness by applying on each of the test data set to choose the best option. It is an obvious task that you need to choose from the algorithms which match your task. So be patient and do not try to rush things. Keep Learning!&lt;/span&gt; </p> <p><strong>Author Bio:</strong> </p> <p>Ava Barker working as a Technology Consultant at <a href="https://www.tatvasoft.co.uk/">Tatvasoft UK</a>. Coming from a technology background she likes to share her insights about development, design and more. She has also published her author bylines on many different publications online.</p> https://overiq.com/top-9-machine-learning-algorithms-for-data-scientists/Data Science Learning Path or Steps to become a data scientist Finalhttps://overiq.com/data-science-learning-path-or-steps-to-become-a-data-scientist-final/<p>There is a massive shortage of quality data scientists on the market right now (<a href="https://insidebigdata.com/2018/12/27/data-scientist-shortage-huge-heres-beat/" rel="nofollow" >Source</a>). IBM <a href="https://www.forbes.com/sites/louiscolumbus/2017/05/13/ibm-predicts-demand-for-data-scientists-will-soar-28-by-2020/" rel="nofollow" >predicts</a> the market demand for data scientists to rise by 28% increase by 2020. That means there is a lot of room left for data scientists.</p> <p>We <a href="https://www.forbes.com/sites/bernardmarr/2018/05/21/how-much-data-do-we-create-every-day-the-mind-blowing-stats-everyone-should-read/" rel="nofollow" >produce</a> 2.5 quintillions of data, and that number will increase with the advancement in IoT. The current world needs more professionals who can play around with data. The corporations do not utilize their collected data due to lack of skilled data science workforce who can extract valuable insights from the massive pool of information.</p> <p>The <a href="https://hbr.org/2016/09/bad-data-costs-the-u-s-3-trillion-per-year" rel="nofollow" >cost</a> of wrong data is $3 trillion annually in the United States. On the other hand, the smart use of collected data can significantly enhance the revenue and productivity of an organization (<a href="https://bi-survey.com/big-data-benefits" rel="nofollow" >Source</a>).</p> <p><img src="/media/uploads/2020/07/11/selection_126.png" loading="lazy" alt="" ><em>Image Source: <a href="https://www.statista.com/statistics/551501/worldwide-big-data-business-analytics-revenue/" rel="nofollow" >Statista</a></em></p> <p>The average pay of data scientists surpasses $115k annually (<a href="https://www.glassdoor.com/Salaries/data-scientist-salary-SRCH_KO0,14.htm" rel="nofollow" >Source</a>). Do you want to fill the gap between demand and supply? In this article, we will reveal steps that can help you be a skilled data scientist.</p> <span id="steps-to-come-out-as-a-data-scientist" class="anchor-target"></span><h2 class="heading">Steps to come out as a data scientist <a class="header-link" href="#steps-to-come-out-as-a-data-scientist">#</a></h2> <p>The data scientists are responsible for extracting, filtering, and interpreting data in a meaningful way with the use of various statistical and machine learning tools and techniques. Here are the steps that you need to follow to be a data scientist:</p> <ol> <li><p>Do you meet the basic requirements to apply for a job?</p> <p>The corporations who are looking to hire data scientists need some degree. Here is one of the posts of data scientist vacancy.</p> <p><img src="/media/uploads/2020/07/11/selection_127.png" loading="lazy" alt="" ><em>Image Source: <a href="https://www.indeed.com/q-Data-Scientist-jobs.html?vjk=21091c4562d65586" rel="nofollow" >Indeed</a></em></p> <p>Most of the jobs on the market require you to at least have a bachelor’s degree in a relevant field like computer science, statistics, applied mathematics, and so on. You will be eligible to apply for the majority of job posts if you have a related degree. If you keep an eye on the pay scale, you will see that even a beginner position surpasses $95k annually.</p></li> <li><p>Understand about various aspects of data science</p> <p>It is crucial to know what you’re going to experience in advance on the <a href="https://www.simplilearn.com/big-data-and-analytics/senior-data-scientist-masters-program-training" rel="nofollow" >road to becoming a data scientist</a>. Do some research about the duties and responsibilities of data scientists. After that, you need to select the tools and programming language. Currently, R and Python are the two preferred programming languages in the field of data science. I would recommend <a href="https://www.simplilearn.com/mobile-and-software-development/python-development-training" rel="nofollow" >Python training</a> due to its ease of learning and flexibility.</p> <p><img src="/media/uploads/2020/07/11/selection_128.png" loading="lazy" alt="" ><em>Image Source: <a href="https://stackoverflow.blog/2017/09/06/incredible-growth-python/" rel="nofollow" >Stack Overflow</a></em></p></li> <li><p>Get some knowledge of basic mathematics and statistics</p> <p>You must have a core knowledge of basic mathematics and statistics to become an outstanding data scientist. It is possible for you to use the tools for performing calculations. However, you will not be able to fulfill your responsibilities efficiently without a strong foundation in both mathematics and statistics.</p> <p>The data scientists need to frequently use statistic methods (descriptive and inferential analysis) and numerical solutions (linear algebra) in their jobs. You should also be keen to solve problems, applying logic because that is what you are going to do in your career.</p></li> <li><p>Time for some essential machine learning</p> <p>There is a considerable role of machine learning in data science. The knowledge of machine learning can help you accomplish great things in your profession. At first, you should only get the necessary know-how of machine learning to be able to perform more in-depth applications of it in your job.</p> <p>The Python programming language is also prevalent for performing machine learning applications. Many professionals prefer implementing machine learning with Python. Due to the full range of applications, it is better to learn Python. You can jump into web applications, game development, and more with Python.</p></li> <li><p>Dig deeper into machine learning applications</p> <p>After you have a strong foundation of machine learning, you can dig deeper into machine learning applications that you can apply in your job. You can learn some advanced applications, such as boosting algorithm, time series methods, random forest, ensemble learning, and so on. Right after algorithm, you should know how to improve models and bring new predictive models with tricks, such as validation strategies along with feature engineering.</p> <p>You can use machine learning for producing accurate results and use data-driven models for processing data in real time.</p></li> <li><p>Get some concepts of deep learning</p> <p>After gaining a good grasp of machine learning, it is a time for you to get into deep learning. Deep learning is an integral part of machine learning. Having a solid knowledge of deep learning can significantly increase your value as a data scientist. At first, you should only get a basic understanding of deep learning, such as a neural network. Also, get your feet wet with Keras.</p> <p><img src="/media/uploads/2020/07/11/selection_129.png" loading="lazy" alt="" ><em>Image Source: <a href="https://machinelearningmastery.com/what-is-deep-learning/" rel="nofollow" >Machine Learning Mastery</a></em></p></li> <li><p>Dig deeper into advanced deep learning applications</p> <p>After you have some strong foundation of machine learning and deep learning, you can now jump into advance neural network frameworks. The neural network frameworks to focus on are convolutional and recurrent neural networks. You will need some time to understand those concepts. I suggest you be patient while learning these advanced deep learning concepts. You may need to invest a few weeks of your time in acquiring them.</p></li> <li><p>Learn computer vision applications</p> <p>Computer vision application is a trending technology. It has touched different industries like manufacturing, retail, construction, and so on. Some of the examples of these technologies are face detection technologies like MobileNet, object recognition technology like ResNet, and so on.</p> <p>The data scientists can use these technologies to extract useful insights from images, objects, and so on. You will get more tasks as a data scientist where the computer vision applications will come handy.</p></li> <li><p>Natural Language Processing</p> <p>Finally, you need to learn about natural language processing to sharpen your skill as a data scientist. You must at least have a basic understanding of the concepts, such as text preprocessing and text classification.</p></li> </ol> <span id="how-can-i-get-started-learning-all-these-concepts-and-skills" class="anchor-target"></span><h2 class="heading">How can I get started learning all these concepts and skills? <a class="header-link" href="#how-can-i-get-started-learning-all-these-concepts-and-skills">#</a></h2> <p>We have broken down the steps to become a data scientist. However, some of you might be confused on how to start learning all the things that I have mentioned above. The task of learning is not difficult in this day and age. You have information in your fingertips. There are plenty of quality resources that you can access for free or for an affordable price. </p> <p>The <a href="https://www.forbes.com/sites/tjmccue/2018/07/31/e-learning-climbing-to-325-billion-by-2025-uf-canvas-absorb-schoology-moodle/#645042263b39" rel="nofollow" >market size</a> of the eLearning industry is expected to rise to $325 by 2025. The only thing you need to do is find appropriate articles, videos, and courses to enroll and start learning.</p> <span id="over-to-you" class="anchor-target"></span><h2 class="heading">Over to You <a class="header-link" href="#over-to-you">#</a></h2> <p>If you have reached this portion of the article, you must be clear about what to do next. You need to follow the steps that I have mentioned to be a data science professional. Every single step takes a lot of time and effort.</p> <p>Before jumping into the field of data science, you must decide if you want to be a data scientist or not. Do not dive into data science only because of a lucrative pay package. If there is something that you want to add, feel free to leave your opinion in the comment section. I would love to know your thoughts.</p> https://overiq.com/data-science-learning-path-or-steps-to-become-a-data-scientist-final/Enable Edit Button in Shutter In Linux Mint 19 and Ubuntu 18.04https://overiq.com/enable-edit-button-in-shutter-in-linux-mint-19-and-ubuntu-18-04/<p>Shutter is a screen capturing software. It allows you to take screenshot of a specific area, window and even the entire screen. </p> <p>Shutter also comes with a few editing tools, however these tools are not enabled by default. To enable these tools we&#39;ll have to install some additional packages. </p> <p>All the instructions mentioned in this post is tested on Linux Mint 19 and Ubuntu 18.04. </p> <p>Let&#39;s start!</p> <span id="enabling-the-edit-button" class="anchor-target"></span><h2 class="heading">Enabling the Edit button <a class="header-link" href="#enabling-the-edit-button">#</a></h2> <p><img src="/media/uploads/2020/07/11/selection_037.png" loading="lazy" alt="" ></p> <p>As you can see in the above image the Edit button is disabled. To enable the Edit button, you need following three packages:</p> <ol> <li> <code>libgoo-canvas-perl</code></li> <li> <code>libgoocanvas-common</code></li> <li> <code>libgoocanvas3</code></li> </ol> <p>We can download these packages from the following links:</p> <ol> <li><a href="https://launchpad.net/ubuntu/+source/libgoo-canvas-perl">https://launchpad.net/ubuntu/+source/libgoo-canvas-perl</a></li> <li><a href="https://launchpad.net/ubuntu/xenial/amd64/libgoocanvas-common/1.0.0-1">https://launchpad.net/ubuntu/xenial/amd64/libgoocanvas-common/1.0.0-1</a></li> <li><a href="https://launchpad.net/ubuntu/bionic/amd64/libgoocanvas3/1.0.0-1">https://launchpad.net/ubuntu/bionic/amd64/libgoocanvas3/1.0.0-1</a></li> </ol> <p>If you prefer command line, you can download all these packages via the <code>wget</code> command as follows:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3</pre></div></td><td class="code"><div class="highlight"><pre><span></span>wget -q http://mirrors.kernel.org/ubuntu/pool/universe/g/goocanvas/libgoocanvas-common_1.0.0-1_all.deb wget -q http://mirrors.kernel.org/ubuntu/pool/universe/g/goocanvas/libgoocanvas3_1.0.0-1_amd64.deb wget -q http://mirrors.kernel.org/ubuntu/pool/universe/libg/libgoo-canvas-perl/libgoo-canvas-perl_0.06-2ubuntu3_amd64.deb </pre></div> </td></tr></table></div> <p>Once you have downloaded all the necessary packages, install them using the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>sudo dpkg -i libgoocanvas-common_1.0.0-1_all.deb ; sudo apt-get -f install ; sudo dpkg -i libgoocanvas3_1.0.0-1_amd64.deb ; sudo apt-get -f install; sudo dpkg -i libgoo-canvas-perl_0.06-2ubuntu3_amd64.deb ; sudo apt-get -f install </pre></div> </div> <p>Now kill any any running instance of Shutter and then start it again.</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>sudo killall shutter </pre></div> </div> <p>You should now have Edit button enabled. </p> <p><img src="/media/uploads/2020/07/11/selection_039.png" loading="lazy" alt="" ></p> <span id="enabling-edit-button-on-linux-mint-17-18-or-ubuntu-1604" class="anchor-target"></span><h2 class="heading">Enabling Edit button on Linux Mint 17, 18 or Ubuntu 16.04 <a class="header-link" href="#enabling-edit-button-on-linux-mint-17-18-or-ubuntu-1604">#</a></h2> <p>To enable Edit button on Linux Mint 17, 18 or Ubuntu 16.04, the fix is comparatively simple. All you need to do is install <code>libgoo-canvas-perl</code> using the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>sudo apt-get install libgoo-canvas-perl </pre></div> </div><span id="enabling-the-web-button" class="anchor-target"></span><h2 class="heading">Enabling the Web button <a class="header-link" href="#enabling-the-web-button">#</a></h2> <p>Just like the Edit button, the Web button is also disabled by default. The Web button allows us to take a screenshot of a website by providing a URL. </p> <p><img src="/media/uploads/2020/07/11/selection_045.png" loading="lazy" alt="" ></p> <p>To enable the Web button we&#39;ll need a package called <code>gnome-web-photo</code>. Download gnome-web-photo from the following link: [</p> <p><a href="https://launchpad.net/ubuntu/+source/gnome-web-photo/0.10.6-1/+build/5854031%5D(!https://launchpad.net/ubuntu/+source/gnome-web-photo/0.10.6-1/+build/5854031)">https://launchpad.net/ubuntu/+source/gnome-web-photo/0.10.6-1/+build/5854031](!https://launchpad.net/ubuntu/+source/gnome-web-photo/0.10.6-1/+build/5854031)</a> </p> <p>Or simply, execute the following command to download the <code>gnome-web-photo</code> package.</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>wget -q https://launchpad.net/ubuntu/+source/gnome-web-photo/0.10.6-1/+build/5854031/+files/gnome-web-photo_0.10.6-1_amd64.deb </pre></div> </div> <p>Once the package is downloaded install it by typing:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo dpkg -i gnome-web-photo_0.10.6-1_amd64.deb sudo apt-get -f install </pre></div> </td></tr></table></div> <p>Kill any running instance of Shutter and start the application again. The Web button should be enabled now. </p> <p><img src="/media/uploads/2020/07/11/selection_040.png" loading="lazy" alt="" ></p> <p>Restart the shutter and now you should be able to take screenshots of websites. </p> <p><img src="/media/uploads/2020/07/11/selection_041.png" loading="lazy" alt="" ></p> <p><img src="/media/uploads/2020/07/11/selection_042.png" loading="lazy" alt="" ></p> <p>Next, we will see how to enable the Web button on shutter.</p> <span id="enabling-the-web-button-on-linux-mint-17-18-or-ubuntu-1604" class="anchor-target"></span><h2 class="heading">Enabling the Web button on Linux Mint 17, 18 or Ubuntu 16.04 <a class="header-link" href="#enabling-the-web-button-on-linux-mint-17-18-or-ubuntu-1604">#</a></h2> <p>To install <code>gnome-web-photo</code> on Linux Mint 17, 18 or Ubuntu 17.06, simply execute the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>sudo apt-get install gnome-web-photo </pre></div> </div> <p>That&#39;s all there is to it. </p> <p>Let&#39;s us know how this tip worked out for you in comments.</p> https://overiq.com/enable-edit-button-in-shutter-in-linux-mint-19-and-ubuntu-18-04/Python 3 time modulehttps://overiq.com/python-3-time-module/<p>The <code>time</code> module provides a number of time-related functions. Most of the functions found in this module call the platform C library functions behind the scenes with the same name.</p> <p>To import the <code>time</code> module enter the following command:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">time</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="unix-epoch-time" class="anchor-target"></span><h2 class="heading">Unix Epoch Time <a class="header-link" href="#unix-epoch-time">#</a></h2> <p>Most modern computers store dates and times as a difference of seconds between January 1, 1970 00:00:00 UTC and the time to be stored (also in UTC). We call this difference Unix timestamp or Unix epoch time or simply timestamp. For example, date and time &quot;11 July 2018 22:52:42&quot; in UTC can be represented as timestamp <code>1531329762</code>.</p> <p>In the following sections, we discuss some common attributes and functions of the <code>time</code> module.</p> <span id="time-function" class="anchor-target"></span><h2 class="heading">time() function <a class="header-link" href="#time-function">#</a></h2> <p><strong>Syntax:</strong> <code>time() -&gt; floating point number</code></p> <p>The <code>time()</code> function returns the number of seconds passed since January 1, 1970 00:00:00 UTC as a floating point number.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="go">1531326753.9201949</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="localtime-function" class="anchor-target"></span><h2 class="heading">localtime() function <a class="header-link" href="#localtime-function">#</a></h2> <p><strong>Syntax:</strong> <code>localtime([seconds]) -&gt; (tm_year,tm_mon,tm_mday,tm_hour,tm_min,<br> tm_sec,tm_wday,tm_yday,tm_isdst)</code></p> <p>Converts the specified Unix timestamp to local time. If the <code>seconds</code> argument not passed in, it uses timestamp returned by the <code>time()</code> function. This function returns a <code>time.struct_time</code> object with the following attributes.</p> <div style="overflow-x:auto"><table class="table table-bordered table-hover table-condensed"><thead> <tr> <th>Attribute</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>tm_year</code></td> <td>year</td> </tr> <tr> <td><code>tm_mon</code></td> <td>month of year (1-12)</td> </tr> <tr> <td><code>tm_mday</code></td> <td>day of month (1-31)</td> </tr> <tr> <td><code>tm_hour</code></td> <td>hour (1-23)</td> </tr> <tr> <td><code>tm_min</code></td> <td>minutes (0-59)</td> </tr> <tr> <td><code>tm_sec</code></td> <td>seconds (0-59)</td> </tr> <tr> <td><code>tm_wday</code></td> <td>day of week (0-6) (Sunday = 0, Monday = 1 and so on)</td> </tr> <tr> <td><code>tm_yday</code></td> <td>day of year (0-365), also known as julian day</td> </tr> <tr> <td><code>tm_isday</code></td> <td>daylight saving flag (0, 1 or -1). A value of <code>1</code> indicates that the daylight savings is in effect, 0 if daylight savings is not in effect and <code>-1</code> if the information is not available.</td> </tr> </tbody> </table></div> <p>The <code>time.struct_time</code> object is also commonly known as <strong>timetuple</strong>.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt1</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="mi">1200000000</span><span class="p">)</span> <span class="c1"># convert the timestamp 1200000000 to local time</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt1</span> <span class="go">time.struct_time(tm_year=2008, tm_mon=1, tm_mday=11, tm_hour=2, </span> <span class="go">tm_min=50, tm_sec=0, tm_wday=4, tm_yday=11, tm_isdst=0)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">()</span> <span class="c1"># convert timestamp returned by time() to local time</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span> <span class="go">time.struct_time(tm_year=2018, tm_mon=7, tm_mday=11, tm_hour=22, </span> <span class="go">tm_min=3, tm_sec=3, tm_wday=2, tm_yday=192, tm_isdst=0)</span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>Once you have access to timetuple you can access values inside it either by index or attribute name. For example:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span><span class="o">.</span><span class="n">tm_year</span><span class="p">,</span> <span class="n">lt2</span><span class="o">.</span><span class="n">tm_mon</span><span class="p">,</span> <span class="n">lt2</span><span class="o">.</span><span class="n">tm_mday</span> <span class="go">(2018, 7, 12)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">lt2</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">lt2</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="c1"># same as: lt2.tm_year, lt2.tm_mon, lt2.tm_mday</span> <span class="go">(2018, 7, 12)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span><span class="o">.</span><span class="n">tm_hour</span><span class="p">,</span> <span class="n">lt2</span><span class="o">.</span><span class="n">tm_min</span><span class="p">,</span> <span class="n">lt2</span><span class="o">.</span><span class="n">tm_sec</span> <span class="go">(0, 3, 40)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span><span class="p">[</span><span class="mi">3</span><span class="p">],</span> <span class="n">lt2</span><span class="p">[</span><span class="mi">4</span><span class="p">],</span> <span class="n">lt2</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="c1"># same as: lt2.tm_hour, lt2.tm_min, lt2.tm_sec</span> <span class="go">(0, 3, 40)</span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span><span class="o">.</span><span class="n">tm_wday</span><span class="p">,</span> <span class="n">lt2</span><span class="o">.</span><span class="n">tm_yday</span><span class="p">,</span> <span class="n">lt2</span><span class="o">.</span><span class="n">tm_isdst</span> <span class="go">(3, 193, 0)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lt2</span><span class="p">[</span><span class="mi">6</span><span class="p">],</span> <span class="n">lt2</span><span class="p">[</span><span class="mi">7</span><span class="p">],</span> <span class="n">lt2</span><span class="p">[</span><span class="mi">8</span><span class="p">]</span> <span class="c1"># same as: lt2.tm_wday, lt2.tm_yday, lt2.tm_isdst</span> <span class="go">(3, 193, 0)</span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="gmtime-function" class="anchor-target"></span><h2 class="heading">gmtime() function <a class="header-link" href="#gmtime-function">#</a></h2> <p><strong>Syntax:</strong> <code>gmtime([seconds]) -&gt; (tm_year,tm_mon,tm_mday,tm_hour,tm_min,<br> tm_sec,tm_wday,tm_yday,tm_isdst)</code></p> <p>Works exactly like <code>localtime()</code> but the converts the specified timestamp to UTC instead of local time. If the <code>seconds</code> argument not passed in, it uses timestamp returned by the <code>time()</code> function.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">gm1</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">gmtime</span><span class="p">(</span><span class="mi">1200000000</span><span class="p">)</span> <span class="c1"># convert timestamp 1200000000 to UTC time</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">gm1</span> <span class="go">time.struct_time(tm_year=2008, tm_mon=1, tm_mday=10, tm_hour=21, </span> <span class="go">tm_min=20, tm_sec=0, tm_wday=3, tm_yday=10, tm_isdst=0)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">gm2</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">gmtime</span><span class="p">()</span> <span class="c1"># convert timestamp returned by time() to UTC time</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">gm2</span> <span class="go">time.struct_time(tm_year=2018, tm_mon=7, tm_mday=12, tm_hour=8, </span> <span class="go">tm_min=5, tm_sec=38, tm_wday=3, tm_yday=193, tm_isdst=0)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">gm2</span><span class="o">.</span><span class="n">tm_year</span><span class="p">,</span> <span class="n">gm2</span><span class="o">.</span><span class="n">tm_mon</span><span class="p">,</span> <span class="n">gm2</span><span class="o">.</span><span class="n">tm_mday</span><span class="p">,</span> <span class="n">gm2</span><span class="o">.</span><span class="n">tm_hour</span><span class="p">,</span> <span class="n">gm2</span><span class="o">.</span><span class="n">tm_min</span><span class="p">,</span> <span class="n">gm2</span><span class="o">.</span><span class="n">tm_sec</span> <span class="go">(2018, 7, 12, 8, 22, 36)</span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">gm1</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">gm1</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">gm1</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">gm1</span><span class="p">[</span><span class="mi">3</span><span class="p">],</span> <span class="n">gm1</span><span class="p">[</span><span class="mi">4</span><span class="p">],</span> <span class="n">gm1</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="go">(2008, 1, 10, 21, 20, 0)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="mktime-function" class="anchor-target"></span><h2 class="heading">mktime() function <a class="header-link" href="#mktime-function">#</a></h2> <p><strong>Syntax:</strong> <code>mktime(timetuple) -&gt; floating point number</code></p> <p>This is the opposite of <code>localtime()</code> function. It accepts a timetuple representing local time and returns the number of seconds passed since January 1, 1970 00:00:00 UTC.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">timestamp</span><span class="p">,</span> <span class="n">timetuple</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">(),</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">()</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">timestamp</span><span class="p">,</span> <span class="n">timetuple</span> <span class="go">(1531384941.615937, time.struct_time(tm_year=2018, tm_mon=7, tm_mday=12, </span> <span class="go">tm_hour=14, tm_min=12, tm_sec=21, tm_wday=3, tm_yday=193, tm_isdst=0))</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">mktime</span><span class="p">(</span><span class="n">timetuple</span><span class="p">)</span> <span class="go">1531384941.0</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="sleep-function" class="anchor-target"></span><h2 class="heading">sleep() function <a class="header-link" href="#sleep-function">#</a></h2> <p><strong>Syntax:</strong> <code>sleep(seconds)</code></p> <p>This function suspends the process execution for the specified number of seconds.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">5</span><span class="p">):</span> <span class="gp">... </span> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="gp">... </span> <span class="k">print</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span> <span class="gp">... </span> <span class="go">1531391820.9281697</span> <span class="go">1531391825.9332898</span> <span class="go">1531391830.9384072</span> <span class="go">1531391835.9435263</span> <span class="go">1531391840.9486341</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>If you run the preceding code interactively, you will find that the for loop prints the timestamp after every 5 seconds.</p> <span id="ctime-function" class="anchor-target"></span><h2 class="heading">ctime() function <a class="header-link" href="#ctime-function">#</a></h2> <p><strong>Syntax:</strong> <code>ctime([seconds]) -&gt; string</code></p> <p>Converts the timestamp to a string representation in local time. If <code>seconds</code> argument not specified or <code>None</code>, it uses timestamp returned by <code>time()</code>.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">()</span> <span class="go">&#39;Thu Jul 12 16:18:51 2018&#39;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span> <span class="go">&#39;Thu Jul 12 16:18:54 2018&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">(</span><span class="mi">1290000000</span><span class="p">)</span> <span class="go">&#39;Wed Nov 17 18:50:00 2010&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="asctime-function" class="anchor-target"></span><h2 class="heading">asctime() function <a class="header-link" href="#asctime-function">#</a></h2> <p><strong>Syntax:</strong> <code>asctime([timetuple]) -&gt; string</code></p> <p>Converts the specified <code>timetuple</code> to a string representation in local time. If the <code>timetuple</code> is not specified, it uses current time returned by the <code>localtime()</code> function.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">asctime</span><span class="p">()</span> <span class="go">&#39;Thu Jul 12 16:57:53 2018&#39;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">asctime</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">())</span> <span class="c1"># same as time.asctime()</span> <span class="go">&#39;Thu Jul 12 16:58:03 2018&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">asctime</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="mi">1230000000</span><span class="p">))</span> <span class="go">&#39;Tue Dec 23 08:10:00 2008&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="strftime-function" class="anchor-target"></span><h2 class="heading">strftime() function <a class="header-link" href="#strftime-function">#</a></h2> <p><strong>Syntax:</strong> <code>strftime(format[, timetuple]) -&gt; string</code></p> <p>The <code>strftime()</code> function converts the <code>timetuple</code> to a string representation. It takes two arguments, <code>format</code> and an optional <code>timetuple</code>, and returns string according to the format codes used in the first argument. If <code>timetuple</code> not specified, it uses current time returned by the <code>localtime()</code> function.</p> <p>The following table lists some common format codes:</p> <div style="overflow-x:auto"><table class="table table-bordered table-hover table-condensed"><thead> <tr> <th>Format Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>%d</code></td> <td>Day of the month</td> </tr> <tr> <td><code>%H</code></td> <td>hours in 12-hour format</td> </tr> <tr> <td><code>%I</code></td> <td>hours in 24-hour format</td> </tr> <tr> <td><code>%M</code></td> <td>minutes</td> </tr> <tr> <td><code>%S</code></td> <td>seconds</td> </tr> <tr> <td><code>%p</code></td> <td>A.M. or P.M. (depends upon locale)</td> </tr> <tr> <td><code>%m</code></td> <td>month number</td> </tr> <tr> <td><code>%w</code></td> <td>weekday</td> </tr> <tr> <td><code>%y</code></td> <td>2 digit year</td> </tr> <tr> <td><code>%Y</code></td> <td>4 digit year</td> </tr> <tr> <td><code>%Z</code></td> <td>Timezone name</td> </tr> <tr> <td><code>%x</code></td> <td>Date representation according to locale</td> </tr> <tr> <td><code>%X</code></td> <td>Time representation according to locale</td> </tr> <tr> <td><code>%b</code></td> <td>Locale’s abbreviated month name</td> </tr> <tr> <td><code>%B</code></td> <td>Locale’s full month name</td> </tr> <tr> <td><code>%a</code></td> <td>Locale’s abbreviated weekday name</td> </tr> </tbody> </table></div><div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;%Y/%m/</span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">)</span> <span class="go">&#39;2018/07/12&#39;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;%H:%m:</span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">)</span> <span class="go">&#39;18:07:12&#39;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;%a %B </span><span class="si">%d</span><span class="s2"> %Y %H:%I:%S %p&quot;</span><span class="p">)</span> <span class="go">&#39;Thu July 12 2018 18:06:46 PM&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">%x</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="mi">1230000000</span><span class="p">))</span> <span class="go">&#39;12/23/08&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">%X</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="mi">1230000000</span><span class="p">))</span> <span class="go">&#39;08:10:00&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="strptime-function" class="anchor-target"></span><h2 class="heading">strptime() function <a class="header-link" href="#strptime-function">#</a></h2> <p><strong>Syntax:</strong> <code>strptime(string, format) -&gt; struct_time</code></p> <p>The <code>strptime()</code> function lets you convert date string to a timetuple according to the format string <code>format</code>. By default, the <code>format</code> argument is set to <code>&#39;%a %b %d %H:%M:%S %Y&#39;</code>. This is the same format as produced by the <code>ctime()</code> function. If the <code>string</code> and <code>format</code> do not match it raises <code>ValueError</code> exception.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">())</span> <span class="go">time.struct_time(tm_year=2018, tm_mon=7, tm_mday=12, tm_hour=19, </span> <span class="go">tm_min=6, tm_sec=3, tm_wday=3, tm_yday=193, tm_isdst=-1)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="s1">&#39;11-01-2018&#39;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">%d</span><span class="s2">-%m-%Y&quot;</span><span class="p">)</span> <span class="go">time.struct_time(tm_year=2018, tm_mon=1, tm_mday=11, tm_hour=0, </span> <span class="go">tm_min=0, tm_sec=0, tm_wday=3, tm_yday=11, tm_isdst=-1)</span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="s1">&#39;Mon, 01 Dec 2018&#39;</span><span class="p">,</span> <span class="s2">&quot;%a, %m %b %Y&quot;</span><span class="p">)</span> <span class="go">time.struct_time(tm_year=2018, tm_mon=1, tm_mday=1, tm_hour=0, </span> <span class="go">tm_min=0, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1)</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="s1">&#39;01-Dec-2018&#39;</span><span class="p">,</span> <span class="s2">&quot;%m-%b-%Y&quot;</span><span class="p">)</span> <span class="go">time.struct_time(tm_year=2018, tm_mon=1, tm_mday=1, tm_hour=0, </span> <span class="go">tm_min=0, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="s1">&#39;01-Dec-2018&#39;</span><span class="p">,</span> <span class="s2">&quot;%m-%b-%y&quot;</span><span class="p">)</span> <span class="c1"># string and format do not match, thus ValueError is raised</span> <span class="gp">...</span> <span class="go">ValueError: unconverted data remains: 18</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="tzname-attribute" class="anchor-target"></span><h2 class="heading">tzname attribute <a class="header-link" href="#tzname-attribute">#</a></h2> <p>The <code>tzname</code> attribute returns a tuple containing two values: name of the local time zone and name of the local daylight saving time zone (if defined).</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">tzname</span> <span class="go">(&#39;SGT&#39;, &#39;SGT&#39;)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>As you can see, my default time zone is set to Asia/Singapore. To determine the offset between UTC and local time we use the <code>timezone</code> attribute.</p> <span id="timezone-attribute" class="anchor-target"></span><h2 class="heading">timezone attribute <a class="header-link" href="#timezone-attribute">#</a></h2> <p>The <code>timezone</code> attribute returns the difference between the UTC time and local time in seconds.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">timezone</span> <span class="go">-28800</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">timezone</span><span class="o">/</span><span class="mi">3600</span> <span class="c1"># difference between UTC time and localtime in hours</span> <span class="go">-8.0</span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This means that the Asia/Singapore time zone is 8 hours (or 28800 seconds) ahead of UTC.</p> <span id="tzset-function" class="anchor-target"></span><h2 class="heading">tzset() function <a class="header-link" href="#tzset-function">#</a></h2> <p>The <code>tzset()</code> function changes the local time zone to the value stored in the <code>TZ</code> environment variable.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">tzname</span> <span class="c1"># initial time zone</span> <span class="go">(&#39;SGT&#39;, &#39;SGT&#39;)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">os</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;TZ&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;Europe/Moscow&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">tzset</span><span class="p">()</span> <span class="c1"># change time zone</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">tzname</span> <span class="c1"># local time zone is now changed to Moscow</span> <span class="go">(&#39;MSK&#39;, &#39;MSK&#39;)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>My default time zone is changed for the session. If you now call the <code>localtime()</code> function, it will return the local time of Moscow.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">()</span> <span class="go">time.struct_time(tm_year=2018, tm_mon=7, tm_mday=12, tm_hour=20, </span> <span class="go">tm_min=0, tm_sec=27, tm_wday=3, tm_yday=193, tm_isdst=0)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div>https://overiq.com/python-3-time-module/Pygments Tutorialhttps://overiq.com/pygments-tutorial/<p>Pygments is a very popular and robust Python package to highlight code snippets. Many well-known sites like Wikipedia, BitBucket, Read the Docs etc. are using it. Here are some of the features of Pygments:</p> <ul> <li>Supports a wide range of languages and markup formats.</li> <li>New language and markup can be added easily. </li> <li>Can use used as library or command line utility</li> <li>A number of output formats are available, like HTML, RTF, Latex etc.</li> </ul> <p>To install Pygments enter the following command:</p> <div class="codeblock language-bash"><div class="highlight"><pre><span></span>$ pip install pygments </pre></div> </div><span id="highlighting-using-pygments" class="anchor-target"></span><h2 class="heading">Highlighting using Pygments <a class="header-link" href="#highlighting-using-pygments">#</a></h2> <p>To highlight a code snippet using Pygments we follow these steps:</p> <ol> <li>Select lexer.</li> <li>Select the output format.</li> <li>Call the <code>highlight()</code> function.</li> </ol> <p>Let&#39;s go through each step in detail.</p> <span id="selecting-the-lexer" class="anchor-target"></span><h2 class="heading">Selecting the lexer <a class="header-link" href="#selecting-the-lexer">#</a></h2> <p>A lexer is a program which performs the lexical analysis. In other words, it splits the code into tokens (identifier, keyword, literal etc). Every language or markup has its own lexer. To select the lexer use <code>get_lexer_by_name()</code> function from the <code>pygments.lexers</code> package. It takes a single argument named alias which is name of the lexer. For example, to select the lexer for Python do this:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pygments</span> <span class="kn">import</span> <span class="n">lexers</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lexers</span><span class="o">.</span><span class="n">get_lexer_by_name</span><span class="p">(</span><span class="s2">&quot;python&quot;</span><span class="p">)</span> <span class="go">&lt;pygments.lexers.PythonLexer&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>We can see all the available lexers using the <code>get_all_lexers()</code> function:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">lexers</span><span class="o">.</span><span class="n">get_all_lexers</span><span class="p">())</span> <span class="go">[(&#39;Transact-SQL&#39;, (&#39;tsql&#39;, &#39;t-sql&#39;), (&#39;*.sql&#39;,), (&#39;text/x-tsql&#39;,)), (&#39;Termcap&#39;, (&#39;termcap&#39;,), (&#39;termcap&#39;, &#39;termcap.src&#39;), ()), (&#39;Snowball&#39;, (&#39;snowball&#39;,), (&#39;*.sbl&#39;,), ()), (&#39;Elm&#39;, (&#39;elm&#39;,), (&#39;*.elm&#39;,), (&#39;text/x-elm&#39;,)), (&#39;IRC logs&#39;, (&#39;irc&#39;,), (&#39;*.weechatlog&#39;,), (&#39;text/</span> <span class="gp">...</span> <span class="go">(&#39;pycon&#39;,), (), (&#39;text/x-python-doctest&#39;,)), (&#39;BBCode&#39;, (&#39;bbcode&#39;,), (), (&#39;text/x-bbcode&#39;,))]</span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="selecting-the-formatter" class="anchor-target"></span><h2 class="heading">Selecting the Formatter <a class="header-link" href="#selecting-the-formatter">#</a></h2> <p>Once you have selected the lexer, the next step is to select the Formatter. The Formatter&#39;s job is to take a token stream from the lexer and writes the output, in the format such as HTML, LaTex, RTF, BBCode etc. To see the available formats use the <code>get_all_formatters()</code> function from the <code>pygments.formatters</code> package.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pygments.formatters</span> <span class="kn">import</span> <span class="n">get_all_formatters</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">get_all_formatters</span><span class="p">())</span> <span class="go">[&lt;class &#39;pygments.formatters.img.JpgImageFormatter&#39;&gt;, </span> <span class="go">&lt;class &#39;pygments.formatters.rtf.RtfFormatter&#39;&gt;, </span> <span class="gp">...</span> <span class="go">&lt;class &#39;pygments.formatters.svg.SvgFormatter&#39;&gt;, </span> <span class="go">&lt;class &#39;pygments.formatters.html.HtmlFormatter&#39;&gt;, </span> <span class="go">&lt;class &#39;pygments.formatters.irc.IRCFormatter&#39;&gt;, </span> <span class="go">&lt;class &#39;pygments.formatters.img.BmpImageFormatter&#39;&gt;]</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>In our case, we are interested in outputting code snippet in HTML. As a result, we will use, <code>HtmlFormatter</code> (third from the last in preceding output). To use <code>HtmlFormatter</code>, import it from <code>pygments.formatters</code> and then instantiate it as follows:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pygments.formatters</span> <span class="kn">import</span> <span class="n">HtmlFormatter</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">()</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div><span id="highlighting-code" class="anchor-target"></span><h2 class="heading">Highlighting Code <a class="header-link" href="#highlighting-code">#</a></h2> <p>Finally, the last step is to call the <code>highlight()</code> function from the <code>pygments</code> package. The <code>highlight()</code> function puts everything together and returns the highlighted output. It takes three arguments, the code to highlight, lexer and the formatter.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pygments</span> <span class="kn">import</span> <span class="n">highlight</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">code</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;</span><span class="se">\</span> <span class="gp">... </span><span class="s2">def func():</span> <span class="gp">... </span><span class="s2"> # function body</span> <span class="gp">... </span><span class="s2"> print(&quot;hello world!&quot;)</span> <span class="gp">... </span><span class="s2">&quot;&quot;&quot;</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lex</span> <span class="o">=</span> <span class="n">lexers</span><span class="o">.</span><span class="n">get_lexer_by_name</span><span class="p">(</span><span class="s2">&quot;python&quot;</span><span class="p">)</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">)</span> <span class="go">&#39;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;\n\t&lt;span class=&quot;c1&quot;&gt;# function body&lt;/span&gt;\n\t&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;hello world!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;\n&lt;/pre&gt;&lt;/div&gt;\n&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>If you want <code>highlight()</code> function to save the output to a file rather than returning it, use the <code>outfile</code> argument as follows:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;out.html&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> <span class="gp">&gt;&gt;&gt; </span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">f</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This will create a file named <code>out.html</code> in the current working directory containing the highlighted code.</p> <p>If open <code>out.html</code> in a browser you will find that code doesn&#39;t appear to be highlighted at all. This is because by default <code>HtmlFormatter</code> generates HTML with CSS classes to marks various tokens, but it doesn&#39;t generate the actual CSS styles. We will see how to fix this in the next section.</p> <span id="customizing-the-output-of-htmlformatter" class="anchor-target"></span><h2 class="heading">Customizing the Output of HtmlFormatter <a class="header-link" href="#customizing-the-output-of-htmlformatter">#</a></h2> <p>The following is a lists of some common keyword arguments that you can pass to <code>HtmlFormatter()</code> function to customize the generated output:</p> <div style="overflow-x:auto"><table class="table table-bordered table-hover table-condensed"><thead> <tr> <th>Argument</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>full</code></td> <td>If set to <code>True</code>, <code>HtmlFormatter</code> generates a self-contained document with inline CSS styles. By default, it is set to <code>False</code></td> </tr> <tr> <td><code>style</code></td> <td>The color scheme to use. It defaults to <code>default</code>.</td> </tr> <tr> <td><code>linenos</code></td> <td>If set to <code>True</code>, tells the formatter to generate output with line numbers. By default, it is set to <code>False</code>.</td> </tr> <tr> <td><code>hl_lines</code></td> <td>Specify the list of lines to be highlighted.</td> </tr> <tr> <td><code>cssclass</code></td> <td>CSS class for wrapping the code block.</td> </tr> </tbody> </table></div> <p>Here is how to use these arguments:</p> <span id="full" class="anchor-target"></span><h3 class="heading">full <a class="header-link" href="#full">#</a></h3> <p>In the previous section we have seen that by default, the output generated by <code>HtmlFormatter()</code> only contains HTML markup and CSS classes only, it doesn&#39;t contain the actual CSS styles to format the HTML markup. We can alter this behavior by passing <code>full=True</code> to <code>HtmlFormatter()</code> as follows:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">full</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;out.html&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> <span class="gp">&gt;&gt;&gt; </span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">f</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This will re-write the existing <code>out.html</code> file. If you now open <code>out.html</code> in a text editor you will find that in addition to HTML markup and CSS classes, it also contains a list of CSS style in the head section of the document.</p> <p><img src="/media/uploads/2018/6/7/Selection_215-5259b440-aadf-4db7-b2b1-ba9c88ed2ee0.png" loading="lazy" alt="" ></p> <p>Open <code>out.html</code> in your browser and it should look like this:</p> <p><img src="/media/uploads/2018/6/7/Selection_209-beedcbe3-6404-4e24-b7de-7d36cebb722b.png" loading="lazy" alt="" ></p> <span id="style" class="anchor-target"></span><h3 class="heading">style <a class="header-link" href="#style">#</a></h3> <p>The <code>HtmlFormatter</code> uses a default color scheme named <code>default</code> to highlight the code. Pygments comes with several built-in styles. To view the built-in styles use <code>get_all_styles()</code> function of the <code>pygments.styles</code> package.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">get_all_styles</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">get_all_styles</span><span class="p">())</span> <span class="go">[&#39;borland&#39;, &#39;xcode&#39;, &#39;pastie&#39;, &#39;emacs&#39;, &#39;vim&#39;, &#39;rainbow_dash&#39;, &#39;igor&#39;, </span> <span class="go">&#39;algol&#39;, &#39;murphy&#39;, &#39;native&#39;, &#39;lovelace&#39;, &#39;algol_nu&#39;, &#39;rrt&#39;, &#39;arduino&#39;, </span> <span class="go">&#39;paraiso-dark&#39;, &#39;trac&#39;, &#39;fruity&#39;, &#39;colorful&#39;, &#39;friendly&#39;, &#39;vs&#39;, &#39;perldoc&#39;,</span> <span class="go">&#39;autumn&#39;, &#39;monokai&#39;, &#39;abap&#39;, &#39;default&#39;, &#39;paraiso-light&#39;, &#39;tango&#39;, &#39;bw&#39;, &#39;manni&#39;]</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p><strong>Note:</strong> To get an instant preview of the available styles visit <a href="http://pygments.org/demo" rel="nofollow" >http://pygments.org/demo</a>.</p> <p>Once you know the style you want to use set it using the <code>style</code> argument as follows:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7 8</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">full</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="s1">&#39;monokai&#39;</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;out.html&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> <span class="gp">... </span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">f</span><span class="p">)</span> <span class="gp">... </span> <span class="go">&gt;&gt;&gt;</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This will highlight the code snippet using monokai color scheme.</p> <p>Open <code>out.html</code> and it will look like this:</p> <p><img src="/media/uploads/2018/6/7/Selection_211-1d56521d-2857-4465-a084-f9260a25fc4c.png" loading="lazy" alt="" ></p> <span id="linenos" class="anchor-target"></span><h3 class="heading">linenos <a class="header-link" href="#linenos">#</a></h3> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">full</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">linenos</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;out.html&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> <span class="gp">... </span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">f</span><span class="p">)</span> <span class="gp">... </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This will add line numbers to the highlighted code:</p> <p>Open <code>out.html</code> and it will look like this:</p> <p><img src="/media/uploads/2018/6/7/Selection_212-0f8f2195-dc08-493d-8efc-236d4591215b.png" loading="lazy" alt="" ></p> <span id="hl_lines" class="anchor-target"></span><h3 class="heading">hl_lines <a class="header-link" href="#hl_lines">#</a></h3> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">full</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">linenos</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">hl_lines</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;out.html&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> <span class="gp">... </span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">f</span><span class="p">)</span> <span class="gp">... </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This will highlight the first and second line of the code. </p> <p>Open <code>out.html</code> and it will look like this:</p> <p><img src="/media/uploads/2018/6/7/Selection_213-120e08dc-b062-4059-8a33-5e115f75ea12.png" loading="lazy" alt="" ></p> <span id="cssclass" class="anchor-target"></span><h3 class="heading">cssclass <a class="header-link" href="#cssclass">#</a></h3> <p>By default, <code>HtmlFormatter()</code> generates code block wrapped in <code>&lt;div&gt;</code> tag with <br> <code>class=&quot;highlight&quot;</code>. For example:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">()</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">)</span> <span class="go">&#39;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;\n\t&lt;span class=&quot;c1&quot;&gt;# function body&lt;/span&gt;\n\t&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;hello world!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;\n&lt;/pre&gt;&lt;/div&gt;\n&#39;</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>We can specify any other class name using <code>cssclass</code> argument.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">cssclass</span><span class="o">=</span><span class="s2">&quot;code-block&quot;</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">)</span> <span class="go">&#39;&lt;div class=&quot;code-block&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;\n\t&lt;span class=&quot;c1&quot;&gt;# function body&lt;/span&gt;\n\t&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;hello world!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;\n&lt;/pre&gt;&lt;/div&gt;\n&#39;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This returns the code block wrapped in <code>&lt;div&gt;</code> with <code>class=&quot;code-block&quot;</code>.</p> <span id="generating-css" class="anchor-target"></span><h2 class="heading">Generating CSS <a class="header-link" href="#generating-css">#</a></h2> <p>We have seen that passing <code>full=True</code> to <code>HtmlFormatter()</code> creates a self-contained document with CSS styles. Although, this approach works, but it generates a lot of redundant CSS styles. A better approach would be to create an external style sheet containing all the CSS classes used in the output. </p> <p>We can use <code>get_style_defs()</code> method of <code>HtmlFormatter()</code> to get the style definitions used by the formatter as a string.</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">()</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">formatter</span><span class="o">.</span><span class="n">get_style_defs</span><span class="p">())</span> <span class="go">.hll { background-color: #ffffcc }</span> <span class="go">.c { color: #408080; font-style: italic } /* Comment */</span> <span class="go">.err { border: 1px solid #FF0000 } /* Error */</span> <span class="go">.k { color: #008000; font-weight: bold } /* Keyword */</span> <span class="go">.o { color: #666666 } /* Operator */</span> <span class="go">.ch { color: #408080; font-style: italic } /* Comment.Hashbang */</span> <span class="go">.cm { color: #408080; font-style: italic } /* Comment.Multiline */</span> <span class="go">/* ... */</span> <span class="go">.bp { color: #008000 } /* Name.Builtin.Pseudo */</span> <span class="go">.fm { color: #0000FF } /* Name.Function.Magic */</span> <span class="go">.vc { color: #19177C } /* Name.Variable.Class */</span> <span class="go">.vg { color: #19177C } /* Name.Variable.Global */</span> <span class="go">.vi { color: #19177C } /* Name.Variable.Instance */</span> <span class="go">.vm { color: #19177C } /* Name.Variable.Magic */</span> <span class="go">.il { color: #666666 } /* Literal.Number.Integer.Long */</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>This returns CSS styles for the default style. </p> <p>To get the CSS styles for monokai, do this:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="s1">&#39;monokai&#39;</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">formatter</span><span class="o">.</span><span class="n">get_style_defs</span><span class="p">())</span> <span class="go">.hll { background-color: #49483e }</span> <span class="go">.c { color: #75715e } /* Comment */</span> <span class="go">.err { color: #960050; background-color: #1e0010 } /* Error */</span> <span class="go">.k { color: #66d9ef } /* Keyword */</span> <span class="go">.l { color: #ae81ff } /* Literal */</span> <span class="go">/* ... */</span> <span class="go">.bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */</span> <span class="go">.fm { color: #a6e22e } /* Name.Function.Magic */</span> <span class="go">.vc { color: #f8f8f2 } /* Name.Variable.Class */</span> <span class="go">.vg { color: #f8f8f2 } /* Name.Variable.Global */</span> <span class="go">.vi { color: #f8f8f2 } /* Name.Variable.Instance */</span> <span class="go">.vm { color: #f8f8f2 } /* Name.Variable.Magic */</span> <span class="go">.il { color: #ae81ff } /* Literal.Number.Integer.Long */</span> </pre></div> </td></tr></table></div> <p>We can also pass additional classes to <code>get_style_defs()</code> method that will be prepended to the class. For example:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">formatter</span><span class="o">.</span><span class="n">get_style_defs</span><span class="p">(</span><span class="s1">&#39;.highlight&#39;</span><span class="p">))</span> <span class="go">.highlight .hll { background-color: #ffffcc }</span> <span class="go">.highlight { background: #f8f8f8; }</span> <span class="go">.highlight .c { color: #408080; font-style: italic } /* Comment */</span> <span class="go">.highlight .err { border: 1px solid #FF0000 } /* Error */</span> <span class="go">.highlight .k { color: #008000; font-weight: bold } /* Keyword */</span> <span class="go">.highlight .o { color: #666666 } /* Operator */</span> <span class="go">/* ... */</span> <span class="go">.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */</span> <span class="go">.highlight .fm { color: #0000FF } /* Name.Function.Magic */</span> <span class="go">.highlight .vc { color: #19177C } /* Name.Variable.Class */</span> <span class="go">.highlight .vg { color: #19177C } /* Name.Variable.Global */</span> <span class="go">.highlight .vi { color: #19177C } /* Name.Variable.Instance */</span> <span class="go">.highlight .vm { color: #19177C } /* Name.Variable.Magic */</span> <span class="go">.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>In case you have specified <code>cssclass</code> argument while creating <code>HtmlFormatter</code> instance then the default selector for <code>get_style_defs()</code> will be this class. For example:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">cssclass</span><span class="o">=</span><span class="s2">&quot;code-block&quot;</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">formatter</span><span class="o">.</span><span class="n">get_style_defs</span><span class="p">())</span> <span class="go">.code-block .hll { background-color: #ffffcc }</span> <span class="go">.code-block { background: #f8f8f8; }</span> <span class="go">.code-block .c { color: #408080; font-style: italic } /* Comment */</span> <span class="go">.code-block .err { border: 1px solid #FF0000 } /* Error */</span> <span class="go">.code-block .k { color: #008000; font-weight: bold } /* Keyword */</span> <span class="go">.code-block .o { color: #666666 } /* Operator */</span> <span class="go">/* ... */</span> <span class="go">.code-block .bp { color: #008000 } /* Name.Builtin.Pseudo */</span> <span class="go">.code-block .fm { color: #0000FF } /* Name.Function.Magic */</span> <span class="go">.code-block .vc { color: #19177C } /* Name.Variable.Class */</span> <span class="go">.code-block .vg { color: #19177C } /* Name.Variable.Global */</span> <span class="go">.code-block .vi { color: #19177C } /* Name.Variable.Instance */</span> <span class="go">.code-block .vm { color: #19177C } /* Name.Variable.Magic */</span> <span class="go">.code-block .il { color: #666666 } /* Literal.Number.Integer.Long */</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>And here is how you can save the generated CSS styles to an external file:</p> <div class="codeblock language-pycon"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">linenos</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">hl_lines</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">],</span> <span class="n">css</span><span class="o">=</span><span class="s2">&quot;code-snippet&quot;</span><span class="p">)</span> <span class="go">&gt;&gt;&gt;</span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;out.html&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> <span class="gp">... </span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lex</span><span class="p">,</span> <span class="n">formatter</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">f</span><span class="p">)</span> <span class="gp">... </span> <span class="gp">&gt;&gt;&gt; </span> <span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;style.css&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> <span class="gp">... </span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">formatter</span><span class="o">.</span><span class="n">get_style_defs</span><span class="p">())</span> <span class="gp">... </span> <span class="go">3583</span> <span class="go">&gt;&gt;&gt;</span> </pre></div> </td></tr></table></div> <p>Now open <code>out.html</code> file in a text editor and add the following line at the top of the it:</p> <div class="codeblock language-html"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/css&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;style.css&quot;</span><span class="p">&gt;</span> </pre></div> </div> <p>Open <code>out.html</code> in a browser and it will look like this:</p> <p><img src="/media/uploads/2018/6/7/Selection_214-58a9da6e-6084-48e9-a4c9-45622f3aef0e.png" loading="lazy" alt="" ></p> <p>Another way to create CSS styles is to use pygments as a command line tool. For example:</p> <div class="codeblock language-bash"><div class="highlight"><pre><span></span>$ pygmentize -S default -f html &gt; default.css </pre></div> </div> <p>This command will create the CSS styles for the <code>default</code> style. The <code>-S</code> option specifies the style and <code>-f</code> option specifies the formatter.</p> <p>To generate CSS styles for monokai, use this:</p> <div class="codeblock language-bash"><div class="highlight"><pre><span></span>$ pygmentize -S monokai -f html &gt; monokai.css </pre></div> </div> <p>We can also specify the top-level class using <code>-a</code> option:</p> <div class="codeblock language-bash"><div class="highlight"><pre><span></span>$ pygmentize -S default -f html -a .code-snippet &gt; default.css </pre></div> </div>https://overiq.com/pygments-tutorial/How to use Virtualenv?https://overiq.com/how-to-use-virtualenv/<span id="what-is-virtualenv" class="anchor-target"></span><h2 class="heading">What is Virtualenv? <a class="header-link" href="#what-is-virtualenv">#</a></h2> <p>Virtualenv is a handy tool for creating Python Virtual Environments.</p> <p>So Why do we need Virtual Environments?</p> <p>You can think of Virtual Environments as a separate Python installation which allows us to work on projects using different versions of the same package without conflicting with one another. Consider the following example: </p> <p>Let&#39;s say we are working on an e-commerce website and a CRM. Our e-commerce website depends upon version 1 of the <code>foo</code> package but our CRM needs version 2. At a time, we can only work with one version of the <code>foo</code> package. We can&#39;t have both versions simultaneously on the system. A virtual environment can resolve these kinds of problem easily.</p> <p>Another excellent use case of Virtualenv is that when you are working on a system and you don&#39;t have the privilege to install packages globally. What you can do is create a virtual environment in your home directory and then install all the dependencies of the project inside the virtual environment.</p> <p>Even if you don&#39;t work with conflicting packages and have full access to the system, it is still a good idea to always start your new project in a virtual environment that way if anything goes wrong with the project, your system-wide Python installation will remain intact.</p> <p>Now you the Why of Virtualenv let&#39;s get into the How?</p> <span id="installing-virtual" class="anchor-target"></span><h2 class="heading">Installing Virtual <a class="header-link" href="#installing-virtual">#</a></h2> <p>To install Virtualenv type the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>pip3 install virtualenv </pre></div> </div><span id="creating-virtual-environment" class="anchor-target"></span><h2 class="heading">Creating Virtual Environment <a class="header-link" href="#creating-virtual-environment">#</a></h2> <p>We now ready to create virtual environments. Create a new directory <code>my-project</code> and change your current working directory to this directory using the <code>cd</code> command:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>$ mkdir my-project $ cd my-project </pre></div> </td></tr></table></div> <p>To create the virtual environment type the following:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ virtualenv env </pre></div> </div> <p>Alternatively, you can also use the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ python -m virtualenv env </pre></div> </div> <p>This will create a new a new directory named <code>env</code> in your current working directory. The structure of the <code>env</code> directory should look like this:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5</pre></div></td><td class="code"><div class="highlight"><pre><span></span>env/ ├── bin/ ├── include/ ├── lib/   └── pip-selfcheck.json </pre></div> </td></tr></table></div> <p>So what are these files and folder?</p> <p>These files and folder constitute a separate Python installation. </p> <p>The <code>bin/</code> folder contains all the executables that you would find in an ordinary Python installation:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>$ ls env/bin/ activate activate_this.py pip python python-config activate.csh easy_install pip3 python3 wheel activate.fish easy_install-3.5 pip3.5 python3.5 </pre></div> </td></tr></table></div> <p>By default, Virtualenv creates virtual environment using the version of Python under which it is installed. In other words, if Virtualenv is installed as a package of Python 3.5 then it will create virtual environment using Python 3.5. We can specify another version of the Python using the <code>-p</code> option.</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>virtualenv env -p /usr/bin/python2 </pre></div> </div> <p>This will create a virtual environment using Python 2.7 instead of Python 3.5.</p> <span id="activating-the-virtual-environment" class="anchor-target"></span><h2 class="heading">Activating the Virtual Environment <a class="header-link" href="#activating-the-virtual-environment">#</a></h2> <p>To use a virtual environment, we first have to activate it. Activate virtual environment by typing the following command:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>$ source env/bin/activate (env) $: </pre></div> </td></tr></table></div> <p>If you are on Windows use the following command:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>C:\Users\user&gt;env\bin\activate (env) C:\Users\user&gt; </pre></div> </td></tr></table></div> <p>Our virtual environment is now active. Did you notice <code>(env)</code> in front of the shell prompt? It indicates that the virtual environment named <code>env</code> is up and running.</p> <p>Activating a virtual environment changes the <code>$PATH</code> environment variable temporarily so that the <code>bin/</code> directory of the virtual environment will become first in the list. If you now execute <code>python</code> command, Python executable which resides in the <code>env/bin/</code> directory is executed instead of the globally installed Python.</p> <p>Once virtual environment is activated, any package you add or remove using the <code>pip</code> will only affect the virtual environment you are working on. Packages installed at system-wide installation will not be affected at all.</p> <span id="deactivating-the-virtual-environment" class="anchor-target"></span><h2 class="heading">Deactivating the Virtual Environment <a class="header-link" href="#deactivating-the-virtual-environment">#</a></h2> <p>Once you are done working with the Virtualenv you can deactivate it using the <code>deactivate</code> command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ deactivate </pre></div> </div> <p>This will remove the <code>bin/</code> directory from the <code>$PATH</code> environment variable, making globally installed Python accessible again.</p> <span id="inheriting-packages-using-system-site-packages" class="anchor-target"></span><h2 class="heading">Inheriting Packages using --system-site-packages <a class="header-link" href="#inheriting-packages-using-system-site-packages">#</a></h2> <p>On some occasions, you might want to create a virtual environment with the packages from the global Python installation. This can be accomplished using <code>--system-site-packages</code> option.</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ virtualenv env --system-site-packages </pre></div> </div>https://overiq.com/how-to-use-virtualenv/Installing MySQL (Windows, Linux and Mac)https://overiq.com/installing-mysql-windows-linux-and-mac/<p>MySQL is one of the most used Relational databases on the Web and in this lesson, we will learn how to install it.</p> <p>This post specifically covers how to install MySQL on Windows, Linux and Mac OS.</p> <span id="installing-mysql-on-windows" class="anchor-target"></span><h2 class="heading">Installing MySQL on Windows <a class="header-link" href="#installing-mysql-on-windows">#</a></h2> <p>To download MySQL for Windows navigate to <a href="https://dev.mysql.com/downloads/windows/installer/" rel="nofollow" >https://dev.mysql.com/downloads/windows/installer/</a>. Scroll down a little and you will be displayed download links like this:</p> <p><img src="/media/uploads/2018/1/22/mysql_installer_links-3f945c2c-7463-4a57-9b64-563da6791865.png" loading="lazy" alt="" ></p> <p>The first one is a web installer and the second one is an offline installer. Select whichever you like and hit the Download button.</p> <p>After the download finishes double-click to start the installer. </p> <p><strong>Step 1:</strong> Accepts Licence Agreement.</p> <p><img src="/media/uploads/2018/1/22/step1_mysql_license_agreement-c541d69e-6a5c-426a-bc8f-5f5c70751e94.png" loading="lazy" alt="" ></p> <p><strong>Step 2:</strong> Select Setup Type.</p> <p><img src="/media/uploads/2018/1/22/step_2_-_select_setup_type-74937076-cd85-443c-a20b-9c5a6f47185e.png" loading="lazy" alt="" ></p> <p>The default set up installs many additional packages like MySQL workbench, Connectors, plugins, documentation, samples databases and so on. Installing all these packages will take some time and additional space. And the worst part is you won&#39;t even use half of these packages. That&#39;s why it is better to go with the Custom Installation and only install the packages you need. Don&#39;t worry you can always install these packages later by running installer again.</p> <p><strong>Step 3:</strong> Select Product and Features.</p> <p><img src="/media/uploads/2018/1/22/step_3_-_Select_Product_and_Features-1bf5305a-7350-48a8-be7d-a6d57cd1e241.png" loading="lazy" alt="" ></p> <p>In this case, we are only interested in installing MySQL server. Select architecture ( x86 or x64 ) depending upon your OS and click Next.</p> <p><strong>Step 4:</strong> Check Requirements.</p> <p><img src="/media/uploads/2018/1/22/Step_4_Check_Requirements-da9a3c30-d33b-44a9-8856-ffb94cb8b309.png" loading="lazy" alt="" ></p> <p>In this screen, the installer will download the missing dependencies. You will see this screen only when your system has missing dependencies. Click the &quot;Execute&quot; button to start the process. As you can see, on this system, installers need Microsoft Visual C++ Redistributable Package before it can proceed. Click the Next button and installer will prompt you to install the necessary package. </p> <p><img src="/media/uploads/2018/1/22/mysql_installer_installing_dependencies-134859ca-8fe1-4fac-a1e3-ce9861224a02.png" loading="lazy" alt="" ></p> <p>Once you have installed all the dependencies you will see a green check mark before the product name.</p> <p><img src="/media/uploads/2018/1/22/mysql_installer_requirements_satisfied-2109f2d7-c3a5-46f4-82bf-a6175b432cc4.png" loading="lazy" alt="" ></p> <p><strong>Step 5:</strong> Installation.</p> <p><img src="/media/uploads/2018/1/22/Step_5_Installation-fd96c498-ffb6-42e5-a069-20f56f0d31a2.png" loading="lazy" alt="" ></p> <p>This screen shows the list of products that will be installed. The list only contains MySQL Server because that&#39;s what we are installing here. To start the installation process click the Execute button. After successful installation, you will get the following screen.</p> <p><img src="/media/uploads/2018/1/22/installation_success-73e9c7df-f5be-489c-afc7-4ec313764997.png" loading="lazy" alt="" ></p> <p>Click Next to proceed.</p> <p><strong>Step 6:</strong> Product Configuration.</p> <p><img src="/media/uploads/2018/1/22/Step_6_Product_Configuration-924499b2-8a60-4bf9-9b74-74eed8d039bd.png" loading="lazy" alt="" ></p> <p>In this part, the installer will configure MySQL Server. Default options are fine, so just click Next on the next on the several screens. After that, you will be prompted for username and password. Set username and password of your choice. You will use this to login into the MySQL server.</p> <p>You have made through the hard part of the installation phase. In the next several screens accept the default by clicking Next. Finally, close the installer by clicking the Finish button.</p> <p><img src="/media/uploads/2018/1/22/mysql_windows_installation_finished-88f9c8df-250b-4f58-845e-0975b6702bc7.png" loading="lazy" alt="" ></p> <span id="adding-mysql-to-path-environment-variable-in-windows" class="anchor-target"></span><h2 class="heading">Adding MySQL to PATH Environment Variable in Windows <a class="header-link" href="#adding-mysql-to-path-environment-variable-in-windows">#</a></h2> <p>MySQL Installer by default doesn&#39;t add the <code>mysql.exe</code> to the PATH environment variable. As a result, every time we want to execute <code>mysql.exe</code> we have to specify the full path to it. The <code>mysql.exe</code> resides in the <code>MySQL\MySQL Server 5.7\bin</code> directory. But the path to <code>MySQL</code> directory depends upon the architecture of the application. If you have installed x64 version then it should be in <code>C:\Program Files\</code>. Otherwise, it should be in <code>C:\Program Files (x86)</code>. On this system, MySQL is installation is in C:\Program Files\ and the complete path to <code>mysql.exe</code> is <code>C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe</code>.</p> <p>To add <code>mysql.exe</code> to PATH environment variable follow these steps:</p> <ol> <li><p>Hit Win+Pause/Break. This will open System Properties Window.</p> <p><img src="/media/uploads/2018/1/22/System_Properties_Window-cf8f658a-3d88-4af9-a021-be1657283fcf.png" loading="lazy" alt="" ></p></li> <li><p>Click on Advanced system settings.</p></li> <li><p>At the bottom of the newly opened window click on Environment Variables.</p> <p><img src="/media/uploads/2018/1/22/Advanced_system_settings_tab-82cc529e-bd9c-4666-8a40-a7c6895a4baa.png" loading="lazy" alt="" ></p></li> <li><p>In the new window Select Path environment variable and click Edit.</p> <p><img src="/media/uploads/2018/1/22/2018-01-20_18-41-47-ce709341-af4a-4e41-bd39-b71226908e42.png" loading="lazy" alt="" ></p></li> <li><p>Add <code>;</code> at the end of the current variable value and append <code>C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe</code> (the exact may differ depending upon version and architecture of the application). Click OK to save.</p> <p><img src="/media/uploads/2018/1/22/2018-01-20_18-43-00-61822b03-a081-49d5-b4d4-3dd93df1ee38.png" loading="lazy" alt="" ></p></li> </ol> <p>Now start the Command Prompt and enter the following command:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>C:\Users\user&gt;mysql --version mysql Ver 14.14 Distrib 5.7.20, for Win64 (x86_64) </pre></div> </td></tr></table></div> <p>If you get the MySQL version as shown in the output, then it means everything is working alright and you have successfully installed MySQL Server. To login into the MySQL server use the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>C:\Users\user&gt;mysql -u root -p </pre></div> </div> <p>You will then be asked for a password. On success, on you get the following output:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13</pre></div></td><td class="code"><div class="highlight"><pre><span></span>Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 51 Server version: 5.7.20-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the current input statement. mysql&gt; </pre></div> </td></tr></table></div> <p>To quite the MySQL shell hit <code>\q</code>.</p> <span id="install-mysql-in-debianubuntumint" class="anchor-target"></span><h2 class="heading">Install MySQL in Debian/Ubuntu/Mint <a class="header-link" href="#install-mysql-in-debianubuntumint">#</a></h2> <p>To install MySQL on Debian based system like Ubuntu or Mint type the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo apt-get install mysql-server </pre></div> </div> <p>If you are using a Redhat based system like Fedora or CentOS use the following command:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo yum install mysql-community-server </pre></div> </div> <p>The installer will automatically add the path to MySQL executable to the PATH environment variable so you don&#39;t need to do anything.</p> <span id="testing-the-installation" class="anchor-target"></span><h2 class="heading">Testing the Installation <a class="header-link" href="#testing-the-installation">#</a></h2> <p>To the installation run the following command:</p> <div class="codeblock language-text"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>$ mysql --version mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper </pre></div> </td></tr></table></div> <p>If you get the version of MySQL then it means you have successfully installed MySQL server.</p> <p>After the installation MySQL server will start automatically. At anytime, we can check the status of the MySQL server using the following command:</p> <p>For Debian/Ubuntu/Mint:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo service mysql status </pre></div> </div> <p>For Redhat/Fedora/CentOS:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo service mysqld status </pre></div> </div> <p>You can stop the server using the following command:</p> <p>For Debian/Ubuntu/Mint:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo service mysql stop </pre></div> </div> <p>For Redhat/Fedora/Cent OS:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo service mysqld stop </pre></div> </div> <p>To restart the server use the following command:</p> <p>For Debian/Ubuntu/Mint:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo service mysql start </pre></div> </div> <p>For Redhat/Fedora/Cent OS:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ sudo service mysqld start </pre></div> </div><span id="installing-mysql-on-mac-os" class="anchor-target"></span><h2 class="heading">Installing MySQL on Mac OS <a class="header-link" href="#installing-mysql-on-mac-os">#</a></h2> <p>To download MySQL for Mac OS visit <a href="https://dev.mysql.com/downloads/mysql/" rel="nofollow" >https://dev.mysql.com/downloads/mysql/</a> and download the DMG archive.</p> <p><img src="/media/uploads/2018/1/22/mysql_download_links_for_mac_os-ce45991e-b778-4caa-80f3-5eca0ef7d3d1.png" loading="lazy" alt="" ></p> <p>Double-click the installer to start and go through the usual installation process. After the successful installation, you will be provided a temporary password to login into MySQL server. The temporary password is not recoverable so make sure to copy and save it in the safe place.</p> <p><img src="/media/uploads/2018/1/22/mysql_temporary_password_in_mac-b74310e7-2780-4deb-8983-9a780aef4a2f.png" loading="lazy" alt="" ></p> <p>The MySQL installer usually installs the files in the directory named <code>mysql</code> within <code>/usr/local/</code>. Just like Windows, MySQL installer for Mac doesn&#39;t add MySQL executable to the PATH environment variable. Consequently, we have to execute MySQL by specifying the full path to it in the terminal.</p> <p>We are now ready to start the server. Open System Preference and click on the MySQL icon.</p> <p><img src="/media/uploads/2018/1/22/mac_system_preference-db9a20fe-fe45-4deb-a51f-319a91b262ec.png" loading="lazy" alt="" ></p> <p>This will open MySQL preference pane.</p> <p><img src="/media/uploads/2018/1/22/mysql_preference_pane-cd32d421-d38d-4a02-9df5-505f2e95841f.png" loading="lazy" alt="" ></p> <p>As the screen shows, currently, MySQL server is not running. Click Start MySQL Server button to start the server.</p> <p>To login to the MySQL server enter the following command in the terminal.</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ /usr/local/mysql/bin/mysql -u root -p </pre></div> </div> <p>You will then be prompted for a password. Enter the temporary password you copied at the time of installation and hit Enter.<br> Once you are inside the terminal, change your password using the following command.</p> <div class="codeblock language-sql"><div class="highlight"><pre><span></span><span class="k">ALTER</span> <span class="k">USER</span> <span class="s1">&#39;root&#39;</span><span class="o">@</span><span class="s1">&#39;localhost&#39;</span> <span class="n">IDENTIFIED</span> <span class="k">BY</span> <span class="s1">&#39;your_new_password&#39;</span> </pre></div> </div> <p>To quit the MySQL shell enter <code>\q</code>.</p> <span id="adding-mysql-to-path-environment-variable-in-mac-os" class="anchor-target"></span><h2 class="heading">Adding MySQL to Path Environment Variable in Mac OS <a class="header-link" href="#adding-mysql-to-path-environment-variable-in-mac-os">#</a></h2> <p>To add MySQL executable to the PATH environment variable open <code>.bash_profile</code> and add the following code at the end of the file.</p> <p><strong>.bash_profile</strong></p> <div class="codeblock language-bash"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1">#...</span> <span class="nv">PATH</span><span class="o">=</span><span class="s2">&quot;/usr/local/mysql/bin:</span><span class="si">${</span><span class="nv">PATH</span><span class="si">}</span><span class="s2">&quot;</span> <span class="nb">export</span> PATH </pre></div> </td></tr></table></div> <p>Logoff and then login again for the changes to take effect. To verify the changes try running MySQL with without specifying the full path to it, as follows:</p> <div class="codeblock language-text"><div class="highlight"><pre><span></span>$ mysql --version </pre></div> </div> <p>If you get the MySQL version then it means you have successfully added MySQL to PATH environment variable. You should now have MySQL server on your Mac OS up and running.</p> <p>How did this guide work for you? If you are encountering any error let me know in the comments.</p> https://overiq.com/installing-mysql-windows-linux-and-mac/