<?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 Calie Rushton on Medium]]></title>
        <description><![CDATA[Stories by Calie Rushton on Medium]]></description>
        <link>https://medium.com/@calielrushton?source=rss-743db9e1a86d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sOiJI6ta4Nruhi5rDbgAAQ.jpeg</url>
            <title>Stories by Calie Rushton on Medium</title>
            <link>https://medium.com/@calielrushton?source=rss-743db9e1a86d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 15:14:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@calielrushton/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[Christmas cards and serving hatches]]></title>
            <link>https://medium.com/@calielrushton/christmas-cards-and-serving-hatches-dddfecc8767?source=rss-743db9e1a86d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dddfecc8767</guid>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Calie Rushton]]></dc:creator>
            <pubDate>Tue, 07 May 2019 16:04:32 GMT</pubDate>
            <atom:updated>2019-05-07T16:20:28.452Z</atom:updated>
            <content:encoded><![CDATA[<h4>How I explain what I’m learning to my parents…</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*0zpt-J7io5NJlnHs8sD0lw.png" /><figcaption>courtesy of TVTropes.org</figcaption></figure><p>I’m 11 weeks into coding bootcamp and my mind is turning towards a subject for my next blog. This weekend is a little different from the previous ones — all the code challenges have been taken and passed, next week we continue working on our paired projects and then its onto the final module, the one where all our learning comes together in projects we will conceive and build by ourselves. We have all written and given our <em>Flatiron School Presents</em> presentations. There are no labs to be done in preparation for a week of lectures on an entirely new topic. It feels like the first real chance to breathe since this whole intense experience began, a brief moment of calm before module 5 kicks off. Unsurprisingly my mood is somewhat reflective.</p><p>We had a presentation in our first module, a key theme of which was perspective. It is only after you’ve travelled a way down a road that you can pause to take a look over your shoulder to see where you’ve been, to look at the same place from the opposite direction and with the wisdom and benefit of hindsight.</p><p>I don’t come from a computer-literate family, in the sense that lots of developers often seem to. In junior school we had a single BBC Micro computer in the classroom that we could take turns playing Podd on, then when the Gameboy came out me and my sister would spend hours playing Tetris and Super Mario Brothers, but I wasn’t involved in anything deeper than switching a console on or typing ‘Podd can jump’. I didn’t have any idea what programming was or how the games were made but I did love breaking things apart and putting them back together, so I ended up becoming a car mechanic.</p><p>So when I found myself changing careers many years later, my family (and at first myself) were surprised at my choice but supportive nonetheless. (My amazing mum was still playing with my Mod1 CLI game way after everyone else had drifted out of the room.) Catching up over dinners at the weekend they say “so what are you learning at the moment?”. I take a breath and think about how best to describe the stuff I’d just learned that week and wasn’t even sure how well I understood it yet.</p><p>Explaining something to someone else is a great way to check your own grasp on a subject. It’s one of the reasons we write blogs during bootcamp and beyond. I often need to relate what I’m learning to something tangible, which means my conversations with my family go something like this:</p><p>“I’m learning about how the internet works; what happens when you press a button on a webpage; how the front and back end interact.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*ZB_N4XTO1nLbzGNT8VYIIA.jpeg" /><figcaption>giphy.com</figcaption></figure><p>“The what and the what?”</p><p>“Frontend and Backend? Well, you know when you come to ours for dinner, you all sit at the table and I’m in the kitchen still, and I usually stick my head through the hatch and ask you if you want any condiments? Well you’re at the front end, the fridge is the back end, and I’m whats called a server. When you ask me for mustard, or click on a link to go to a new webpage, that’s a request from the frontend, or the ‘client’. You requested mustard so I have a look in the fridge, which is a database where all the condiments — or web pages (more specifically all the text, pictures and instructions for how to style them) are stored. Once I find it, I take it back to the hatch, stick my arm through and pass it to you… that’s the job of the server — go get the thing the client (browser) asked for, and serve it up to them so it can be looked at on the computer screen. Or in your case, spread onto your steak.”</p><p>There’s also a story about what variables are and how (and why) we pass them, explained in the context of Mum and Dad writing the Christmas cards. I’ll save that for another time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*OQgI5E0pg8zNBH9N.gif" /><figcaption>MARC M COOL STORY BRO GIF BY SICK ANIMATION</figcaption></figure><p>I have no idea if my descriptions ever actually land with them but they always nod and smile so hopefully its making a bit of sense. The trick is to know your audience and gauge how deep you can go with the technical jargon. Come to think of it, it was exactly the same if I tried to explain where that funny noise was coming from on their car.</p><p>When I realise I’m losing them, I adjust my approach but smile inwardly because I also realise that I’m getting it. The coding journey started for me when I went to my first Girls Code MK meetup just a year ago: I always thought coding was beyond me but within the hour they’d helped me display a picture of kitten, and I even knew how to change the colour of the border. I can’t wait to go back there in a few weeks armed with my newfound knowledge, and perhaps use it to help another woman or girl get started on her journey. I might need to work on my stories though.</p><h4>References and Acknowledgments</h4><p>While I was doing the bootcamp prework I found a blog post written in the plain English explanation style I relate to. It got me over a learning block so I’m eternally grateful to Betsy Sallee for writing it:</p><p><a href="https://medium.com/@ensallee/the-difference-between-sort-and-sort-by-in-ruby-253171f52b15">The Difference Between .sort and .sort_by in Ruby</a></p><p><strong>Podd:</strong></p><p>(you’ll have to click through to YouTube to watch this video)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8LYPsdBNTi8&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8LYPsdBNTi8&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2F8LYPsdBNTi8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/75d4998e7daba89292a8e447e4f2c535/href">https://medium.com/media/75d4998e7daba89292a8e447e4f2c535/href</a></iframe><p><strong>Girls Code MK — an amazing group of people who give their time to help people like me get started:</strong></p><p><a href="https://girlscodemk.co.uk/">GirlsCode MK</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dddfecc8767" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The CSS box model]]></title>
            <link>https://medium.com/@calielrushton/the-css-box-model-88592afcb82e?source=rss-743db9e1a86d------2</link>
            <guid isPermaLink="false">https://medium.com/p/88592afcb82e</guid>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Calie Rushton]]></dc:creator>
            <pubDate>Wed, 24 Apr 2019 14:03:34 GMT</pubDate>
            <atom:updated>2019-04-24T14:03:34.505Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>V Important.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*WAKPFpLlZbWoZb59-TunRQ.jpeg" /></figure><p>For most of us CSS is tricky at best, infuriatingly frustrating for the rest of the time. A huge breakthrough for me when I first started learning to code was this single revelation:</p><blockquote>Everything sits in a box</blockquote><p>That’s every heading, every paragraph, and every other element they are nested within.</p><p>Understanding the CSS box model is crucial — it underpins everything else that you learn about constructing the layout of a page. If you know what’s going on with each box and how it naturally behaves, you begin to understand what can be done with it, how to pick the most appropriate element for each task and hopefully spend less time randomly adding and removing varying amounts of margin in the hope you’ll get the outcome you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*BPVcLFwBPeCoNhjdkk141Q.gif" /><figcaption>For the sake of your blinds, learn the box model…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7g499pgB1FNiPZ-tFX7Vsw.png" /><figcaption>the box model is in the bottom right-hand corner ^^^</figcaption></figure><h4><strong>Firstly, go find the box model:</strong></h4><p>Open your browser and navigate to any webpage. Now open the Devtools by your preferred method, click on Elements, then click on any element in the HTML and in the right hand pane you’ll be able to see the box model for that element.</p><p>Here it is in more detail:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*ghmnqQBm9ewfrwezMMhDRQ.png" /><figcaption>close-up of the box model</figcaption></figure><p>The four parts of the box model are margin, border, padding and content (the blue box in the centre). The position box only appears when the position of an element is set to anything other that its default, which is static.</p><h4>Content (the blue box)</h4><p>As the name suggests, this is where all the content sits — this includes text, and any elements like images that are nested within it. The simplest way of controlling the absolute sizing of this box is with the CSS <em>width</em> and <em>height</em> properties. Use settings like <em>min-width</em> and <em>max-width</em> (and the same for height) if you want to be a little less rigid.</p><h4>Padding (the green box)</h4><p>Padding is the space immediately outside of the content area, but before the border — it may help to think of it like an inner margin, since it sits within the border. Padding is set with the CSS property <em>padding</em>, followed by <em>-top/-bottom/-left/-right</em>, then the amount you want to add, eg:</p><p><strong><em>padding-top: 1rem;</em></strong></p><p>If you don’t specify a side, the same amount of padding will be added on each side of the content in that element. Padding is especially useful for adding a bit of breathing room to text, for instance on a button, because it has the effect of pushing the border away from it.</p><h4>Border (the yellowy box)</h4><p>The border separates the margin and the padding areas (or the inner and outer margins if you wish). To alter the border there are 3 properties you can change — <em>width(</em>thickness<em>), style </em>and <em>colour</em>. As with the padding properties they can be set for one side specifically, or for all sides at once. For quickness it is possible to set all 3 properties for all 4 sides in one line:</p><p><strong><em>border: 5px solid black;</em></strong></p><p>There are lots of cool styles you can set like dotted, dashed, inset, etc. You can also set a bit of border radius to give boxes a nice rounded edge.</p><p><strong>Top-tip: </strong>to make it easier to see whats actually happening to the elements you are trying to position on a page, add a small border in varying colours and styles to each one. It removes some of the guesswork. Just set the thickness back to 0px when you’re done.</p><h4>Margin (the orangey-beigey box)</h4><p>The margin surrounds the box that the element is sitting in. Because it is on the outside of the border, it is the margin that pushes up against the nearest elements in the layout. Margin is declared in the same way as padding, either one side individually or all sides at once.</p><p>On the MDN website there’s a cool playground where you can try all these settings out:</p><p><a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Box_model#Active_learning_playing_with_boxes">The box model</a></p><h4>Elements have default values</h4><p>Something you should bear in mind when choosing an element is that many of them come with default amounts of margin or padding. You maybe never gave any thought thought to why or how an unordered list appears inset from the surrounding text…? It’s because &lt;ul&gt; elements have a default padding-left value of 40px.</p><p>If you don’t want certain characteristics by default you’ll need to set them to 0 manually. All the default values are listed here:</p><p><a href="https://www.w3schools.com/cssref/css_default_values.asp">CSS Default Browser Values for HTML Elements</a></p><h4>Total dimensions of a box</h4><p>The total width of a box is the sum of the width of its content, plus any padding (left and right), plus any border (left and right); height works the same way but with top and bottom instead of left and right. By default, any width and height you specify on an element is applied only to the content (the blue box), as we saw above. This means that if you want to think about the dimensions of a box as a whole you’d need to do that sum every time. If you want to increase the width or height you’d then need to decrease the border and/or padding accordingly to keep the overall box dimensions the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*mpf3XwCJJbIfqCfIRdxDmA.png" /><figcaption>box-sizing: border-box;</figcaption></figure><p>But what if you wanted it so that you could specify the width of the <em>entire</em> box (including the border and padding) in one dimension? Thankfully, there is a property called <em>box-sizing </em>to help with this. Use <strong><em>box-sizing: content-width;</em></strong><em> </em>to continue as just described, or choose <strong><em>box-sizing: border-box; </em></strong>to tell the browser that the width and height values are now inclusive of border and padding— now if you change the width of an element, the border and padding amounts will be automatically adjusted…no more maths for you!</p><p>Go here for a good demonstration: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing">https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88592afcb82e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Persistence of Memory]]></title>
            <link>https://medium.com/@calielrushton/the-persistence-of-memory-e90758ca390b?source=rss-743db9e1a86d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e90758ca390b</guid>
            <category><![CDATA[windows-10]]></category>
            <dc:creator><![CDATA[Calie Rushton]]></dc:creator>
            <pubDate>Wed, 10 Apr 2019 13:51:08 GMT</pubDate>
            <atom:updated>2019-04-10T13:51:08.765Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*GuAhkT0e67ieN_9tmxAB1g.jpeg" /></figure><h3>The Persistence of Memory….</h3><h4>…a brief look at Windows dumps.</h4><p>Whilst I was writing my first blog of bootcamp (which was about ways of printing to the console in Ruby) I came across the website of Michael Dvorkin, the man who came up with ‘awesome-print’. The homepage of his website is pretty striking….</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*BPF67FvQ5oUyL5mTF86W4w.png" /><figcaption>go to <a href="http://www.dvorkin.net/">http://www.dvorkin.net/</a> to see this in action…</figcaption></figure><p>A voice from over my shoulder said ‘cool, that looks like a memory dump…’, to which I said ‘what’s a memory dump?’, then I had my subject for blog three.</p><p>A memory dump happens when Windows operating system software crashes unexpectedly, an event commonly known as the ‘blue screen of death’. These ‘crash dump’ (aka ‘core dump’, aka ‘system dump’) files contain a copy of the computer’s memory at the time of the crash, so they can be used to identify what caused it in the first place.</p><h3>Types of dump files:</h3><p>There are 4 different types of memory dump; each operating system has one type set by default but this can be changed (or even switched off) in user settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*YbJDb-NaeLiWzvnqsHhqTA.png" /><figcaption>courtesy of howtogeek.com</figcaption></figure><h4>Complete memory dump</h4><p>As the name suggests, this is the largest type of dump, and therefore contains the most amount of information. The size of this file will be equal to the amount of memory in use by the computer at the time of the crash, eg a 16GB system using 8GB of memory when it crashed will produce a complete memory dump file of 8GB. For this reason, there needs to be plenty of space available to hold it…a ‘paging’ file (hidden system file on the hard disk) of adequate size, plus an additional 1MB.</p><p>When a subsequent system crash occurs, any previously stored file of this type is overwritten.</p><h4>Kernel memory dump</h4><p>The kernel is the central part of an operating system. It is the part that loads first, so it is usually stored in a protected part of memory in order to prevent it being accidentally overwritten. This type of memory dump records only the kernel memory, so the recording process is much quicker and the resulting file is much smaller in comparison to a complete memory dump, about one third in fact. Kernel memory usually takes up between 150MB and 2GB.</p><p>Because this file only includes records of memory that relates to the kernel and directly related programs, it is more useful in diagnosis because it holds information about the parts of memory that are most likely to have been involved in the reason for the crash.</p><p>Any subsequent crash will also overwrite this type of dump file unless a specific option is selected.</p><h4>Small memory dump (64 KB)</h4><p>As the name suggests, this is the smallest type of memory dump file. It requires a paging file of about 2MB and will not overwrite any previous files — subsequent files are given unique names and stored in a specific folder.</p><p>Small memory dump files don’t store a huge amount of detail, only information and context relating to the process that stopped at the time of the crash such as the stop message and a list of loaded drivers. Because it contains so little information, it is less useful in debugging that the kernel or complete types.</p><h4>Automatic memory dump</h4><p>Available from Window 8 onwards, this type of file contains the same information as a Kernel dump file. The difference is in the way the size of the paging file is set.</p><p>If paging file size is set to ‘System Managed’ and dump type is set to ‘Automatic’, Windows sets the size of the paging file to less than the size of RAM. Most of the time this will be large enough to record a Kernel dump file, but if it isn’t, Windows temporarily (for 4 weeks) increases the size of the file to match the size of RAM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*HiJCg-QL75z3lUM-tX37lA.png" /><figcaption>Setting the paging file size</figcaption></figure><p>Whichever type is enabled it is possible to use a command line utility called Dumpchk.exe, in order to check that the crash dump file was created correctly. Some basic information is provided, along with any error messages.</p><h4>Minidumps</h4><p>In addition to the above types, you will also get a minidump file (stored in the Minidump folder by default). These files show the exact driver files involved in a crash, and are pretty useful in identifying the problem that caused the crash. For this reason it isn’t recommended to turn off Minidump recordings.</p><h4>Using the stored dump file…</h4><p>So once you have the dump file, what should you do with it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q8rnQTxbto4VZiIyvCycDw.gif" /><figcaption><a href="http://blog.frizk.net/2018/03/">http://blog.frizk.net/2018/03/</a> — PCILeech</figcaption></figure><p>Unless you are a Windows developer, or you fix pc’s for a living, the larger memory dump files aren’t really going to interest you much. The average Windows user is most likely to post one to Microsoft or Symantec for diagnostic purposes. An engineer who is developing drivers may want to intentionally crash a system, which is possible with a ‘crash on demand’ utility called Bang!, or with a built-in Windows shortcut (holding down the right CTRL key and pressing the SCROLL LOCK key two times).</p><p>Minidumps on the other hand are much more useful. They can be read with a program like Blue Screen View (Nirsoft). This summarises the crash information like time, date, basic crash information that was displayed on the blue screen, stop code, along with a pointer towards which driver or module may have caused the crash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*I8Fr_ge1ghSog90boteg-g.gif" /><figcaption>courtesy of Nirsoft.com</figcaption></figure><h3>References:</h3><ul><li><a href="http://www.nirsoft.net/utils/blue_screen_view.html">Blue screen of death (STOP error) information in dump files.</a></li><li><a href="http://www.osronline.com/article.cfm%5earticle=153.htm">Downloads:BANG! -- Crash on Demand Utility</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e90758ca390b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Y2K38 !]]></title>
            <link>https://medium.com/@calielrushton/y2k38-55ac3425c4d8?source=rss-743db9e1a86d------2</link>
            <guid isPermaLink="false">https://medium.com/p/55ac3425c4d8</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Calie Rushton]]></dc:creator>
            <pubDate>Wed, 27 Mar 2019 16:52:39 GMT</pubDate>
            <atom:updated>2019-03-27T16:52:39.475Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*nf-vNPs8-cea26j-3wVesw.png" /></figure><h3><strong>Y2K38 !</strong></h3><h4><strong>Could it worse than Y2K?</strong></h4><p>Back in the late 90’s there was mass panic over the &#39;Millenium Bug’ — worry spread over how computers would cope at the turn of the century…when the calendar turned over to Jan 1st 2000, would planes really drop out of the sky?</p><p>Now we’re being warned of a possible new threat — on January 19th 2038, we could be waking up to another technological meltdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*eJWK9-8ICd68AqCZbyPaRg.png" /><figcaption>Time is a construct</figcaption></figure><p>If time isn’t real, how are digital systems dealing only in true or false supposed to handle it? Computers have to represent time in binary (1’s and 0’s), which takes up room in memory.</p><p>32-bit systems represent the time in seconds as a string of 32 1’s and 0’s, giving 4,294,967,295 different values in 4GB of memory. In reality they don’t have that many separate combinations available for time-keeping, because the actual values range from -2,147,483,648 to 2,147,483,647.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*k2-G9NVw7p1HhIfSdruZtg.gif" /><figcaption>Courtesy of TechConductor.com</figcaption></figure><p>These systems consider Jan 1st 1970 to be the beginning of time — they began counting from zero which only takes them up to 03:14:07 on 19th Jan 2038. At this point they reach the magic number of available combinations and will start counting from -2,147,483,647 back towards 0.</p><p>Computers, smart as they are, won’t be able to tell you whether it’s 1970 or 2038; they simply won’t know the difference.</p><p>While a certain Kardashian is credited with breaking the internet using only her bare behind, the honour of breaking YouTube surely goes to Korean musical sensation PSY. His hit Gangnam Style had so many views on the platform that when the counter reached 2,147,483,647 and couldn’t go any higher, the resulting ‘integer overflow’ saw the counter numbers simply spin round and round when you hovered over it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*rMRj8cRGV_ugjpukz_kkng.gif" /><figcaption>Courtesy of Mashable</figcaption></figure><h4>Is this the same problem as the Millenium Bug?</h4><p>No. Computers then were also going to run out of memory, but they had a lot less of it in the first place. The first desktop computers were using 16-bit processors (the really important bit that allows programs to run) with 64kb of memory.</p><p>When they were built, memory was expensive, so to save space programmers used 2 digit placeholders instead of 4 digits for the year portion of dates. 1978 became 78, 1999 was persisted as 99….(you can probably see where this going)…the year 2000 was going to look no different to the computer than 1900.</p><h4>So how bad is it…?</h4><p>I’ve seen it referred to as the &#39;clockopalypse’, but will it bring about the end of the world?? It depends who you ask.</p><p>For most of us, the worst we will see is the wrong date on our computer. The fix is relatively simple in most cases — the systems just need to recompiled/upgraded to 64-bit, which was YouTube’s solution to the problem with the counter (they later said it was a joke and had been fixed months before).</p><p>For embedded systems it’s a little more involved because they can’t necessarily be upgraded simply by recompiling, instead they might need to be completely replaced, so the process needs to start in plenty of time. Embedded systems are utilised mostly in long-lived applications such as infrastructure, transportation, stability control, connected cars and IOT (Internet Of Things) devices. Any dependent systems or devices, databases etc also need to be considered.</p><h4>Will this happen again?</h4><p>A comment on an article on howstuffworks.com pointed out that IBM PC hardware suffers from the Year 2116 problem. They also count in 32-bit combinations, similarly to UNIX time, but for them the beginning of time starts at January 1, 1980 so their integer overflow will happen in 2116.</p><p>Most computers available today and even some smartphones and tablets are already based on 64-bit processors and software . Their maximum number of unique values is 18 quintillion, stored in 16 <a href="http://en.wikipedia.org/wiki/Exabyte">Exabytes</a> of memory, so they are unlikely to fail for something like 292 billion years.</p><h4>References</h4><ul><li><a href="https://blogs.akamai.com/2019/01/preparing-for-y2038-already.html">Preparing for Y2038 (Already?!)</a></li><li><a href="https://computer.howstuffworks.com/question75.htm">What is the Year 2038 problem?</a></li><li><a href="https://www.theguardian.com/technology/2014/dec/17/is-the-year-2038-problem-the-new-y2k-bug">Is the Year 2038 problem the new Y2K bug?</a></li><li><a href="https://twitter.com/countdown2038?lang=en">Y2K38 bug countdown (@countdown2038) | Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55ac3425c4d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[puts, prints and more — printing to the console in Ruby…]]></title>
            <link>https://medium.com/@calielrushton/puts-prints-and-more-printing-to-the-console-in-ruby-7830cdaace0a?source=rss-743db9e1a86d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7830cdaace0a</guid>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Calie Rushton]]></dc:creator>
            <pubDate>Wed, 13 Mar 2019 16:39:12 GMT</pubDate>
            <atom:updated>2019-03-13T16:45:52.308Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*5JxVDF_N-tmfNVcrhjZbUg.png" /><figcaption>thanks to vinoth from stack overflow :)</figcaption></figure><h3><strong>puts, prints and more — printing to the console in Ruby…</strong></h3><p>Why do we need these methods in the first place?</p><p>When you run a program, Ruby will read the lines but not print anything out. If you want to display something to the person using your program (like an instruction or a request for input), or for some help with debugging your code, you’ll need to use one of these in order to tell Ruby to output that something to the console:</p><h3>puts</h3><p>Most of us, I think (me anyway) default to using <em>puts</em> also because it’s the first way of logging that comes to mind, but also because it shows our result in a nicely formatted way. There’s a reason for that: <em>puts</em> is shorthand for <em>put.to_s</em>…looks familiar, right?</p><p>When you use <em>puts</em>, Ruby calls <em>.to_s</em> on an object, converting it to a string then displaying on the screen. A neat thing about <em>puts</em> is that it adds a new line at the end of each statement so you can read it more easily.</p><p>The return value of <em>puts </em>is always nil.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*MM42jzGPU208JBspUqLOiw.png" /><figcaption>using puts to output multiple objects</figcaption></figure><p>I particularly like <em>puts</em> for debugging, I’m a fan of <em>puts</em>-ing random words all over the place so I can see where my program is running up until(or not), which helps me find the bit where the code is broken.</p><p>If you do this just remember to take them all out of your finished product 😏</p><h3>print</h3><p><em>print</em> also calls <em>to_s</em> on the object but unlike <em>puts</em> it DOESN’T add that handy line break, so if you <em>print</em> a lot of things you will see them all mashed together in the console like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*hTa2fOQ_wxsFSj9HZC7NgA.png" /><figcaption>using print on multiple objects</figcaption></figure><p>The return value of prints is also nil.</p><p>Using <em>puts</em> and <em>print</em> on the same object is a good way to illustrate the difference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ryKPngx9RxZ4S3u9cDzZhg.png" /><figcaption>using puts and print to display the same complex object</figcaption></figure><p>Notice how <em>puts</em> didn’t display the nil value?</p><h3>p</h3><p>Yes, just the letter p, all by itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*6WK-qhFAgntk9IWl" /><figcaption>COPYRIGHT scopefeatures.com</figcaption></figure><p>Where <em>puts</em> calls <em>.to_s</em> on the object, <em>p</em> calls <em>.inspect </em>(link to docs in references)<em>. </em>In the true Ruby tradition of making life easier, <em>p</em> is much nicer than writing <em>puts some_object.inspect</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*6CW9RwBg7BeCRrEC22ek2g.png" /><figcaption>p is the same as puts object.inspect</figcaption></figure><p>The return value of <em>p</em> is the object you passed to it.</p><p><em>p</em> is pretty good for debugging because you still get a sense of which class each object belongs to, since its not converting anything into a string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*KCBE7OcShBcByqM0mnuMxg.png" /><figcaption>The return value of <em>p</em> is the object you passed to it.</figcaption></figure><p>One way <em>p</em> <em>is</em> similar to puts is that it adds a line break after each object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*-OBemPqOGQ9On9W-yM2BjA.png" /><figcaption>using p to output multiple objects</figcaption></figure><h3><strong>***BONUS***</strong></h3><h4>To finish, here’s <em>pp!</em></h4><p><em>pp</em> stands for <em>pretty print</em>. It’s a rather less well-known method that you’ve possibly never heard of (I hadn’t). What it does, is call the <em>pretty_inspect</em> method on the object, arranging its contents on separate lines to make it easier to read (and debug).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*5MIogHJePwpNIyXlSvwXzg.png" /><figcaption>using pp to output multiple objects</figcaption></figure><p>Where it really comes into it’s own is by taking a complex nested object like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kHwsftg_fakFVgCCTdsJ0g.png" /><figcaption>Complex object example from <a href="https://github.com/awesome-print/awesome_print">https://github.com/awesome-print/awesome_print</a></figcaption></figure><p>…and displaying it in a format that’s much easier to read, like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6TlT35vE7S1MVvTy78aGQ.png" /><figcaption>Same object, pretty-printed</figcaption></figure><p>All of these methods are part of the Kernel module (which is included by the Object class). As of Ruby 2.5 <em>pp</em> is automatically required, for earlier versions you’ll have to require manually whenever you want to use it. Same applies whether you want to add it to a file or just use it in irb.</p><h3>***BONUS-BONUS!***</h3><h4>Awesome_print…</h4><p>Yes, someone took <em>pp</em> to the next level and came up with the ultimate console logging method for Ruby. If you use it on the complex string from the previous example, you get this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*g_6YdVobgLnsZFHjc0nqjA.png" /><figcaption>how awesome_print displays a complex object</figcaption></figure><p>Awesome_print is a Ruby library (you can install it with gem install awesome_print ) created by Michael Dvorkin. You need to enter ‘<em>require</em> <em>ap’</em> in an irb session, then you can use it in place of <em>p</em>.</p><p>As you can see it uses colour coding to discern between data types, shows the indexes of array elements and even which classes embedded objects inherit from. Most of the features can be customised, and you can even make it your default formatter for irb, Rails console and pry.</p><h4>References:</h4><ul><li><a href="https://ruby-doc.org/core-2.6.1/Object.html#method-i-inspect">Class: Object (Ruby 2.6.1)</a></li><li><a href="https://github.com/awesome-print/awesome_print">awesome-print/awesome_print</a></li><li><a href="http://www.dvorkin.net/">Michael Dvorkin</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7830cdaace0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>