Feed aggregator

Wouter Verhelst: C11 function overloading

Planet Debian - Wed, 08/04/2015 - 00:12

About four years ago, the ISO 9899:2011 "C11" standard was announced. At the time, I had a short look at (a draft version of) the standards document, and found a few interesting bits in there. Of course, however, due to it only very recently having been released, I did not have much hope of it being implemented to any reasonable amount anywhere yet. Which turned out to be the case. Even if that wasn't true, writing code that uses C11 features and expecting it to work just about anywhere else would have been a bad idea back then.

We're several years down the line now, however, and now the standard has been implemented to a reasonable extent in most compilers. GCC claims its "support [for C11] is at a similar level of completeness to (...) C99 support" since GCC 4.9.

Since my laptop has GCC 4.9, I looked at one feature in C11 that I have been wanting to use for a while: Generic selection.

#include <stdint.h> #include <inttypes.h> #include <stdio.h> void say32(uint32_t i) { printf("32-bit variable: %" PRId32 "\n", i); } void say64(uint64_t i) { printf("64-bit variable: %" PRId64 "\n", i); } void sayother(int i) { printf("This is something else.\n"); } #define say(X) _Generic((X), uint32_t: say32, uint64_t: say64, default: sayother)(X) int main(void) { uint32_t v32 = 32; uint64_t v64 = 64; uint8_t v8 = 8; say(v32); say(v64); say(v8); }

Output of the above:

32-bit variable: 32 64-bit variable: 64 This is something else.

or, "precompiler-assisted function overloading for C". Should be useful for things like:

#define ntoh(X) _Generic((X), int16_t: ntohs, uint16_t: ntohs, int32_t: ntohl, uint32_t: ntohl)(X) #define hton(X) _Generic((X), int16_t: ntohs, uint16_t: htons, int32_t: ntohl, uint32_t: htonl)(X)

... and if one adds the ntohll found here, it can do 64 bit as well.

Categories: Elsewhere

Thorsten Glaser: exciting news, or so

Planet Debian - Wed, 08/04/2015 - 00:02

I implemented <? support (including <?php…) script embedding support for *.inc in MirWebseite today; the specific syntax was explicitely requested by Natureshadow. Ugh.

My own hacking activities are progressing, even if slowly. I do some other interesting, funny, social, beneficial, etc. stuff in between, though. I’ll even have to get some of my DD buddies to sponsor me some QA uploads of packages I formerly maintained, whereever changes are queued up… such as better old-format repo compatibility in cvs(GNU) ☺ Though some of the stuff I do at work is currently done only there… sorry.

Also: prepare to be fully enlightened about just what evil (nice picture) Docker is. I especially liked the comparison of containers to a herd of cattle, mere numbers, replaceable, whereas VMs are cats, each with their individual name, lovely petted each day, etc.

ObHint: Some may have noticed I do have a Twitter account now. I do not really use it much. I got it because I wanted to rant at someone who only gave Twitter as means to contact them (a European company running a lottery for USA citizens only). But I found one nice thing: @HourlyCats (though @FacesPics and @BahnAnsagen are funny too, and the Postillon anyway). The internet is there for cat content, anyway.
Ahem. Do not contact me there, use IRC, more specifically, the Freenode network, and possibly memoserv to mirabilos instead, I can’t fit things into 140 chars, that’s just ridiculous. Also, don’t follow me. It may contain rants, it’s NSFW, and I’m not censoring there. As I said: I do not use it. So should you. (But kudos for having a mostly functional “fallback” site (the “mobile” one), which even works in PocketIE (Windows Mobile) and Opera 9, though not so much lynx(1)…)

odc (from #!/bin/mksh on IRC) is hacking support to use mksh instead of GNU bash for bootstrapping pkgsrc® (e.g. on Solaris). Nice! Good luck!

… à propos mksh(1), dear Debian armel and armhf buildd maintainer colleagues, pretty please with strawberries and chocolate ice on top (I just had that on waffles at my favourite ice salon, so I may be biased), do like s390x and update your chroots and wanna-build give-back mksh, as we requested, so the privacy fix makes it into jessie. Thanks in advance!

Oh, and Y_Plentyn and I have both putting more and updated packages into my APT repository. XTaran held a talk at CLT 2015 mentioning it… maybe I should write up some docs about how to use it for which purposes (e.g. how to avoid systemd but not get the other packages from it, or how to use it with systemd (trivial but has to be stated, it’s freedom of choice after all), etc.)?

Besides decent fanfiction (the stories in the Uzumaki Naruto universe seem, on average, to be much longer than those in the Harry Potter one), the weather is becoming good, so I’ve already been enjoying myself with geocaching and will have the bike fixed at the shop RSN (it suffers a bit each winter, as it stands outside, since our basement is mouldy, which is worse than a bit of rust IMHO) to get more activity in. Also planning to head to the GPS Maze in Mainz and, besides what time FrOSCon (including preparation) allows, heading to DebConf for a while.

Categories: Elsewhere

Wouter Verhelst: C11 operator overloading

Planet Debian - Tue, 07/04/2015 - 23:53

C11 function overloading

About four years ago, the ISO 9899:2011 "C11" standard was announced. At the time, I had a short look at (a draft version of) the standards document, and found a few interesting bits in there. Of course, however, due to it only very recently having been released, I did not have much hope of it being implemented to any reasonable amount anywhere yet. Which turned out to be the case. Even if that wasn't true, writing code that uses C11 features and expecting it to work just about anywhere else would have been a bad idea back then.

We're several years down the line now, however, and now the standard has been implemented to a reasonable extent in most compilers. GCC claims its "support [for C11] is at a similar level of completeness to (...) C99 support" since GCC 4.9.

Since my laptop has GCC 4.9, I looked at one feature in C11 that I have been wanting to use for a while: Generic selection.

#include <stdint.h> #include <inttypes.h> #include <stdio.h> void say32(uint32_t i) { printf("32-bit variable: %" PRId32 "\n", i); } void say64(uint64_t i) { printf("64-bit variable: %" PRId64 "\n", i); } void sayother(int i) { printf("This is something else.\n"); } #define say(X) _Generic((X), uint32_t: say32, uint64_t: say64, default: sayother)(X) int main(void) { uint32_t v32 = 32; uint64_t v64 = 64; uint8_t v8 = 8; say(v32); say(v64); say(v8); }

Output of the above:

32-bit variable: 32 64-bit variable: 64 This is something else.

or, "precompiler-assisted function overloading for C". Should be useful for things like:

#define ntoh(X) _Generic((X), int16_t: ntohs, uint16_t: ntohs, int32_t: ntohl, uint32_t: ntohl)(X) #define hton(X) _Generic((X), int16_t: ntohs, uint16_t: htons, int32_t: ntohl, uint32_t: htonl)(X)

... and if one adds the ntohll found here, it can do 64 bit as well.

Categories: Elsewhere

Promet Source: My Experience with Acquia Certification

Planet Drupal - Tue, 07/04/2015 - 23:03
My Advice

 

Preparing for the exam:

- Review this great guide: Five Steps to Get Ready for the Acquia Certified Developer Exam (pdf)

- As the guide says, review topics (in the pdf appendix) and identify your weaknesses, read up on your weaknesses.

Categories: Elsewhere

Drupal Easy: Drupal Goes to College

Planet Drupal - Tue, 07/04/2015 - 22:04

DrupalEasy is so excited to announce that we are teaming up with Stetson University to present the first comprehensive, university-based Drupal career professional development program in Florida! The Drupal Career Certificate Program (DCCP), which is built on DrupalEasy’s Drupal Career Starter Program curriculum, marks an official entrance to the Drupal talent pipeline through the US higher education system. The DCCP, now part of the university’s Boundless Learning programs, will be officially announced at Florida DrupalCamp 2015!  The first course will kick off this Fall at the Stetson Celebration Center located right in the middle of Florida's High Tech corridor on the outskirts of Orlando.

-->

read more

Categories: Elsewhere

Mario Lang: I am sorry, but this looks insane

Planet Debian - Tue, 07/04/2015 - 21:03

I am a console user. I really just started to use X11 again about two weeks ago, to sometimes test an a Qt application I am developing. I am not using Firefox or anything similar, all my daily work happens in shells and inside of emacs, in a console, not in X11. BRLTTY runs all the time, translating the screen content to something that my braille display can understand, sent out via USB. So the most important programs to me, are really emacs, and brltty.

This is my desktop, that is up since 179 days.

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1227 message+ 20 0 7140 2860 672 S 0,0 0,1 153:33.10 dbus-daemon 21457 root 20 0 44456 1116 788 S 0,0 0,1 146:42.47 packagekitd 1 root 20 0 24348 2808 1328 S 0,0 0,1 109:16.99 systemd 7897 mlang 20 0 585776 121656 4188 S 0,0 6,0 105:22.40 emacs 13332 root 20 0 10744 432 220 S 0,0 0,0 91:55.96 ssh 19581 root 20 0 4924 1632 1076 S 0,0 0,1 53:33.56 systemd 19596 root 20 0 20312 9764 9660 S 0,0 0,5 48:10.76 systemd-journal 10172 root 20 0 85308 2472 1672 S 0,0 0,1 20:30.18 NetworkManager 29 root 20 0 0 0 0 S 0,0 0,0 18:40.24 kswapd0 13334 root 20 0 120564 5748 304 S 0,0 0,3 16:20.89 sshfs 7 root 20 0 0 0 0 S 0,0 0,0 15:21.15 rcu_sched 14245 root 20 0 7620 316 152 S 0,0 0,0 15:08.64 ssh 438 root 20 0 0 0 0 S 0,0 0,0 12:14.80 jbd2/dm-1-8 11952 root 10 -10 42968 2028 1420 S 0,0 0,1 10:36.20 brltty

I am sorry, but this doesn't look right, not at all. I am not even beginning to talk about dbus-daemon and systemd. Why the HECK does packagekitd (which I definitely don't use actively) use up more then two hours of plain CPU time? What did it do, talk to NSA via an asymmetric cipher, or what?! I play music via sshfs, sometimes FLAC files. That barely consumed more CPU time then brltty, which is probably the most active daemon on my system, erm, it should be.

I don't want to chime into any flamewars. I have accepted that we have systemd. But this does not look right! I remember, back in the good old days, emacs and brltty were my top CPU users.

Categories: Elsewhere

Drupalpress, Drupal in the Health Sciences Library at UVA: equipment booking system — simplify(ing) comments

Planet Drupal - Tue, 07/04/2015 - 20:52

We don’t have a lot of feedback about how our patrons are using the current equipment booking system. There may be information that users could share with one another (and the library) if given a mechanism to do so. So as part of the new booking system implementation in Drupal, we set a task of including a commenting feature. Each reservable piece of equipment stands alone as a node so all we have to do is turn on commenting, right?

Basically.

But there are a couple of things that are worth noting about that.

If you’re enabling comments on a content type, it’s probably a good idea to consider who can view (and post comments to) that content. That’s all in the permissions table.

In our scenario, we didn’t want unauthenticated comments and we didn’t want to restrict the individual equipment pages (e.g. the page for iPad copy 2) to any kind of login. The request to reserve equipment from that page would trigger the login.

The snippet from the permissions table below shows how we adjusted the comment access. Note that these will be permissions that will apply anywhere else on we’re using comments on our site … we’re not currently, but if we do in the future we’re fine with this access level.

Once authenticated, the comment form defaults to give users a text format selection option. There are advantages to users selecting a WYSIWYG format This too can be handled in the text format configurations or even the permissions table. An easier way is with the Simplify module.

Simplify gives you an interface to hide a bunch of stuff that may be noisy to users adding content — publishing options, path settings, etc.

And for comments it lets you hide text formats.

The finished product:

Categories: Elsewhere

Carl Chenet: Backup Checker, the ServerSpec for your backups

Planet Debian - Tue, 07/04/2015 - 19:38

Follow me on Identi.ca  or Twitter  or Diaspora*

Sysadmins usually know ServerSpec, a tool allowing to check if your servers are correctly configured. The use of automated deployment tools makes deployments easier and easier, but lot of unexpected situations can come up using this tool, especially when more and more servers are implied. ServerSpec allows to verify that the result of your deployments are what you were expecting for and that no exception or unexpected event goes undetected.

Backup Checker (Github stars appreciated :)) offers the same kind of controls, but for your backups. Once you have backups, you don’t know if they contain what you are expecting for. And this is especially important because having broken backups mean losing your data after a major outage! Moreover if you think you are well protected with backups but they are eventually broken (corrupted archives, archives being filled with empty files, saving useless files…), you will perform your server or database upgrades without being really protected, leading to terrible situations.

Backup Checker on github

 

Backup Checker offers lots of controls over backups:

  • check if an archive is corrupted
  • control if some files or directories exist inside an archive exist
  • check if a file size inside an archive is not null or has a specific size (operators smaller than, equals, greater than supported)
  • owner, group, uid, gid of files/directories inside an archive
  • and a lot more. Check the official documentation!
Use Backup Checker with Backup-Manager or Rsnapshot

Starting from Backup Checker 1.7,if you use a backup tool like Backup-Manager or Rsnapshot, you’ll be glad to know that Backup Checker perfectly works with them. The documentation is available on the Backup Checker Community page with the howtos to install and configure Backup Checker with Backup-Manager or with Rsnapshot.

What about you? Let us know in the comments what you think of Backup Checker and its features to connect with other backup tools. We would be happy to get your feedbacks about how you use Backup Checker or what you expect from a backup checking solution.


Categories: Elsewhere

Zlatan Todorić: Atlassian honors 10 years of Git

Planet Debian - Tue, 07/04/2015 - 19:37

and even mentions Debian.Here under info for Git installations skyrocket (January 2010).

Categories: Elsewhere

Red Crackle: Why We Chose Drupal Organic Groups: A Comparative Study

Planet Drupal - Tue, 07/04/2015 - 19:30
This article explains why we went ahead with Organic Groups for one of our Drupal projects. As part of our research, we did a detailed analysis of the following platforms: Organic Groups, Open Atrium, Drupal Commons, Open Scholar and Domain Access. We have listed the positive and negatives in the article. You will understand why we finally decided to go with Organic Groups. Follow this article to make informed decisions while choosing a platform for your business needs.
Categories: Elsewhere

Mediacurrent: Mediacurrent Dropcast: Episode 3

Planet Drupal - Tue, 07/04/2015 - 18:40

This week on the show we will be discussing the new Configuration Management system in Drupal 8 based on an article by Victor Kane, and once again dive into RESTFUL Drupal, or Headless as the cool kids say, based on a blog post from Joris Snoek. We’ll go over some Drupal 8 news and once again Ryan will bring it home the Closing Bell.

Categories: Elsewhere

Lucas Nussbaum: Tentative systemd slides

Planet Debian - Tue, 07/04/2015 - 17:52

I recently spent some time updating my systemd knowledge and decided to put together some slides that I’ll use for a lecture. I’m interested in feedback about things that are missing,  unclear, etc. Available on slideshare, as PDF, and as LaTeX source.

Categories: Elsewhere

Pages

Subscribe to jfhovinne aggregator