<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by TeraJournal on Medium]]></title>
        <description><![CDATA[Stories by TeraJournal on Medium]]></description>
        <link>https://medium.com/@terajournal?source=rss-11ae72a9d956------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gqRLYjVVNkjOGOOK9KDegw.png</url>
            <title>Stories by TeraJournal on Medium</title>
            <link>https://medium.com/@terajournal?source=rss-11ae72a9d956------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:06:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@terajournal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Increasing Size of Available Shrink Space for Hard Drive Partition in Windows]]></title>
            <link>https://medium.com/@terajournal/increasing-size-of-available-shrink-space-for-hard-drive-partition-in-windows-8fffa50535d3?source=rss-11ae72a9d956------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fffa50535d3</guid>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[sysadmin]]></category>
            <category><![CDATA[windows-10]]></category>
            <dc:creator><![CDATA[TeraJournal]]></dc:creator>
            <pubDate>Tue, 02 May 2017 02:57:35 GMT</pubDate>
            <atom:updated>2024-11-25T03:36:10.888Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes ago, I was trying to install Ubuntu, so I had to partition my hard drive. I opened Disk Management at once and wanted to shrink, but I found out that the available shrink space was nothing compared to the available space on my hard drive. I wondered why this was happening, so I did my homework and found out that Windows won’t let me shrink because there are immovable system files at the end of the volume.</p><p>I found ways to get out of the mess. If you find yourself experiencing the same thing, just do the following things I did:</p><p>1. Run the Disk Cleanup Wizard (be sure to remove all restore points and the hibernation file)</p><p>2. Disable System Restore by:</p><p>· Searching for “advanced system setting” and once you see “View advanced system setting”, click it</p><p>· A small window that says “System Properties” on the top-left corner will appear. It has about five tabs below where it says System Properties. Look for the one that says “System Protection” and click it. Check for “Protection Settings”, you’ll see a table (kind of) listing Available Drives and corresponding Protection. If the Protection status is Off, skip this step. Otherwise, below the table, check for a button that says “Configure”, click it and another window will appear. The first thing on the new window is Restore Settings and below it are options to turn System Restore On or Off. Select “Disable system protection”. Confirm this setting by clicking OK at the bottom of the window.</p><p>3. Disable pagefile by:</p><p>· Opening the same window that says “System Properties” like you did in step 2</p><p>· This time look for the tab that says “Advanced”. There’s a section that says “Performance” there and a “Settings” button associated with it. Click the button and another window that says “Performance Options” the top-left corner will open. Below it are tabs — click the “Advanced” tab and look for a “Change” button at the bottom right. Click the “Change” button and look for the option that says “No paging file”. Select it and confirm the setting by clicking Ok</p><p>4. Disable kernel memory dump by:</p><p>· Clicking “Advanced” on the “System Properties” page</p><p>· There’s a “Startup and Recovery” option. Click the associated “Settings” button, click the button and a “Startup and Recovery” window will open. Look for a “Write debugging information” dropdown, click it and select “(none)”. If it’s “(none)” already, skip this step</p><p>5. Disable Hibernation in Shutdown Settings by:</p><p>· Searching for “power options” and clicking “Power Options” when it appears</p><p>· There’s a sidebar with about six options. Look for one that says “Choose what the power button does”. The window will display options to define power button. At the bottom of the page are inactive Shutdown settings. To make them active, look for a blue text with a shield in front that says “Change settings that are currently unavailable” and click it. The Shutdown settings will become active and you can untick the Hibernate box</p><p>6. Finally, check the root of your directory (C:\) and see if there’s a “pagefile.sys” file. If it exists, delete it and if it doesn’t, just ignore this.</p><p>Restart your system and try shrinking to see if the available shrink space increased.</p><p>Comment to ask questions and make suggestions. Be sure to share this post and also follow us on our social media platforms. Stay tuned for more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fffa50535d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Basic Data Types — Integers and Floats (Numbers)]]></title>
            <link>https://medium.com/@terajournal/python-basic-data-types-integers-and-floats-numbers-654d817450dc?source=rss-11ae72a9d956------2</link>
            <guid isPermaLink="false">https://medium.com/p/654d817450dc</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[TeraJournal]]></dc:creator>
            <pubDate>Tue, 02 May 2017 02:35:59 GMT</pubDate>
            <atom:updated>2017-05-02T03:04:30.301Z</atom:updated>
            <content:encoded><![CDATA[<p>We’ll be taking a good look at Python’s simplest built-in data types:</p><ul><li>Integers (whole numbers)</li><li>Floats (decimal numbers)</li></ul><p>Each type has specific rules for its usage and is handled differently by the computer.</p><p>&lt;&lt;Note: It is assumed you have python installed and running on your computer as the examples below are to be run through the Python IDLE or any environment that can execute Python commands. If not, please read our post on <a href="http://www.terajournal.com/blog/install-and-run-python">installing and running python</a>.</p><h3>Numbers</h3><p>Python has built-in support for integers (whole numbers like 89 and 3000000) and floating point numbers (decimal numbers like 93.5, 105.5 and 1.87e4). Calculations can be done on combination of numbers with the basic operators on the table below:</p><h3>Operator</h3><h3>Description</h3><p>+Addition-Subtraction*Multiplication/Division//Integer (truncating) Division%Modulus (remainder)**Exponentiation</p><h3>Integers</h3><p>Any sequence of digits in Python is assumed to be a literal integer. Even plain zero (0) is allowed:</p><pre>&gt;&gt;&gt; 5<br>5<br>&gt;&gt;&gt; 0<br>0</pre><p>But you can’t put zero in front of other digits:</p><pre>&gt;&gt;&gt; 05<br>    File &quot;&lt;stdin&gt;&quot;, line 1<br>        05<br>          ^<br>SyntaxError: invalid token</pre><p>What the interpreter returns when you put zero in front of other digits is called a Python Exception — it’s how Python alerts you that there’s a program error rather than just crashing the program as we have it in some languages. It’s a warning that 05 is an “invalid token” in this case. You’ll see many more examples of exceptions in posts to come as they’re Python’s main error handling mechanism.</p><p>A sequence of digits specifies a positive integer and if you put a + sign before digits, nothing changes. To specify a negative integer, put a dash (-) before the digits:</p><pre>&gt;&gt;&gt; 123<br>123<br>&gt;&gt;&gt; +123<br>123<br>&gt;&gt;&gt; -123<br>-123</pre><p>Python allows you to do normal arithmetic, like you would with a calculator, by using the operators listed in the table above. They all work as you’d expect:</p><pre>&gt;&gt;&gt; 10 + 6<br>16<br>&gt;&gt;&gt; 10 + 6 + 10 + 4<br>30<br>&gt;&gt;&gt; 10 - 6<br>4<br>&gt;&gt;&gt; 6 - 10<br>-4<br>&gt;&gt;&gt; 10 + 6 + 5 - 3 - 8 + 4<br>14<br>&gt;&gt;&gt; 10 * 6<br>60<br>&gt;&gt;&gt; 10 * 6 - 10 + 4<br>54</pre><p>As you can see, you can include as many numbers and operators as needed. Know that, you need not have a space between numbers and operators. Including spaces only makes it look better and easier to read.</p><p>I didn’t show anything on division because division is a quite interesting. It comes in two flavours:</p><ul><li>/ is used to perform floating point (decimal) division</li><li>// is used to perform integer (truncating) division</li></ul><p>Dividing an integer by an integer using / gives a floating point result and using // gives an integer result. Here’s what I’m saying:</p><pre>&gt;&gt;&gt; 13 / 5<br>2.6<br>&gt;&gt;&gt; 13 // 5<br>2</pre><p>Note that, dividing any integer by 0 with either kind of division causes a Python exception. See what I mean:</p><pre>&gt;&gt;&gt; 13 / 0<br>Traceback (most recent call last):<br>    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>ZeroDivisionError: division by zero<br>&gt;&gt;&gt; 13 // 0<br>Traceback (most recent call last):<br>    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>ZeroDivisionError: integer division or modulo by zero</pre><p>All the examples you’ve seen so far used literal integers. Literal integers and variables that have been assigned integer values can be mixed. See what I mean:</p><pre>&gt;&gt;&gt; a = 64<br>&gt;&gt;&gt; a<br>64<br>&gt;&gt;&gt; a - 4<br>60</pre><p>When I said a — 4, I didn’t assign the result back to a, so the value of a won’t change:</p><pre>&gt;&gt;&gt; a <br>64</pre><p>If you’d like to change a, do this:</p><pre>&gt;&gt;&gt; a = a - 4<br>&gt;&gt;&gt; a<br>60</pre><p>Beginners usually find this very difficult because school math though us to think of equality when we see =. In Python, the expression on the right side of = is solved first, then assigned to the variable on the left. Think of it this way:</p><ul><li>Subtract 4 from a</li><li>Assign the result of the subtraction to a temporary variable</li><li>Assign the value of the temporary variable to a</li></ul><p>Let’s see this with the interactive interpreter:</p><pre>&gt;&gt;&gt; a = 64<br>&gt;&gt;&gt; temporary = a - 4<br>&gt;&gt;&gt; a = temporary<br>&gt;&gt;&gt; a<br>60</pre><p>Any arithmetic operator can be combined with assignment by putting the operator before the =. For statements like a = a — 4 and b = b + 12, you’ll have a -= 4 and b += 12 respectively. Remember this, any arithmetic operator can be combined with the assignment operator. Try them out to see how they all work.</p><h3>Operator Precedence</h3><p>How do you know the Python operator precedence rules? There’s a simple acronym that some smart people derived sometimes ago, it’s PEMDAS. PEMDRAS is the short form of Parentheses, Exponentiation, Multiplication, Division (float division comes before integer division though), Remainder, Addition and Subtraction. It was derived for easy remembrance. But there’s more to precedence than this, trust me.</p><p>Wanna know how I save myself a lot of trouble? How I never have to look up to these rules? I just add parentheses to group my code as I want the calculation to be carried out. This way, anyone reading my code (or your code, if you decide to use my style) doesn’t have to guess its intent or look up precedence rules that won’t always be readily available.</p><h3>Bases</h3><p>Unless a prefix is used to specify another base, integers are assumed to be decimal (base 10). You might not need to use other bases, but you’ll probably come across them in Python code somewhere, sometime.</p><p>In Python, you can express literal integers in three bases besides decimal:</p><ul><li>0b or 0B for binary (base 2)</li><li>0o or 0O for octal (base 8)</li><li>0x or 0X for hexadecimal (base 16)</li></ul><p>Let’s try these bases with the interactive interpreter:</p><pre>&gt;&gt;&gt; 10<br>10<br>&gt;&gt;&gt; 0b10<br>2<br>&gt;&gt;&gt; 0o10<br>8<br>&gt;&gt;&gt; 0x10<br>16</pre><p>If you’re wondering what “digits” base 16 uses, they are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f. 0xa is a decimal 10 and 0xf is 15. Add 1 to 0xf and you’ll get 0x10 (decimal 16).</p><p>Numbers in a different base other than 10 are useful in bit-level operations.</p><h3>How big is an int?</h3><p>The size of an int was limited to 32 bits in Python 2. This was enough to store any integer in the range -2,147,483,648 to 2,147,483,647. A long (a kind of data type) had even more room: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. In Python 3, the long data type doesn’t exist and an upgraded int which can be any size — even greater than 64-bits. So you can say something like 10**100 (10**100 is called a googol, and it was the original name of Google before those behind renaming it decided to use Google for the sake of easier spelling). In many languages, this would cause an integer overflow — a situation where a number is in need of more space than a computer allows for it, and this usually has bad effects. With Python, you don’t have to worry about things like this.</p><h3>Type Conversion</h3><p>Use the int() function to convert other data types to an integer. The function simply keeps the whole number and discards any fractional part (if any). Here’s what I mean:</p><pre>&gt;&gt;&gt; int(93.5)<br>93</pre><p>Python’s simplest data type, the boolean, has only True and False values. When converted to integers, they result in 1 and 0. See what I’m saying:</p><pre>&gt;&gt;&gt; int(True)<br>1<br>&gt;&gt;&gt; int(False)<br>0</pre><p>Converting an integer to an integer won’t change a thing. Here’s how to convert a string that contains only digits, (possibly with + or — signs):</p><pre>&gt;&gt;&gt; int(&#39;39&#39;)<br>39<br>&gt;&gt;&gt; int(&#39;-20&#39;)<br>-20</pre><p>If you try to convert something that doesn’t look like a number, you’ll get an exception. Also know that, int() will make integers from floats and strings of digits, but won’t handle strings containing decimal points. Try this to get an exception thrown at you.</p><p>If you mix numeric types, Python will automatically convert for you. See what I mean:</p><pre>&gt;&gt;&gt; 16 + 3.0<br>19.0</pre><p>Finally, the boolean value False is interpreted as 0 or 0.0 when mixed with integers or floats, and True is interpreted as 1 or 1.0:</p><pre>&gt;&gt;&gt; True + 14<br>15<br>&gt;&gt;&gt; 14.0 + False<br>14.0</pre><h3>Floats</h3><p>There is nothing much going on here. You already know that floating point numbers (called floats in Python) have decimal points. They are also handled almost the same way integers are handled — any of the aforementioned operators can be used on them.</p><p>Like the int() function, float() is used to convert other data types to floats. Converting an integer to a float makes the integer possess decimal points. You can also convert a string having characters that would be valid floats — digits, signs, decimal points, or e followed by an exponent — to a real float. Here what I’ve been saying:</p><pre>&gt;&gt;&gt; float(98)<br>98.0<br>&gt;&gt;&gt; float(&#39;99&#39;)<br>99.0<br>&gt;&gt;&gt; float(&#39;75.5&#39;)<br>75.5<br>&gt;&gt;&gt; float(&#39;-47.5&#39;)<br>-47.5<br>&gt;&gt;&gt; float(&#39;1.0e4&#39;)<br>10000.0</pre><p>This will be all on Floats and Integers. Feel free to drop your suggestions and questions in the comment section below and don’t forget to follow to share this post, like, comment and follow us on our social media platforms. Stay Tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=654d817450dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python — Objects, Variables and Names]]></title>
            <link>https://medium.com/@terajournal/python-objects-variables-and-names-8c45a775f97e?source=rss-11ae72a9d956------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c45a775f97e</guid>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[TeraJournal]]></dc:creator>
            <pubDate>Tue, 02 May 2017 02:34:53 GMT</pubDate>
            <atom:updated>2017-05-02T02:34:53.221Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Qg4YudnCY6yWtNV-flGqEQ.jpeg" /></figure><p>In Python, everything — talking ‘bout simple data types, large data structures, functions and even programs — is implemented as an object. This is why Python has a consistency (and useful features) that other languages don’t have.</p><p>&lt;&lt;Note: It is assumed you have python installed and running on your computer as the examples below are to be run through the Python IDLE or any environment that can execute Python commands. If not, please read our post on <a href="http://www.terajournal.com/blog/install-and-run-python">installing and running python</a>.</p><h3>Let’s talk about Objects</h3><p>Think of objects as clear plastic boxes that contain something (in this case, pieces of data). An object has a type, like Boolean or String (more on various data types later), that determines what can be done with the data it is housing. An object will tell you certain things. For instance, if an object has a data that is of type int (short for integer), you know that there are certain operations you can perform on that data — like adding it to another data of type int.</p><p>Classes are definitions (blueprints) of objects. In Python, “class” and “type” pretty much mean the same thing. There’ll be a future post dedicated to Classes. Watch Out!</p><p>Data type also determines if the data value in a box can be changed or not. If the data can be changed or altered, it’s said to be mutable and if it can’t be changed, it’s immutable. An immutable object can be thought of as a closed box with a clear window — you can see the value but can’t touch, alter or change it. Using the same analogy, a mutable object will be a box with a clear window — not only will you see the value, you can also touch, alter or change it.</p><p>Python is strongly typed — which means the type of an object doesn’t change, even if it’s mutable.</p><h3>Let’s move on to Variables</h3><p>Languages let you define variables. Variables are names that reference values in the computer’s memory that you can define for use in programs. In Python, = is used to assign a value to a variable. You might ask: why do many programming languages, Python included, use = for assignment after we learnt in school math that = means equal to? One reason is that standard keyboards lack logical alternatives such as left arrow key and = didn’t seem too confusing. Also, in computer programs, you use assignment much more than you test for equality.</p><p>The two-line Python program below assigns the integer 3 to a variable named x and then prints the value associated with x:</p><pre>&gt;&gt;&gt; x = 3<br>&gt;&gt;&gt; print(x)<br>3</pre><p>Please note a very important point about variables in Python: variables are just names. Assignments don’t copy a value, they just associate a name with the object that contains the data. The name is a reference to a thing rather than the actual thing. Think of a name as a sticky note. We’ll take a deeper look at References later (after we might have taken a deeper look at the various data types in Python).</p><p>Let’s try this with the interactive interpreter:</p><pre>&gt;&gt;&gt; x = 3<br>&gt;&gt;&gt; print(x)<br>3<br>&gt;&gt;&gt; y = x<br>&gt;&gt;&gt; print(y)<br>3</pre><p>3 was assigned to the name x — this created an object box containing integer value 3. The value of x was printed, then x was assigned to y — making y also stick to the object box containing 3. The value of y was then printed.</p><h3>Naming conventions</h3><p>In Python, variable names can only contain these:</p><ul><li>Lowercase letters (a — z)</li><li>Uppercase letters (A — Z)</li><li>Digits (0–9)</li><li>Underscore (_)</li></ul><p>Names can’t begin with a digit and you mustn’t use any of Python’s reserved words as variables names. To take a quick look at all of these reserved words, do this on the interactive interpreter:</p><pre>&gt;&gt;&gt; import keyword<br>&gt;&gt;&gt; print(keyword.kwlist)</pre><p>When you run that, you’ll get a list of all Python reserved words that you shouldn’t use as variable names. If you try using any of these, you’ll get a syntax error. These words, alongside some punctuations, are used to define Python’s syntax. You’ll see all of as we progress in Python on this blog.</p><p>Please feel free to drop your comments below and don’t forget to share this post, like, comment and follow us on our social media platforms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c45a775f97e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Enable Hibernation in Ubuntu]]></title>
            <link>https://medium.com/@terajournal/how-to-enable-hibernation-in-ubuntu-ebf1fbfd7634?source=rss-11ae72a9d956------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebf1fbfd7634</guid>
            <category><![CDATA[features]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[TeraJournal]]></dc:creator>
            <pubDate>Tue, 02 May 2017 02:27:02 GMT</pubDate>
            <atom:updated>2017-05-02T02:27:44.679Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s the thing, Ubuntu doesn’t include the option “Hibernate” alongside other power options by default. Confirm this by clicking the Gear Menu — the Gear at the top right of the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*GGUXlDlP4iYRTSnt." /></figure><p>When I first installed Ubuntu and discovered that there’s no such thing as Hibernate among the power options, I went online to see how I could go about it and I found that I could use my terminal by typing a certain command. The command:</p><p>sudo systemctl hibernate</p><p>will hibernate your computer provided it’s used on a Linux system (Ubuntu in this case) via a terminal.</p><p>I felt good about this but I got tired as time went on because I had to type this command each time I would like to hibernate my computer. I checked the net again, this time for a permanent solution and I found that I could add Hibernate to the power options that were already available in the Gear Menu. All I had to do was create a file with the name com.ubuntu.enable-hibernate.pkla and add the following to it:</p><pre>[Re-enable hibernate by default in upower]</pre><pre>Identity=unix-user:*</pre><pre>Action=org.freedesktop.upower.hibernate</pre><pre>ResultActive=yes</pre><pre>[Re-enable hibernate by default in logind]</pre><pre>Identity=unix-user:*</pre><pre>Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit</pre><pre>ResultActive=yes</pre><p>Be sure to add the statements above without any mistakes. After that, you should move the file to the directory where it should be. It should be in a directory with the name 50-local.d and the path to the directory is /etc/polkit-1/localauthority/50-local.d. You won’t be able to access the directory normally, you need certain security privileges to get to it. To get the needed privileges, open your Terminal and type:</p><p>sudo nautilus</p><p>You might be wondering what the sudo command (which you came across when you started reading this post) is and what Nautilus is. sudo is basically used to run commands and execute programs with the security privileges of the superuser or simply put, sudo is used to run commands and execute programs as the root user (Don&#39;t quote me but maybe the SU in SUDO means Super User and the DO just means do).</p><p>Nautilus is the name of the default file manager in Ubuntu.</p><p>The command above will ask for your password. When it asks, supply your password and the file manager will open automatically. The just-opened file manager will give you access to every file and folder, including those you won’t be able to access on a normal day. Now that you have access, find your way to the 50-local.d folder( /etc/polkit-1/localauthority/50-local.d in case you forgot I already put that above.) and paste the com.ubuntu.enable-hibernate.pkla file you created. Restart your computer and check the Gear Menu for the hibernate option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*5CJANzjOb3tYFq26." /></figure><p>I hope this worked for you, if it didn’t, go through this tutorial again or drop your comment.</p><p>Don’t forget to comment and be sure to share this post and also follow us on our social media platforms.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebf1fbfd7634" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick REGEX reference]]></title>
            <link>https://medium.com/@terajournal/quick-regex-reference-938d5705de87?source=rss-11ae72a9d956------2</link>
            <guid isPermaLink="false">https://medium.com/p/938d5705de87</guid>
            <category><![CDATA[regex]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[search]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[TeraJournal]]></dc:creator>
            <pubDate>Fri, 14 Apr 2017 08:31:58 GMT</pubDate>
            <atom:updated>2017-04-14T08:34:32.163Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*hspMDQmwgNLJV0nFCKvu3g.jpeg" /></figure><p>According to <a href="https://en.wikipedia.org/">Wikipedia</a>, <a href="https://en.wikipedia.org/wiki/Regular_expression">Regex (or regular expression, or regexp)</a> is, in theoretical computer science and formal language theory, a sequence of characters that define a search pattern. Usually this pattern is then used by string searching algorithms for “find” or “find and replace” operations on strings.</p><p>In other words, regular expression or regex is a way to search, match or compare a string to another by matching patterns and not exact characters. For instance, if we have a sentence: “TeraJournal is a top tech blog”, you could match another string such as “I love technology” by declaring regex rules that instructs the program or the computer to match if both strings contain the characters “t”, “e”, “c”, “h” in that sequence. So yes, regex works through rules defined by the programmer.</p><p>This post is supposed to be a reference for the programmer who already knows regex. If you are looking to learn regex or know what it is, there are many paid and free books and resources online, a simple google search will help. <a href="https://regexone.com/">Regexone</a> is a good place for the beginner, intermediate and advanced regex programmer, be sure to check it out to get started.</p><p>Now to business, the reference:</p><ul><li>\d -&gt; Match digit.</li><li>\w -&gt; Match any alphanumeric character.</li><li>\s -&gt; Match white space (i.e, TAB SPACE, NEWLINE).</li><li>^ -&gt; Specifies that the matching should start at the beginning of the specified string.</li><li>. -&gt; Matches any single character except a NEWLINE.</li><li>$ -&gt; Match the end of the specified string..</li><li>{} -&gt; Holds the number of characters to match (e.g. #\d{3}# will match 234).</li><li>{min, max} -&gt; Specifies the range of number of characters to match (e.g. #\d{2,5}# will match 93, 49432, 624,7804).</li><li>+ -&gt; The preceding character must appear one or more times.</li><li>* -&gt; The preceding character can appear zero or more times.</li><li>? -&gt; The preceding character can appear only once or not at all.</li><li>[] -&gt; Specifies range of characters to match (e.g. #[0-3]# will match 0, 1, 2 and 3 while #[f-h]# will match f, g and h).</li><li>[^] -&gt; Specifies range of characters not to match (e.g. #[0-3]# will match every other characters except 0, 1,2 and 3 while #[f-h]# will match every other characters except f, g and h).</li></ul><h3>Reserved REGEX characters</h3><ul><li>. -&gt; period (full stop sign)</li><li>? -&gt; question mark</li><li>+ -&gt; plus sign</li><li>[ -&gt; opening square bracket</li><li>( -&gt; opening bracket</li><li>) -&gt; closing bracket</li><li>^ -&gt; caret</li><li>$ -&gt; dollar sign</li><li>| -&gt; vertical pipe</li><li>\ -&gt; back slash</li><li>/ -&gt; forward slash</li><li>* -&gt; asterisk</li></ul><p>Thanks for reading to this point. If there is an error with any of the things I mentioned above or anything you feel I left out, please feel free to drop your comment below.</p><p>Please don’t forget to share this post, like, comment and follow us on our social media platforms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=938d5705de87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install and Run Python]]></title>
            <link>https://medium.com/@terajournal/install-and-run-python-d3321f4c35ce?source=rss-11ae72a9d956------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3321f4c35ce</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[TeraJournal]]></dc:creator>
            <pubDate>Mon, 10 Apr 2017 22:54:26 GMT</pubDate>
            <atom:updated>2017-04-10T22:54:26.537Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python 2 or Python 3</h3><p>Python 2 has been around for quite sometime — much longer than Python 3 — and it comes preinstalled on Apple and Linux systems. It’s been an excellent language but nothing is perfect. In many areas (computer languages in this case), some mistakes are trivial and easy to correct , whereas others are very difficult to fix. Hard fixes aren’t compatible: new programs written with them won’t work on old Python system, and old programs written before the correction won’t work on the new Python system.<br>The Benevolent Dictator for Life (BDFL) and the creator of this great language, Guido Van Rossum alongside some other people decided to bring all the hard fixes together and call it Python 3. Python 2 is past and Python 3 is the future of the language. The last version of 2 is 2.7 which will be supported for a long time, but it’s the end of the line (there will be no version 2.8 after 2.7, just like there was 2.7 after 2.6). New development will be in 3.<br>Everything I will be saying about Python will feature Python 3. If you’ve been using 2, there isn’t much difference. The most important change is the handling of Unicode Characters (more on this later). Conversion of popular Python software has been gradual, but now I think a tipping point has finally been reached.<br>I decided to talk about this because I think it will be the biggest issue that will confront a newbie.</p><h3>Installing Python</h3><p>Windows doesn’t have Python at all, and OS X, Linux and Unix tend to have old versions. Until they start coming with Python 3, you’ll probably need to install Python 3 yourself. At the time of this writing, the most recent stable version at the time of writing is Python 3.6.1. There are many sources of Python and many ways to install a new version. However, I’ll only describe just a way and that is — going to the official language site to get the standard interpreter and libraries.</p><h3>Install Standard Python</h3><p>With your web browser, visit the <a href="https://www.python.org/downloads/">Python download page</a>. It tries to guess your OS and present the appropriate choices, but if it guesses wrong, you can use these:</p><ul><li><a href="https://www.python.org/downloads/windows/">Python Releases for Windows</a></li><li><a href="https://www.python.org/downloads/mac-osx/">Python Releases for Mac OS X</a></li><li><a href="https://www.python.org/downloads/source/">Python Source Releases (Linux and Unix)</a></li></ul><p>Click the Download link for the most recent version. In our case, it’s version 3.6.1. This takes you to an information page. You’ll need to scroll down to get to the actual release-specific page. You can now click the correct version for your computer.</p><h3>Mac OS X</h3><p>To download a .dmg file, click the Mac OS X 64/32-bit installer link. After the download completes, double-click it and a window with four icons will open. Right-click Python.mpkg and then, in the dialog box that opens , click Open. Step through the legalese by clicking the Continue button three or more times and when the appropriate dialog box opens, click Install. You’ll find your just installed Python 3 in /usr/local/bin/python3 and your preinstalled Python 2 will be untouched.</p><h3>Windows</h3><p>Download either of these for Windows:</p><ul><li>Windows x86–64 exe installer (64-bit)</li><li>Windows x86 exe installer (32-bit)</li></ul><p>Be sure to determine whether you have a 32-bit or a 64-bit Windows. To check, just click Start and search “msinfo32” (without the quotes). Check for System Type in the list of items on the right-hand side (it’s usually the 7th or 8th item in the list). If the value is x64-based PC, then you have a 64-bit version of Windows, else you have a 32-bit version of Windows.<br>Click the appropriate installer (.exe file). After downloading, double-click it and follow the installer directions.</p><h3>Linux or Unix</h3><p>Users of Linux and Unix systems have a choice of compressed source formats:</p><ul><li>XZ compressed source tarball</li><li>Gzipped source tarball</li></ul><p>Download either of them (depends on you). Decompress it by using tar(.xz file) or tar(.tgz file) and you can run the resulting shell script.</p><h3>Running Python</h3><p>After successfully installing Python 3, you can now use it to run various Python programs. There are actually two main ways of running a Python program</p><ul><li>Use the interactive interpreter — it gives you the power to experiment with small programs. It allows you to type commands, line by line so you can see the results immediately. I’ll be using the interactive interpreter to show language features.</li><li>Use Python files — for every other thing. With Python files, you can store your programs in text files (which must end with the .py extension) and later run them by typing python followed by those filenames.</li></ul><p>The basic way to develop Python programs is by using a plain-text editor and a terminal window. You should also know that there are many good Integrated Development Environments (IDEs) for Python. The commonest is Integrated Development and Learning Environment (IDLE) which is installed alongside Python. I’ll be using plain-text displays in posts to come, sometimes I’ll show interactive terminal sessions and even pieces of Python files.<br>You’ll be typing to an actual Python system and they have got to follow legal Python syntax (else the Python programs you’ll be writing are those that you and only you understand). Instead of dropping the syntax rules on you all at once, we’ll go over them together in posts to come. Stay Tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3321f4c35ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: Let’s See]]></title>
            <link>https://medium.com/@terajournal/python-lets-see-66dd99792d4d?source=rss-11ae72a9d956------2</link>
            <guid isPermaLink="false">https://medium.com/p/66dd99792d4d</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[TeraJournal]]></dc:creator>
            <pubDate>Sun, 09 Apr 2017 01:31:40 GMT</pubDate>
            <atom:updated>2017-04-09T01:36:32.524Z</atom:updated>
            <content:encoded><![CDATA[<h4>Python is a programming language and before anything else, I’d like you to know that programming isn’t some mystical stuff. It’s just about learning and mastering the right words and rules.</h4><p>I’ve worked with several languages over the last two years and I’m just so fond of Python. I really don’t know why. Everything about Python is very natural, like a recipe.</p><p>I know you’re thinking if it’s really worth the time and effort so let me take you to school. Python has actually been around since 1991 (longer than Java), and it’s consistently in the top 10 most popular languages. The “Big Boys” in the computer world (you know what I mean) actually pay people to write Python programs. It has a hand in almost any serious thing you use everyday — talking ‘bout Google, Dropbox, YouTube, Netflix, Hulu, you name it. It’s got a reputation for productivity that appeals to fast-moving organizations and it is found in many computing environments, including:</p><ul><li>The command line</li><li>Mobile devices</li><li>Embedded devices</li><li>Backend servers in support of huge popular sites</li><li>The Web (on client and server sides)</li><li>The Cloud</li><li>GUIs (including the Web)</li></ul><p>Python programs range from a single script to million-line systems. As time goes on, I’ll be showing its uses in websites, system administration and data manipulation. Also, I’ll be showing you its specific use in arts, science and business.</p><h3>Which is which? Python or some other language</h3><p>Let’s compare Python against other languages.</p><p>Python versus:</p><p>C and C++ — these are low-level languages and they are used when speed is most important. They’re crazy as hell, harder to learn and also require the programmer to keep track of details that may lead to bugs that are hard to find.</p><p>Java and C# — they succeeded C and C++ and they avoid some of their problems but they’re verbose and restrictive.</p><p>Perl — it was the all-purpose dynamic language (more on dynamic languages later) for years. It is powerful and has extensive libraries but what to do about the awkward syntax? It even lost momentum to my beloved Python and Ruby in the last few years.</p><p>Ruby — a more recent language that borrows a little from Perl and is popular mostly because of Ruby on Rails (a web development framework). It’s used in many areas as Python and the choice of using one over the other comes down to taste or libraries available for a particular application.</p><p>PHP — is very popular for web development as it makes it easy to combine HTML and code. The language has a number of “how do I put it?” — WAIT FOR IT! — gotchas (that’s the word) and it hasn’t caught on as a general language outside of the web.</p><h3>I said “more on dynamic languages” earlier. Let’s take a quick look.</h3><p>Some languages carry too many syntactic stuffs. Most times, they’re referred to as static languages because they let you specify low-level details for the computer. They’re static because variables in such languages can’t ever change their type: they’re static. An integer will forever be an integer, there’s usually no going back.</p><p>Au contraire, dynamic languages (often referred to as scripting languages like Python) don’t force you to declare variable types before they can be used. Dynamic languages know that 12 in a statement such as r = 12, is an integer: thus r is too. They let you accomplish tasks in fewer lines of code. (I mean it when I say “fewer lines”. I’ve heard the same thing about some languages and frameworks and when I checked them out, I started crying and rolling on the floor because I was deceived.) Instead of being compiled like static languages, they’re interpreted by a program called an interpreter. They might be slower than compiled languages but their speed improves as their interpreters become more optimized. They were once used to write glue code (that is, short programs (scripts) that prepare data for processing by longer programs written in static languages). Though they are well suited for this purpose, they can now handle most large processing tasks as well.</p><h3>Why still Python of all languages?</h3><p>Let me convince you with few reasons:</p><ul><li>It’s a general-purpose, high level language</li><li>Its design makes it very readable</li><li>Being readable makes it easier to learn and remember</li><li>Being easier to learn and remember makes it more writable</li><li>It’s got a gentle learning curve that makes its user productive sooner</li><li>It’s got depths its user can explore as expertise is gained</li><li>Its relative terseness makes it possible to write a program that’s smaller than its equivalent in a static language</li><li>It’s the most popular language for introducing Computer Science courses in top colleges around the world</li><li>It’s also the most popular language for evaluating programming skill by thousands of employers</li><li>It’s free (yeah, like speech). Anything can be written with Python and used anywhere freely</li><li>It runs almost everywhere and has “batteries included” — many useful built-in functions</li><li>And the unexpected reason: people just love programming with it, rather than treating it as just another tool to get things done</li></ul><h3>When not to use Python</h3><p>It’s not the best for every situation. It’s not installed everywhere (we’ll discuss installing it if it’s not already on your computer later).</p><p>It’s fast enough for most applications but might not be fast enough for more demanding ones. If your program is CPU bound, a C or C++ program will run faster than its Python equivalent, but not always. Here’s why:</p><ul><li>The standard Python interpreter is written in C and can be extended with C code</li><li>Python interpreters are becoming faster</li><li>A better algorithm (step wise approach) in Python beats an inefficient C algorithm</li><li>In many applications, a program accomplishes nothing useful while awaiting response from server across a network. The CPU (responsible for all calculations) is barely involved, so end-to-end times between static and dynamic programs will be close</li><li>You might be in a situation whereby you have an extremely demanding application and no matter what Python doesn’t meet your needs. In that case, accept my ALL THE BEST! Usual alternatives are C, C++ or Java, but a newer language Go (Python-like but performs like C) could be an answer.</li></ul><p>Looks like I even hyped Python the more. Don’t mind me, I think I’m biased. Next we’ll be talking about Installing and Running Python. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66dd99792d4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>