I’ve searched for this before, and I’m sure I’ll do that again (although the need is not that frequent), so here it goes. It is possible to move files from one git repository to another, preserving commit history. The following links provide a few examples of how to do this:
Basically, you need git filter-branch command, usually with the –subdirectory-filter parameter.
An example of where it is useful would be the extraction of some code from a project you have into a shared library or a simple plugin.
I don’t do a lot of front-end work these days, but I am genuinely interested in approaches that help build modular systems, especially when the subject is something as messy and as context-dependent as CSS.
Recently, I came across the Block-Element-Modifier approach, aka BEM, which I find interesting.
If you’re not familiar with BEM, it’s a naming methodology that provides a rather strict way to arrange CSS classes into independent components. It stands for Block Element Modifier and a common one looks like this:
The principles are simple — a Block represents an object (a person, a login form, a menu), an Element is a component within the block that performs a particular function (a hand, a login button, a menu item) and a Modifier is how we represent the variations of a block or an element (a female person, a condensed login form with hidden labels, a menu modified to look differently in the context of a footer).
This follow-up article provides more details and examples.
Here’s a feature of composer that I didn’t know about until a few days ago – require inline alias. Here’s the example from the documentation:
"monolog/monolog": "dev-bugfix as 1.0.x-dev"
This is super useful when you have dependencies in your project that require a particular version of a third-party library or plugin, and you want to try a branch of that library or plugin. Switching to the branch alias doesn’t solve the problem, as everything that has version constraints on that requirement, will complain. With inline alias, you can alias a particular branch of the dependency as a particular version.
With inline alias, composer will fetch the branch that you want, but will assume that that branch works as a particular version that you specify, and thus satisfy all the other dependencies that require that particular version.
In my particular case, I was working on the CakePHP-based application, which was using a few CakePHP plugins (installed via composer). Those plugins require CakePHP v3+. I wanted to test a branch of CakePHP which had a particular fix I was interested in, but without disabling all the plugins. Switching my application’s composer to require a branch dissatisfied all the plugins, as now composer didn’t know if the branch that I am requiring is of the CakePHP v3 or not. Aliasing the branch to v3.4.1 (current stable version at the time) worked like a charm.
Slashdot runs a thread on “Are Remote Software Teams More Productive?“. The original post links to a few research references that, unsurprisingly, show how expensive interruptions are to programmers, and how unprepared we are, as an industry, to deal with this problem. I particularly liked a rather in-depth look at the issue in “Programmer Interrupted” article.
Like you, I am programmer, interrupted. Unfortunately, our understanding of interruption and remedies for them are not too far from homeopathic cures and bloodletting leeches.
Here are a few points, if the article is too long for you to handle:
Based on a analysis of 10,000 programming sessions recorded from 86 programmers using Eclipse and Visual Studio and a survey of 414 programmers (Parnin:10), we found:
- A programmer takes between 10-15 minutes to start editing code after resuming work from an interruption.
- When interrupted during an edit of a method, only 10% of times did a programmer resume work in less than a minute.
- A programmer is likely to get just one uninterrupted 2-hour session in a day
And also this bit on the worst time to interrupt a programmer:
If an interrupted person is allowed to suspend their working state or reach a “good breakpoint”, then the impact of the interruption can be reduced (Trafton:03). However, programmers often need at least 7 minutes before they transition from a high memory state to low memory state (Iqbal:07). An experiment evaluating which state a programmer less desired an interruption found these states to be especially problematic (Fogarty:05):
- During an edit, especially with concurrent edits in multiple locations.
- Navigation and search activities.
- Comprehending data flow and control flow in code.
- IDE window is out of focus.
Overall, not surprising at all, but it’s nice to have some numbers and research papers to point to…
WallpapersCraft is a collection of high quality desktop wallpapers / backgrounds. There are quite a few categories and tags. The search works. Tonnes of high quality wallpapers, available in a variety of resolutions. And the site is very fast. If you are in the mood for a new desktop background, I strong suggest you check it out. Here is my new choice:
A week ago I blogged about i3 window manager and my attempt to use it instead of MATE. So, how am I am doing so far?
The long story short: I love i3. It’s awesome. But I still switch back to MATE once in a while.
What’s good about i3? It’s super fast. Even faster than a pretty fast MATE. It’s keyboard navigated, and it only takes about a day to get used to enough keyboard shortcuts to feel comfortable and productive. It’s super efficient. Until I tried i3 I didn’t recognize how much time I spend moving windows around. It is unexcusable amount of time spent needlessly.
What’s bad about i3? It’s low level. In order to make it work right with multiple screens, one need to get really familiar with xrandr, the tool I last used years ago. If you are on a laptop, with a dynamic setup for the second screen (one monitor at the office, one at home, and an occasionally different project at client’s premises), you’ll need a bunch of helper scripts to assist you in quick change between these setups.
And then there is an issue of flickering desktop. The web is full of questions about how to solve a variety of flickering issues when using i3. The one that I see most often is the screen going black once in a while. Sometimes it takes a second to come back, sometimes a few seconds, and sometimes and it doesn’t come back at all. The more windows I have, spread across more workspaces, with more connected monitors – the more often I see the issues. It’s annoying, and it’s difficult to troubleshoot or even report, as I haven’t found a pattern yet, or how to reproduce the problem.
With that said though, I am now about 80% time using i3. I like the simplicity and efficiency of it. It’s so good, that I work better even without a second monitor. But when I do need a second monitor (paired programming, demos, etc), or when I have a projector connected, I switch to MATE. That’s about 20% of my time.
If Vim is your editor of choice, and WordPress is something you work with on a regular basis, then check out WordPress.vim – a Vim plugin for WordPress development.
Some of the features are:
- Auto-Completion for the WordPress API
- WordPress Hooks Integration
- WP-CLI Integration
- Jump to Definition in WordPress Core
- UltiSnips Snippets
- Syntax Highlighting for WordPress PHP files.
- Markdown Syntax Highlighting for readme.txt
- PHPCS Syntax Checker integrated with WordPress Coding Standards
- Search in Codex
- Integration with WpSeek API.
- Readme.txt Auto Validation.
Social Media Research Toolkit — a list of 50+ social media research tools curated by researchers at the Social Media Lab at Ted Rogers School of Management, Ryerson University. The kit features tools that have been used in peer-reviewed academic studies. Many tools are free to use and require little or no programming. Some are simple data collectors such as tweepy, a Python library for collecting Tweets, and others are a bit more robust, such as Netlytic, a multi-platform (Twitter, Facebook, and Instagram) data collector and analyzer, developed by our lab. All of the tools are confirmed available and operational.
Via Four short links: 14 Feb 2017.
GitHub blog is “Announcing Open Source Guides“:
we’re launching the Open Source Guides, a collection of resources for individuals, communities, and companies who want to learn how to run and contribute to open source.
Open Source Guides are a series of short, approachable guides to help you participate more effectively in open source, whether it’s:
- Finding users for your project
- Making your first contribution
- Managing large open source communities
- Improving the workflow of your project
These guides aim to reflect the voice of the community and their years of wisdom and practice. We’ve focused on the topics we’ve heard about most, and curated stories from open source contributors across the web.
I think it’s a great idea and I really like the execution too. Most of what I know about Open Source comes from years of participation, and from reading old books, manuals and licenses – not something that is easy to share with people who are just getting their feet wet.
GitHub’s Open Source Guides are very simple, concise and specific. And they cover a variety of subjects, not just the legal or technical side of things, but also communications, support, marketing, etc.
I’ve started using Let’s Encrypt for the SSL certificates a while back. I installed it on all the web servers, irrelevant of the need for SSL, just to have it there, when I need it (thanks to this Ansible role). One of those old web servers needed an SSL certificate recently, so I thought it’d be no problem to generate one.
But I was wrong. The letsencrypt-auto tool got outdated and was failing to execute, throwing some Python exception about missing zope.interface module. A quick Google search brought this StackOverflow discussion, with the exact issue I was having.
Traceback (most recent call last):
File "/root/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
from certbot.main import main
File "/root/.local/share/letsencrypt/local/lib/python2.7/dist-packages/certbot/main.py", line 12, in <module>
File "/root/.local/share/letsencrypt/local/lib/python2.7/dist-packages/zope/component/__init__.py", line 16, in <module>
from zope.interface import Interface
ImportError: No module named interface
However, the solution didn’t fix the problem for me:
Even pulling the updated version from the GitHub repository didn’t solve it.
After poking around for a while more, I found this bug report from the last year, which solved my problem.
- Running rm -rf /root/.local/share/letsencrypt. This removes your installation of letsencrypt, but keeps all configuration files, certificates, logs, etc.
- Make sure you have an up to date copy of letsencrypt-auto. It can be found here.
- Run letsencrypt-auto again.
If you get the same behavior, you can try installing zope.interface manually by running:
/root/.local/share/letsencrypt/bin/pip install zope.interface
Hopefully, next time I’ll remember to search my blog’s archives …