GNU Guix: Documentation video creation

GNU Planet! - Fri, 2019-03-15 07:00

Over the last few months, I have been working as an Outreachy intern with the GNU Guix crowd to develop videos presenting and documenting the project. My goal in this round as an Outreachy intern for the December 2018 to March 2019 period consists of creating introductory documentation videos about different topics for people who would like to use GNU Guix, admins and/or those who would like to join Guix community and don’t know where to start. Even interested or having a clear documentation, they might feel overwhelmed by it. I experienced this issue in the past with people in another context.

My main tasks consist of creating a workflow for automating as much as possible the process of creating the videos, as well as, of course, creating the videos themselves. Creating the videos is not that easy as it might seem, I have to design them (I cannot automate that part), let the audio match the video, and matching the exact timing is quite difficult. Something very important that I should mention is that the workflow currently allows translations to other languages.

It is a work in progress for too many reasons, specially because it keeps being improved all the time.

Also, I had to study tools deeply both for the creation of the workflow and the videos because I did not know them beforehand or I knew just the basics.

After trying several approaches for the workflow, the current one consists of creating “pieces of videos” and gluing them together in the end.

These “pieces of videos” may consist of:

  • Slide videos: they contain only a sequence of one or more slides.
  • Command line session videos: they contain only Guix or shell commands and their output, without showing any slide at all.
Workflow for creating each slide video.

The inputs are SVG files and audio files. First, SVGs are converted to PNGs (“the slides”). Then, a text file having the order in which each slide will appear and the duration of the audio that matches it is created. An audio text file containing all the audio files sorted to have a complete audio file is created too. Lastly, with the slides' text file that has the reference to the slide files and the glued audio file the final slide video is made.

Workflow for creating each command line session video.

The input is a session text file that has commands or meta-commands that are used to simulate, for example, the typing of a command, or the printing of it’s output. This file is passed to a Guile script that is in charge of executing the commands defined in the input text file and take text snapshots at a fixed time interval. Then, all these files are converted to postscript format. After that, they are transformed to SVG format. Finally, the process is repeated and the audio and the slides are glued to have final command line session video.

Workflow for creating the final video.

Slide videos and command line videos are a “bunch of videos” that need to be glued into the final one. They are sorted, and using the same tool for video creation our final introductory video is created.

The code for this video creation workflow is available on Savannah. Enjoy!

About GNU Guix

GNU Guix is a transactional package manager and an advanced distribution of the GNU system that respects user freedom. Guix can be used on top of any system running the kernel Linux, or it can be used as a standalone operating system distribution for i686, x86_64, ARMv7, and AArch64 machines.

In addition to standard package management features, Guix supports transactional upgrades and roll-backs, unprivileged package management, per-user profiles, and garbage collection. When used as a standalone GNU/Linux distribution, Guix offers a declarative, stateless approach to operating system configuration management. Guix is highly customizable and hackable through Guile programming interfaces and extensions to the Scheme language.

Categories: FLOSS Project Planets

Enrico Zini: gitpython: list all files in a git commit

Planet Debian - Fri, 2019-03-15 06:41

A little gitpython recipe to list the paths of all files in a commit:

#!/usr/bin/python3 import git from pathlib import Path import sys def list_paths(root_tree, path=Path(".")): for blob in root_tree.blobs: yield path / blob.name for tree in root_tree.trees: yield from list_paths(tree, path / tree.name) repo = git.Repo(".", search_parent_directories=True) commit = repo.commit(sys.argv[1]) for path in list_paths(commit.tree): print(path)

It can be a good base, for example, for writing a script that, given two git branches, shows which django migrations are in one and not in the other, without doing any git checkout of the code.

Categories: FLOSS Project Planets

Drupal Association blog: In Search of Elephants

Planet Drupal - Fri, 2019-03-15 06:28

As Community Liaison, I find it important to liaise face-to-face whenever I can, and an opportunity presented itself to visit a community I have not been able to spend time with until now; that in India.

This was going to not only be the first time I’ve worked with the community in India but also my first time in India. I couldn’t help but wonder, “Will I see any elephants?”

Think Indian!

I found myself sat on a motorbike at the side of a road in Goa, India and about to plunge into the traffic for the first time. At home, I’m an experienced motorcyclist but here, everything is different. I have to learn fast…

Waiting for a gap in the stream of vehicles that will never come, I shout at myself, “Come on Rachel, think Indian!” I just need to adjust how I think and accept that the traffic conditions here are not better or worse, just different, and to “go with the flow”. I take the plunge and catch up with Surabhi Gokte and Manjit Singh (the extremely generous community member who loaned me his beautiful Royal Enfield, pictured here) on their scooter and we disappear into the night.

Manjit's beautiful Royal Enfield Classic 350 - quite a change from my own BMW...

I learned a lot about India riding Manjit’s motorbike over the next couple of days (yes, sorry Manjit - I may have added another 250Km to the clock!) and at the marvellous Drupal Camp Goa that I had flown out to join.

Drupal Camp Goa was a great place to meet the Drupal community in India and I was determined to find out as much as I could about what was going on there. What I learned was that the community is hugely vibrant and doing amazing things —at a scale I simply never grasped before.

I was invited to do an opening talk at the beginning of the weekend and I chose to speak about community, as is my want, and how we can ensure that the whole World is aware of the community here. It is well documented in Dries’ blog posts that the contributions to the project from India are significant; they are, after all, the second most prolific country in code contributions after the USA, and then only by a small margin.

Code contributions to Drupal, by country. Taken from https://dri.es/who-sponsors-drupal-development-2018 

What struck me, though, was that I didn’t know the amazing individuals here and I don’t see them featured enough in the global Drupal conversation. I talked about how we recognise the contributions made but we all have a responsibility to ensure that we facilitate people outside of places like the USA and Europe moving into “positions of influence” in our global community; places like the track chairs of global Drupal conferences, our many working groups and so on. I would very much like every lead of every Drupal working group to be asking themselves, “If 13% of our code contributions come from India, do we have at least 13% of our group’s leadership represented by Indians and, if not, why not?”

I was particularly struck at the quality of the sessions that I attended, and the scope of the things they were discussing.

Two sessions stuck out in my mind: The first was one on machine learning and its applications in Drupal, by Akanksha Singh. She not only described much of the history behind machine learning and explained how it may be used for many applications, she described a Drupal module she is finishing developing (on drupal.org/projects very soon!) that will allow sentiment analysis of content via tools like IBM Watson. I can think of a thousand uses for this!!

I very much enjoyed a session on “college leaver” education in Drupal by Sharmila Kumaran. It seems that she has developed a system by which they spend time exposing a lot of students to Drupal and then identify those who they think have potential to move into Drupal careers. Pretty standard stuff but then they mentioned the scale of the operation and I sat up: In 2019, they are expecting to have exposed over 6,000 (yes, six thousand) college-aged people to Drupal and how it works. Is there anyone else, anywhere in the World, educating people in Drupal at this scale??

The whole camp was full of people doing amazing things. The organisers were doing a fantastic job, the food was awesome, and I left with an overwhelming feeling that region including India will power the growth of Drupal for a long time.

Shout out to all the Volunteers and Speakers of @DrupalcampGoa 2019 - We are happy to give you credits on https://t.co/Ip1TSC0VnA as you have contributed to #DCG19. Here is the link - https://t.co/hhXnXEB5Xx, please add comments to justify your contribution :) pic.twitter.com/tlCApvXhQJ

— DrupalCamp Goa (@DrupalcampGoa) March 12, 2019

In the Mountains

We all highly appreciate the contributions Drupal community members make by becoming individual members of the Drupal Association, especially as it directly finances my ability to see people face to face at camps and meetups. I make every possible effort to spend that contribution wisely. So, on the return from India, I called off at Drupal Mountain Camp in Switzerland, where I had been invited to moderate a keynote panel on “The Future of Communities”, also involving Nick Veenhof, Imre Gmelig Meijling, Yauhen Zenko and Vincent Maucorps.

A recurring theme of the panel discussion was one of collaboration between the local associations, their members and each other. At the Drupal Association, we are working to aid that collaboration as much as possible and I was hugely impressed by the panel conversations. I learned more about how the local associations in Europe work with their members and each other to promote Drupal and facilitate growth. Truly a model to emulate across our global community.

One other thing - I very much appreciate that the event, thinking about its location, supplied a wonderful woolly hat rather than the usual t-shirt as a freebie. I know I'm not the only one who is aggrieved every time she is told "Oh, we only have straight fit t-shirts". Thanks Drupal Mountain Camp!

But what about the elephants?

I never did manage to find any elephants whilst exploring India, or even in Switzerland. I did learn about a two “elephants in the room”, though:

  1. The Drupal community in India is extraordinary, doing great things, and I wasn’t aware enough of this. That is my fault and I intend to change that. I think we should all be looking to how we can learn more, too. It is very obvious that Drupal is in a state of growth in India and we should be cultivating that - I wouldn’t be surprised at all if the next webchick or xjm is already in India. We all gain by helping her grow.

  2. The Drupal communities in Europe are organising themselves in some really professional ways; using their established local associations to promote the project and members through tools like press releases, hosting local Splash Awards etc. These local associations in Europe are shining examples to other countries around the World.

Categories: FLOSS Project Planets

Droptica: Summary of DrupalCamp London 2019

Planet Drupal - Fri, 2019-03-15 06:02
As always at this time of the year, we set our course on DrupalCamp London 2019. DrupalCamp London is the event most awaited by us. This year our team was somewhat bigger. Grzesiek and Maciek were joined by Jaro. As always, we had great expectations and thirst for knowledge – and as always, we were fully satisfied.
Categories: FLOSS Project Planets

Qt 5.12.2 Released

Planet KDE - Fri, 2019-03-15 05:45

I am pleased to announce that the second patch release of Qt 5.12 LTS, the Qt 5.12.2 is released today. While not adding new features, the Qt 5.12.2 release provides a number of bug fixes and other improvements.

Compared to Qt 5.12.1, the new Qt 5.12.2 contains more than 250 bug fixes. For details of the most important changes, please check the Change files of Qt 5.12.2.

With Qt 5.12.2 we bring back widely asked MinGW 32 bit prebuild binaries in addition to 64 bit ones.

Qt 5.12 LTS will receive many more patch releases throughout the coming years and we recommend all active developed projects to migrate to Qt 5.12 LTS. Qt 5.9 LTS is currently in ‘Strict’ phase and receives only the selected important bug and security fixes, while Qt 5.12 LTS is currently receiving all the bug fixes. With Qt 5.6 Support ending in March 2019 all active projects still using Qt 5.6 LTS should now migrate to a later version of Qt.

Qt 5.12.2 is available via the maintenance tool of the online installer. For new installations, please download latest online installer from Qt Account portal or from qt.io Download page. Offline packages are available for commercial users in the Qt Account portal and at the qt.io Download page for open-source users. You can also try out the Commercial evaluation option from the qt.io Download page.

The post Qt 5.12.2 Released appeared first on Qt Blog.

Categories: FLOSS Project Planets

The Digital Cat: Clean Architectures in Python: the book

Planet Python - Fri, 2019-03-15 05:30

UPDATE: a Russian translation is in the works!

UPDATE: version 1.0.7 is out, the book reached 7,400 downloads. Thanks!

I'm excited to announce that the success of the post on clean architectures encouraged me to expand the subject and to write a book that I titled "Clean Architectures in Python. A practical approach to better software design".

The book contains a complete introduction to TDD and clean architectures, two topics that I believe are strictly interconnected. The book is 170 pages long and it is complete, at least for a first edition, but I am already planning to add content that could not fit in this release for several reasons (mostly because still unclear in my mind).

The book is available for free on Leanpub. If you enjoy it, please tweet about it with the #pycabook hashtag.

So far more than 7,400 readers downloaded the book. Thank you all!

The book will soon be translated into Russian by Алексей Пыльцын (Alexey Pyltsyn), who already worked on the translation of technical books like "The Majesty of Vue.js 2" and "The Road to learn React".

Alexey is a web developer and maintainer of the official PHP documentation in Russian. His website is https://lex111.ru/.

If you are interested you can show you support on the Leanpub page

Categories: FLOSS Project Planets

James Duncan

Planet Apache - Fri, 2019-03-15 05:20

Steven Sinofsky’s tweet thread about going through the Microsoft security crisis is related to Facebook starting its own pivot, but is useful thinking for taking any kind of organization through a significant shift of strategy:

All you can do as an organization executing on this sort of pivot is to do the work. Keep people informed. Build incremental trust across all stakeholders by actions.

Nobody knows if Facebook can pull off what Mark Zuckerberg says that he wants to do, but for sure it’s going to be messy, take a lot of time, and it will be a hard time for all involved to build up trust.

Categories: FLOSS Project Planets

Low Kian Seong: DevOps for corporate ?

Planet Python - Fri, 2019-03-15 04:35
Implementing a DevOps strategy with your army of one team is most of the the time easy. It's just dependent on the sweat on your brow. A matter of experimentation, glue the pieces together push it out and you are pretty much good to go.

Put in a corporate environment into the mix and add in about a few hundred more people into the mix and you get a pretty interesting mix. Strangely this time around I don't find the exercise exhausting or that much frustrating. I have been struggling and examining my own feelings and comparing to find the difference in the situation this and why don't I feel so restless or frustrated. I think it's a function of growing up and the promise I see in the people that I am helping now. The difference I see with the people now is that they want to change and they feel a need to do so. No question about that.

However add in that dash of fear of the unknown of the new methods and practices and you get a a jumble of wishful thinking and half implemented ideas and visions. Main thing is try not to judge. That is very important. The book "Factfulness" says it best. Try to believe that people are not stupid. Practices or things are a certain way for a reason. Sticking with the belief that people or practices in an organisation is a certain way because people are stupid or stubborn just makes the task or changing or overhauling something in that same organisation so much insurmountable and frustrating for me.

Believing that people inherently want to do the right thing given the chance puts you on a mode of thinking or view that have a much higher chance for success. Then the only thing left are practices or governance that were erected to protect a collective belief or state not because people want to make other people's life harder but usually because they did not know better and were of the belief that the governance or checks will help their current situation.

Now I see a lot of opportunities for improvement and change that can be unlocked via many levels governance unlocked by convincing committees and gatekeepers. I am hopeful and see many opportunities to help and make things better enabling the organisation to move faster than it had before in the past.

Currently reading ...

Categories: FLOSS Project Planets

Dirk Eddelbuettel: #20: Dependencies. Now with badges!

Planet Debian - Thu, 2019-03-14 23:41

Welcome to post number twenty in the randomly redundant R rant series of posts, or R4 for short. It has been a little quiet since the previous post last June as we’ve been busy with other things but a few posts (or ideas at least) are queued.

Dependencies. We wrote about this a good year ago in post #17 which was (in part) tickled by the experience of installing one package … and getting a boatload of others pulled in. The topic and question of dependencies has seen a few posts over the year, and I won’t be able to do them all justice. Josh and I have been added a few links to the tinyverse.org page. The (currently) last one by Russ Cox titled Our Software Dependency Problem is particularly trenchant.

And just this week the topic came up in two different, and unrelated posts. First, in What I don’t like in you repo, Oleg Kovalov lists a brief but decent number of items by which a repository can be evaluated. And one is about [b]loated dependencies where he nails it with a quick When I see dozens of deps in the lock file, the first question which comes to my mind is: so, am I ready to fix any failures inside any of them? This is pretty close to what we have been saying around the tinyverse.

Second, in Beware the data science pin factory, Eric Colson brings an equation. Quoting from footnote 2: […] the number of relationships (r) grows as a function number of members (n) per this equation: r = (n^2-n) / 2. Granted, this was about human coordination and ideal team size. But let’s just run with it: For n=10, we get r=9 which is not so bad. For n=20, it is r=38. And for n=30 we are at r=87. You get the idea. “Big-Oh-N-squared”.

More dependencies means more edges between more nodes. Which eventually means more breakage.

Which gets us to announcement embedded in this post. A few months ago, in what still seems like a genuinely extra-clever weekend hack in an initial 100 or so lines, Edwin de Jonge put together a remarkable repo on GitLab. It combines Docker / Rocker via hourly cron jobs with deployment at netlify … giving us badges which visualize the direct as well as recursive dependencies of a package. All in about 100 lines, fully automated, autonomously running and deployed via CDN. Amazing work, for which we really need to praise him! So a big thanks to Edwin.

With these CRAN Dependency Badges being available, I have been adding them to my repos at GitHub over the last few months. As two quick examples you can see

  • Rcpp
  • RcppArmadillo

to get the idea. RcppArmadillo (or RcppEigen or many other packages) will always have one: Rcpp. But many widely-used packages such as data.table also get by with a count of zero. It is worth showing this – and the badge does just that! And I even sent a PR to the badger package: if you’re into this, you can have a badge made for your via badger::badge_depdencies(pkgname).

Otherwise, more details at Edwin’s repo and of course his actual tinyverse.netlify.com site hosting the badges. It’s easy as all other badges: reference the CRAN package, get a badge.

So if you buy into the idea that lightweight is the right weight then join us and show it via the dependency badges!

This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.

Categories: FLOSS Project Planets

leftmouseclickin: Plot the technical data for a stock

Planet Python - Thu, 2019-03-14 23:40
Our Own Score

Welcome back, in this chapter we will continue to develop our stock and Forex application by plotting the technical data for any stock which has been selected from the stock symbol combo box. If you are really interested to develop your own Stock/Forex analysis application then alpha_vantage is probably your best choice, the data is great and the data returning speed is very fast plus one more, the API is completely free. Look no further than alpha vantage if you are a serious Forex or Stock application developer. I am not the affiliate of this program but just give you a suggestion.

As usual, we are going to create a button which will then call the plot method to retrieve and plot the technical data of that particular stock which has been selected through the combo box.

import json from tkinter import * import tkinter.ttk as tk from alpha_vantage.foreignexchange import ForeignExchange from alpha_vantage.techindicators import TechIndicators from alpha_vantage.timeseries import TimeSeries import matplotlib.pyplot as plt win = Tk() # Create tk instance win.title("Real Forex n Stock") # Add a title win.resizable(0, 0) # Disable resizing the GUI win.configure(background='white') # change window background color selectorFrame = Frame(win, background="white") # create the top frame to hold base and quote currency combobox selectorFrame.pack(anchor = "nw", pady = 2, padx=10) currency_label = Label(selectorFrame, text = "Select base currency / quote currency / stock :", background="white") currency_label.pack(anchor="w") # the currency pair label curr1 = tuple() # the tuple which will be populated by base and quote currency currency_list = ['AUD', 'BCH', 'BNB', 'BND', 'BTC', 'CAD', 'CHF', 'CNY', 'EOS', 'EUR', 'ETH', 'GBP', 'HKD', 'JPY', 'LTC', 'NZD', 'MYR', 'TRX', 'USD', 'USDT', 'XLM', 'XRP'] # major world currency pairs # populate the combo box for both the base and quote currency for key in currency_list: curr1 += (key, ) # populate the stock symbol tuple f = open("stock.txt", "r") curr2 = tuple() for line in f.readlines(): curr2 += (line.replace('\n', ''),) f.close() # Create a combo box for base currency base_currency = StringVar() # create a string variable based = tk.Combobox(selectorFrame, textvariable=base_currency) based['values'] = curr1 based.pack(side = LEFT, padx=3) # Create a combo box for quote currency quote_currency = StringVar() # create a string variable quote = tk.Combobox(selectorFrame, textvariable=quote_currency) quote['values'] = curr1 quote.pack(side = LEFT, padx=3) # Create a combo box for stock stock_symbol = StringVar() # create a string variable stock = tk.Combobox(selectorFrame, textvariable=stock_symbol) stock['values'] = curr2 stock.current(0) stock.pack(side = LEFT, padx=3) s = StringVar() # create string variable which will be used to fill up the Forex data # create currency frame and text widget to display the incoming forex data currencyFrame = Frame(win) currencyFrame.pack(side=TOP) currency = Label(currencyFrame) currency.pack() text_widget = Text(currency, fg='white', background='black') text_widget.pack() s.set("Click the find button to find out the currency exchange rate") text_widget.insert(END, s.get()) buttonFrame = Frame(win) # create a bottom frame to hold the find button buttonFrame.pack(side = BOTTOM, fill=X, pady = 6) # first get the api key and secret from the file f = open("alpha.txt", "r") api_key = f.readline() f.close() api_key = api_key.replace('\n', '') def get_exchange_rate(): # this method will display the incoming forex data after the api called try: cc = ForeignExchange(key= api_key) from_ = based.get() to_ = quote.get() countVar = StringVar() # use to hold the character count text_widget.tag_remove("search", "1.0", "end") # cleared the hightlighted currency pair if(from_ != '' and to_ != '' and from_ != to_): data, _ = cc.get_currency_exchange_rate(from_currency=from_, to_currency=to_) exchange_rate = dict(json.loads(json.dumps(data))) count = 1 sell_buy = str(count) + ".) Pair : " + exchange_rate['1. From_Currency Code'] + "(" + exchange_rate['2. From_Currency Name'] + ")" + " / " + exchange_rate['3. To_Currency Code']+"(" + exchange_rate['4. To_Currency Name'] + ") : " + str(exchange_rate['5. Exchange Rate']) + '\n' text_widget.delete('1.0', END) # clear all those previous text first s.set(sell_buy) text_widget.insert(INSERT, s.get()) # display forex rate in text widget pos = text_widget.search(from_, "1.0", stopindex="end", count=countVar) text_widget.tag_configure("search", background="green") end_pos = float(pos) + float(0.7) text_widget.tag_add("search", pos, str(end_pos)) # highlight the background of the searched currency pair pos = float(pos) + 2.0 text_widget.see(str(pos)) except: print("An exception occurred") def plot_stock_echange(): try: stock_symbol_text = stock.get() # get the selected symbol if(stock_symbol_text!= ''): ts = TimeSeries(key=api_key, output_format='pandas') data, meta_data = ts.get_intraday(symbol=stock_symbol_text, interval='1min', outputsize='full') data['4. close'].plot() stock_title = 'Intraday Times Series for the ' + stock_symbol_text + ' stock (1 min)' plt.title(stock_title) plt.show() except: print("An exception occurred") def plot_stock_technical(): try: stock_symbol_text = stock.get() # get the selected symbol if(stock_symbol_text!= ''): ti = TechIndicators(key=api_key, output_format='pandas') data, meta_data = ti.get_bbands(symbol=stock_symbol_text, interval='60min', time_period=60) data.plot() stock_title = 'BBbands indicator for ' + stock_symbol_text + ' (60 min)' plt.title(stock_title) plt.show() except: print("An exception occurred") action_vid = tk.Button(buttonFrame, text="Exchange Rate", command=get_exchange_rate) # button used to find out the exchange rate of currency pair action_vid.pack(side=LEFT, padx=2) action_stock_plot = tk.Button(buttonFrame, text="Plot Stock", command=plot_stock_echange) # button used to plot the intra-minute stock value action_stock_plot.pack(side=LEFT, padx=2) action_technical_plot = tk.Button(buttonFrame, text="Plot Technical", command=plot_stock_technical) # button used to plot the 60 minutes stock technical value action_technical_plot.pack(side=LEFT, padx=2) win.iconbitmap(r'ico.ico') win.mainloop()

If you run the above python code and click on the Plot Technical button with any stock symbol selected then you will see the below outcome.

Help me to retweet or like the below tweet so more people can enjoy this little program.

Another stock analysis program @stock and @FOREXcom with @ThePSF https://t.co/N2PiVoCkJn source code pic.twitter.com/QB0Qy9U9QY

— TechLikin (@ChooWhei) March 15, 2019
Categories: FLOSS Project Planets

gamingdirectional: Online Game Manual and Sound On Off

Planet Python - Thu, 2019-03-14 22:50

Hello and in this chapter, we will wrap up the features on the main manual page so we can move on to the last feature on the game page which is the power bar display. We will edit two files to finish up the final two features on the manual page. The first one is to create a clickable game manual button which when someone clicks on it will open up an online manual page. The second feature is a...


Related posts: Create enemy missiles within the Enemy object Touch up the about scene Rotate the mana object Create the mana object with Pygame Final touch up for the boy boundary detection mechanism Moving the player object in Pygame Create the player animation Modify the enemy sprite’s animation Create the animation character on the maze Create the game background Part 2
Categories: FLOSS Project Planets

Hideki Yamane: pbuilder hack with new debootstrap option

Planet Debian - Thu, 2019-03-14 22:17
Suddenly I noticed that maybe I can use --cache-dir option that I've added to debootstrap some time ago for pbuilder, too. Then hacked it.

> original
real    3m34.811s
user    1m6.676s
sys     0m33.051s

> use aptcache for debootstrap
real    2m52.397s
user    0m59.660s
sys     0m28.631s
It cuts 40s for creating base.tgz. Nice, isn't it? :) Hope pbuilder team will accept this Merge Request and push it to buster since it's worth for stable release, IMHO.
Categories: FLOSS Project Planets

codingdirectional: Count the number of audiences around you in the theater

Planet Python - Thu, 2019-03-14 22:02

Hello and welcome back. In this chapter, we are going to create the python method which will count the number of audiences around you in the theater based on the column and the row you are sitting on as well as the total rows and the total columns of the seat in the cinema. Here is the full question from CodeWars.

Your friend advised you to see a new performance in the most popular theater in the city. He knows a lot about art and his advice is usually good, but not this time: the performance turned out to be awfully dull. It’s so bad you want to sneak out, which is quite simple, especially since the exit is located right behind your row to the left. All you need to do is climb over your seat and make your way to the exit.

The main problem is your shyness: you’re afraid that you’ll end up blocking the view (even if only for a couple of seconds) of all the people who sit behind you and in your column or the columns to your left. To gain some courage, you decide to calculate the number of such people and see if you can possibly make it to the exit without disturbing too many people.

Given the total number of rows and columns in the theater (nRows and nCols, respectively), and the row and column you’re sitting in, return the number of people who sit strictly behind you and in your column or to the left, assuming all seats are occupied.

Example : For nCols = 16, nRows = 11, col = 5 and row = 3, the output should be

Here is the solution to the above question.

def seats_in_theater(tot_cols, tot_rows, col, row): a1 = tot_cols - col b1 = tot_rows - row total1 = a1 * b1 return b1 + (total1)

Very simple, all you need is just to think a little bit. Help me to retweet this tweet so we can share this solution with more people.

Count the number of audiences around you in the theater with @python #python https://t.co/64F3cAyiC8

— TechLikin (@ChooWhei) March 15, 2019
Categories: FLOSS Project Planets

Template meta-functions for detecting template instantiation

Planet KDE - Thu, 2019-03-14 20:00

I’ve been playing around with type meta-tagging for my Voy reactive streams library (more on that some other time) and realized how useful it is to be able to check whether a given type is an instantiation of some class template, so I decided to write a short post about it.

Imagine you are writing a generic function, and you need to check whether you are given a value or a tuple so that you can unpack the tuple before doing anything with it.

If we want to check whether a type T is an instance of std::tuple or not, we can create the following meta-function:

template <typename T> struct is_tuple: std::false_type {}; template <typename... Args> struct is_tuple<std::tuple<Args...>>: std::true_type {};

The meaning of this code is simple:

  • By default, we return false for any type we are given
  • If the compiler is able to match the type T with std::tuple<Args...> for some list of types, then we return true.

To make it easier to use, we can implement a _v version of the function like the meta-functions in <type_traits> have:

template <typename T> constexpr bool is_tuple_v = is_tuple<T>::value;

We can now use it to implement a merged std::invoke+std::apply function which calls std::apply if the user passes in a tuple, and std::invoke otherwise:

template <typename F, typename T> auto call(F&& f, T&& t) { if constexpr(is_tuple_v<T>) { return std::apply(FWD(f), FWD(t)); } else { return std::invoke(FWD(f), FWD(t)); } } Up one level

The previous meta-function works for tuples. What if we needed to check whether a type is an instance of std::vector or std::basic_string?

We could copy the previously defined meta-function, and replace all occurrences of “tuple” with “vector” or “basic_string”. But we know better than to do copy-paste-oriented programming.

Instead, we can increase the level of templatedness.

For STL algorithms, we use template functions instead of ordinary functions to allow us to pass in other functions as arguments. Here, we need to use template templates instead of ordinary templates.

template <template <typename...> typename Template, typename Type> struct is_instance_of: std::false_type {}; template <template <typename...> typename Template, typename... Args> struct is_instance_of<Template, Template<Args...>>: std::true_type {}; template <template <typename...> typename Template, typename Type> voy_concept is_instance_of_v = is_instance_of<Template, Type>::value;

The template <template <typename...> allows us to pass in template names instead of template instantiations (concrete types) to a template meta-function.

We can now check whether a specific type is an instantiation of a given template:

static_assert(is_instance_of_v<std::basic_string, std::string>); static_assert(is_instance_of_v<std::tuple, std::tuple<int, double>>); static_assert(!is_instance_of_v<std::tuple, std::vector<int>>); static_assert(!is_instance_of_v<std::vector, std::tuple<int, double>>);

A similar trick is used alongside void_t to implement the detection idiom which allows us to do some compile-time type introspection and even simulate concepts.

I’ll cover the detection idiom in some of the future blog posts.

P.S. There is a 50% discount on manning.com for Functional Programming in C++ and other books til the Tuesday, 19th of March. Use wm031519lt at checkout.

You can support my work on Patreon, or you can get my book Functional Programming in C++ at Manning if you're into that sort of thing.
Categories: FLOSS Project Planets

Ben Hutchings: Debian LTS work, February 2019

Planet Debian - Thu, 2019-03-14 19:46

I was assigned 19.5 hours of work by Freexian's Debian LTS initiative and carried over 1 hour from January. I worked only 4 hours and so will carry over 16.5 hours.

I backported various security fixes to Linux 3.16, but did not upload a new release yet.

Categories: FLOSS Project Planets

Karim Boudjema: Saving temporary values of a form with Private Tempstore in Drupal 8

Planet Drupal - Thu, 2019-03-14 18:54
In this post we’ll see how to save temporary values from a form and how to retrieve or process them later in a controller. To do that, we’ll use the Form API and the private tempstore (the temporary store storage system of Drupal 8).

The use case is the following: we need to build a simple RSS reader (a form) where the user could introduce the URL of an RSS file and the number of items to retrieve from that file.  Next, in a new page (a controller), the application should display the list of items with a link to each syndicated page .

The easiest way to achieve it would be to retrieve the values in our buildForm() method, process them and display the result thought a specific field of the form. But that’s not our use case.
Categories: FLOSS Project Planets

FSF News: Activists and experts gather in Cambridge for ethical tech conference to celebrate software freedom on March 23-24

GNU Planet! - Thu, 2019-03-14 17:01

CAMBRIDGE, Massachusetts, USA -- Thursday, March 14, 2019 -- Next weekend, the Free Software Foundation (FSF) presents the eleventh annual LibrePlanet free software conference in Cambridge, March 23-24, 2019, at the Stata Center at the Massachusetts Institute of Technology. LibrePlanet is an annual conference for people who care about their digital freedoms, bringing together software developers, policy experts, activists, and computer users to learn skills, share accomplishments, and tackle challenges facing the free software movement, including 3D printing, cryptography, medical devices, privacy, security, and current issues in software licensing. LibrePlanet 2019 will focus on the exploration of software freedom and how to bring to life trailblazing, principled new technologies.

LibrePlanet 2019 will include four keynotes. Tarek Loubani, an emergency physician, will talk about his work on making medical devices accessible through free designs that meet medical industry standards. Micky Metts, a member of the Agaric Design Collective, will talk about your collective and individual roles in maintaining your freedoms, with free software as the foundation. Bdale Garbee, longtime free software contributor and former Debian Project Leader, will tell us about the fun in free software, using personal anecdotes as examples. Richard Stallman, founder of the FSF and president of the board of directors, will discuss current issues facing user freedom, and announce the winners of the 2018 Free Software Foundation awards.

"What makes LibrePlanet great is how it brings everyone from old hand activists to new free software enthusiasts from around the world to exchange ideas, collaborate, and take on challenges to software freedom," said John Sullivan, executive director of the FSF. "We run the event using entirely free software, putting our ideals into action. This conference builds the software community, by offering opportunities for those who cannot attend to participate remotely via watching a multi-channel livestream and online voice and text conversations."

In addition to keynote presentations, LibrePlanet will include: 36 sessions; a party and a hack night on Saturday; an exhibit hall with exciting free software projects, nonprofits, and companies; and community organized meetups. Sessions include such topics as "The Tor Project: State of the Onion," "Australia's decryption law and free software," "Free software in the 3D printing community," and the "The Right to Repair & the DMCA." There will be talks on activism, case studies, communities, licensing and legal issues, and technical issues.

Attendees may register online until Tuesday, March 19 at 10:00 EDT, after which point they can register onsite at the conference, space permitting. Attendance is gratis for students and FSF members. Journalists interested in press passes should contact campaigns@fsf.org.

LibrePlanet is financially supported in part by Red Hat and Private Internet Access.

About LibrePlanet

LibrePlanet is the annual conference of the Free Software Foundation. What was once a small gathering of FSF members has grown into a larger event for anyone with an interest in the values of software freedom. LibrePlanet is always gratis for associate members of the FSF and students. Sign up for announcements about the LibrePlanet conference here.

LibrePlanet 2018 was held at MIT from March 24-25, 2018. About 350 attendees from all over the world came together for conversations, workshops, and keynotes centered around the theme of "Freedom Embedded." You can watch videos from past conferences at https://media.libreplanet.org, including keynotes by Deb Nicholson, Seth Schoen, and Benjamin Mako Hill.

About the Free Software Foundation

The FSF, founded in 1985, is dedicated to promoting computer users' right to use, study, copy, modify, and redistribute computer programs. The FSF promotes the development and use of free (as in freedom) software -- particularly the GNU operating system and its GNU/Linux variants -- and free documentation for free software. The FSF also helps to spread awareness of the ethical and political issues of freedom in the use of software, and its Web sites, located at https://fsf.org and https://gnu.org, are an important source of information about GNU/Linux. Donations to support the FSF's work can be made at https://donate.fsf.org. Its headquarters are in Boston, MA, USA.

More information about the FSF, as well as important information for journalists and publishers, is at https://www.fsf.org/press.

Media Contact

Molly de Blanc
Campaigns Manager
Free Software Foundation
+1 (617) 542 5942

Categories: FLOSS Project Planets

eRambler: Using Pipfile in Binder

Planet Python - Thu, 2019-03-14 16:08

Photo by Sear Greyson on Unsplash

I recently attended a workshop, organised by the excellent team of the Turing Way project, on a tool called BinderHub. BinderHub, along with public hosting platform MyBinder, allows you to publish computational notebooks online as "binders" such that they're not static but fully interactive. It's able to do this by using a tool called repo2docker to capture the full computational environment and dependencies required to run the notebook.

What is the Turing Way?

The Turing Way is, in its own words, "a lightly opinionated guide to reproducible data science." The team is building an open textbook and running a number of workshops for scientists and research software engineers, and you should check out the project on Github. You could even contribute!

The Binder process goes roughly like this:

  1. Do some work in a Jupyter Notebook or similar
  2. Put it into a public git repository
  3. Add some extra metadata describing the packages and versions your code relies on
  4. Go to mybinder.org and tell it where to find your repository
  5. Open the URL it generates for you
  6. Profit

Other than step 5, which can take some time to build the binder, this is a remarkably quick process. It supports a number of different languages too, including built-in support for R, Python and Julia and the ability to configure pretty much any other language that will run on Linux.

However, the Python support currently requires you to have either a requirements.txt or Conda-style environment.yml file to specify dependencies, and I commonly use a Pipfile for this instead. Pipfile allows you to specify a loose range of compatible versions for maximal convenience, but then locks in specific versions for maximal reproducibility. You can upgrade packages any time you want, but you're fully in control of when that happens, and the locked versions are checked into version control so that everyone working on a project gets consistency.

Since Pipfile is emerging as something of a standard thought I'd see if I could use that in a binder, and it turns out to be remarkably simple. The reference implementation of Pipfile is a tool called pipenv by the prolific Kenneth Reitz. All you need to use this in your binder is two files of one line each.

requirements.txt tells repo2binder to build a Python-based binder, and contains a single line to install the pipenv package:


Then postBuild is used by repo2binder to install all other dependencies using pipenv:

pipenv install --system

The --system flag tells pipenv to install packages globally (its default behaviour is to create a Python virtualenv).

With these two files, the binder builds and runs as expected. You can see a complete example that I put together during the workshop here on Gitlab.

Categories: FLOSS Project Planets

Software Freedom Conservancy Becomes an Open Source Initiative Affiliate Member

Open Source Initiative - Thu, 2019-03-14 14:28

Palo Alto, CA - March 14, 2019The Software Freedom Conservancy joins long list of Open Source Initiative Affiliate Members

The Open Source Initiative (OSI), the founding organization of the open source software movement, is excited to announce the Affiliate Membership of the Software Freedom Conservancy. "Conservancy", a public charity, that works to promote, improve, develop, and defend free and open source projects. Conservancy provides a home and infrastructure for projects such as Git, Godot Engine, Inkscape, Outreachy, Samba, and many more. Conservancy's support allows free and open source software developers to focus on what they do best—writing and improving code for the general public—while Conservancy takes care of the projects' needs that do not relate directly to software development and documentation.   "We're excited to participate in the Open Source Initiative's ongoing work to educate users and decision-makers about how licensing and cooperation go hand in hand. By joining as an affiliate member, we affirm our support of collaboration to promote the ideals of software freedom." says Karen Sandler, Software Freedom Conservancy's Executive Director   Critical to both the OSI's and open source projects' success is, as stated in the OSI mission, "building bridges between communities." Both the OSI and Conservancy believe those organisations serving free and open source software communities should seek out ways to support each other—Conservancy's Afffiliate Membership is an excellent example of such collaboration. The OSI Affiliate Member Program is available at no-cost to non-profits, educational institutions, and government agencies that support the OSI's mission to promote and protect open source software. As the steward of the Open Source Definition certifying Open Source Software Licenses, by establishing such certification as the standard for open source software development and distribution, and with the support of our Affiliate Membership, the OSI has become a cornerstone of software freedom.   "Software Freedom Conservancy continues to have a profound effect on the world of free, open source software both through its work sustaining important projects and by engaging more widely on topics of general concern. OSI is delighted to welcome them as an Affiliate and looks forward to working with them to promote software freedom." says Simon Phipps, OSI Board President.   About Conservancy Conservancy, a public charity focused on ethical technology, is the home of nearly fifty member projects dedicated to developing free and open source software.  Conservancy acts as a corporate umbrella, allowing member projects to operate as charitable initiatives without having to independently manage their own corporate structure and administrative services. To learn more about Conservancy, visit https://sfconservancy.org/, or email at, info@sfconservancy.org.   About The Open Source Initiative Founded in 1998, the Open Source Initiative (OSI) protects and promotes open source software, development and communities, championing software freedom in society through education, collaboration, and infrastructure, stewarding the Open Source Definition, and preventing abuse of the ideals and ethos inherent to the open source movement. The OSI is a public charity with global vision based in California. For more information about the OSI, please see https://opensource.org, or email the organization at, contact@opensource.org.
Categories: FLOSS Research

Lullabot: Designing with Rhythm and Proportion

Planet Drupal - Thu, 2019-03-14 13:48

Similar to many other creative mediums, music depends on rhythm. Rhythm indicates the presence of a strong, regular, repeated pattern. It’s the constraint and consistency in tempo that creates a foundation for expression and creativity. 

Categories: FLOSS Project Planets