science and technology Override window.alert By davidwalsh.name Published On :: Tue, 11 Feb 2020 03:39:58 +0000 For years the only bit of feedback web developers could get was via alert("{str}") calls. These days we have the web console but, in rare cases, we don’t have a console and alert calls are our only window into a value at a given time. One problem: if an alert sneaks into production code, your […] The post Override window.alert appeared first on David Walsh Blog. Full Article JavaScript Quick Tips
science and technology Land Your Dream Job with Vettery (Sponsored) By davidwalsh.name Published On :: Mon, 17 Feb 2020 11:13:30 +0000 Whether you’re an experienced pro or someone new to the industry, finding a great job can be a scary, stressful process. Engineers and designers get inundated with Hacker Rank tests, portfolio requests, and a variety of other queries. Vettery improves the experience for free agents by creating an atmosphere where businesses reach out to you! […] The post Land Your Dream Job with Vettery (Sponsored) appeared first on David Walsh Blog. Full Article Sponsored _HideInContentAds
science and technology Lazy Object Initialization By davidwalsh.name Published On :: Mon, 17 Feb 2020 13:13:33 +0000 The Firefox DevTools underlying code, which is written with JavaScript and HTML, is a complex application. Due to the complexity and amount of work going on, the DevTools team has done everything they can to load as little as possible. Furthermore the team has a system of lazily importing and initializing objects when they’re needed. […] The post Lazy Object Initialization appeared first on David Walsh Blog. Full Article JavaScript
science and technology View Mac Calendar from Command Line By davidwalsh.name Published On :: Mon, 24 Feb 2020 12:28:44 +0000 As someone that loves using UI tools, I do pride myself in learning how to accomplish the same feats from command line. Don’t believe me? Check out my Command Line tutorials section — I guarantee you’ll learn quite a bit. Recently I learned that you can view basic calendars from command line with the cal […] The post View Mac Calendar from Command Line appeared first on David Walsh Blog. Full Article Shell
science and technology How to Specify User Agent with cURL By davidwalsh.name Published On :: Tue, 25 Feb 2020 11:06:35 +0000 Over the years I’ve shared how to perform a number of actions with cURL: how to send POST data, how to retrieve headers, follow redirects, check GZIP encoding, and more. Another useful cURL directive is sending the user agent, as some servers respond with different content or headers depending on the user agent. Let’s have […] The post How to Specify User Agent with cURL appeared first on David Walsh Blog. Full Article Quick Tips Shell
science and technology How to Set a Default Commit Message By davidwalsh.name Published On :: Mon, 02 Mar 2020 15:23:46 +0000 Having a default commit message is really useful for a number of reasons: It can formalize your commit messages It serves as a good reminder for the information you should add to your commit message, like issue number If you set it to “Drunk AF, don’t accept this” To set a default commit message on […] The post How to Set a Default Commit Message appeared first on David Walsh Blog. Full Article git Quick Tips Shell
science and technology Hex Opacity Table By davidwalsh.name Published On :: Fri, 06 Mar 2020 02:29:44 +0000 We’ve used hex colors for years but 8-digit hexadecimal is still relatively new. While rgba is simple to understand, 8-digit hex is more difficult, as you need to provide a hex representation of a numeric value. The following is a hexadecimal chart of opacity! Opacity Value Hex Code 100 FF 99 FC 98 FA 97 […] The post Hex Opacity Table appeared first on David Walsh Blog. Full Article CSS Quick Tips
science and technology Tips for Working Remotely and Enjoying It! By davidwalsh.name Published On :: Mon, 09 Mar 2020 17:09:10 +0000 With the coronavirus spreading and employers telling employees work from home if possible, there are scores of people getting their first taste of working remotely. Depending on your experience and discipline levels, this could be a welcomed change or a complete culture shock. The amount of freedom your find yourself in can be similar the […] The post Tips for Working Remotely and Enjoying It! appeared first on David Walsh Blog. Full Article Theory / Ideas
science and technology How to Simulate Long HTTP Requests By davidwalsh.name Published On :: Tue, 17 Mar 2020 14:40:48 +0000 It happens less frequently these days but there are times when we need to accommodate for a HTTP request timing out. The service could be down, under heavy traffic, or just poorly coded, or any host of other issues. Whenever I need to simulate a long HTTP request, I use a bit of PHP to […] The post How to Simulate Long HTTP Requests appeared first on David Walsh Blog. Full Article PHP Quick Tips
science and technology How to Cancel a Fetch Request By davidwalsh.name Published On :: Tue, 17 Mar 2020 18:25:29 +0000 JavaScript promises have always been a major win for the language — they’ve led to a revolution of asynchronous coding that has vastly improved performance on the web. One shortcoming of native promises is that there’s no true way to cancel a fetch…until now. A new AbortController has been added to the JavaScript specification that […] The post How to Cancel a Fetch Request appeared first on David Walsh Blog. Full Article AJAX JavaScript Promises
science and technology Teamstack: Easy Automation of Identity Management (Sponsored) By davidwalsh.name Published On :: Mon, 23 Mar 2020 17:19:26 +0000 Access management can be a bit of a nightmare, especially when we realize that we rely on a number of different, independent services that power our organizations. Many businesses use Gmail for email, Google Docs for documents, Slack for communication, GitHub for their codebase, etc. Yet each of these services provides their own permissions screens, […] The post Teamstack: Easy Automation of Identity Management (Sponsored) appeared first on David Walsh Blog. Full Article Sponsored
science and technology 5 Essential git Commands and Utilities By davidwalsh.name Published On :: Thu, 26 Mar 2020 16:20:37 +0000 For many of us, git and GitHub play a huge role in our development workflows. Whenever we have a tool that we need to use often, the more fine-tuned we can make that tool, the faster we can get things done. The following are five git commands or helpers that can make your developer life […] The post 5 Essential git Commands and Utilities appeared first on David Walsh Blog. Full Article git
science and technology Detect git Directory with Bash By davidwalsh.name Published On :: Thu, 02 Apr 2020 15:02:47 +0000 One interesting aspect of working at Mozilla is that Firefox lives in a mercurial repository while several other projects live on GitHub in a git repository. While most focus on either Firefox or another project, I switch between both, leaving me running git commands inside the mercurial repository and hg commands inside git repos. It’s […] The post Detect git Directory with Bash appeared first on David Walsh Blog. Full Article git Shell
science and technology How to Create a CSS-Tricks Custom Scrollbar By davidwalsh.name Published On :: Mon, 13 Apr 2020 12:41:20 +0000 Chris Coyier of CSS-Tricks is an amazing engineer and blogger. He’s not only creative but has always had the drive to put his thoughts to work, no matter how large. He also has a good eye for the little things that can make CSS-Tricks or your site special. One of those little things is his […] The post How to Create a CSS-Tricks Custom Scrollbar appeared first on David Walsh Blog. Full Article CSS
science and technology JavaScript Picture-in-Picture API By davidwalsh.name Published On :: Tue, 14 Apr 2020 12:08:11 +0000 As a huge fan of media on the web, I’m always excited about enhancements to how we can control our media. Maybe I get excited about simple things like the <video> tag and its associated elements and attributes because media on the web started with custom codecs, browser extensions, and Flash. The latest awesome media […] The post JavaScript Picture-in-Picture API appeared first on David Walsh Blog. Full Article HTML5 JavaScript
science and technology How to Add Native Keyword Aliases to Babel By davidwalsh.name Published On :: Thu, 16 Apr 2020 12:09:13 +0000 Those of you who follow this blog know that not every blog post is an endorsement of a technique but simply a tutorial how to accomplish something. Sometimes the technique described is probably not something you should do. This is one of those blog posts. The Babel parser is an essential tool in the web […] The post How to Add Native Keyword Aliases to Babel appeared first on David Walsh Blog. Full Article JavaScript Theory / Ideas
science and technology How to Play Retro Game ROMs on Windows By davidwalsh.name Published On :: Mon, 20 Apr 2020 13:27:53 +0000 Video games are always a fun time, something we desperately need during our COVID lockdown. A few years back I shared how to play retro games on Mac, as well as how to patch games to play popular ROM hacks like Grand Poo World and Invictus. One disadvantage that Macs have, however, is performance — […] The post How to Play Retro Game ROMs on Windows appeared first on David Walsh Blog. Full Article Games
science and technology Track Your Keyword Placement with Ranktrackify (Sponsored) By davidwalsh.name Published On :: Mon, 27 Apr 2020 16:17:10 +0000 I don’t need to tell you how important search engine placement is. You either earn it with quality content, loads of SEO work, paying for placement, or all of the above. And even we you achieve best placement, you need to be wary of your content becoming stale or someone else coming along with a […] The post Track Your Keyword Placement with Ranktrackify (Sponsored) appeared first on David Walsh Blog. Full Article Sponsored
science and technology How to Display Mode-Specific Images By davidwalsh.name Published On :: Mon, 04 May 2020 13:05:43 +0000 Now that we have most of the basics of HTML and CSS in the browser, we’ve begun implementing new features that I would consider “quality of life” improvements, many of which have been inspired by mobile. One great example is the CSS prefers-color-scheme media query, which allows developers to cater their design to system theme […] The post How to Display Mode-Specific Images appeared first on David Walsh Blog. Full Article CSS Quick Tips
science and technology How to Fix ESLint Errors Upon Save in VS Code By davidwalsh.name Published On :: Wed, 06 May 2020 03:05:49 +0000 Two of the most prominent utilities in web development today are ESLint and Microsoft’s Visual Studio Code. I enjoy using both, and I love the integration between both tools, but warnings from ESLint inside Visual Studio Code aren’t fulfilling — I’d rather lint errors be fixed each time I save. Complete the following steps to […] The post How to Fix ESLint Errors Upon Save in VS Code appeared first on David Walsh Blog. Full Article JavaScript Quick Tips
science and technology How We Built The World Wide Web In Five Days By adactio.com Published On :: Wed, 16 Oct 2019 14:20:40 GMT This talk about recreating the first ever web browser was a joint presentation with Remy Sharp, delivered at the Fronteers conference in Amsterdam in October 2019. Full Article worldwideweb history cern nexus browsers web30 amsterdam fronteers conference speaking presentation talking hypertext html http networks remysharp medium:id=e0e325217955
science and technology Building The Web By adactio.com Published On :: Sat, 14 Dec 2019 02:47:47 GMT An interview conducted by Vitaly Friedman ahead of the 2019 View Source conference in Amsterdam. Full Article interview web frontend development standards browsers future trends complexity simplicity diversity medium:id=295018f056e6
science and technology The Layers Of The Web By adactio.com Published On :: Fri, 20 Dec 2019 14:53:02 GMT The opening presentation from the Beyond Tellerrand conference held in Berlin in November 2019. Full Article btconf presentation talk conference layers web history serviceworkers goingoffline cern frontend development medium:id=5180e9538b09
science and technology Building By adactio.com Published On :: Wed, 22 Jan 2020 16:20:16 GMT The opening presentation from the New Adventures conference held in Nottingham in January 2019. Full Article building layers language metaphors architecture engineering frontend development web design history longnow newadventures naconf2019 conference presentation talk transcript medium:id=5cfabe6afacc
science and technology 09/22:10 EST Warning to Sheep Graziers for Northern Country, North Central, North East, South West, Central, West and South Gippsland and East Gippsland forecast districts By www.bom.gov.au Published On :: Sat, 09 May 2020 12:10:53 GMT Full Article
science and technology 09/16:01 EST Frost Warning for North East and East Gippsland forecast districts By www.bom.gov.au Published On :: Sat, 09 May 2020 06:01:47 GMT Full Article
science and technology 09/16:50 EST Cancellation Severe Weather Warning for East Gippsland, North East and West and South Gippsland Forecast Districts. By www.bom.gov.au Published On :: Sat, 09 May 2020 06:50:22 GMT Full Article
science and technology Duetting as a collective behavior By hdl.handle.net Published On :: 2016-01-01T00:00:00Z Duetting as a collective behavior Logue, David M.; Krupp, Daniel B. Mated birds of many species vocalize together, producing duets. Duetting behavior occurs at two levels of organization: the individual level and the pair level. Individuals initiate vocalizations, answer their mates’ vocalizations, and control the structure and timing of their own vocalizations. Pairs produce duets that vary with respect to duration, temporal coordination, and phrase-type combinations, among other properties. To make sense of this hierarchical structure, organize duetting research, and identify new avenues of investigation, we advocate a “collective behavior” approach to the study of duets. We critically review key terminology in the duetting literature in light of this approach, and elucidate six insights that emerge from the collective behavior approach: (1) Individual-level behaviors describe pair-level behaviors, but the opposite is not true; (2) The level of organization informs how we test for the rules that govern behavior; (3) Functional hypotheses about duetting must distinguish individual from group characters; (4) Stimulus-response, cybernetics, and entrainment offer alternative hypotheses for the cognitive control of duetting behavior; (5) Avian duetting has the potential to be a model system for the ontogeny of vocal interaction; and (6) The collective behavior approach suggests new avenues of research. Ultimately, we argue that nearly every aspect of duetting research stands to benefit from adopting a collective behavior approach. This approach also has applications to other forms of interactive vocal communication in birds and primates, including humans. Sherpa Romeo green journal. Open access article. Creative Commons Attribution License (CC BY) applies. Full Article
science and technology Chorus song of the indri (Indri indri: Primates, Lemuridae): Group differences and analysis of within-group vocal interactions By hdl.handle.net Published On :: 2013-01-01T00:00:00Z Chorus song of the indri (Indri indri: Primates, Lemuridae): Group differences and analysis of within-group vocal interactions Baker-Medard, Merrill S. A.; Baker, Myron C.; Logue, David M. The loud chorus songs of the group-living lemur Indri indri are a striking feature of rainforest areas of eastern Madagascar. Despite some research on the conspicuous vocal display of the indri, two hypotheses have not been addressed: do groups differ in the acoustic properties of their songs, and is there evidence of coordinated singing between individuals within groups. We recorded and analyzed the songs of three indri groups to examine these two questions. To answer the first question, we made quantitative spectral measures on songs of the three groups and performed multivariate analyses of the acoustic features of the notes constituting the songs. Our results showed songs of the three groups differed significantly, although there was overlap between groups. To answer the second question, we classified note types and quantified their occurrence as overlapping and abutting pairs. We found non-random associations between sequential note types in all three indri groups. These associations were consistent among groups, suggesting that individuals follow consistent answering rules when contributing to choruses. Whether indris use acoustic group identifiers in management of behavioral strategies and how within-group coordinated note production might function remain unknown. We compare our results to a number of taxonomically diverse species that live in groups and broadcast chorus and duet vocal signals. Open access article. Creative Commons Attribution 4.0 International License (CC BY 4.0) applies. Full Article
science and technology A locally funded Puerto Rican parrot (Amazona vittata) genome sequencing project increases avian data and advances young researcher education By hdl.handle.net Published On :: 2012-01-01T00:00:00Z A locally funded Puerto Rican parrot (Amazona vittata) genome sequencing project increases avian data and advances young researcher education Oleksyk, Taras K.; Pombert, Jean-Francois; Siu, Daniel; Mazo-Vargas, Anyimilehidi; Ramos, Brian; Guiblet, Wilfried; Afanador, Yashira; Ruiz-Rodriguez, Christina T.; Nickerson, Michael L.; Logue, David M.; Dean, Michael; Figueroa, Luis; Valentin, Ricardo; Martinez-Cruzado, Juan-Carlos Background: Amazona vittata is a critically endangered Puerto Rican endemic bird, the only surviving native parrot species in the United States territory, and the first parrot in the large Neotropical genus Amazona, to be studied on a genomic scale. Findings: In a unique community-based funded project, DNA from an A. vittata female was sequenced using a HiSeq Illumina platform, resulting in a total of ~42.5 billion nucleotide bases. This provided approximately 26.89x average coverage depth at the completion of this funding phase. Filtering followed by assembly resulted in 259,423 contigs (N50=6,983 bp, longest=75,003 bp), which was further scaffolded into 148,255 fragments (N50=19,470, longest=206,462 bp). This provided ~76% coverage of the genome based on an estimated size of 1.58 Gb. The assembled scaffolds allowed basic genomic annotation and comparative analyses with other available avian whole-genome sequences. Conclusions: The current data represents the first genomic information from and work carried out with a unique source of funding. This analysis further provides a means for directed training of young researchers in genetic and bioinformatics analyses and will facilitate progress towards a full assembly and annotation of the Puerto Rican parrot genome. It also adds extensive genomic data to a new branch of the avian tree, making it useful for comparative analyses with other avian species. Ultimately, the knowledge acquired from these data will contribute to an improved understanding of the overall population health of this species and aid in ongoing and future conservation efforts. Sherpa Romeo green journal. Open access article. Creative Commons Attribution 2.0 (CC BY 2.0) applies Full Article
science and technology Aggressiveness and size: a model and two tests By hdl.handle.net Published On :: 2011-01-01T00:00:00Z Aggressiveness and size: a model and two tests Logue, David M.; Takahashi, April D.; Cade, William H. Individual variation in aggressive behavior in animals might be caused by adaptive covariation with body size. We developed a model that predicts the benefits of aggressiveness as a function of body size. The model indicated that individuals of intermediate sizes would derive the greatest benefits from being aggressive. If we assume that the cost of aggression is approximately uniform with respect to body size, selection should favor higher aggression in intermediate-sized individuals than in large or small individuals. This prediction was tested by stimulating male Madagascar hissing cockroaches, Gromphadorhina portentosa, with disembodied antennae and recording the males’ aggressive responses. Antennae from larger males evoked weaker responses in subjects, suggesting that males obtained information about their opponents’ size from the opponents’ antennae alone. After accounting for this effect, we found support for the key prediction of our model: aggressiveness peaked at intermediate sizes. Data from actual male-male interactions validated that the antenna assay accurately measured aggressiveness. Analysis of an independent data set generated by staging male-male interactions also supported the prediction that intermediate-sized males were most aggressive. We conclude that adaptive covariation between body size and aggressiveness explains some interindividual variation in aggressiveness. Sherpa Romeo green journal. Permission to archive final published version Full Article
science and technology New Book- The HTML and CSS Workshop: A New, Interactive Approach to Learning HTML and CSS By feedproxy.google.com Published On :: Wed, 11 Dec 2019 15:48:40 +0000 I only wrote a chapter in this new book, The HTML and CSS Workshop: A New, Interactive Approach to Learning HTML and CSS, but it is a new book and my name is on it and it’s on Amazon, so it’s still ???? cool. I wrote the chapter on Themes, Colors, and Polish. Here’s what […] Full Article CSS HTML books my-work
science and technology Buy Two of my Books (eBook format) for $5 at Packt By feedproxy.google.com Published On :: Tue, 17 Dec 2019 02:52:03 +0000 News flash! Both Mastering SVG and The HTML and CSS Workshop are available as eBooks for $5 starting today. Full Article CSS HTML JavaScript mastering svg my-work svg
science and technology Working From Home For The First Time in 3 Years – Expect Some Writing/Open Source From Me By feedproxy.google.com Published On :: Tue, 17 Mar 2020 14:03:21 +0000 Like many of you I’m working from home for a while. As a mental health strategy, I’m going to do some writing and coding in the hour or so I get back each day from not having to commute. The first post, which will follow today, will be my thoughts on working from home. I […] Full Article Site
science and technology Connecting VS Code to an EC2 Instance Using Remote – SSH By feedproxy.google.com Published On :: Thu, 19 Mar 2020 14:26:13 +0000 I use VS Code almost exclusively now. It’s the best editor for Angular and TypeScript and that’s where I spend most of my time these days. It’s also a pretty good all-around editor, so even when I’m not working in TypeScript I still use it. I recently found the need to edit a WordPress theme […] Full Article Web aws vs-code
science and technology 10 Years of HTML5 Boilerplate By feedproxy.google.com Published On :: Thu, 30 Apr 2020 14:43:51 +0000 While we’re preparing an upcoming release, I didn’t want the day to go by without mentioning that ten years ago today, HTML5 Boilerplate was released. Here’s the story of the project as we wrote it up a few years ago. The History of HTML5 Boilerplate Sometime in 2009… “Wouldn’t it be great if we created […] Full Article HTML Web h5bp
science and technology Real-Time Search in JavaScript By osvaldas.info Published On :: What I meant was scanning the DOM of a page for text equivalents and showing the actual parts of the page, as well as hiding the irrelevant ones. I came up with the technique when I was designing Readerrr’s FAQ page. Take a look at the example: I have also implemented the solution here on my blog. How it works All simple. Let’s take the FAQ page as an example. Here’s a typical markup: <h1>FAQ</h1> <div class="faq"> <input type="search" value="" placeholder="Type some keywords (e.g. giza, babylon, colossus)" /> <ul> <li id="faq-1"> <h2><a href="#faq-1">Great Pyramid of Giza</a></h2> <div> <p>The Great Pyramid of Giza <!-- ... --></p> <!-- ... --> </div> </li> <li id="faq-2"> <h2><a href="#faq-2">Hanging Gardens of Babylon</a></h2> <div> <p>The Hanging Gardens of Babylon <!-- ... --></p> <!-- ... --> </div> </li> <!-- ... --> </ul> <div class="faq__notfound"><p>No matches were found.</p></div> </div> I wrote a tiny piece of JavaScript code to handle the interaction and this is how it works: When the page loads, the script indexes the content of all li’s into browser’s memory. When a user types text into the search field, the script searches for equivalents among the indexed data and hides the corresponding li’s where no equivalents were found. If nothing found, a message is shown. The script highlights the text equivalents by replacing phases, for example, babylon becomes <span class="highlight">babylon</span>. Now, try it yourself: Demo Taking it further Since I chose FAQ page as an example, there are some issues to deal with. Toggling the answers It is a good practice to hide the answers by default and show them only when user needs them, that is to say when they press the question: .faq > ul > li:not( .is-active ) > div { display: none; } $( document ).on( 'click', '.faq h2 a', function( e ) { e.preventDefault(); $( this ).parents( 'li' ).toggleClass( 'is-active' ); }); In the CSS part I use child combinator selector > because I don’t want to select and, therefore, to hide the elements of an answer, which may contain lists and div’s. What if JavaScript is disabled The user won’t be able to see the answers. Unless you show them by default or develop a JavaScript-less solution. To do this, take a closer look at these fragments of the markup: <li id="faq-1"> <a href="#faq-1"> The usage of fragment identifiers enables us to take the advantage of CSS’s pseudo selector :target: .faq > ul > li:not( :target ) > div { display: none; } Furthermore, the real-time search is not possible as well. But you can either provide a sever-side search possibility or hide the search field and so as not to confuse the user: <html class="no-js"> <head> <!-- remove this if you use Modernizr --> <script>(function(e,t,n){var r=e.querySelectorAll("html")[0];r.className=r.className.replace(/(^|s)no-js(s|$)/,"$1$2")})(document,window,0);</script> </head> </html> I added a class name no-js to <html> element. The <script> part removes that class name. If JavaScript support is disabled in a browser, the class name won’t be removed; therefore: .no-js .faq input { display: none; } The no-js is a very handy technique, you can use it site-wide. Improving UX If there is only one list item that matches user’s query, it is a good practice to automatically show the content of that item, without requiring to press the title. To see what I mean, head over the GIF at the beginning of the post. Hidden keywords Here on my blog I have a filterable list of blog post titles only. Each post has some related keywords assigned. So, during the search, how do I make an item discoverable even if the title does not consist of a particular keyword? For example, how can I make the entry “Real-Time Search in JavaScript” visible if a user entered “jquery”? Yes, exactly, that is adding keywords and hiding them with CSS: <li> <h2><a href="/real-time-search-in-javascript">Real-Time Search in JavaScript</a></h2> <p class="hidden-keywords" aria-hidden="true">jquery filter input html css</p> </li> .hidden-keywords { display: none; } A simple trick but not always that obvious. You will find two versions of the code in the source of the demo: without dependencies and jQuery-dependent. These versions are also divided into three groups of code so you can adapt only what your project needs. Demo Full Article
science and technology Customizing File Inputs the Smart Way By osvaldas.info Published On :: And so it happened that I published the latest post of mine on Codrops, not here this time. It’s about styling <input type="file" /> by taking the advantage of <label>. The technique is not perfect – nothing is perfect that imitates native HTML elements – but having in mind its pros & cons, I found it to be the most appropriate solution for styling file inputs. Read the article See the Demo Full Article
science and technology Drag and Drop File Uploading By osvaldas.info Published On :: When working on Readerrr, I wanted to enrich the experience of uploading an OPML file for importing feeds from other readers. There is nothing wrong with the traditional way for uploading a file, but it is a good thing to provide the alternative way – drag & drop file uploading. I've combined my experience into an article which you are very welcome to read on CSS-Tricks. Read the article Try the Demo Full Article
science and technology How to Display Publish Dates as Time Since Posted By osvaldas.info Published On :: It’s common to present dates on the Web in a format such as "Published on September 12th, 2015", or "09/12/2015 09:41:23". Each of these examples tells the full date and/or time of some kind of activity – be it a published article, or a reader comment, or perhaps an uploaded video. Date formats like this might seem perfectly reasonable. After all, they’re informative and human-readable. Well yes, but “human-readable” doesn’t necessary mean users will readily be able to understand how recently the activity has occurred. The Web is a fast-moving place, and giving your content a sense of freshness could be the key to engaging with your audience. I combined my ideas and practical solutions into an article which you are very welcome to read on SitePoint. Read the article See the Demo Full Article
science and technology Lazy Loading Responsive Adsense Ads By osvaldas.info Published On :: You've been hard at work optimizing your site. You've already done things like lazy-loading Google Maps and been wondering if there was anything else you could do. For example, is there anything we can do to improve the loading of ads? Good news, there is some things you can do. You can respect user's mobile data plan by loading ads only when they are likely to appear in the viewport zone. You can also serve ads in the right size in accordance to the screen of the device. That would be nice of you. That would not only be responsive but also responsible. I've written an article on that and got it published on CSS-Tricks. Read the article Try the Demo You can also examine the demo on CodePen and contribute, follow the project on GitHub. Full Article
science and technology Enabling CodeIgniter's Garbage Collector By osvaldas.info Published On :: My session driver of choice for CodeIgniter is database. A while ago, I noticed millions of rows in the corresponding database table. That means that garbage collector was not working. I checked config.php for sess_regenerate_destroy, but it was already set to false. It was really weird because the problem seemed to have come out of nowhere – not much ago things were working just fine. After a short investigation, I found out this was and still is a common problem for those who had upgraded their CodeIgniter version from 2.x to 3.x. Turns out, the later possesses heavy changes for Sessions library. And most importantly – fundamental changes in dealing with garbage: CodeIgniter 3.x relies on PHP's native grabage collector. So, in order to get things working again, we need to configure PHP properly. The Solution Today there are three PHP-native settings for dealing with session garbage collector. CodeIgniter's Session library has already taken care of one of them – gc_maxlifetime – so there's no need for an extra touch here. The problem lies within the rest: session.gc_probability and/or session.gc_divisor. These two determine when the garbage collector is running. Here's what php.net says: session.gc_divisor coupled with session.gc_probability defines the probability that the gc (garbage collection) process is started on every session initialization. The probability is calculated by using gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the GC process starts on each request. In my case, using ini_get() revealed the following values: 0 and 1000. The equation 0/1000=0 meant there was no chance the garbage collector would even run. Finally, I solved the problem by using the values officially stated as default and by putting the following lines of PHP code into config/config.php file: ini_set( 'session.gc_probability', 1 ); ini_set( 'session.gc_divisor', 100 ); Theoretically, this means that the garbage collector usually runs once every 100th request. It's more than enough, but it is up to you whether that causes too many unnecessary hits to database. An alternative solution for heavy-traffic websites could be having a 0% probability on the production site and a Cronjob-based script which removes database rows of the expired sessions. Full Article
science and technology Lazy-Loading Disqus Comments By osvaldas.info Published On :: Lately, I've been obsessed with optimizing performance through lazy-loading. Recently, I've written on how to lazy-load Google Maps and on how to lazy-load responsive Google Adsense. Now it's time for Disqus, a service for embedding comments on your website. It's a great service. It eliminates the headache of developing your own local commenting system, dealing with spam, etc. Recently, I've been working on implementing the widget in one of my projects. I've written an article on that and got it published on CSS-Tricks. Read the article Try the Demo You can also contribute, follow the project on GitHub. Full Article
science and technology Service Worker gotchas By osvaldas.info Published On :: Service Worker has already been here for a while: since 2015-09 it has been fully supported in Chrome/Opera and if compared to what we have today it has gone a promising way of improvements, bug fixes, became more easily debuggable and is supported much widely (hello Firefox). That led us into using the technology in production and implementing it in our kollegorna.se website, as well as some client projects. We’ve learned there quite a few gotchas to grasp in order to get Service Worker working correctly… Here is the list of what I overviewed in the article: Service Worker is a part of Progressive Web Apps What Service Worker is for Registering a Service Worker HTTPS and localhost Service Worker working scope ES6: to be or not to be? “Offline” page Service Worker lifecycle and events hierarchy Critical and non-critical resources Service Worker strategies Serving “offline” image Garbage in cache is your problem Service Worker and DOM Service Worker for multilingual website Service Worker is backend-dependent Debugging Service Worker Read the article Full Article
science and technology Service Worker for Middleman based websites By osvaldas.info Published On :: Middleman is a Ruby based static site generator which we use heavily at Kollegorna both for prototyping (checkout our Middleman boilerplate) and production sites. In my previous article on Service Worker, I overviewed the most common challenges you may face when implementing the technology. This time I’d like to dive into a single specific topic of enabling a worker on Middleman based website as there are a few things to deal with… Read the article Full Article
science and technology Container-Adapting Tabs With "More" Button By osvaldas.info Published On :: Or the priority navigation pattern, or progressively collapsing navigation menu. We can name it in at least three ways.. There are multiple UX solutions for tabs and menus and each of them have their own advantages over another, you just need to pick the best for the case you are trying to solve. At design and development agency Kollegorna we were debating on the most appropriate UX technique for tabs for our client’s website… I wrote an article, coded a demo and got it all published on CSS-Tricks — you're very welcome to read, try and use it! Read the article Try the demo Full Article
science and technology The Wiley Handbook of What Works in Violence Risk Management: Theory, Research, and Practice By www.wiley.com Published On :: 2020-02-10T05:00:00Z A comprehensive guide to the theory, research and practice of violence risk managementThe Wiley Handbook of What Works in Violence Risk Management: Theory, Research and Practice offers a comprehensive guide to the theory, research and practice of violence risk management. With contributions from a panel of noted international experts, the book explores the most recent advances to the theoretical understanding, assessment and management of violent Read More... Full Article
science and technology The Wiley Handbook of What Works in Violence Risk Management: Theory, Research, and Practice By www.wiley.com Published On :: 2020-02-10T05:00:00Z A comprehensive guide to the theory, research and practice of violence risk managementThe Wiley Handbook of What Works in Violence Risk Management: Theory, Research and Practice offers a comprehensive guide to the theory, research and practice of violence risk management. With contributions from a panel of noted international experts, the book explores the most recent advances to the theoretical understanding, assessment and management of violent Read More... Full Article
science and technology Quaternary ecology, evolution and biogeography [electronic resource] / Valentí Rull. By darius.uleth.ca Published On :: London : Academic Press, 2020. Full Article
science and technology School closures and the online preparedness of children during the COVID-19 pandemic [electronic resource] / by Marc Frenette, Kristyn Frank, and Zechuan Deng By darius.uleth.ca Published On :: [Ottawa] : Statistics Canada = Statistique Canada, 2020 Full Article