Feed aggregator

Ben Hutchings: Truncating a string in C

Planet Debian - Thu, 27/08/2015 - 22:10

This version uses the proper APIs to work with the locale's multibyte encoding (with single-byte encodings being a trivial case of multibyte). It will fail if it encounters an invalid byte sequence (e.g. byte > 127 in the "C" locale), though it could be changed to treat each rejected byte as a single character.

#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main(int argc, char **argv) { size_t n = 12, totlen = 0, maxlen, chlen; setlocale(LC_ALL, ""); if (argc != 2) return EXIT_FAILURE; maxlen = strlen(argv[1]); while (n--) { chlen = mbrlen(argv[1] + totlen, maxlen - totlen, NULL); if (chlen > MB_CUR_MAX) return EXIT_FAILURE; totlen += chlen; } printf("%.*s\n", (int)totlen, argv[1]); return 0; }
Categories: Elsewhere

Ben Hutchings: Truncating a string in C

Planet Debian - Thu, 27/08/2015 - 22:10

This version uses the proper APIs to work with the locale's multibyte encoding (with single-byte encodings being a trivial case of multibyte). It will fail if it encounters an invalid byte sequence (e.g. byte > 127 in the "C" locale), though it could be changed to treat each rejected byte as a single character.

#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <wchar.h> int main(int argc, char **argv) { size_t n = 12, totlen = 0, maxlen, chlen; setlocale(LC_ALL, ""); if (argc != 2) return EXIT_FAILURE; maxlen = strlen(argv[1]); while (n--) { chlen = mbrlen(argv[1] + totlen, maxlen - totlen, NULL); if (chlen > MB_CUR_MAX) return EXIT_FAILURE; totlen += chlen; } printf("%.*s\n", (int)totlen, argv[1]); return 0; }
Categories: Elsewhere

Alexander Wirt: Basic support for SSO Client certificates on paste.debian.net

Planet Debian - Thu, 27/08/2015 - 21:07

Sometimes waiting for a delayed flight helps to implement things. I added some basic support for the new Debian SSO Client Certificate feature to paste.debian.net.

If you are using such a certificate most anti-spam restrictions, code limitations and so on won’t count for you anymore.

Categories: Elsewhere

Viktor Bán: GSoC 2015 - Security Review D8 - Wrap up

Planet Drupal - Thu, 27/08/2015 - 20:05

I've spent most of this summer working on the Drupal module called Security Review. My project was porting it to Drupal 8 as part of Google Summer of Code 2015. I'm happy to say that the requirements have been met long before the end of the programme, so there was no rush at the end of the coding period.

How it all started

It all started with a simple Facebook post in my faculty's FB group. I didn't even notice it as I was too busy learning for a midterm, but thankfully my friends were kind enough to procrastinate at the time and showed me the link to GSoC. It didn't take long until I found that Drupal would be a perfect candidate for me, even without any experience related to it. So I took a leap of faith and started writing a proposal for the project that I liked most, "Port security_review to Drupal 8". I liked the cause (eliminate security vulnerabilites from misconfiguration), the freedom of designing a new architecture from scratch and the GSoC t-shirt I hope I will soon receive.

Preparation for GSoC

Drupal requires GSoC student candidates to complete the ladder called Getting Started with Drupal for GSoC Students. This is really a necessity as it teaches the basics which students will need numerous times during working on Drupal.

Finishing the ladder, I've tried to get a mentor for my project as it didn't have one, and who could be better than the module's owner!? So I went ahead and contacted coltrane, who then shortly accepted to be the mentor of the project. He is pretty awesome and helpful, I really enjoyed working with him.

Writing a good proposal might have been the hardest part of the whole project, so I advise every future student to take their time to work out a really good one. There are links to a lot of resources in the Google Summer of Code Drupal group that were really helpful, so I highly recommend future students to read everything they can find there.

After the proposal

Days went by and finally the accepted projects were announced and I could see my name in the list. Of course I celebrated the event properly, but soon I had to realize that all of this won't be easy. Finals here in Hungary started on 25th May... yes, the same as the coding period. So I went ahead and did a little work on the module before finals so that I would be able to concentrate on my studies on the first week. I was soon ready with some parts of the module that meant 1-2 weeks worth of work according to my proposal, so all I had to focus on were my finals. Writing 4 exams in 1 week and passing all of them is very hard and I don't recommend it to anyone as the stress levels get way too high, but I somehow managed to do it.

Starting the work on the second week I was so relieved that my summer had finally started and I could do what I was waiting for: coding. Of course GSoC is not just programming, there are meetings students have to attend: one every week with the organization admins (we could choose from 2 meetings, whichever worked best in our timezone) and one or more with our mentor(s). I've had all my meetings on tuesdays so that I could work more flexibly on the other days. Another thing that is required that does not involve coding is maintaining a blog. Students have to write a blog post every week about their progress in a way that anyone who is not familiar with their project or GSoC will be able to understand it, also it should be written in a Drupal Planet compatible way, so the word about GSoC can be spread.

My task was mostly doing what I wrote in the proposal's timeline, but sometimes I had to solve issues posted on my GitHub (by my mentor) and also in the Drupal.org issue queue (by the community). In the first couple of weeks I did 10-12 hours of work a day and needless to say that got me ahead of my schedule fast. Soon came the midterm evaluation and I was about 75% done with the project. The evaluation itself didn't require much interaction from my part, I just had to fill a short questionnaire about my progress and my thoughts about the project and my mentor.

The second coding period went much slower. On average I think it's safe to say that I did no more 20-30 hours of work per week. Slow weeks may sound nice at first, but aren't actually enjoyable. Still, the module got finished around week 9 or 10 and the last few weeks were spent with polishing it and looking for ways to improve it.

The results What I learnt

Before GSoC I had, let's say, pretty limited knowledge about Drupal. All I knew is that it exists. Now I'm familiar with how to operate a Drupal website, how to write modules for Drupal 7 and 8 that don't just work, but also use the technologies provided by Drupal. By learning Drupal 8 one can learn a bit about Symfony 2 too, as D8 uses a lot of S2 components.

After GSoC 2015

I have plans for Security Review 8.x-2.x, I also wish to have time to make a Drupal based website for myself to get familiar with site building using Drupal. So in conclusion I will definitely keep working with and on Drupal in the future.

Thanks

I would like to thank Slurpee and cs_shadow for dedicating their valuable times for the weekly check-in meetings that sometimes took hours and a huge thanks for Ben Jeavons (coltrane) for providing fast and valuable help and an amazing summer! Also I would like to thank drupalize.me for the free membership, it was pretty useful, I wish I started to use it sooner. And last but not least I would like to thank the Google Summer of Code organizers for the opportunity and the amazing experience.

Categories: Elsewhere

Axelerant Blog: DrupalCamp London 2015 - Inspiration, Challenge, and Passion

Planet Drupal - Thu, 27/08/2015 - 20:00

I happened to attend the DrupalCamp London 2015 held between 27th February to 1st March and was honoured to be invited for presenting a session during CXO Day.

CXO Day

The event was a huge success with around 500 attendees and a plethora of engaging sessions and workshops. The venue was quite brilliant from its modern facilities and central location perspective at City University London in Northampton Square. As in previous years, City University hosted DrupalCamp London, its location is quite apt for such a community focused event. Sessions took place in various breakout rooms while the auditorium Oliver Thompson Lecture Theatre remained reserved for keynote and other larger gathering sessions.

DrupalCamp London opened on Friday February 25th with CXO Day. While I attended most of the talks at CXO day, I mostly especially liked the sessions by Mark Taylor, CEO of Sirius, Mike Meyers - VP Large  Scale Drupal, and the ever enchanting JAM, Open Source Evangelist, Acquia at his best.

I took the opportunity of presenting a session on Consumption to Contribution - Lessons from India. The presentation was centered around India’s Drupal journey since 2010 and how organisations and individuals have evolved from being code consumers to being active contributors and participants in the Drupal project and the local community at large. I described how some of the biggest Drupal projects are being developed in part or full by Indian developers and companies. The session attracted some very interesting Q&A discussions. I had some very insightful conversations with CXOs, Business Leaders based in the UK and European regions who attended the CXO Day

Another interesting session during the DrupalCamp London 2015 - CXO day was an unconference about things which keeps CXOs up at night. All participants organised themselves into small groups and focused on discussions around topics like Hiring, EU Drupal Association, Project Management, Sales & Marketing, etc. Afterward, one representative of each group present the findings or summary of the discussion to all the participants.

CXO day ended with a reception on the campus followed by people heading towards Slaughtered Lamb for food and wine.

DrupalCamp London Itself

The main days of the DrupalCamp London were on Saturday and Sunday with a variety of knowledge sessions, workshops, exhibit corridor, etc.

On the first day, I was Interviewed by Janis Janovskis, friend and owner of Passive Management, London about the way we have built and been maintaining a distributed work culture at Axelerant. The interview was for an event called No Pants that Janis was going to present at later. His slides 35-37 mention specific takeaways of the interview.

I felt honoured when Jeffrey McGuire approached me for recording an interview with me for his infamous Acquia Podcast as part of multi-series podcast titled Karma and the journey from Consumption to Contribution - Drupal in India.

There were quite a few Interesting talks that I attended during DrupalCamp London that I thoroughly enjoyed such as:

  • Saturday Keynote by Dr Sue Black. Sue is an award-winning computer scientist, radical thinker and passionate social entrepreneur who excels at bringing people together to solve complex issues. #techmums
  • Sunday Keynote by Robert Douglass, Director of Products, CommerceGuys.
  • Mike Bell's brave talk about his long battle with ME/CFS, culminating in a breakdown and use of the UK's mental health services.
  • Kubair Shirazi's  session on Better understanding your prospects, clients, stakeholders and end users

Both days of DrupalCamp London ended with event socials at The Slaughtered Lamb on Great Sutton Street. The place was buzzing with energy all this time and some very interesting conversations flowed along with a nice collection of beers.

A Wrap.

Overall it was a great DrupalCamp London 2015! And, well worth round tripping over 10,000 kilometers from India to attend.

My special thanks go to sponsors BBC and City University London. Further applause to volunteers like Ben Wilding, Tim Deeson, George Hazlewood, Alex Burrows, Della Deme, John Kennedy, and all others for having worked so hard and to pull together such a brilliant event.

In having made some good friends, met old ones, and having interesting conversations along with insightful takeaways I am already looking forward to the 2016 DrupalCamp London.

Be sure to comment below and share of your experience at this camp.

The post DrupalCamp London 2015 - Inspiration, Challenge, and Passion first appeared on Axelerant.

Categories: Elsewhere

Ritesh Raj Sarraf: Laptop Mode Tools - 1.68

Planet Debian - Thu, 27/08/2015 - 19:39

I am please to announce the release of Laptop Mode Tools, version 1.68.

This release is mainly focused on integration with the newer init system, systemd. Without the help from the awesome Debian systemd maintainers, this would not have been possible. Thank you folks.

While the focus now is on systemd, LMT will still support the older SysV Init.

With this new release, there are some new files: laptop-mode.service, laptop-mode.timer and lmt-poll.service. All the files should be documented well enough for users. lmt-poll.service is the equivalent of the module battery-level-polling, should you need it.

Filtered git log:

1.68 - Thu Aug 27 22:36:43 IST 2015 * Fix all instances for BATTERY_LEVEL_POLLING * Group kill the polling daemon so that its child process get the same signal * Release the descriptor explicitly * Add identifier about who's our parent * Narrow down our power_supply subsystem event check condition * Fine tune the .service file * On my ultrabook, AC as reported as ACAD * Enhance lmt-udev to better work with systemd * Add a timer based polling for LMT. It is the equivalent of battery-polling-daemon, using systemd * Disable battery level polling by default, because most systems will have systemd running * Add documentation reference in systemd filesThe tarball is available @ http://samwel.tk/laptop_mode/tools/downloads/laptop-mode-tools_1.68.tar.gz The md5 checksum for the tarball is 15edf643990e08deaebebf66b128b270
  Categories: Keywords: Like: 
Categories: Elsewhere

Drupal Association News: Global Training Days - August 2015 Summary

Planet Drupal - Thu, 27/08/2015 - 19:15

Global Training Days last weekend was a great success. There were 33 hosts from 21 countries who stepped up to introduce new people to Drupal in both half and full day sessions.

Drupal Global Training Day, Drupak, Peshawar Pakistan from Azmat Shah on Vimeo.

Thank you to the training companies, local groups, and site hosts who made the event possible. We were particularly excited to host a training at the Drupal Association office and we have to thank Gregory Boggs of ThinkShout for leading the full day training. Thanks to Gregory's good work, I started my week with a note from an attendee that said "I learned a lot, all while having a wonderful time!" It doesn't get much better than that.

Check out the photos and updates at #DrupalGTD on Twitter. See the full list on our GTD 2015 page along with reports from the trainers as they come in.

We have one more GTD weekend this year: November 14th-15th. Join the 17 hosts who have already committed to train new Drupalers at https://assoc.drupal.org/sign-participate-drupal-global-training-days. Give a training in your community to get everyone started off in the right direction with Drupal.

Personal blog tags: Drupal Global Training Day
Categories: Elsewhere

Drupal Watchdog: When Howard Met Ronnie

Planet Drupal - Thu, 27/08/2015 - 18:40

As it says on the t-shirt, I’M NOT HIM.

Okay, I know I look a lot like Howard Stern.

And yes, I spent a pleasant hour chatting with him and Robin on his show that one time. (The video is somewhere on YouTube, but don’t ask.)

And yes, I auditioned for America’s Got Talent. (Three thumbs-up votes, one thumbs-down.)

And okay, yes, I’ve obligingly posed for thousands of selfies with Stern-fans.

But I’M NOT HIM! I’m not leading a double-life as Drupal Watchdog editor and the King of All Media.

Yes, but what if...?

So here’s a spoof Bob Williams and I made during DrupalCon Los Angeles. Yeah, I know, the audio on the elevator kinda sucks, but the acting!

The acting – and Ronnie Ray’s Drupal expertise.

(Photo by Myles Brawer)

Images:  Video: 
Categories: Elsewhere

Acquia Developer Center Blog: 10 Ways Drupal 8 Will Be More Secure

Planet Drupal - Thu, 27/08/2015 - 18:20

Security is very hard to bolt on to any software or product after it has been built. Building it into the core of the code helps to avoid mistakes, and thus the upcoming release of Drupal 8 tries to build in more security by default, while still being usable for developers and site builders. This list of 10 security improvements is not exhaustive - some are just a line or two to handle an edge case, and there are others I may have overlooked. I've contributed to a number of these improvements, but they reflect overall the community consensus as well as reactions to problems that required security releases for Drupal core or contributed modules in the past. For each point I've tried to include a link or two, such as the Drupal core change record, a documentation page, or a presentation that provides more information. Some of these may also be possible to back-port to Drupal 7, to benefit you even sooner. A "7.x back-port" link indicates that.

For context on why these 10 improvements are important, I looked at past security advisories (SAs) as well as considering the kind of questions we get here at Acquia from companies considering adopting Drupal. In terms of past SAs, cross-site scripting (XSS) is the most commonly found vulnerability in Drupal core and contributed modules and themes.

  1. Twig templates used for html generation

    This is probably first on the list of anyone you ask about Drupal 8 security. This is also one of the most popular features with themers.



    One security gain from this is that it enforces much stricter separation of business logic and presentation – this makes it easier to validate 3rd party themes or delegate pure presentation work. You can't run SQL queries or access the Drupal API from Twig. 




    

In addition, Drupal 8 enables Twig auto-escaping, which means that any string that has not specifically flagged as safe will be escaped using the PHP function htmlspecialchars() (e.g. the same as Drupal 7 check_plain()). Auto-escaping of variables will prevent many XSS vulnerabilities that are accidentally introduced in custom site themes and custom and contributed modules. That fact is why I ranked this as number one. XSS is the most frequent security vulnerability found in Drupal code. We don't have a lot of hard data, but based on past site audits we generally assume that 90% of site-specific vulnerabilities are in the custom theme.


    To see why themers love Twig, compare the Drupal 7 block.tpl.php code to the Drupal 8 Twig version.

    Drupal 7 block.tpl.php:

    Drupal 8 block.html.twig:

  2. Removed PHP input filter and the use of PHP as a configuration import format

    OK, maybe this should have been number one. Drupal 8 does not include the PHP input format in core. In addition to encouraging best practices (managing code in a revision control system like git), this means that Drupal no longer makes it trivial to escalate an administrator login to being able to execute arbitrary PHP code or shell commands on the server. 


    For Drupal 7, importing something like a View required importing executable PHP code, and for certain custom block visibility settings, etc. you would need to enter a PHP snippet. These uses of evaluated PHP (exposing possible code execution vulnerabilities) are all gone – see the next point about configuration management.


    Now that we have covered the top two, the rest of the 10 are in rather arbitrary order.

  3. Site configuration exportable, manageable as code, and versionable

    The Configuration Management Initiative (CMI) transformed how Drupal 8 manages things that would have been represented in Drupal 7 as PHP code. Things like Drupal variables or ctools exportables (e.g. exported Views).



    CMI uses YAML as the export and import format and the YAML files can be managed together with your code and checked into a revision control system (like git). 


    Why is this a security enhancement? Well, in addition to removing the use of PHP code as an import format (and hence possible code execution vulnerability), tracking configuration in code makes it much easier to have an auditable history of configuration changes. This will make Drupal more appealing and suitable for enterprises that need strict controls on configuration changes in place. In addition, configuration can be fully tested in development and then exactly replicated to production at the same time as any corresponding code changes (avoiding mistakes during manual configuration).
 Finally, it is possible to completely block configuration changes in production to force deployment of changes as code.


  4. User content entry and filtering improved

    While the integration of a WYSIWYG editor with Drupal core is a big usability improvement, extra care was taken that to mitigate poor practices that adding a WYSIWYG editor encouraged in past Drupal versions. In particular, users with access to the editor were often granted access to the full html text format, which effectively allowed them to execute XSS attacks on any other site user.



    To encourage the best practice of only allowing the use of the filtered HTML format, the Drupal 8 WYSIWYG editor configuration is integrated with the corresponding text filter. When a button is added to the active configuration, the corresponding HTML tag is added to the allowed list for the text filter.


    Drag a new button from the available to enabled section in the editor configuration:

    The corresponding HTML tag (the U tag) is added to the allowed list:

    An additional security improvement is that the core text filtering supports limiting users to using only images local to the site which helps prevent cross-site request forgery (CSRF) and other attacks or abuses using images.

  5. Hardened user session and session ID handling

    There are three distinct improvements to session and session cookie handling.

    First, the security of session IDs has been greatly improved against exposure via database backups or SQL injection (7.x back-port ). Previously in Drupal, the session ID is stored and checked directly against the incoming session cookie from the browser. The risk from this is that the value from the database can be used to populate the cookie in the browser and thus assume the session and identity of any user who has a valid session in the database. In Drupal 8, the ID is hashed before storage, which prevents the database value from being used to assume a user's session, but the incoming value from the value is simply hashed in order to verify the value.


    Next, mixed-mode SSL session support was added to core to support sites that, for example, used contributed modules to serve the login page over SSL while other pages unencrypted. You will have to replace the session handling service if you really need this. This encourages serving your entire site over SSL (which is also a search engine ranking boost).



    The final change is that the leading “www.” is no longer stripped from the session cookie domain since that causes the session cookie to be sent to all subdomains (7.x back-port)

  6. Automated CSRF token protection in route definitions

    Links (GET requests) that cause some destructive action or configuration change need to be protected from CSRF, usually with a user-specific token in the query string that is checked before carrying out the action.

    

This change improves the developer experience and security by automating a process frequently forgotten or done incorrectly in contributed modules. In addition, centralizing the code makes it easier to audit and provide test coverage.

    Drupal 8 makes it easy. A developer merely needs to specify that a route (a system path in Drupal 7 terms) require a CSRF token. Here is an example of the YAML route definition for a protected link in Drupal 8 entity.

    entity.shortcut.link_delete_inline: path: '/admin/config/user-interface/shortcut/link/{shortcut}/delete-inline' defaults: _controller: 'Drupal\shortcut\Controller\ShortcutController::deleteShortcutLinkInline' requirements: _entity_access: 'shortcut.delete' _csrf_token: 'TRUE'

    Only the one line in the requirements: section needs to be added to protect shortcut deletion from CSRF.

    Shortcut inline delete link and corresponding URL with a token in the query string:

  7. Trusted host patterns enforced for requests

    Many Drupal sites will respond to a page request using an arbitrary host header sent to the correct IP address. This can lead to cache poisoning, bogus site emails, bogus password recovery links, and other problems with security implications.

    For earlier versions of Drupal, it can be a challenge to correctly configure the webserver for a single site that uses sites/default as its site directory to prevent these host header spoofing attacks. Drupal 8 ships with a simple facility to configure expected host patterns in settings.php and warns you in the site status report if it's not configured.

  8. PDO MySQL limited to executing single statements

    If available, Drupal 8 will set a flag that limits PHP to sending only a single SQL statement at a time when using MySQL. This change would have reduced the severity of SA-CORE-2014-005 (a SQL injection vulnerability that was easily exploited by anonymous users) (7.x back-port)
. Getting this change into Drupal 8 meant I first had to contribute a small upstream change to the PHP language itself, and to the PDO MySQL library that is available in PHP versions 5.5.21 or 5.6.5 and greater.

    There is also a patch in progress to try to enforce this protection regardless of which specific database driver is being used.

  9. Clickjacking protection enabled by default

    A small change, but Drupal 8 sends the X-Frame-Options: SAMEORIGIN header in all responses by default. This header is respected by most browsers and prevents the site from being served inside an iframe on another domain. This blocks so-called click-jacking attacks (e.g. forms or links on the site being presented in a disguised fashion on an attacker's site inside an iframe), as well as blocking the unauthorized re-use of site content via iframes. (7.x back-port).

  10. Core JavaScript API Compatible with CSP

    Support for inline JavaScript was removed from the #attached property in the Drupal render API. In addition, the Drupal javascript settings variables are now added to the page as JSON data and loaded into a variable instead of being rendered as inline JavaScript. This was the last use of inline JavaScript by Drupal 8 core, and means that site builders can much more easily enable a strict content security policy (CSP) – a new web standard for communicating per-site restrictions to browsers and mitigating XSS and other vulnerabilities.

A final note of caution: The substantial code reorganization and refactoring in Drupal 8 as well as the dependence on third party PHP components does present a certain added risk. The code reorganization may have introduced bugs that were missed by the existing core tests. The third party components themselves may have security vulnerabilities that affect Drupal, and at the very least, we need to track and stay up to date with them and fix our integration for any corresponding API changes. In order to try to mitigate the risk, the Drupal Association has been conducting the first Drupal security bug bounty that has been run for any version of Drupal core. This has uncovered several security bugs and means they will be fixed before Drupal 8 is released.

I am excited that we've added more “security by default” to Drupal 8, and I hope you download and try it out so you are ready to start using it for new projects as soon as it's released.

Blog series: Drupal 8Workflow: PublishedFeatured: NoTags: acquia drupal planetSecurityDrupal 8 related: YesAuthor: Peter Wolanin
Categories: Elsewhere

Palantir: The True Value of Certification

Planet Drupal - Thu, 27/08/2015 - 18:15

Drupal project lead and Acquia co-founder Dries Buytaert recently blogged about the one-year anniversary of Acquia’s certification program, which seeks to validate skills and knowledge that focus on open source Web development and Acquia products and services.

The topic of certification has long been a controversial one within the Drupal community. As an open source project that primarily measures achievement by one's contributions, some have questioned the need for developers with an established track record in the community to prove themselves through certification. Others are skeptical that the quality or skills of a developer can be judged by the results of a sixty-question multiple choice test.

Those arguments, while completely valid, miss the larger point.

Over the last few years, Drupal has become one of the leading content management platforms for high-traffic sites, powering nearly 15% of the top ten thousand CMS-backed sites on the Web. Large companies and organizations are increasingly evaluating Drupal against commercial and proprietary options like Adobe Experience Manager and SiteCore.

And for those enterprise evaluators, as well as influential research analysts like Forrester and Gartner, the presence of a robust commercial ecosystem surrounding a software platform is a strong indicator of its strength. One of the ways that those ecosystems are evaluated is by the presence of well-regarded and widely adopted certification programs, like the one that Acquia is working to build.

Those of us who have been involved with the Drupal project and community for years understand that the strength of open source software has less to do with its commercial ecosystem than it does with the level of engagement of its contributor community. We know this because we work with and alongside those contributors every single day. But that’s not the experience that most of our customers have; their perspective is more likely to be informed by the companies with whom they work.

And because Drupal is now increasingly competing against large commercial entities instead of other open source projects, those companies can no longer rely solely on their community experience and contributions to make the case for an open source solution. That experience can and should be an important factor in the evaluation process, but all too often other qualifications are necessary.

The value that open source software brings to the table isn't always apparent to those used to proprietary solutions. Acquia's certification program aims to surface that value by leveling the playing field and offering evaluators more of an apples-to-apples comparison. From that perspective, certification is less about the knowledge and skills of individual developers than it is about the investment made by companies into competing for large projects against other enterprise vendors.

Acquia's Certified Developer exam tests developers’ base level of familiarity with Drupal’s features and functionality, but in our experience that has little to do with their skills as developers, which is something that no multiple choice test can measure. Developers get better by working alongside other talented developers in an environment that promotes professional growth and development, which is what we try to build every day at Palantir. We demonstrate those skills to prospective customers both through our past experience and by demonstrating the approaches we take to solving our customers’ problems.

We don't need our developers to pass certification exams to know that they're awesome, and no matter how good a certification program might be, it’s still incumbent on evaluators to do their due diligence when picking who they want to work on their next project.

So if all that’s true, why have certified developers at all? The answer is going to be different for different people, but for us, it’s about making sure that customers understand that Palantir is willing and able to tackle large projects that might otherwise go to proprietary vendors by default. Some prospective customers have existing relationships with Acquia, and in addition to being an Acquia partner, having Acquia Certified developers on our team provides them with the justification they need to know that we're familiar with the products and services that they offer.

At the end of the day, the rise of certification programs like the one offered by Acquia are yet another example of Drupal’s growth as a project and as a community. Very few open source projects are strong enough to compete against proprietary enterprise solutions, but Drupal does it every day, delivering value to customers of all sizes and shapes. We're proud to be a part of it.

I’ll be talking more about Drupal certification and related topics next month in my DrupalCon Barcelona session, Architecting Drupal Business that are Built to Last. I’ve also proposed a session titled Building Tech Companies That Last for next year’s South by Southwest Interactive; voting is open through September 4.

Categories: Elsewhere

Palantir: D8FTW: Customizing your back-end

Planet Drupal - Thu, 27/08/2015 - 18:00

In our last episode, we talked about the various ways of storing data in Drupal 8. One important point we noted was that "in the database" is not an option. All of Drupal's storage systems are abstractions above the actual data store. In fact, I will go as far as saying that if you ever write an SQL query yourself in Drupal 8, you're probably doing it wrong.

There are two key reasons for that stance. One, there's no reason that any of those storage systems, conceptually, need to be in SQL. In fact, for Configuration, Key/Value, and the Cache, it's not even the best tool available. Any of them could be backed by MongoDB, Cassandra or Redis, instead. In fact, many sites will use one of those tools instead of SQL for some (but not all) data storage systems. If your module is hard-coded to SQL, you've now hard-coded all of your users to SQL only. And there's a good chance you've also hard-coded a specific SQL server (generally MySQL) without even intending to.

The second reason is that as a module developer, you should be thinking at a higher level than rows and columns. Most of those systems offer a lot of automation and abstraction tools that provide more power with an easier syntax than SQL, and if you write your own SQL you are bypassing all of that. Most especially, if you have any module configuration not stored in the Configuration system it will not work with any staging and deployment tools. Don't do that to your users.

If for some reason you must write a custom query, say for performance, there is a supported, flexible way to do so. First, ensure that your query is contained within a service, and that service conforms to a declared interface. (You should be doing that anyway, but it's especially important here.) For example, let's say we're creating a service that finds nodes by some highly complex logic that normal Entity Queries don't support. We'll call the class DatabaseComplexNodeFinder, with a ComplexNodeFinderInterface. When we register that service in the container, we should also tag it as one that allows its backend to be overridden, like so:

mymodule.services.yml:

services:
mymodule.nodefinder:
  class: Drupal\mymodule\DatabaseComplexNodeFinder
  arguments: ['@database']
  tags:
   - { name: backend_overridable }

And then we use that service wherever we need to use that logic. The "backend_overridable" tag tells Drupal that there may be alternate implementations it should look for. By default, the class should be written to use generic, non-engine-specific SQL. (That is, no MySQL or PostgreSQL specific features.) It doesn't have to be fast, just work.

Now comes the fun part. We can also define another service named mysql.mymodule.nodefinder, which has the same interface but is very specific to MySQL. Similarly, we can have a service named pgsql.mymodule.nodefinder or mongodb.mymodule.nodefinder, which would be specific to PostgreSQL or MongoDB, respectively. Just registering those services in the container has virtually no cost if they're not used. Those alternate services can have whatever code in them they want, and any set of dependencies they want, as long as they follow ComplexNodeFinderInterface.

Now, in the sites/default/services.yml file, a site owner can specify an alternate default backend:

parameters:
default_backend: mysql

The default is mysql, which means that if Drupal finds a mysql version of any "backend_overridable" service, it will use that instead of the generic one. If it doesn't, it just uses whatever is registered by default. (Often times an SQL-database-specific version will be unnecessary, but the capability is there if you need it.) If your site is running on PostgreSQL, change that default_backend to "pgsql". If on MongoDB, set it to "mongodb". And so on. What if we want to use something other than the default? For instance, we're on a mostly-MySQL-based site but we want to use MongoDB for the State system? That's another simple toggle in the services.yml file. To change the backend for our nodefinder service, we would simply add this to the site-specific services.yml file:

services:
mymodule.nodefinder:
  alias: mongodb.mymodule.nodefinder

That tells the container to use the MongoDB-specific version of that service instead of whatever it was going to use.
There are two big advantages of this design:
1) As a module developer, you can optimize your module for MySQL, PostgreSQL, or MongoDB at the same time. Even if you don't, any other module is free to provide an alternate backend by just registering a service with the correct name.
2) As a site owner, you can mix and match what backend services you want to use. Want a mostly-MySQL-based site, but with Redis for the lock and caching systems? Go for it. Want to store your entities in SQL but everything else in MongoDB? You can do that. Any well-written module will keep on working just fine, because it's either using Drupal's higher-level abstractions or using swappable backends. And if the backend you're looking for isn't available for that service, there's only one class that needs to be written to make it available.
That's the power of dependency injection.

Categories: Elsewhere

Acquia Developer Center Blog: Securing Your Site’s Communications with SSL

Planet Drupal - Thu, 27/08/2015 - 18:00
*/

These days, using SSL with your website isn’t just a good idea — it’s essentially a requirement. Encrypting the information that’s sent between visitors’ browsers and your website is the new price of doing business.

Fortunately, Acquia has a lot of experience helping to secure websites, and we’ve collected several of these tips into a best practices article on the Acquia Help Center.

Want to know about using Varnish with SSL (and you’re an Acquia Cloud user)?

It’s in there.

Want to ensure that all of your website’s assets are served to visitors using the HTTPS protocol?

It’s in there.

Want to set up your 301 redirects from your HTTP pages to HTTPS?

Surprise! It’s in there.

For more information on how best to use SSL with your website, visit the article and read for yourself.

And for even more information that you can use with your Drupal website, feel free to browse the articles and resources on the Acquia Help Center.

Workflow: PendingFeatured: NoTags: acquia drupal planetDrupal 8 related: NoAuthor: Lynette Miles
Categories: Elsewhere

Thorsten Glaser: Go enjoy shell

Planet Debian - Thu, 27/08/2015 - 16:12

Dimitri, I personally enjoy shell…

tglase@tglase:~ $ x=車賈滑豈更串句龜龜契金喇車賈滑豈更串句龜龜契金喇 tglase@tglase:~ $ echo ${x::12} 車賈滑豈更串句龜龜契金喇 tglase@tglase:~ $ printf '%s\n' 'import sys' 'print(sys.argv[1][:12])' >x.py tglase@tglase:~ $ python x.py $x 車賈滑豈

… much more than Python, actually. (Python is the language in which you do not want to write code dealing with strings, due to UnicodeDecodeError and all; even py3k is not much better.)

I would have commented on your post if it allowed doing so without getting a proprietary Google+ account.

Categories: Elsewhere

Mediacurrent: Mediacurrent Dropcast: Episode 10

Planet Drupal - Thu, 27/08/2015 - 13:40

This episode we have Mario Hernandez, front end developer at Mediacurrent, to talk about his upcoming talks at DrupalCamp LA, and how to properly plan for giving a presentation. We talk about the smart_trim module in our Pro Project Pick, which is an awesome module. We talk about Drupal 8 news and as always, birthday boy Ryan, brings it home with the Final Bell. Also, Mark starts his run for President of these United States.

Categories: Elsewhere

Dimitri John Ledkov: Go enjoy Python3

Planet Debian - Thu, 27/08/2015 - 12:39
Given a string, get a truncated string of length up to 12.

The task is ambiguous, as it doesn't say anything about whether or not 12 should include terminating null character or not. None the less, let's see how one would achieve this in various languages.
Let's start with python3

import sys
print(sys.argv[1][:12])
Simple enough, in essence given first argument, print it up to length 12. As an added this also deals with unicode correctly that is if passed arg is 車賈滑豈更串句龜龜契金喇車賈滑豈更串句龜龜契金喇, it will correctly print 車賈滑豈更串句龜龜契金喇. (note these are just random Unicode strings to me, no idea what they stand for).

In C things are slightly more verbose, but in essence, I am going to use strncpy function:

#include <stdio.h>
#include <string.h>
void main(int argc, char *argv[]) {
char res[12];
strncpy(res,argv[1],12);
printf("%s\n",res);
}
This treats things as byte-array instead of unicode, thus for unicode test it will end up printing just 車賈滑豈. But it is still simple enough.
Finally we have Go
package main

import "os"
import "fmt"
import "math"

func main() {
fmt.Printf("%s\n", os.Args[1][:int(math.Min(12, float64(len(os.Args[1]))))])
}
This similarly treats argument as a byte array, and one needs to cast the argument to a rune to get unicode string handling. But there are quite a few caveats. One cannot take out of bounds slices. Thus a naïve os.Args[1][:12] can result in a runtime panic that slice bounds are out of range. Or if a string is known at compile time, a compile time error. Hence one needs to calculate length, and do a min comparison. And there lies the next caveat, math.Min() is only defined for float64 type, and slice indexes can only be integers and thus we end up writing ]))))])...

12 points for python3, 8 points for C, and Go receives nul points Eurovision style.




The postings on this site are my own and don't necessarily represent Intel’s positions, strategies, or opinions.
Categories: Elsewhere

Frederic Marand: Drupal 8 tip of the day: autoloaded code in a module install file

Planet Drupal - Thu, 27/08/2015 - 08:24

Autoloading in D8 is much more convenient that in previous versions, however, it still has limitations. One such issue is with hook_requirements(), which is supposed to be present in the module install file, not the module itself: when called at runtime for the site report page, the module is loaded and the PSR/4 autoloader works fine. However, when that hook is fired during install to ensure the module can indeed be enabled, the module is not yet enabled, and the autoloader is not yet able to find code from that module, meaning the hook_requirements('install') implementation cannot use namespaced classes from the module, as they will not be autoloadable. What are the solutions ?

read more

Categories: Elsewhere

KatteKrab: D8 Accelerate - Game over?

Planet Drupal - Thu, 27/08/2015 - 02:47
Thursday, August 27, 2015 - 10:47

The Drupal 8 Accelerate campaign has raised over two hundred and thirty thousand dollars ($233,519!!).  That's a lot of money! But our goal was to raise US$250,000 and we're running out of time. I've personally helped raise $12,500 and I'm aiming to raise 8% of the whole amount, which equals $20,000. I've got less than $7500 now to raise. Can you help me? Please chip in.

Most of my colleagues on the board have contributed anchor funding via their companies. As a micro-enterprise, my company Creative Contingencies is not in a position to be able to that, so I set out to crowdfund my share of the fundraising effort.

I'd really like to shout out and thank EVERYONE who has made a contribution to get me this far.Whether you donated cash, or helped to amplify my voice, thank you SO so soooo much. I am deeply grateful for your support.

If you can't, or don't want to contribute because you do enough for Drupal that's OK! I completely understand. You're awesome. :) But perhaps you know someone else who is using Drupal, who will be using Drupal you could ask to help us? Do you know someone or an organisation who gets untold value from the effort of our global community? Please ask them, on my behalf, to Make a Donation

If you don't know anyone, perhaps you can help simply by sharing my plea? I'd love that help. I really would!

And if you, like some others I've spoken with, don't think people should be paid to make Free Software then I urge you to read Ashe Dryden's piece on the ethics of unpaid labor in the Open Source Community. It made me think again.

Do you want to know more about how the money is being spent? 
See: https://assoc.drupal.org/d8-accelerate-awarded-grants

Perhaps you want to find out how to apply to spend it on getting Drupal8 done?
See: https://assoc.drupal.org/d8-accelerate-application

Are you curious about the governance of the program?
See: https://www.drupal.org/governance/d8accelerate

And just once more, with feeling, I ask you to please consider making a donation.

So how much more do I need to get it done? To get to GAME OVER?

  • 1 donation x $7500 = game over!
  • 3 donations x $2500
  • 5 donations x $1500
  • 10 donations x $750
  • 15 donationsx $500 <== average donation
  • 75 donations x $100 <== most common donation
  • 100 donations x $75
  • 150 donations x $50
  • 500 donations x $15
  • 750 donations x $10 <== minimum donation

Thank you for reading this far. Really :-)

Categories: Elsewhere

Joey Hess: then and now

Planet Debian - Thu, 27/08/2015 - 02:01

It's 2004 and I'm in Oldenburg DE, working on the Debian Installer. Colin and I pair program on partman, its new partitioner, to get it into shape. We've somewhat reluctantly decided to use it. Partman is in some ways a beautful piece of work, a mass of semi-object-oriented, super extensible shell code that sprang fully formed from the brow of Anton. And in many ways, it's mad, full of sector alignment twiddling math implemented in tens of thousands of lines of shell script scattered amoung hundreds of tiny files that are impossible to keep straight. In the tiny Oldenburg Developers Meeting, full of obscure hardware and crazy intensity of ideas like porting Debian to VAXen, we hack late into the night, night after night, and crash on the floor.

It's 2015 and I'm at a Chinese bakery, then at the Berkeley pier, then in a SF food truck lot, catching half an hour here and there in my vacation to add some features to Propellor. Mostly writing down data types for things like filesystem formats, partition layouts, and then some small amount of haskell code to use them in generic ways. Putting these peices together and reusing stuff already in Propellor (like chroot creation).

Before long I have this, which is only 2 undefined functions away from (probably) working:

let chroot d = Chroot.debootstrapped (System (Debian Unstable) "amd64") mempty d & Apt.installed ["openssh-server"] & ... partitions = fitChrootSize MSDOS [ (Just "/boot", mkPartiton EXT2) , (Just "/", mkPartition EXT4) , (Nothing, const (mkPartition LinuxSwap (MegaBytes 256))) ] in Diskimage.built chroot partitions (grubBooted PC)

This is at least a replication of vmdebootstrap, generating a bootable disk image from that config and 400 lines of code, with enormous customizability of the disk image contents, using all the abilities of Propellor. But is also, effectively, a replication of everything partman is used for (aside from UI and RAID/LVM).

What a difference a decade and better choices of architecture make! In many ways, this is the loosely coupled, extensible, highly configurable system partman aspired to be. Plus elegance. And I'm writing it on a lark, because I have some spare half hours in my vacation.

Past Debian Installer team lead Tollef stops by for lunch, I show him the code, and we have the conversation old d-i developers always have about partman.

I can't say that partman was a failure, because it's been used by millions to install Debian and Ubuntu and etc for a decade. Anything that deletes that many Windows partitions is a success. But it's been an unhappy success. Nobody has ever had a good time writing partman recipes; the code has grown duplication and unmaintainability.

I can't say that these extensions to Propellor will be a success; there's no plan here to replace Debian Installer (although with a few hundred more lines of code, propellor is d-i 2.0); indeed I'm just adding generic useful stuff and building further stuff out of it without any particular end goal. Perhaps that's the real difference.

Categories: Elsewhere

Savas Labs: Sassy Drupal theming: a lighter version of SMACSS

Planet Drupal - Thu, 27/08/2015 - 02:00

It takes some forethought, but a well-organized theme means code that is modular and easy to maintain or pass off to another developer. SMACSS principles are becoming more and more widespread and can be applied to a Drupal theme. At Savas we've picked out what we love from SMACSS and simplified the rest, creating a stylesheet organization method that works for us. In this post (part 2 of my three-part series on Drupal theming with Sass) I'll go through our version of SMACSS and link to real examples.

Continue reading…

Categories: Elsewhere

DrupalCon News: Introduction to Headless Drupal

Planet Drupal - Thu, 27/08/2015 - 01:22

Drupal is an amazing platform for making websites, but it can also be a world-class API that can easily integrate with other technologies. In this class you will learn how to create fully featured APIs in Drupal, and you’ll build a simple Node.js application that consumes that API to make a highly interactive website.

If you are looking to learn about building APIs in Drupal, or creating websites with Node.js, this class is for you!

Categories: Elsewhere

Pages

Subscribe to jfhovinne aggregator