FLOSS Project Planets

DrupalCon News: New Orleans Welcomes Y'all

Planet Drupal - Wed, 2016-02-03 05:44

The Louisiana Drupal Community is proud to welcome you to our world class city! Drupal powers some of our finest universities, museums, restaurants, radio stations and some of America’s oldest establishments.

Since 2010 our local and dedicated group of Drupaleanians meet each month for support and to share and socialize.

Our Drupal Camps (http://www.drupalcampnola.com/) have grown in size and popularity over the last two years with attendees traveling from around the country to attend.

Categories: FLOSS Project Planets

Reuven Lerner: Free Webinar: Pandas and Matplotlib

Planet Python - Wed, 2016-02-03 04:44

It’s time for another free hour-long Webinar! This time, I’ll be talking about the increasingly popular tools for data science in Python, namely Pandas and Matplotlib. How can you read data into Pandas, manipulate it, and then plot it? I’ll show you a large number of examples and use cases, and we’ll also have lots of time for Q&A. Previous Webinars have been lots of fun, and I expect that this one will be, too!

Register (for free) to participate here:

https://www.eventbrite.com/e/analzying-and-viewing-data-with-pandas-and-matplotlib-tickets-21198157259

If you aren’t sure whether you’ll be able to make it, you can still sign up; I’ll be sending information, and a URL with the recording afterwards, soon after the Webinar concludes.

I look forward to seeing you there; if you have any questions, please feel free to contact me at reuven@lerner.co.il or on Twitter as @reuvenmlerner.

The post Free Webinar: Pandas and Matplotlib appeared first on Lerner Consulting Blog.

Categories: FLOSS Project Planets

Looking for FreeBSD wallpaper for Plasma 5 Desktop

Planet KDE - Wed, 2016-02-03 04:36

Most distro’s that ship Plasma Desktop as .. well, as a desktop to work in, have their own default wallpaper choice that isn’t exactly the upstream default. OpenSUSE has things with geekos (which I personally really like, for their understatedness). KDE neon goes for the upstream default, but that is the nature of that particular distro.

The FreeBSD packages of KDE4 had a nice variant of vertical blinds (here’s the OpenSUSE variant — FreeBSD is blue and with a FreeBSD logo). I think that was done by Ivan. However, we’re getting close to a release of Plasma 5 Desktop and workspaces as well as KDE Applications for FreeBSD, and it’s time to think of a new default wallpaper for the FreeBSD packages. Something lightly branded. So this here is a call for contributions for a KDE-FreeBSD wallpaper for use with the first (FreeBSD) release of the current generation of KDE software.

(I know personally I’d like some combination of Flying Konqui with a Beastie logo, but we’re open to all kinds of ideas.)

Categories: FLOSS Project Planets

Jeff Hinrichs: Mutant Registration: Implicit or Explicit

Planet Python - Wed, 2016-02-03 04:14

Since Python is call-by-object(*1), a function that mutates a mutable argument, changes that object in the caller’s scope. some code to illustrate:

>>> mobject = {'magic': True} >>> id(mobject) 140330485577440 >>> >>> def toggle(mdata): ... '''flip the state of magic''' ... mdata['magic'] = not mdata['magic'] ... >>> >>> toggle(mobject) >>> mobject {'magic': False} >>> id(mobject) 140330485577440

So hopefully this does not surprise you. If it does, please see the two links in the footnotes(*1) as they explain it quiet well.

My question deals with the implicit nature of the mutation. Not that Python is somehow wrong, it is the fact that the function usage does not convey the mutation to the reader as pointedly as I want. Coming from other languages that are call by value, a function that wanted to mutate an argument and get it back into the caller’s scope had to return the mutated value.

>>> def toggle_explicit(mdata): ... '''flip the state of magic and return''' ... mdata['magic'] = not mdata['magic'] ... return mdata ... >>> mobject = toggle_explicit(mobject) >>> mobject {'magic': True} >>> id(mobject) 140330485577440 >>>

Now I know that the above code is most definitely NOT call by value, but I do feel that it is more explicit about my intention. Even though the assignment is not needed for the actual effect. i.e.:

>>> toggle_explicit(mobject) {'magic': False} >>> mobject {'magic': False}

So why does toggle_explicit() give me the warm fuzzies? Where as toggle() requires the reader to know what is going on. Is it just me shaking the cruft of call-by-value languages off? What do you do, when you mutate state within a function? Is the toggle_explicit() form not/less Pythonic?

— Footnotes —

(*1) Raymond Hettinger in this SO article references a post by Fredrik Lundh’s on “Call By Object

Categories: FLOSS Project Planets

groups.drupal.org frontpage posts: Scott Reeves

Planet Drupal - Wed, 2016-02-03 04:11

I'm pleased to announce that Scott Reeves (Cottser on Drupal.org) has accepted my invitation to become a provisional Drupal 8 committer. He will be focused on front-end and theming.

Scott has been working with Drupal for nearly 5 years, and has a strong passion around improving the theming experience of Drupal. Scott was a major force in the push for Twig and clean markup in Drupal 8 core, sharing both his technical expertise and his enthusiastic community-building to make Drupal 8's theme layer awesome. He helped lead the "Consensus Banana" initiative that solved a long-standing concern with how core provides classes and markup, and then helped add the Stable base theme so that Drupal core could provide backwards compatibility for themes in minor releases.

Scott has organized sprints and discussions at many DrupalCons, including the groundbreaking templating and performance testing sprint at DrupalCon Portland that allowed Twig to become Drupal's primary theme engine. He and others also organized a Drupal 8 Accelerate sprint on security criticals related to the theme system that were blocking Drupal 8's release, engaging novice contributors to fix the issues. Finally, Scott was previously a lead for the Drupal Core Contribution Mentoring program, mentoring dozens of other contributors on IRC, at sprints, etc. He is skilled at evaluating a problem, framing how it can be solved, and helping people solve it. In short: Scott has not only the strong technical abilities, but also the patient and supportive personality to make him an amazing fit for a core committer.

Scott's appointment as a core committer was enthusiastically endorsed from the rest of the Drupal 8 committers. Please join me in helping him feel welcome! And please also give thanks to his employer, Digital Echidna, who have agreed to partially sponsor his community time!

Categories: FLOSS Project Planets

Drupal core announcements: Looking for another Drupal 7 co-maintainer

Planet Drupal - Wed, 2016-02-03 04:05

I selected David Rothstein as my co-maintainer for Drupal 7 back in May of 2012. Since then, David has done a tremendous job shepherding the Drupal 7 release, paying very careful attention to the ramifications of any given patch and allowing ample time for "real world" testing before incorporating changes into the code base, ensuring that the code powering 2% of the Internet stays stable and performant.

However, after nearly 4 years of excellent stewardship on his own, David would like to also focus on other endeavors, including Drupal 8. Now the time has come to select an additional co-maintainer for Drupal 7. While David himself has recommended some excellent candidates, I'd also like to open the call out more broadly, to see if there are others who have an inclination and interest.

The Drupal core maintainer handbook contains comprehensive documentation on everything that a release manager does. In particular, the ideal candidate has the following traits:

  • Ample experience building "real world" sites/platforms on Drupal 7, particularly high-performant sites, sites with millions of records, or other edge cases.
  • Ample experience performing detailed and thorough technical reviews of patches, being particularly mindful of their effects on existing sites.
  • Ability to communicate calmly and respectfully when critiquing code.
  • Solid knowledge of Git and the Drupal.org release process.
  • Ideally, sponsored time to work through your employer to maintain Drupal 7, particularly around the first and third Wednesdays of the month, which are the Drupal core release windows.

Please either respond here or use my contact form if you'd like to be considered as a potential Drupal 7 co-maintainer. Thank you!

Categories: FLOSS Project Planets

Thomas Goirand: Moby

Planet Debian - Wed, 2016-02-03 01:00

Just a quick reply to Rhonda about Moby. You can’t introduce him without telling about Go, which is the title who made him famous, very early in the age of electronic music (November 1990, according to wikipedia). Many attempted to remix this song (and Moby himself), but nothing’s as good as the original version.

Categories: FLOSS Project Planets

Modules Unraveled: 154 Commerce 2.x for Drupal 8 with Bojan Zivanovic - Modules Unraveled Podcast

Planet Drupal - Wed, 2016-02-03 01:00
Published: Wed, 02/03/16Download this episodeCommerce 2.x for Drupal 8
  • What has been the biggest success of Commerce on D7?
    • By starting from scratch on D7 technologies we created a solution that is intuitive to Drupal developers and easier to extend. And with 60k installs, we’ve set a record for ecommerce on Drupal in general.
  • And what do you think have been its biggest weaknesses?
    • Not prioritizing UX from the start. Took us a year after the 1.0 release to create Inline Entity Form and recreate the admin screens as a part of the Kickstart. At that point many people already had the impression that Commerce was hard to use.
    • Not providing enough direction to developers. Flexibility is important, as is having unopinionated code. But developers also need to have a clear and obvious path forward. Having an opinionated layer on top, with sane defaults, can save a lot of development time and prevent frustration.
    • Not prioritizing certain features, leaving them to contrib instead. Modules that make up the checkout ux (checkout progress, checkout redirect, addressbook), discounts. Of course, all generals are smart after the battle.
  • How has that influenced the development of Commerce 2.x?
    • With Commerce 2.x we once again started from scratch, evaluating all feedback received in the 1.x cycle. We decided to address all three of these major points.
    • Better UX means paying more attention to the product and order admin experience, as well as providing better checkout out of the box.
    • Better APIs means doing more work for the developer, especially around pricing and taxes.
    • And finally, we’re growing the core functionality. We’re expecting a dozen contrib modules to be no longer needed, as we address edge cases and add functionality.
  • What are some of the biggest new features of Commerce 2.x?
    • Multi-store will allow people to bill customers from different branches (US and FR offices, for example), or create marketplaces like Etsy.
    • Improved support for international markets means better address forms, better currency management, and significantly better tax support, the kind that will reduce the need for people to use cloud-based tax solutions, at least in Europe.
    • Support for multiple order types, each with its own checkout and workflows will allow developers to create tailored experiences for different kinds of products, such as events, ebooks, t-shirts.
    • An integrated discounts UI means more power to the store admin.
    • And this is just the beginning. Under the hood there are many small features and improvements, over both 1.x and Kickstart.
  • What has Commerce done to integrate better with the PHP and Drupal communities?
    • We’ve created several independent ecommerce libraries, attacking currency formatting, address management and taxes. These libraries are now being adopted by the wider PHP community, bringing us additional contributors.
    • On the Drupal side we’ve joined forces with the Profile2 team, creating the D8 Profile module that we’ll use for customer profiles. We’re also depending on Inline Entity Form, which is now shared with the Media team. We’re also moving some of our generic entity code into a new Entity API module, maintained together with Daniel Wehner and other community members.
    • Finally, we have been champions of Composer, the replacement for Drush Make, and required for any module that depends on external libraries.
The Future of Commerce 2.x
  • Commerce 2.x is now in alpha2. What’s included? What’s next?
    • Alpha2 includes stores and products, as well as initial order and cart implementations.
    • It also has functional currency management and formatting, address and profile management.
    • Alpha3, to be released in the next two weeks, is focusing on completing the order and cart implementations, and adding the initial checkout implementation.
    • Post-alpha3 our focus will be on discounts, taxes, and finally, payments.
    • The best way to learn more about this is to read the drupalcommerce.org blog, where I post “Commerce 2.x stories” detailing work done so far. We have several new posts planned for february.
  • When can we expect Commerce 2.x to be production ready?
    • Our current goal is to release a production ready beta by end of march. We should also have Search API and Rules by then. Leading up to DrupalCon New Orleans we’ll be helping the community implement shipping and licensing and port payment modules. At the same time, we’ll be focusing on reaching RC status.
  • What’s the status of commerce contrib? Like PayPal, Authorize.net, etc.
  • How can the community help?
    • Each new alpha welcomes more manual testing and feedback.
    • We also have office hours every wednesday at 3PM GMT+1 on #drupal-commerce where people can discuss code and help out on individual issues.
  • Do you feel that requiring Commerce to be installed via Composer will impact adoption?
    • The average developer is already familiar with Composer and will benefit greatly from it, just like D7 developers benefited from Drush Make. Getting Drupal, Commerce, and all dependencies is a single Composer command, as is keeping it all up to date.
    • People unwilling to run Composer on their servers can run it locally and commit the result.
    • I’m also hoping we’ll be able to offer distribution-like tarballs on either drupal.org or drupalcommerce.org as we get closer to a release candidate.
Questions from Twitter
  • howdytom ‏@howdytom
    Commerce Kickstart provides a great toolset with basic configuration. Is there a plan to do a Commerce Kickstart for Drupal 8? If not, will Commerce provide more out of the box solutions for a full featured shop?
    • Commerce Kickstart had several parts.
    • The first one was about providing better admin and checkout UX, as well as discounts. That’s now handled by Commerce out of the box.
    • The second was about providing a demo store with a developed set of frontend pages. That’s going to stay in contrib and will greatly benefit from the flexibility introduced by Drupal 8 and CMI.
    • It’s too early to plan a distribution yet. Drupal 8 has almost no contrib, and drupal.org doesn’t support using Composer to build distributions yet.
    • However, we are using Composer to provide single-command site templates, the kind that gives you Drupal core, Commerce and other modules. This will allow us to provide good starting points for different use cases, similar in nature to Commerce Kickstart 1.x.
    • Once 2017 comes around, we’ll investigate next steps.
  • Jimmy Henderickx ‏@StryKaizer
    In commerce d8, will it be possible to alter a product name dynamicly (either by hook or other solution)?
  • Czövek András ‏@czovekandras
    Any plans making iframe payment methods 1st class citizens? Thinking of running checkout form callbacks.
  • Marc van Gend ‏@marcvangend
    How did D8 architecture change the way you code your modules?
Episode Links: Bojan on drupal.orgBojan on Twitter#Drupal-Commerce channel on IRCCommerce 2.x blog postsInstalling Commerce 2.x using ComposerDrupal Commerce DocumentationTim Millwood’s MultiversionTags: CommerceDrupal 8planet-drupal
Categories: FLOSS Project Planets

My Ruby Performance Optimization Book Is Now In Print

Planet KDE - Wed, 2016-02-03 01:00

My Ruby Performance Optimization book is in print!

Honestly, it's old news. I was so excited to get the book out and ruby-performance-book.com up that I forgot to announce it here on my personal blog.

I'm proud to say that my Ruby Performance Optimization is the first book on Ruby and Rails performance that actually teaches performance optimization and is not a mere collection of tips and tricks.

See why you should read the book and make sure to read excerpts about what makes ruby code fast, how to optimize your iterators, and analyze/compare measurements using statistics.

Printed book costs $36. Make sure to check Amazon before you buy. They sometimes sell it for $30. There are also many offers for used books around $20. I don't really know where they come from. So if you buy one, please let me know how well that went.

Of course you can stil buy an ebook in epub, PDF, and Kindle (mobi) formats for just $24.

Buy Now
Categories: FLOSS Project Planets

Michal Čihař: New projects on Hosted Weblate

Planet Debian - Wed, 2016-02-03 00:00

I had some pile of hosting requests in queue since half of January and my recent talk on FOSDEM had some impact on requests for hosting translations as well, so it's about time to process them.

New kids on the block are:

Unfortunately I had to reject some projects as well mostly due to lack of file format support. This is still the same topic - when translating project, please stick with some standard format. Preferably what is usual on your platform.

If you like this service, you can support it on Bountysource salt or Gratipay. There is also option for hosting translations of commercial products.

Filed under: English Weblate | 0 comments

Categories: FLOSS Project Planets

Vasudev Ram: Using Python's trace module to understand the flow of programs (from many angles)

Planet Python - Tue, 2016-02-02 22:28
By Vasudev Ram


Some time back, I had written this post:

Python's trace module and chained decorators

in which I had briefly described use of the Python standard library's trace module to help us understand and debug Python programs. In that post I showed a small program with 3 chained decorators. The trace module was used to trace the execution of the decorators and the functions that they decorated.

The trace output in that post also showed the difference between function definition and function execution, both of which occur at run time in Python, since it is a dynamic language.

In this post, I'm going to use the trace module in a few other ways.

Here is a small program in which we will use the trace module.

(Note that I said "in which", not "on which", because I am going to invoke the trace module as a library from within this program, and tell it to start tracing from a specific function call, unlike in my previous post (linked above), in which I used the trace module as though it was a program itself, by using the "python -m" option, to trace my own program containing those decorators.)
# This is a program to show some basic usage of the trace module
# from the Python standard library.
# Author: Vasudev Ram -
# http://jugad2.blogspot.in/p/about-vasudev-ram.html
# Copyright 2016 Vasudev Ram

def fa():
fb()

def fb():
fc()

def fc():
fd(5)

def fd(n):
if n = 1:
return
else:
fd(n - 1)

import trace

tracer = trace.Trace(
count=0, trace=0, countfuncs=0, countcallers=1,
)

tracer.run('fa()')
r = tracer.results()
r.write_results(show_missing=True, coverdir=".")
In this program, I have a function fa calling fb which calls fc which calls fd. Function fd also calls itself recursively, with a termination condition so the recursion is not infinite.

Note that the program contains all the three main programming constructs: sequential execution of statements, conditional execution and iteration (via the recursive call in function fd).

From the Python documentation, the trace.Trace() constructor has the following (partial) signature:

class trace.Trace(count=1, trace=1, countfuncs=0, countcallers=0, ...)

where I have used ellipsis (...) to represent the remaining arguments, which I do not pass. (See the docs (linked above, near top of post) for the full signature and the meaning of all the arguments. The ones I use are explained below.)

As for what those arguments do, again, from the docs:

Create an object to trace execution of a single statement or expression. All parameters are optional. count enables counting of line numbers. trace enables line execution tracing. countfuncs enables listing of the functions called during the run. countcallers enables call relationship tracking.

I ran the program simple_prog.py 4 times. Each time I passed a different combination of argument values to trace.Trace() - with only one argument set to 1 each time, and all the others set to 0 in that run. And each time I redirected the resulting trace output to an output file, except for the first run, in which Python created the output in the file simple_prog.cover (since the program being traced is named simple_prog.py.

The lines below show the sets of arguments passed, and the corresponding output file names for the trace output. (I will show the contents of each output file later, below.)

arg set 1: count=1, trace=0, countfuncs=0, countcallers=0, output: simple_prog.cover

arg set 2: count=0, trace=1, countfuncs=0, countcallers=0, output: run_2.txt

arg set 3: count=0, trace=0, countfuncs=1, countcallers=0, output: run_3.txt

arg set 4: count=0, trace=0, countfuncs=0, countcallers=1, output: run_4.txt

Notice that in each of the arg sets, only one flag is set.

I ran the program this time with just:

python simple_prog.py

since the tracing is started from within the program, unlike in my previous post (linked above) in which I started the tracing like this:

python -m trace -t test_chained_decorators.py

Here is the output for the 1st run, simple_prog.cover: # This is a program to show some basic usage of the trace module
# from the Python standard library.
# Author: Vasudev Ram -
# http://jugad2.blogspot.in/p/about-vasudev-ram.html
# Copyright 2016 Vasudev Ram

>>>>>> def fa():
1: fb()

>>>>>> def fb():
1: fc()

>>>>>> def fc():
1: fd(5)

>>>>>> def fd(n):
5: if n <= 1:
1: return
else:
4: fd(n - 1)

>>>>>> import trace

>>>>>> tracer = trace.Trace(
>>>>>> count=1, trace=0, countfuncs=0, countcallers=0,
)

>>>>>> tracer.run('fa()') # This line starts the tracing process.
>>>>>> r = tracer.results()
>>>>>> r.write_results(show_missing=True, coverdir=".")
You can see that the output includes the counts of the number of times lines of code are called. Notice that there are no line counts for the def lines, presumably because function definitions are only supposed to be done once (by definition, ha ha), so it would not make sense to show it, and might even be confusing.

Here is the output for the 2nd run, run_2.txt: --- modulename: simple_prog, funcname: <module>
<string>(1): --- modulename: simple_prog, funcname: fa
simple_prog.py(6): fb()
--- modulename: simple_prog, funcname: fb
simple_prog.py(9): fc()
--- modulename: simple_prog, funcname: fc
simple_prog.py(12): fd(5)
--- modulename: simple_prog, funcname: fd
simple_prog.py(15): if n <= 1:
simple_prog.py(18): fd(n - 1)
--- modulename: simple_prog, funcname: fd
simple_prog.py(15): if n <= 1:
simple_prog.py(18): fd(n - 1)
--- modulename: simple_prog, funcname: fd
simple_prog.py(15): if n <= 1:
simple_prog.py(18): fd(n - 1)
--- modulename: simple_prog, funcname: fd
simple_prog.py(15): if n <= 1:
simple_prog.py(18): fd(n - 1)
--- modulename: simple_prog, funcname: fd
simple_prog.py(15): if n <= 1:
simple_prog.py(16): return
--- modulename: trace, funcname: _unsettrace
trace.py(80): sys.settrace(None)
Since the trace flag is set, we get line execution tracing. And due to that, there are 5 entries for function fd, since there are 5 calls to it (of which 4 are recursive).

Here is the output for the 3rd run, run_3.txt: functions called:
filename: <string>, modulename: <string>, funcname: <module>
filename: D:\Anaconda-2.1.0-64\lib\trace.py, modulename: trace, funcname: _unsettrace
filename: simple_prog.py, modulename: simple_prog, funcname: fa
filename: simple_prog.py, modulename: simple_prog, funcname: fb
filename: simple_prog.py, modulename: simple_prog, funcname: fc
filename: simple_prog.py, modulename: simple_prog, funcname: fd
Since the countfuncs flag is set, it shows the functions called during the run of the program.

Here is the output for the 4th run, run_4.txt: calling relationships:

*** <string> ***
--> simple_prog.py
<string>.<module> -> simple_prog.fa

*** D:\Anaconda-2.1.0-64\lib\trace.py ***
--> <string>
trace.Trace.runctx -> <string>.<module>
trace.Trace.runctx -> trace._unsettrace

*** simple_prog.py ***
simple_prog.fa -> simple_prog.fb
simple_prog.fb -> simple_prog.fc
simple_prog.fc -> simple_prog.fd
simple_prog.fd -> simple_prog.fd
Since the countcallers flag is set, it shows the function call tree during the run of the program, i.e. what function called what other function(s). The last line shows the recursive call to fd.

So we can see, overall, that those four flags to trace.Trace(), allowed us to get insight into the behaviour of the program, from various angles or perspectives. This makes the trace module a useful tool for debugging and for understanding code that we have to work on.

- Enjoy.

- Vasudev Ram - Online Python training and programming

Signup to hear about new products and services I create.

Posts about Python  Posts about xtopdf

My ActiveState recipes

Share |

Vasudev Ram
Categories: FLOSS Project Planets

Mike Driscoll: Free Intro to Python Course from Webucator

Planet Python - Tue, 2016-02-02 21:33

Webucator recently contacted me to let me know that they have finished up an Introduction to Python Training that they are allowing people to take for free for the month of February. The course is made up of videos, exercises, readings, and quizzes. You can get it free by using the following code when you register: PYTHON

I thought they did a good job when they did a video based on my context manager article.

Categories: FLOSS Project Planets

OSTraining: You Should Use the Drupal Security Review Module

Planet Drupal - Tue, 2016-02-02 20:53

There are two really useful checklist modules in Drupal:

In this video, taken from our Drupal 7 Security class, Robert introduces the Security Review module. He shows you how to fix some of the most common errors found by the module, such as "Base URL is not set in settings.php" and "Some files and directories in your install are writable". Even if you think your site is safe, give the Security Review module and you may well find something you missed.

Categories: FLOSS Project Planets

GNUtls: GnuTLS 3.4.9

GNU Planet! - Tue, 2016-02-02 19:00

Released GnuTLS 3.3.21 and GnuTLS 3.4.9 which are bug fix releases in the previous and current stable branches. The former disables RC4 from the default priorities.

Categories: FLOSS Project Planets

Justin Mason: Links for 2016-02-02

Planet Apache - Tue, 2016-02-02 18:58
Categories: FLOSS Project Planets

Rhonda D'Vine: Moby

Planet Debian - Tue, 2016-02-02 18:08

Today is one of these moods. And sometimes one needs certain artists/music to foster it. Music is powerful. There are certain bands I know that I have to stay away from when feeling down to not get too deep into it. Knowing that already helps a lot. The following is an artist that is not completely in that area, but he got powerful songs and powerful messages nevertheless; and there was this situation today that one of his songs came to my mind. That's the reason why I present you today Moby. These are the songs:

  • Why Does My Heart Feel So Bad?: The song for certain moods. And lovely at that, not dragging me too much down. Hope you like the song too. :)
  • Extreme Ways: The ending tune from the movie The Bourne Ultimatum, and I fell immediately in love with the song. I used it for a while as morning alarm, a good start into the day.
  • Disco Lies: If you consider the video disturbing you might be shutting your eyes from what animals are facing on a daily basis.

Hope you like the selection; and like always: enjoy!

/music | permanent link | Comments: 2 | Flattr this

Categories: FLOSS Project Planets

Mike Driscoll: Python 3 – Import from github

Planet Python - Tue, 2016-02-02 15:13

The other day, I came across this interesting experimental package called import_from_github_com. The package uses the new import hooks provided in PEP 302 to basically allow you to import a package from github. What the package actually appears to do is install the package and add it to locals. Anyway, you need Python 3.2 or greater, git and pip to use this package.

Once it’s installed, you can do the following:

>>> from github_com.zzzeek import sqlalchemy Collecting git+https://github.com/zzzeek/sqlalchemy Cloning https://github.com/zzzeek/sqlalchemy to /tmp/pip-acfv7t06-build Installing collected packages: SQLAlchemy Running setup.py install for SQLAlchemy ... done Successfully installed SQLAlchemy-1.1.0b1.dev0 >>> locals() {'__builtins__': <module 'builtins' (built-in)>, '__spec__': None, '__package__': None, '__doc__': None, '__name__': '__main__', 'sqlalchemy': <module 'sqlalchemy' from '/usr/local/lib/python3.5/site-packages/sqlalchemy/__init__.py'>, '__loader__': <class '_frozen_importlib.BuiltinImporter'>}

One important note that isn’t mentioned on the package’s github page is that you need to run Python as an administrator or it won’t be able to install its packages. At least, this was true for me on Xubuntu. Anyway I thought this was a neat little package and demonstrates some of neat little import hooks that you can add to Python 3.

Categories: FLOSS Project Planets

Compilers and error messages

Planet KDE - Tue, 2016-02-02 14:44

So. I typo’ed up some template code the other day. And once again I learned the importance of using several c++ compilers.

Here is a very reduced version of my code:

#include <utility>
template <typename T> auto foo(const T& t) -> decltype(x.first)
{
return t.first;
}
int main()
{
foo(std::make_pair(1,2));
return 0;
}

And let’s start with the compiler I was testing with first.

MSVC (2013 and 2015)

main.cpp(8): error C2672: ‘foo’: no matching overloaded function found
main.cpp(8): error C2893: Failed to specialize function template ‘unknown-type foo(const T &)’

It is not completely clear from that error message what’s going on, so let’s try some other compilers:

GCC (4.9-5.3)

2 : error: ‘x’ was not declared in this scope
template <typename T> auto foo(const T& t) -> decltype(x.first)

That’s pretty clear. More compilers:

Clang (3.3-3.7)

2 : error: use of undeclared identifier ‘x’
template <typename T> auto foo(const T& t) -> decltype(x.first)

ICC (13)

example.cpp(2): error: identifier “x” is undefined
template <typename T> auto foo(const T& t) -> decltype(x.first)

(Yes. I mistyped the variable name used for decltype. Replacing the x with t makes it build).

Thanks to http://gcc.godbolt.org/ and http://webcompiler.cloudapp.net/ for testing with various compilers.

Categories: FLOSS Project Planets

Sune Vuorela: Compilers and error messages

Planet Debian - Tue, 2016-02-02 14:44

So. I typo’ed up some template code the other day. And once again I learned the importance of using several c++ compilers.

Here is a very reduced version of my code:

#include <utility>
template <typename T> auto foo(const T& t) -> decltype(x.first)
{
return t.first;
}
int main()
{
foo(std::make_pair(1,2));
return 0;
}

And let’s start with the compiler I was testing with first.

MSVC (2013 and 2015)

main.cpp(8): error C2672: ‘foo’: no matching overloaded function found
main.cpp(8): error C2893: Failed to specialize function template ‘unknown-type foo(const T &)’

It is not completely clear from that error message what’s going on, so let’s try some other compilers:

GCC (4.9-5.3)

2 : error: ‘x’ was not declared in this scope
template <typename T> auto foo(const T& t) -> decltype(x.first)

That’s pretty clear. More compilers:

Clang (3.3-3.7)

2 : error: use of undeclared identifier ‘x’
template <typename T> auto foo(const T& t) -> decltype(x.first)

ICC (13)

example.cpp(2): error: identifier “x” is undefined
template <typename T> auto foo(const T& t) -> decltype(x.first)

(Yes. I mistyped the variable name used for decltype. Replacing the x with t makes it build).

Thanks to http://gcc.godbolt.org/ and http://webcompiler.cloudapp.net/ for testing with various compilers.

Categories: FLOSS Project Planets

Steve Kemp: Best practice - Don't serve writeable PHP files

Planet Debian - Tue, 2016-02-02 14:10

I deal with compromises often enough of PHP-based websites that I wish to improve hardening.

One obvious way to improve things is to not serve PHP files which are writeable by the webserver-user. This would ensure that things like wp-content/uploads didn't get served as PHP if a compromise wrote valid PHP there.

In the past using php5-suhosin would have allowd this via the suhosin.executor.include.allow_writable_files flag.

Since suhosin is no longer supported under Debian Jessie I wonder if there is a simple way to achieve this?

I've written a toy-module which allows me to call stat on every request, and return a 403 on access to writeable files/directories. But it seems like I shouldn't need to write my own code for this functionality.

Any pointers welcome; happy to post my code if that is useful but suspect not - it just shouldn't exist.

Categories: FLOSS Project Planets
Syndicate content