Blog

Acquia Dev Desktop and the Drupal 7 test runner

Posted on: 2015-11-15 14:01:47

Recently, I tried to run some tests locally and the test runner kept silently failing. Ultimately, it was just giving up during bootstrap. The problem was eventually traced to Acquia's frustrating modification of the settings.php file; it only loads when $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] is defined.

So in order to make it run, you'll need to:

  1. Define DEVDESKTOP_DRUPAL_SETTINGS_DIR in your CLI environment or:
  2. Modify run-tests.sh to populate that value in $_SERVER before bootstrapping Drupal:
$_SERVER['HTTP_USER_AGENT'] = 'Drupal command line'; $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = '/Users/myusername/.acquia/DevDesktop/DrupalSettings';

Then the test runner will actually do something useful.

Continue reading...

Technological pendulums

Posted on: 2015-11-09 06:53:47

I believe the future of technology is very much a return to simplicity that it seems like every generation or two we end up harkening back to. Modernity, for all of its marvels, feels like it is teetering on collapse. Personally, I see this in all over our society which can't seem to make up it's mind on what it wants. And if modern society could be defined by anything at this time, it'd be by a form of self-opposing delusion. People want security guaranteed by the government and also personal privacy. People want full personal autonomy to live their life as they see fit yet and yet feel obliged to force other's hands using the government when they find it hard to do so. We want the government to be a club for our cause yet so many forget the truth source and purpose of that government.

As it is with society, so also with technology with which society is so intertwined. We want blazing fast, ubiquitous, uninterrupted service but we want it delivered to us without any of the hard work which is required to build and maintain those services. And when a company like AT&T, Time Warner, or Grande Communications provides those services, someone will inevitably complain and emphatically declare what they want and why they are right and why they, the customer, is always right. I suppose we do truly live in an age of consumerism—where the customer is always right. And guess what? We are all customers now.

The pendulum has swung away from the BBSes of old: where groups of individuals combined their efforts to create autonomous, distributed, and personal networks of systems that were capable of transferring email across the world before the internet was in every home, so now it beckons to swing back the other direction. Yes, the pendulum is now seemingly at the very opposite of end of its swing. Where we are now is in an age of consumer demanded centralization: give me one store, one medium, one device that does everything. If it stops working or breaks, I'll throw it away and find another. And if I want it to continue to work, I'll pay exorbitant sums so that someone else can take care of it.

And what do we get for this? Little (if any) privacy. Being at the whim of masked men who wield digital armies and can take down your business for seemingly any reason.

Continue reading...

All code (and coding) is moral

Posted on: 2015-10-19 09:53:02

So I was reading through some blogs this weekend and came across an article about VW on the Clean Code blog. It's a short post and I suppose if you wanted a summary blurb, it would be this:

I think that argument is even more asinine than Michael Horn's. They knew. And if they didn't know, they should have known. They had a responsibility to know.

All too often, we tend to separate the code we write from what it does. In writing open-source Drupal modules, it might be very easy to try to say that there is a certain neutrality about what we do. Take for instance, one of my lowly modules Permission Report. All this module does it take existing information and display it to the user. It doesn't modify any values. And you could say that what it doesn't isn't good or bad—that it's morally neutral.

However, if something were wrong with my program, people would say something. If it were hiding certain roles or providing bad information, it could be an innocent mistake or it could be something malicious. But it would be flawed. The code itself would be bad. And we are no longer in neutral territory. If the code doesn't get changed, the code will be marked as such and it will eventually be replaced or forgotten by the community.

My point is, we don't do this for code that is "morally neutral." All code has some moral capacity in it. This parallels tangible objects such as cars, knives, and baseball bats which have a particular purpose but can be wielded in negligent or malicious ways. Likewise, open source code projects that have modules can be likewise wielded in ways that might align with or otherwise diverge from what we as individuals consider to be good, right, or true.

Now, for a module in a particular open source project that does a particular purpose: sending emails or handling a transaction, it could be used in a project that ultimately disagrees with our own worldview. However, the module itself with it's general quality, tests, and other functionality might be considered morally good, but the resulting use of it might be considered likewise to be morally wrong. But the point is that we didn't write the resulting use, we wrote the intended use and someone else wrote the final moral component. That doesn't change the fact that what we wrote was morally good, just that someone took something good and misused it. There is a difference between creating something good and having it's usage corrupted by circumstances and crafting the corrupting circumstances.

Circling back to the VW article, I'd like to make two points, then:

  1. As a programmer, we have a right—perhaps even a responsibility—to understand what the purpose is for what we are building. I think this is clear from what the author is saying. I would agree with this statement.
  2. Therefore, as a programmer, we have a right to decline work which we personally disagree with. While not stated explicitly, if the argument is that a programmer can and should be held responsible for code they wrote, then they should have the ability to decline to do so on the basis of legal or personal moral dissonance.

Programming, then, is a moral activity and should be treated as such by all who engage in it. Are we ready for this discussion?

Continue reading...

Recreate Drupal's users table from url_alias table

Posted on: 2015-08-19 22:36:38

So I needed to recreate a truncated users table to stop the Drupal admin from barfing all over the admin... the url_alias table has the UID and the user names in it... so why not?

INSERT INTO users SELECT REPLACE(source, 'user/', '') AS uid, REPLACE(alias, 'users/', '') AS name, SHA1('nothing') AS pass, CONCAT(REPLACE(alias, 'users/', ''), '@no.none') AS mail, '' AS theme, '' AS signature, 'filtered_html' AS signature_format, -- make sure this is okay 0 AS created, 0 AS access, 0 AS login, 1 AS status, NULL AS timezone, 'en' AS language, 0 AS picture, CONCAT(REPLACE(alias, 'users/', ''), '@no.none') AS initial_size, NULL AS data FROM url_alias WHERE source LIKE "user/%" -- Only grab users AND source != "user/1" -- But not user 1

I didn't need the emails to be anything useful.

Continue reading...

Using Acquia DevDesktop with a site that has domain access and multiple languages

Posted on: 2015-06-01 15:53:25

Acquia DevDesktop can be pretty slick at times for development, but if you're trying to work with a site that has domain access AND internationalization, you may be scratching your head a bit.

First off, you must correct the entries for the default site (or whichever site you're testing) in the domain and languages tables.

But then...

You'll need this patch since Drupal 7.x Core doesn't handle port numbers properly.

Then your site will work!

Continue reading...

Redirect checker script

Posted on: 2015-04-22 09:37:32

Here's a quick script I wrote to test redirects. Useful if you're trying to... test if your redirects are working properly.

<script src=\"https://gist.github.com/nvahalik/d07a27666b0ac0112e01.js\"></script> Continue reading...

Drupal: Community at the cost of code

Posted on: 2015-04-15 09:18:05

I'm probably the last person who should be writing something like this, seeing as how my interest in Drupal is and has always been one from a perspective that it was the best tool for the job. In many ways, I'm part of the (probably) unquantified mass of people who use Drupal on a daily basis, depending on it for my livelihood but being altogether indifferent toward the community. I mean, it's not that I don't like community, but in general I tend to associate with communities who have a particular purpose or shared interest and whose values end goals are reflect my own. This is probably why my local church and amateur radio club get the most attention of my time when I'm on my own time—so I'll be honest and just say that in general I'm indifferent to the community that surrounds Drupal.

Why is that? Well to be fair the mission, means, and goals of both my local church and amateur radio club are pretty similar when you think about it. In a nutshell, they both have a mission to be community-focused, with a purpose to spread a particular message and offering members the ability to grow in knowledge and wisdom, with a goal of growing and making the world a better place. The only difference is what drives them. One is driven by a communal love for the gospel of Jesus Christ while the other a love for emergency preparedness and awesome toys. Both have discrete membership rules, codes of conduct, and a hierarchy that is respected and trusted.

Because let's face it, FOSS isn't something you just limit to some sort of "day job mentality" where things are generally where you left them and a particular hierarchy is set up and enforced. And while there are people who can manage that, I'm not one of those kinds of people and I'm okay with that.

Continue reading...

Quick and Easy code blocks in Google Docs

Posted on: 2015-03-09 09:53:12

Want some quick and easy code blocks in Google Docs? Just do this:

  1. Make a table.
  2. Remove the border (make it 0px), and add your background color.
  3. Add a numbered list.
  4. Right click on the list and choose "Edit prefix and suffix..."
Continue reading...

Web Weariness

Posted on: 2014-09-10 22:41:13

A while back I was doing a bit of research on web standards. Specifically, I was looking at the number of documents that were published by the W3C over time. The last several years have seen an explosion of new recommendations with everything from CSS to Web Telephony. Let's face it, the web is here to stay. Technology points to the web. The Internet of Things surrounds us.

The number of technologies that power those things seem to grow every day. Because the internet changes so rapidly, new variants of existing languages pop up, new frameworks are created and destroyed. Optimization occurs. Repos get branched. Integrations get built. New SaaS platforms get launched. Every ounce of ROI gets squeezed out.

10 years ago, a guy could learn PHP and SQL (with a little CSS & JavaScript) and build a pretty decent app. And while it's still possible for one-man-shows to build and launch a site, it's getting harder to do. Sure, the number of modules that are available for platforms like Drupal, Magento, Laravel, Symfony, ZF2, PHP, Ruby, Rails, Python, Django, Perl, Node.js, Java, etc., etc. are growing at staggering rates. Which technology you choose is a matter of personal preference, but Polyglots are fairly normal to come across in most shops now. This is practically a requirement and not just a sign of someone who loves this stuff.

Why is this the case?

Three observations.

  1. Websites being built are getting more complex and intricate because a bigger internet means you must differentiate yourself.
  2. The code bases and toolsets required to build those complex and intricate things are getting larger and more diverse.
  3. The knowledge required to use those code bases is also expanding, but perhaps not as rapidly since frameworks help to make interop better.

The one-man-custom shop is slowly dying. You can still do well focusing on a particular piece of the puzzle, but the expectation that one person can do it all is quickly becoming less of a reality. It's a full-time job just to keep up with the changes, let alone spending the time to actually implement them.

So the conundrum that I see right now is that while things are getting easier to build, they are requiring more complexity. And that complexity seems to be winning in terms of where the "how much do I have to know to build this" gauge is moving.

Sometimes I yearn for something simpler: Needing only a language or two. Solid, one-way approaches to implementation. Solving real problems instead of trying to figure out how to not pull your hair while accomplishing something that should be simple.

Continue reading...

PyAudioMixer: A more versatile Python Audio Mixer

Posted on: 2014-09-07 22:43:24

When I came across swmixer, it seemed it answered 90% of my needs for a mixer for an amateur radio application I was working on. However, the one thing that it didn't support that was a deal breaker was that only one mixer could be set up. This was no bueno.

The wonderful thing about swmixer, though, was that it seemed like it would lend itself well to being more objectified so that more than one mixer could be set up. And that's exactly what happened.

PyAudioMixer is a fork of swmixer with the following changes (roadmap items in italics):

  • Multiple discrete mixers
  • Microphone as a channel (with volume control)
  • Frequency and DTMF Generators
  • Support for unlimited length (live) audio streams (partially completed)
  • Mixer to mixer I/O
  • Output to file
  • Network transport & codec support

Patches and comments are welcome!

Continue reading...