FLOSS Project Planets

Family - Implementing Grid layout

Planet KDE - Wed, 2017-07-19 08:01

In my last post, I talked about adding a grid layout to the activity. The inspiration of this layout was to remove the trial and error method of selecting (x,y) positions of a node and to implement a more efficient method of positioning the nodes. Along with that, the distance between two generations and nodes could also be maintained in a homogeneous manner, keeping the layout similar throughout the activity.

As it also turned out, the grid layout along with knowing the width and height of the node also helped in accurately positioning the edges, the effect of which will be shown in a few before-after screenshots later in this post


Vertically, the screen is divided into three equal parts (representing three generations), represented as:

readonly property real gen_1: 0.10 readonly property real gen_2: 0.40 readonly property real gen_3: 0.70

Here, gen_1, gen_2 and gen_3 represent 1st, 2nd and 3rd generation.

Horizontally, the area was originally divided into three parts:

readonly property real left: 0.2 readonly property real center: 0.4 readonly property real right: 0.6

Aside from this, we also divided the horizontal area into four other slots, which will be necessary as it turned out later:

readonly property real left_ext: 0.1 readonly property real left_int: 0.3 readonly property real right_int: 0.5 readonly property real right_ext: 0.7

Here, left_int and right_int represent left and right on the interior side compared to left and right respectively. Similarly, right_ext and left_ext represent left and right exterior, compared to left and right respectively.

The nodes

The arrangement of the nodes are very simple, in which we are avoiding the problem of arranging the nodes via trial and error of the (x,y) position. The x-coordinate can be determined by selecting the best among left, right and center or among left_x or right_x (where x = 1, 2) as mentioned above and the y-coordinate can be determined via selecting the best among gen_1, gen_2 or gen_3, depending on the generation of the node.

As an example, for level 11, we define the nodePositions as follow:

nodePositions: [ [center, gen_1], [left, gen_2], [right, gen_2], [left, gen_3] ]

As we can see from the level, it can be seen that it is very intuitive to determine the node positions for a given level, once we know the type of the node.

The edges

The start-end position of the edges can also be determined via the properties mentioned above along with the nodeWidth and nodeHeight properties mentioned in the previous blog post. For level 11, we calculate the edge positions as:

edgeList: [ [center + nodeWidth / 2, gen_1 + nodeHeight, center + nodeWidth / 2, gen_2 + nodeHeight / 2], [rightXEdge(left), nodeMidPointY(gen_2), right, nodeMidPointY(gen_2)], [left + nodeWidth / 2, gen_2 + nodeHeight, left + nodeWidth / 2, gen_3] ]

As a result of these, level 11 turned out to be like this:

How it all turned up

The layout has come a long way since it was started from the beginning of the second phase of GSoC, and here are the before and after screenshots of the family activity

Initial layout of level 18

Current layout of level 18

Initial layout of level 6

Current layout of level 6

What’s Next

I have started working on the extension of the Family activity, the goal of which is: given a relation, the user will have to find the pair that demonstrate the given relation. I will be documenting the progress of the activity once that is near completion, hopefully by the end of this week.

Relevant links
Categories: FLOSS Project Planets

InternetDevels: Interactive HTML5 content on Drupal site

Planet Drupal - Wed, 2017-07-19 07:37

Since content is king, content marketing is a must-have strategy. With the content you present on the web, you can attract visitors and keep them interested. But have you ever wanted to interact and collaborate with your users through the content? Do you need them not just passively perceive your content, but take some actions with it? This is possible with H5P (HTML 5 Package).

Read more
Categories: FLOSS Project Planets

New in Qt 5.10: recursive filtering for QSortFilterProxyModel

Planet KDE - Wed, 2017-07-19 04:00

When using Qt’s model/view framework, filtering has always been very easy with QSortFilterProxyModel. To filter a list using text typed by the user in a line-edit, you have certainly been applying the standard recipe:

  1. instantiate the proxy;
  2. insert it between view and source model;
  3. connect the lineedit’s textChanged signal to the proxy’s setFilterFixedString slot; done!

But what if the model is a tree rather than a flat list?

Let’s use the tree below as an example. As you can …

The post New in Qt 5.10: recursive filtering for QSortFilterProxyModel appeared first on KDAB.

Categories: FLOSS Project Planets

Python Bytes: #35 How developers change programming languages over time

Planet Python - Wed, 2017-07-19 04:00
<p><strong>Brian #1:</strong> <a href="https://medium.com/@PhilipTrauner/python-quirks-comments-324bbf88612c"><strong>Python Quirks</strong></a> <a href="https://medium.com/@PhilipTrauner/python-quirks-comments-324bbf88612c"><strong>: Comments</strong></a></p> <ul> <li>Python developers put comments in their code.</li> </ul> <pre><code> # Like this """ And like this """ "And like this." ["Not usually like this","but it's possible"] </code></pre> <ul> <li>Philip Trauner timed all of these.</li> <li>Actual # comments are obviously way faster.</li> <li>He also shows the AST difference.</li> <li>Don’t abuse the language. Unused unreferenced strings are not free.</li> </ul> <p><strong>Michael #2:</strong> <a href="https://docs.python.org/3.6/whatsnew/changelog.html#python-3-6-2"><strong>Python 3.6.2 is out!</strong></a></p> <ul> <li><strong>Security</strong> <ul> <li>bpo-30730: Prevent environment variables injection in subprocess on Windows. Prevent passing other environment variables and command arguments.</li> <li>bpo-30694: Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes of multiple security vulnerabilities including: CVE-2017-9233 (External entity infinite loop DoS), CVE-2016-9063 (Integer overflow, re-fix), CVE-2016-0718 (Fix regression bugs from 2.2.0’s fix to CVE-2016-0718) and CVE-2012-0876 (Counter hash flooding with SipHash). Note: the CVE-2016-5300 (Use os-specific entropy sources like getrandom) doesn’t impact Python, since Python already gets entropy from the OS to set the expat secret using XML_SetHashSalt().</li> <li>bpo-30500: Fix urllib.parse.splithost() to correctly parse fragments. For example, splithost('//') now correctly returns the host, instead of treating @evil.com as the host in an authentification (login@host).</li> </ul></li> <li><strong>Core and Builtins</strong> <ul> <li>bpo-29104: Fixed parsing backslashes in f-strings.</li> <li>bpo-27945: Fixed various segfaults with dict when input collections are mutated during searching, inserting or comparing. Based on patches by Duane Griffin and Tim Mitchell.</li> <li>bpo-30039: If a KeyboardInterrupt happens when the interpreter is in the middle of resuming a chain of nested ‘yield from’ or ‘await’ calls, it’s now correctly delivered to the innermost frame.</li> <li>Library</li> <li>bpo-30038: Fix race condition between signal delivery and wakeup file descriptor. Patch by Nathaniel Smith.</li> <li>bpo-23894: lib2to3 now recognizes rb'...' and f'...' strings.</li> <li>bpo-24484: Avoid race condition in multiprocessing cleanup (#2159)</li> </ul></li> <li><strong>Windows</strong> <ul> <li>bpo-30687: Locate msbuild.exe on Windows when building rather than vcvarsall.bat</li> <li>bpo-30450: The build process on Windows no longer depends on Subversion, instead pulling external code from GitHub via a Python script. If Python 3.6 is not found on the system (via py -3.6), NuGet is used to download a copy of 32-bit Python.</li> </ul></li> <li><strong>Plus about 40 more fixes / changes</strong></li> </ul> <p><strong>Brian #3:</strong> <a href="https://github.com/adriennefriend/imposter-syndrome-disclaimer"><strong>Contributing to Open Source Projects: Imposter Syndrome Disclaimer</strong></a></p> <ul> <li>“How to contribute” often part of OSS projects.</li> <li>Adrienne Lowe of codingwithknives.com has an “Imposter Syndrome Disclaimer” to include in your contributing documentation that’s pretty great.</li> <li>She’s also <a href="https://github.com/adriennefriend/imposter-syndrome-disclaimer/blob/master/examples.md">collecting examples</a> of people using it, or similar.</li> <li>From the disclaimer: </li> </ul> <blockquote> <p>“<em>Imposter syndrome disclaimer</em>: I want your help. No really, I do. There might be a little voice inside that tells you you're not ready; that you need to do one more tutorial, or learn another framework, or write a few more blog posts before you can help me with this project. I assure you, that's not the case. … And you don't just have to write code. You can help out by writing documentation, tests, or even by giving feedback about this work. (And yes, that includes giving feedback about the contribution guidelines.)“</p> </blockquote> <p><strong>Michael #4:</strong> <a href="https://www.technologyreview.com/s/604087/the-dark-secret-at-the-heart-of-ai/"><strong>The Dark Secret at the Heart of AI</strong></a></p> <ul> <li>via MIT Technology Review</li> <li>There’s a big problem with AI: even its creators can’t explain how it works</li> <li>Last year, an experimental vehicle, developed by researchers at the chip maker Nvidia, didn’t look different from other autonomous cars, but it was unlike anything demonstrated by Google, Tesla, or General Motors, and it showed the rising power of artificial intelligence. The car didn’t follow a single instruction provided by an engineer or programmer. Instead, it relied entirely on an algorithm that had taught itself to drive by watching a human do it.</li> <li>The result seems to match the responses you’d expect from a human driver. But what if one day it did something unexpected—crashed into a tree, or sat at a green light? </li> <li>As things stand now, it might be difficult to find out why.</li> <li>And you can’t ask it: there is no obvious way to design such a system so that it could always explain why it did what it did.</li> <li>There’s already an argument that being able to interrogate an AI system about how it reached its conclusions is a fundamental legal right</li> <li>We’ve never before built machines that operate in ways their creators don’t understand. How well can we expect to communicate—and get along with—intelligent machines that could be unpredictable and inscrutable</li> </ul> <p><strong>Brian #5:</strong> <a href="http://jamescooke.info/arrange-act-assert-pattern-for-python-developers.html"><strong>Arrange Act Assert pattern for Python developers</strong></a></p> <ul> <li>James Cooke</li> <li>Good introduction to test case structure.</li> <li>Split your tests into setup, action, assertions.</li> <li>Pattern also known by: <ul> <li>Given, When, Then</li> <li>Setup, Test, Teardown</li> <li>Setup, Exercise, Verify, Teardown</li> </ul></li> <li>Also covered in: <ul> <li><a href="http://testandcode.com/10">testandcode.com/10</a></li> <li><a href="http://pythontesting.net/strategy/given-when-then-2/">pythontesting.net/strategy/given-when-then-2</a></li> </ul></li> </ul> <p><strong>Michael #6:</strong> <a href="https://blog.sourced.tech/post/language_migrations/"><strong>Analyzing GitHub, how developers change programming languages over time</strong></a></p> <ul> <li>From source{d}: Building the first AI that understands code</li> <li>Have you ever been struggling with an nth obscure project, thinking : “I could do the job with this language but why not switch to another one which would be more enjoyable to work with” ?</li> <li>Derived from <a href="https://erikbern.com/2017/03/15/the-eigenvector-of-why-we-moved-from-language-x-to-language-y.html"><strong>The eigenvector of “Why we moved from language X to language Y”</strong></a><strong>,</strong> <a href="https://github.com/erikbern/eigenstuff"><strong>Erik Bernhardsson</strong></a> <em>*</em>*</li> <li>Dataset available <ul> <li>4.5 Million GitHub users</li> <li>393 different languages</li> <li>10 TB of source code in total</li> </ul></li> <li>I find it nice to visualize developer’s language usage history with a kind of <a href="https://en.wikipedia.org/wiki/Gantt_chart"><strong>Gantt diagram</strong></a>.</li> <li>We did not include Javascript because</li> <li>Most popular languages on GitHub</li> <li>At last! Here is the reward: the stationary distribution of our Markov chain. This probability distribution is independent of the initial distribution. It gives information about the stability of the process of random switching between languages. </li> <li><table> <thead> <tr> <th>Rank</th> <th>Language</th> <th>Popularity, %</th> <th>Source code, %</th> </tr> </thead> <tbody> <tr> <td>1.</td> <td>Python</td> <td>16.1</td> <td>11.3</td> </tr> <tr> <td>2.</td> <td>Java</td> <td>15.3</td> <td>16.6</td> </tr> <tr> <td>3.</td> <td>C</td> <td>9.2</td> <td>17.2</td> </tr> <tr> <td>4.</td> <td>C++</td> <td>9.1</td> <td>12.6</td> </tr> <tr> <td>5.</td> <td>PHP</td> <td>8.5</td> <td>24.4</td> </tr> <tr> <td>6.</td> <td>Ruby</td> <td>8.3</td> <td>2.6</td> </tr> <tr> <td>7.</td> <td>C#</td> <td>6.1</td> <td>6.5</td> </tr> </tbody> </table></li> <li><p>Python (16.1 %) appears to be the most attractive language, followed closely by Java (15.3 %). It’s especially interesting since only 11.3 % of all source code on GitHub is written in Python.</p></li> <li>Although there are ten times more lines of code on GitHub in PHP than in Ruby, they have the same stationary distribution.</li> <li>What about sticking to a language ? <ul> <li>Developers coding in one of the 5 most popular languages (Java, C, C++, PHP, Ruby) are most likely to switch to Python with approx. 22% chance on average.</li> <li>Similarly, a Visual Basic developer has more chance (24%) to move to C# while Erik’s is almost sure in this transition with 92% chance.</li> <li>People using numerical and statistical environments such as Fortran (36 %), Matlab (33 %) or R (40 %) are most likely to switch to Python in contrast to Erik’s matrix which predicts C as their future language.</li> </ul></li> </ul>
Categories: FLOSS Project Planets

Talk Python to Me: #121 Microservices in Python

Planet Python - Wed, 2017-07-19 04:00
Do you have big, monolith web applications or services that are hard to manage, hard to change, and hard to scale? Maybe breaking them into microservices would give you many more options to evolve and grow that app. <br/> <br/> This week, we meet up again with Miguel Grinberg to discuss the trades offs and advantages of microservices.<br/> <br/> Links from the show:<br/> <br/> <div style="font-size: .85em;"><b>Miguel on Twitter</b>: <a href="https://twitter.com/miguelgrinberg" target="_blank">@miguelgrinberg</a><br/> <b>Miguel's blog</b>: <a href="http://blog.miguelgrinberg.com" target="_blank">blog.miguelgrinberg.com</a><br/> <b>Microservices Tutorial at PyCon</b>: <a href="https://www.youtube.com/watch?v=nrzLdMWTRMM" target="_blank">youtube.com/watch?v=nrzLdMWTRMM</a><br/> <b>Flask Web Development (Amazon)</b>: <a href="https://amzn.to/1oVnibk" target="_blank">amzn.to/1oVnibk</a><br/> <b>Flask Web Development (O'Reilly)</b>: <a href="http://shop.oreilly.com/product/0636920031116.do?cmp=af-webplatform-books-videos-product_cj_9781449372620_%25zp" target="_blank">oreilly.com</a><br/></div>
Categories: FLOSS Project Planets

Lars Wirzenius: Dropping Yakking from Planet Debian

Planet Debian - Wed, 2017-07-19 01:54

A couple of people objected to having Yakking on Planet Debian, so I've removed it.

Categories: FLOSS Project Planets

myDropWizard.com: How to Determine Whether You Can Upgrade From Drupal 6 to Drupal 8 (Yet)

Planet Drupal - Tue, 2017-07-18 19:06

Like many of you, I have a few sites that are fairly complex, utilize dozens of modules - and still run on Drupal 6. At this point, I don't want to invest the time to migrate them to Drupal 7 because I feel the momentum is finally beginning to shift into high gear for Drupal 8.

So, how do you know whether the Drupal 8 ecosystem is ready for a relatively straightforward migration? Thankfully, there are some great resources available!

Categories: FLOSS Project Planets

Enthought: Webinar: Python for Scientists &amp; Engineers: A Tour of Enthought’s Professional Training Course

Planet Python - Tue, 2017-07-18 18:20

When: Thursday, July 27, 2017, 11-11:45 AM CT (Live webcast, all registrants will receive a recording)

What:  A guided walkthrough and Q&A about Enthought’s technical training course Python for Scientists & Engineers with Enthought’s VP of Training Solutions, Dr. Michael Connell

Who Should Attend: individuals, team leaders, and learning & development coordinators who are looking to better understand the options to increase professional capabilities in Python for scientific and engineering applications

REGISTER  (if you can’t attend we’ll send all registrants a recording)

“Writing software is not my job…I just have to do it every day.”  
-21st Century Scientist or Engineer

Many scientists, engineers, and analysts today find themselves writing a lot of software in their day-to-day work even though that’s not their primary job and they were never formally trained for it. Of course, there is a lot more to writing software for scientific and analytic computing than just knowing which keyword to use and where to put the semicolon.

Software for science, engineering, and analysis has to solve the technical problem it was created to solve, of course, but it also has to be efficient, readable, maintainable, extensible, and usable by other people — including the original author six months later!

It has to be designed to prevent bugs and — because all reasonably complex software contains bugs — it should be designed so as to make the inevitable bugs quickly apparent, easy to diagnose, and easy to fix. In addition, such software often has to interface with legacy code libraries written in other languages like C or C++, and it may benefit from a graphical user interface to substantially streamline repeatable workflows and make the tools available to colleagues and other stakeholders who may not be comfortable working directly with the code for whatever reason.

Enthought’s Python for Scientists and Engineers is designed to accelerate the development of skill and confidence in addressing these kinds of technical challenges using some of Python’s core capabilities and tools, including:

  • The standard Python language
  • Core tools for science, engineering, and analysis, including NumPy (the fast array programming package), Matplotlib (for data visualization), and Pandas (for data analysis); and
  • Tools for crafting well-organized and robust code, debugging, profiling performance, interfacing with other languages like C and C++, and adding graphical user interfaces (GUIs) to your applications.

In this webinar, we give you the key information and insight you need to evaluate whether Enthought’s Python for Scientists and Engineers course is the right solution to take your technical skills to the next level, including:

  • Who will benefit most from the course
  • A guided tour through the course topics
  • What skills you’ll take away from the course, how the instructional design supports that
  • What the experience is like, and why it is different from other training alternatives (with a sneak peek at actual course materials)
  • What previous course attendees say about the course


Presenter: Dr. Michael Connell, VP, Enthought Training Solutions

Ed.D, Education, Harvard University
M.S., Electrical Engineering and Computer Science, MIT

Python for Scientists & Engineers Training: The Quick Start Approach to Turbocharging Your Work

If you are tired of running repeatable processes manually and want to (semi-) automate them to increase your throughput and decrease pilot error, or you want to spend less time debugging code and more time writing clean code in the first place, or you are simply tired of using a multitude of tools and languages for different parts of a task and want to replace them with one comprehensive language, then Enthought’s Python for Scientists and Engineers is definitely for you!

This class has been particularly appealing to people who have been using other tools like MATLAB or even Excel for their computational work and want to start applying their skills using the Python toolset.  And it’s no wonder — Python has been identified as the most popular coding language for five years in a row for good reason.

One reason for its broad popularity is its efficiency and ease-of-use. Many people consider Python more fun to work in than other languages (and we agree!). Another reason for its popularity among scientists, engineers, and analysts in particular is Python’s support for rapid application development and extensive (and growing) open source library of powerful tools for preparing, visualizing, analyzing, and modeling data as well as simulation.

Python is also an extraordinarily comprehensive toolset – it supports everything from interactive analysis to automation to software engineering to web app development within a single language and plays very well with other languages like C/C++ or FORTRAN so you can continue leveraging your existing code libraries written in those other languages.

Many organizations are moving to Python so they can consolidate all of their technical work streams under a single comprehensive toolset. In the first part of this class we’ll give you the fundamentals you need to switch from another language to Python and then we cover the core tools that will enable you to do in Python what you were doing with other tools, only faster and better!

Additional Resources Upcoming Open Python for Scientists & Engineers Sessions:

Los Alamos, NM, Aug 14-18, 2017
Albuquerque, NM, Sept 11-15, 2017
Washington, DC, Sept 25-29, 2017
Los Alamos, NM, Oct 9-13, 2017
Cambridge, UK, Oct 16-20, 2017
San Diego, CA, Oct 30-Nov 3, 2017
Albuquerque, NM, Nov 13-17, 2017
Los Alamos, NM, Dec 4-8, 2017
Austin, TX, Dec 11-15, 2017

Have a group interested in training? We specialize in group and corporate training. Contact us or call 512.536.1057.

Learn More

Download Enthought’s Machine Learning with Python’s Scikit-Learn Cheat Sheets
Additional Webinars in the Training Series:

Python for Data Science: A Tour of Enthought’s Professional Technical Training Course

Python for Professionals: The Complete Guide to Enthought’s Technical Training Courses

An Exclusive Peek “Under the Hood” of Enthought Training and the Pandas Mastery Workshop

Download Enthought’s Pandas Cheat Sheets

The post Webinar: Python for Scientists & Engineers: A Tour of Enthought’s Professional Training Course appeared first on Enthought Blog.

Categories: FLOSS Project Planets

Daniel Silverstone: Yay, finished my degree at last

Planet Debian - Tue, 2017-07-18 17:56

A little while back, in June, I sat my last exam for what I hoped would be the last module in my degree. For seven years, I've been working on a degree with the Open University and have been taking advantage of the opportunity to have a somewhat self-directed course load by taking the 'Open' degree track. When asked why I bothered to do this, I guess my answer has been a little varied. In principle it's because I felt like I'd already done a year's worth of degree and didn't want it wasted, but it's also because I have been, in the dim and distant past, overlooked for jobs simply because I had no degree and thus was an easy "bin the CV".

Fed up with this, I decided to commit to the Open University and thus began my journey toward 'qualification' in 2010. I started by transferring the level 1 credits from my stint at UCL back in 1998/1999 which were in a combination of basic programming in Java, some mathematics including things like RSA, and some psychology and AI courses which at the time were aiming at a degree called 'Computer Science with Cognitive Sciences'.

Then I took level 2 courses, M263 (Building blocks of software), TA212 (The technology of music) and MS221 (Exploring mathematics). I really enjoyed the mathematics course and so...

At level 3 I took MT365 (Graphs, networks and design), M362 (Developing concurrent distributed systems), TM351 (Data management and analysis - which I ended up hating), and finally finishing this June with TM355 (Communications technology).

I received an email this evening telling me the module result for TM355 had been posted, and I logged in to find I had done well enough to be offered my degree. I could have claimed my degree 18+ months ago, but I persevered through another two courses in order to qualify for an honours degree which I have now been awarded. Since I don't particularly fancy any ceremonial awarding, I just went through the clicky clicky and accepted my qualification of 'Batchelor of Science (Honours) Open, Upper Second-class Honours (2.1)' which grants me the letters 'BSc (Hons) Open (Open)' which, knowing me, will likely never even make it onto my CV because I'm too lazy.

It has been a significant effort, over the course of the past few years, to complete a degree without giving up too much of my personal commitments. In addition to earning the degree, I have worked, for six of the seven years it has taken, for Codethink doing interesting work in and around Linux systems and Trustable software. I have designed and built Git server software which is in use in some universities, and many companies, along with a good few of my F/LOSS colleagues. And I've still managed to find time to attend plays, watch films, read an average of 2 novel-length stories a week (some of which were even real books), and be a member of the Manchester Hackspace.

Right now, I'm looking forward to a stress free couple of weeks, followed by an immense amount of fun at Debconf17 in Montréal!

Categories: FLOSS Project Planets

Chapter Three: How to implement AppNexus ads in Drupal 8

Planet Drupal - Tue, 2017-07-18 17:50

One of our clients requested to integrate AppNexus ads with their Drupal 8 site. The requirements were very simple:

  • Ability to display ads as blocks.
  • Ad blocks should be configurable: tagId, Sizes. And pass those variables via apntag.defineTag().
  • Ability to pass global page options via apntag.setPageOpts().

Since there wasn't any module that would support this I decided to create a module that will be very easy to use and at the same time will be extendable and useful in other projects.

The module comes with a simple PHP class that helps to generate pageOpts from hook_page_attachments(). You may create your own class using that class as an example.

Categories: FLOSS Project Planets

No Qt4/KDE4libs version of LabPlot anymore

Planet KDE - Tue, 2017-07-18 16:53

In the past there were two versions of LabPlot. The first one was based on Qt4 and KDE4 libraries. The second one uses Qt 5 and KDE frameworks 5. The development was done mainly in the Qt4-based branch which was merged from time to time to the Qt5/frameworks branch where the porting to Qt5/frameworks, if required, was done after the merge. Clearly, this caused a lot of additional work, was very time consuming sometimes and distracted us too often from the actual development – the development mostly done in our very limited spare time.

After long internal discussions we decided to stop developing and releasing the Qt4-version of LabPlot. It should be an exception nowadays to find a distribution without a reasonable support for Qt5 and KDE frameworks. So, starting from the next release, LabPlot 2.5, there will only be the Qt5/kf5-based release. We still can decide to provide fixes to the Qt4-based version, but there definitely won’t be any new features for this release anymore.

Working on one release only will allow us to concentrate more on the application itself and to increase the development speed. Our master branch is now on Qt5/frameworks since couple of weeks already with a lot of great new stuff being developed for the next release.

Having mentioned the next release, couple of words more about this. We plan to release closer to the end of this year. A lot of new features are already developed for the next release. Among them we want to mention the import of data from SQL databases as well as the import of Origin’s project files. Data fitting has got a lot of attention recently and the next release will allow the user to do more advanced fitting and to obtain much better representation of the results of the fitting procedure. Also, we improved a lot the user experience – the creation of multiple plots and data curves as well as performing of data analisis can be carried out more comfortable now and we’ll improve more in this direction soon. More on the new features will come in the next couple of blogs.

LabPlot’s GSoC2017 project makes also good progress and if everything goes well and as expected, the next release of LabPlot will provide support for live data coming from usual files, pipes, sockets and serial port.

Still, a lot of polishment has to be done until the release. Everybody who is interested in testing the new features, please don’t hesitate to build the current version of LabPlot from sources and to provide some feedback!

Categories: FLOSS Project Planets

Abhishek Lal | GSoC Blog: Examples for Developer #7 Week of Coding

Planet Drupal - Tue, 2017-07-18 15:17
Examples for Developer #7 Week of Coding Abhishek Lal B Wed, 07/19/2017 - 00:47
Categories: FLOSS Project Planets

Keep calm, don't panic and [Ctrl+Space]

Planet KDE - Tue, 2017-07-18 14:00
TIL the Rust compiler panics. A lot. Okay, it wasn't today, it was last week. Still. At this point I feel bad because I feel like I'm constantly coming out with something bad to say about Rust. I swear, I love the language. So I'm just going to point it out and move on: libsyntax panics on a lot of lexing and parsing errors. There. Moving on...
I have to admit, I spent too much time thinking of something interesting and engaging to write in this blog post but unfortunately it's just going to be a small progress report. You know the famous saying, a gif is worth a thousand words...HighlightingIn my last post I showed highlighting done for declarations, but uses were not highlighted. Lo and behold...
Video should appear here; if it doesn't click here
This also means that go-to-declaration works as well. You might notice the uses aren't highlighted the same color as the declarations. That's a mistake on my part and I'm working to fix that.RenamingAs I've said before, KDevelop does a lot of things out-of-the-box if it has the Declaration-Use chain for a project. Renaming declarations is one of them.
Video should appear here; if it doesn't click here
Very basic code completionIn the spirit of short recordings, here's another one.
Video should appear here; if it doesn't click here
(yes, the cursor is slightly off in all of these; blame the recording software)
(((also if the videos aren't loading, you can view them here, here and here)))
Up nextSome more interesting things for code completion are coming up. Also, the Rust compiler has amazing error messages and I'm currently looking into getting the diagnostics out of libsyntax and show them in KDevelop. I'm looking into parsing imported modules as well, starting with libstd. All exciting stuff.
I'll also be speaking at KDE's Akademy this weekend, so if you're there, please feel free to drop by and say hi. I won't bite. :)
Categories: FLOSS Project Planets

Chiranjeeb Mahanta | Blog: GSoC’17 Coding period | Week #7 | UC-Wishlist

Planet Drupal - Tue, 2017-07-18 13:48
GSoC’17 Coding period | Week #7 | UC-Wishlist chiranjeeb2410 Tue, 07/18/2017 - 13:48
Categories: FLOSS Project Planets

Anwesha Das: My Free Software journey, from today to yesteryear and back!

Planet Python - Tue, 2017-07-18 13:41

My life can be divided into major two parts.
Life before knowing “Libre Office” and after.
No, I won’t go on about how good the software is (which it is; fairly good).

I was fascinated by the name, the meaning.
Libre, means “free, at liberty.”
The name suggested a philosophy, a vision, an idea to me.

Libre != Gratis

Though I was introduced to the Free Software World briefly a while back at FOSS.in, 2012, a conference that altered the way I look at my soul-mate forever.

But the concept of open source, free software, the industry did not quite settle in clearly, in my mind. The past leads us to the present. So I became more interested in its history. The history of the movement of liberating cyber space. I asked Kushal, who happens to be a free software advocate, and a devout follower to tell me the story, and guide me through the path.

We embarked on a wonderfully meandering journey where I was visiting older, simpler times and Kushal was revisiting the movement with me. The era of sharing, the beginning of the complexities and the fight against it.

Our primary source of knowledge was the book, Hackers: Heroes of the Computer Revolution, apart from several old articles, newsletters etc.

I was astonished to know that there exists software that respects freedom; the freedom of end users.
There exists software that believes in cooperation and collective building.
By strict definition, the first one is known as free software and the second one is open source software.
To my utmost surprise there are people sacrificing their material wants, over the peace of mind, and easy fame to help others. To preach freedom and openness.

How did it help me?

It made me understand the present state of the world, a lot better.
I now see the words community, & collaboration in a different light altogether.
I now understand why people are so passionate about words, phrases or things.
Why these terms make all the difference.

Most importantly it gave me a refuge. I may not be someone with a coding background, but I can still very much be a part of this community. Coding may be a big part of the technical community but it’s not the only part. It gave me the power to ignore the cold shoulder and the occasional jibe (and laugh at their incomprehension about history), whenever someone treated me like an outsider. It gave myself the justification, and confidence to take the decision of quitting a fairly established career as mortgage attorney and start afresh at 30.

Community, collaboration, and freedom are the some my most used words (apart from “No Py”!) in a day since then.

And now I know why.
And it’s time for me to spread the word.

Coming to the present

July 2017, a tweet and its reply made us relive that journey. It was the discussion of the recent travel ban. A tweet came from @gnome about this. Totally appropriate given the primary idea of gnome. But many could not figure out why such statements are coming from @gnome.
I was taken aback. We were sad, surprised and somewhat angry. People were enjoying the fruits of so many people’s hard work and effort and were yet ignorant of the history and the toil behind it all.
Among many other replies, there was a reply from Miguel de Icaza that seemed to echo our (Kushal’s and mine) thoughts.

We understand why he said that. We thought it’s time for us too, to do our bit, to spread the word.
And so, we decided to do two things -

Firstly, to tell newer, younger lot about it.
For which Kushal & I have taken classes on
- the history of hacker ethics - licensing and how the choices we make affect us, the society, and the world at large, at DGPLUG Summer training session.
A similar session will follow in PyLadies Pune August meetup.

Secondly, to write an article on the Hacker Ethic and the Free Software movement, together.
We have published this on 12th July, 2017. Here is the link
. Please read it (though it is a bit lengthy) and be a part of our journey.

Categories: FLOSS Project Planets

Mike Driscoll: Python: All About Decorators

Planet Python - Tue, 2017-07-18 13:15

Decorators can be a bit mind-bending when first encountered and they can also be a bit tricky to debug. But they are a neat way to add functionality to functions and classes. Decorators are also known as a “higher-order function”. What this means is that they can take one or more functions as arguments and return a function as its result. In other words, decorators will take the function they are decorating and extend its behavior while not actually modifying what the function itself does.

There have been two decorators in Python since version 2.2, namely classmethod() and staticmethod(). Then PEP 318 was put together and the decorator syntax was added to make decorating functions and methods possible in Python 2.4. Class decorators were proposed in PEP 3129 to be included in Python 2.6. They appear to work in Python 2.7, but the PEP indicates that they weren’t accepted until Python 3, so I’m not sure what happened there.

Let’s start off by talking about functions in general to get a foundation to work from.

The Humble Function

A function in Python and in many other programming languages is just a collection of reusable code. Some programmers will take an almost bash-like approach and just write all their code out in a file with no functions at all. The code just runs from top to bottom. This can lead to a lot of copy-and-paste spaghetti code. When ever you see two pieces of code that are doing the same thing, they can almost always be put into a function. This will make updating your code easier since you’ll only have one place to update them.

Here’s a basic function:

def doubler(number): return number * 2

This function accepts one argument, number. Then it multiplies it be 2 and returns the result. You can call the function like this:

>>> doubler(5) 10

As you can see, the result will be 10.

Function are Objects Too

In Python, a lot of authors will describe a function as a “first-class object”. When they say this, they mean that a function can be passed around and used as arguments to other functions just as you would with a normal data type such as an integer or string. Let’s look at a few examples so we can get used to the idea:

>>> def doubler(number): return number * 2 >>> print(doubler) <function doubler at 0x7f7886b92f50> >>> print(doubler(10)) 20 >>> doubler.__name__ 'doubler' >>> doubler.__doc__ None >>> def doubler(number): """Doubles the number passed to it""" return number * 2 >>> doubler.__doc__ 'Doubles the number passed to it' >>> dir(doubler) ['__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr__', '__dict__', '__doc__', '__format__', '__get__', '__getattribute__', '__globals__', '__hash__', '__init__', '__module__', '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name']

As you can see, you can create a function and then pass it to Python’s print() function or any other function. You will also note that once a function is defined, it automatically has attributes that we can access. For example, in the example above, we accessed func_doc which was empty at first. This attribute holds the contents of the function’s docstring. Since we didn’t have a docstring, it returned None. So we redefined the function to add a docstring and accessed func_doc again to see the docstring. We can also get the function’s name via the func_name attributes. Feel free to check out some of the other attributes that are shown in the last example above..

Our First Decorator

Creating a decorator is actually quite easy. As mentioned earlier, all you need to do to create a decorator is to create a function that accepts another function as its argument. Let’s take a look:

>>> def doubler(number): """Doubles the number passed to it""" return number * 2 >>> def info(func): def wrapper(*args): print('Function name: ' + func.__name__) print('Function docstring: ' + str(func.__doc__)) return func(*args) return wrapper >>> my_decorator = info(doubler) >>> print(my_decorator(2)) Function name: doubler Function docstring: Doubles the number passed to it 4

You will note that are decorator function, info(), has a function nested inside of it, called wrapper(). You can call the nested function whatever you like. The wrapper function accepts the arguments (and optionally the keyword arguments) of the function you are wrapping with your decorator. In this example, we print out the wrapped function’s name and docstring, if it exists. Then we return the function, calling it with its arguments. Lastly, we return the wrapper function.

To use the decorator, we create a decorator object:

>>> my_decorator = info(doubler)

Then to call the decorator, we call it just like we would a normal function: my_decorator(2).

However this is not the usual method of calling a decorator. Python has a special syntax just for that!

Using Decorator Syntax

Python allows you to call a decorator by using the following syntax: @info. Let’s update our previous example to use proper decorator syntax:

def info(func): def wrapper(*args): print('Function name: ' + func.__name__) print('Function docstring: ' + str(func.__doc__)) return func(*args) return wrapper   @info def doubler(number): """Doubles the number passed to it""" return number * 2   print(doubler(4))

Now you can call doubler() itself instead of calling the decorator object. The @info above the function definition tells Python to automatically wrap (or decorate) the function and call the decorator when the function is called.

Stacked Decorators

You can also stack or chain decorators. What this means is that you can use more than one decorator on a function at the same time! Let’s take a look at a silly example:

def bold(func): def wrapper(): return "<b>" + func() + "</b>" return wrapper   def italic(func): def wrapper(): return "<i>" + func() + "</i>" return wrapper   @bold @italic def formatted_text(): return 'Python rocks!'   print(formatted_text())

The bold() decorator will wrap the text with your standard bold HTML tags, while the italic() decorator does the same thing but with italic HTML tags. You should try reversing the order of the decorators to see what kind of effect it has. Give it a try before continuing.

Now that you’ve done that, you will have noticed that you Python appears to run the decorator closest to the function first and go up the chain. So in the version of code above, the text will get wrapped in italics first and then that text will get wrapped in bold tags. If you swap them, then the reverse will occur.

Adding Arguments to Decorators

Adding arguments to decorators is a bit different than you might think it is. You can’t just do something like @my_decorator(3, ‘Python’) as the decorator expects to take the function itself as it’s argument…or can you?

def info(arg1, arg2): print('Decorator arg1 = ' + str(arg1)) print('Decorator arg2 = ' + str(arg2))   def the_real_decorator(function):   def wrapper(*args, **kwargs): print('Function {} args: {} kwargs: {}'.format( function.__name__, str(args), str(kwargs))) return function(*args, **kwargs)   return wrapper   return the_real_decorator   @info(3, 'Python') def doubler(number): return number * 2   print(doubler(5))

As you can see, we have a function nested in a function nested in a function! How does this work? The function argument doesn’t even seem to be defined anywhere. Let’s remove the decorator and do what we did before when we created the decorator object:

def info(arg1, arg2): print('Decorator arg1 = ' + str(arg1)) print('Decorator arg2 = ' + str(arg2))   def the_real_decorator(function):   def wrapper(*args, **kwargs): print('Function {} args: {} kwargs: {}'.format( function.__name__, str(args), str(kwargs))) return function(*args, **kwargs)   return wrapper   return the_real_decorator   def doubler(number): return number * 2   decorator = info(3, 'Python')(doubler) print(decorator(5))

This code is the equivalent of the previous code. When you call info(3, ‘Python’), it returns the actual decorator function, which we then call by passing it the function, doubler. This gives us the decorator object itself, which we can then call with the original function’s arguments. We can break this down further though:

def info(arg1, arg2): print('Decorator arg1 = ' + str(arg1)) print('Decorator arg2 = ' + str(arg2))   def the_real_decorator(function):   def wrapper(*args, **kwargs): print('Function {} args: {} kwargs: {}'.format( function.__name__, str(args), str(kwargs))) return function(*args, **kwargs)   return wrapper   return the_real_decorator   def doubler(number): return number * 2   decorator_function = info(3, 'Python') print(decorator_function)   actual_decorator = decorator_function(doubler) print(actual_decorator)   # Call the decorated function print(actual_decorator(5))

Here we show that we get the decorator function object first. Then we get the decorator object which is the first nested function in info(), namely the_real_decorator(). This is where you want to pass the function that is being decorated. Now we have the decorated function, so the last line is to call the decorated function.

I also found a neat trick you can do with Python’s functools module that will make creating decorators with arguments a bit shorter:

from functools import partial     def info(func, arg1, arg2): print('Decorator arg1 = ' + str(arg1)) print('Decorator arg2 = ' + str(arg2))   def wrapper(*args, **kwargs): print('Function {} args: {} kwargs: {}'.format( function.__name__, str(args), str(kwargs))) return function(*args, **kwargs)   return wrapper   decorator_with_arguments = partial(info, arg1=3, arg2='Py')   @decorator_with_arguments def doubler(number): return number * 2   print(doubler(5))

In this case, you can create a partial function that takes the arguments you are going to pass to your decorator for you. This allows you to pass the function to be decorated AND the arguments to the decorator to the same function. This is actually quite similar to how you can use functools.partial for passing extra arguments to event handlers in wxPython or Tkinter.

Class Decorators

When you look up the term “class decorator”, you will find a mix of articles. Some talk about creating decorators using a class. Others talk about decorating a class with a function. Let’s start with creating a class that we can use as a decorator:

class decorator_with_arguments:   def __init__(self, arg1, arg2): print('in __init__') self.arg1 = arg1 self.arg2 = arg2 print('Decorator args: {}, {}'.format(arg1, arg2))   def __call__(self, f): print('in __call__') def wrapped(*args, **kwargs): print('in wrapped()') return f(*args, **kwargs) return wrapped   @decorator_with_arguments(3, 'Python') def doubler(number): return number * 2   print(doubler(5))

Here we have a simple class that accepts two arguments. We override the __call__() method which allows us to pass the function we are decorating to the class. Then in our __call__() method, we just print out that where we’re at in the code and return the function. This works in much the same way as the examples in the previous section. I personally like this method because we don’t have functions nested 2 levels inside another function, although some could argue that the partial example also fixed that issue.

Anyway the other use case that you will commonly find for a class decorator is a type of meta-programming. So let’s say we have the following class:

class MyActualClass: def __init__(self): print('in MyActualClass __init__()')   def quad(self, value): return value * 4   obj = MyActualClass() print(obj.quad(4))

That’s pretty simple, right? Now let’s say we want to add special functionality to our class without modifying what it already does. For example, this might be code that we can’t change for backwards compatibility reasons or some other business requirement. Instead, we can decorate it to extend it’s functionality. Here’s how we can add a new method, for example:

def decorator(cls): class Wrapper(cls): def doubler(self, value): return value * 2 return Wrapper   @decorator class MyActualClass: def __init__(self): print('in MyActualClass __init__()')   def quad(self, value): return value * 4   obj = MyActualClass() print(obj.quad(4)) print(obj.doubler(5)

Here we created a decorator function that has a class inside of it. This class will use the class that is passed to it as it’s parent. In other words, we are creating a subclass. This allows us to add new methods. In this case, we add our doubler() method. Now when you create an instance of the decorated MyActualClass() class, you will actually end up with the Wrapper() subclass version. You can actually see this if you print the obj variable.

Wrapping Up

Python has a lot of decorator functionality built-in to the language itself. There are @property, @classproperty, and @staticmethod that you can use directly. Then there is the functools and contextlib modules which provide a lot of handy decorators. For example, you can fix decorator obfuscation using functools.wraps or make any function a context manager via contextlib.contextmanager.

A lot of developers use decorators to enhance their code by creating logging decorators, catching exceptions, adding security and so much more. They are worth the time to learn as they can make your code more extensible and even more readable. Decorators also promote code reuse. Give them a try sometime soon!

Related Reading

Also include class decorators, functools.wrap, @contextlib, decorators with arguments

Python 201: Decorating the main function

Categories: FLOSS Project Planets

Drupal.org blog: What’s new on Drupal.org? - June 2017

Planet Drupal - Tue, 2017-07-18 11:46

Read our Roadmap to understand how this work falls into priorities set by the Drupal Association with direction and collaboration from the Board and community.

Drupal.org updates

Healthcare industry page launched

One of our major goals this year is to highlight the power of Drupal in key industries. The Drupal.org industry pages highlight the story of building a custom-tailored solution for each industry using third-party integrations, expert hosting, or even purpose built distributions for the industry. Each page also highlights case studies which show demonstrated success stories using Drupal in each industry. In June we've launched our latest industry page, highlighting the Healthcare industry.

Semantic Labels for Development Branches

With a six month release cycle for Drupal core, the environment that project maintainers should test their code against will change fairly frequently. To make it easier for maintainers to keep up to date with testing - we've introduced semantic labels for the core branches. Maintainers can now configure tests against Default — the current development branch of Drupal, Stable — the most recent release of core, and Supported — the current patch/bug-fix branch.

These semantic labels should make it easier for project maintainers to manage testing. We hope to expand on this with a few more labels, and may even extend these semantic labels to the version field that issues are filed against in the future.

UTF8MB4 support

As mentioned in last month's update, we've updated the Drupal.org and the sub-sites to support the UTF8MB4 extended character set. While the changes for the sub-sites were deployed in May, we finished up by adding support to Drupal.org itself in June. Among other things, this means that Drupal.org will no longer throw errors if emoji are used in content.

Categories: FLOSS Project Planets

jmolivas.com: One million downloads, one million thanks

Planet Drupal - Tue, 2017-07-18 11:20
One million downloads, one million thanks

It feels great to build a Drupal tool that has achieved more than 1 million downloads and helps people from different places around the world to create, build and deploy Drupal applications. It's been quite a journey, which took almost four years and required a lot of time and effort. It’s only fitting that I walk you through my Drupal Console journey.

I hope that taking you through my experience working on the Drupal Console will motivate you become part of a project, collaborate or take the first step. So here are the most important milestones.

The Beginning: The commit that started all

After been organizing a few hangouts and trying to decide to start a contributed project related to Drupal 8, David Flores pushed the first commit to the project repo. It was just a README.md file but every journey, even those that impact many people, start with one single step. That file marked the beginning of Drupal Console.

jmolivas Tue, 07/18/2017 - 15:20
Categories: FLOSS Project Planets

Drupal Association blog: Take the Survey on the Community Governance Summit

Planet Drupal - Tue, 2017-07-18 09:28

I recently shared the community needs and potential strategies for evolving community governance, which resulted from the Community Discussions we held in person and online throughout April and May. You can find the webinar recording and written transcript, as well as the meeting minutes from all Community Discussions, at https://www.drupal.org/community/discussions.

Many community members who participated in these discussions agreed that the next step to take in this process is to hold a Community Governance Summit. However, we are not yet clear on where and when this event should take place, who should participate, and several other important details. I worked with community members to develop this survey so we can answer those questions.

Please take 5 minutes to take this community survey and tell us your thoughts about the Community Governance Summit. This survey will remain open until 11:59pm EDT on July 28, 2017. We will analyze the findings and report back on what we learned in a follow-up blog post by Friday, August 4.

Thank you for your time and participation.

Categories: FLOSS Project Planets

Valuebound: How to add a Product Programmatically to Drupal Commerce Cart

Planet Drupal - Tue, 2017-07-18 08:32

In last two blog post we discussed the basics of getting started with Drupal Commerce and the steps of e-commerce products creation. As we move forward with our learnings, we will write about how we dealt with those. 

There is Business logic which demands few things out of the box where we create custom modules to aid a process. I came across a situation where we had to use Drupal Commerce module but the product was coming from the content type. Even though we had to import the product as commerce…

Categories: FLOSS Project Planets
Syndicate content