Eclipse Foundation entfernt potenzielles Adware-Plug-in aus dem Marketplace

heise online Newsticker - 16. August 2017 - 15:30
Die Erweiterung namens Eclipse Class Decompiler enthält Binärcode, der sich für Adware verwenden lässt und potenziell Dateien in Eclipse Workspaces herunterladen kann. Wer das Tool installiert hat, sollte es entfernen.

Kommentar zu GNOME: 20 Jahre Quälerei auf hohem Niveau

heise online Newsticker - 16. August 2017 - 15:30
Der GNOME-Desktop wird 20. Fabian Scherschel – selbst bekennender GNOME-Nutzer – ist der Meinung, dass das Beste, was Linux in puncto Desktop zu bieten hat, noch lange nicht gut genug ist.

Valuebound: How to push clean code by following coding standards effectively using git pre-commit hook?

Planet Drupal - 16. August 2017 - 15:26

Pushing clean codes is not every one cups of tea, it needs extensive knowledge and practice. Before a website go live, it needs to pass certain standards and checks in order to deliver quality experience. Certainly, a clean website is a demand of almost every client and it should be. 

In this blog post, you will learn why we need to implement git pre-commit hook? how it works? Simultaneously, we will also attempt to implement working examples in order to have better understanding.

Why we need to implement git pre-commit hook

Any website going live should pass certain standards and checks. If the web is built on any framework, then these checks are mandatory. How to ensure all developers are committing clean code? One way is to do code review,…

Türkei: Kräftige Selbstzensur nach gescheitertem Coup

heise online Newsticker - 16. August 2017 - 15:00
Nach dem gescheiterten Militärcoup in der Türkei twitterten viele Bürger weniger und löschten eigene Tweets und Twitter-Konten. Die staatliche Zensur hatte weniger zu tun.

Blair Wadman: Create a modal in Drupal 8 in a custom module

Planet Drupal - 16. August 2017 - 14:54

Modal dialogs are incredibly useful on websites as they allow the user to do something without having to leave the web page they are on. Drupal 8 now has a Dialog API in core, which greatly reduces the amount of code you need to write to create a modal dialog. Dialogs in Drupal 8 leverage jQuery UI.

In the second part of this series on modal dialogs in Drupal 8, we are going to go a step further from last week by creating the modal in a custom module.

Mediacurrent: Integrating Amazon Alexa With a Drupal 8 Site

Planet Drupal - 16. August 2017 - 14:31

If you’ve ever used Alexa, it may seem like it must be extremely complicated to get her to respond like she does. However, if you have your content inside Drupal, it’s not terribly difficult to get her to utilize that data for your own custom Alexa skill. Let’s take a look at how to accomplish that.
 

Aldi startet Online-Lieferdienst für US-Kunden

heise online Newsticker - 16. August 2017 - 14:30
Der Discounter aus Deutschland setzt auf Expansion in den USA. Zusammen mit dem Lieferdienst Instacart will Aldi den Kauf von Lebensmitteln im Internet ermöglichen. Noch diesen Monat sollen Kunden die ersten virtuellen Warenkörbe füllen können.

Hacken für die Guten: De Maizière regt "Cyber-Feuerwehr" an

heise online Newsticker - 16. August 2017 - 14:00
Wenn's brennt, ruft man die Feuerwehr, aber wen ruft man, wenn die IT-Anlage ausfällt, fragt Thomas de Maizière. Im Wahlkampf schlägt er eine Cyber-Feuerwehr vor, in der sich junge Menschen engagieren könnten.

Intel Celeron "Gemini Lake" mit HDMI 2.0 und SGX

heise online Newsticker - 16. August 2017 - 13:30
Intels nächste Generation von Billigprozessoren ist mit HEVC-10-Decoder, HDMI 2.0 und den Software Guard Extensions SGX für Ultra HD Blu-ray und 4K-Streams mit Kopierschutz gerüstet.

Bluetooth 5: Höhere Geschwindigkeit oder mehr Reichweite

heise online Newsticker - 16. August 2017 - 13:30
Insbesondere fürs Internet der Dinge hat die SIG den neuen Standard Bluetooth 5 entworfen. Dabei sollen Nutzer von einer höheren Geschwindigkeit oder mehr Reichweite profitieren – aber nicht beidem auf einmal.

Cross-Plattform-Entwicklung: Qt adressiert den Automatisierungssektor

heise online Newsticker - 16. August 2017 - 13:30
Die Suite Qt for Automation zielt auf Anwendungen im Bereich Internet der Dinge beziehungsweise Industrie 4.0. Sie setzt auf Qt 5.9 auf und bringt zusätzliche Bibliotheken, unter anderem zur Implementierung des IoT-Protokolls MQTT.

Pokémon Go: Exklusive Raid-Kämpfe gegen Mewtu

heise online Newsticker - 16. August 2017 - 13:00
Niantic entlässt das nächste legendäre Pokémon ins Spiel: Demnächst taucht Mewtu als Gegner auf – doch nicht alle Spieler können ohne weiteres gegen es kämpfen.

Amazee Labs: Extending GraphQL: Part 1 - Fields

Planet Drupal - 16. August 2017 - 12:36
Extending GraphQL: Part 1 - Fields

The last blog post might have left you wondering: "Plugins? It already does everything!". Or you are like one of the busy contributors and already identified a missing feature and can't wait to take the matter into your own hands (good choice).

In this and the following posts we will walk you through the extension capabilities of the GraphQL Core module and use some simple examples to show you how to solve common use cases.

Philipp Melab Wed, 08/16/2017 - 12:36

I will assume that you are already familiar with developing Drupal modules and have some basic knowledge of the Plugin API and Plugin Annotations.

The first thing you will want to do is disabling GraphQL schema and result caches. Add these parameters to your development.services.yml:

parameters: graphql.config: result_cache: false schema_cache: false

This will make sure you don't have to clear caches with every change.

As a starting point, we create an empty module called graphql_example. In the GitHub repository for this tutorial, you will find the end result as well as commits for every major step.

Diff: The module boilerplate

A simple page title field

Can't be too hard, right? We just want to be able to ask the GraphQL API what our page title is.
To do that we create a new class PageTitle in the appropriate plugin namespace Drupal\graphql_example\Plugin\GraphQL\Fields.

Let's talk this through. We've created a new derivation of FieldPluginBase, the abstract base class provided by the graphql_core module.

It already does the heavy lifting for integrating our field into the schema. It does this based on the meta information we put into the annotation:

  • id: A unique id for this plugin.
  • type: The return type GraphQL will expect.
  • name: The name we will use to invoke the field.
  • nullable: Defines if the field can return null values or not.
  • multi: Defines if the field will return a list of values.

Now, all we need to do is implement resolveValues to actually return a field value. Note that this method expects you to use the yield keyword instead of return and therefore return a generator.

Fields also can return multiple values, but the framework already handles this within GraphQL type definitions. So all we do is yield as many values as we want. For single value fields, the first one will be chosen.

So we run the first GraphQL query against our custom field.

query { pageTitle }

And the result is disappointing.

{ "data": { "pageTitle": null } }

Diff: The naive approach

The page title is always null because we extract the page title of the current page, which is the GraphQL API callback and has no title. We then need a way to tell it which page we are talking about.

Adding a path argument

Lucky us, GraphQL fields also can accept arguments. We can use them to pass the path of a page and get the title for real. To do that, we add a new annotation property called arguments. This is a map of argument names to the argument type. In our case, we added one argument with name path that expects a String value.

Any arguments will be passed into our resolveValues method with the $args parameter. So we can use the value there to ask the Drupal route matcher to resolve the route and create the proper title for this path.

Let's try again.

query { pageTitle(path: "/admin") }

Way better:

{ "data": { "pageTitle": "Administration" } }

Congratulations, MVP satisfied - you can go home now!

Diff: Using arguments

If there wasn't this itch every developer has when the engineering senses start to tingle. Last time we stumbled on this ominous route field that also takes a path argument. And this ...

query { pageTitle(path: "/node/1") route(path: "/node/1") { ... } }

... smells like a low hanging fruit. There has to be a way to make the two of them work together.

Attaching fields to types

Every GraphQL field can be attached to one or more types by adding the types property to its annotation. In fact, if the property is omitted, it will default to the Root type which is the root query type and the reason our field appeared there in the first place.

We learned that the route field returns a value of type Url. So we remove the argument definition and add a types property instead.

This means the $args parameter won't receive the path value anymore. Instead, the $value parameter will be populated with the result of the route field. And this is a Drupal Url object that we already can be sure is routed since route won't return it otherwise. With this in mind, we can make the solution even simpler.

Now we have to adapt our query since our field is nested within another.

query { route(path: "/admin") { pageTitle } }

Which also will return a nested result.

{ "data": { "route": { "pageTitle": "Administration" } } }

The price of a more complex nested result might seem high for not having to pass the same argument twice. But there's more to what we just did. By attaching the pageTitle field to the Url type, we added it wherever the type appears. Apart from the route field this also includes link fields, menu items or breadcrumbs. And potentially every future field that will return objects of type Url.
We just turned our simple example into the Swiss Army Knife (pun intended) of page title querying.

Diff: Contextual fields

I know what you are thinking. Even an achievement of this epic scale is worthless without test coverage. And you are right. Let's add some.

Adding tests

Fortunately the GraphQL module already comes with an easy to use test base class that helps us to safeguard our achievement in no time.

First, create a tests directory in the module folder. Inside that, a directory called queries that contains one file - page_title.gql - with our test query. A lot of editors already support GraphQL files with syntax highlighting and autocompletion, that's why we moved the query payload to another file.

The test itself just has to extend GraphQLFileTestBase, add the graphql_example module to the list of modules to enable and execute the query file.

Diff: Adding a test

Wrap-Up

We just created a simple field, passed arguments to it, learned how to attach it to an already existing type and finally verified our work by adding a test case. Not bad for one day's work. Next time we will have a look at Types and Interfaces, and how to use them to create fields with complex results.

Internetsucht: Chinesischer Teenager stirbt in Bootcamp

heise online Newsticker - 16. August 2017 - 12:30
Ratlose Eltern schickten ihren Sohn in ein Bootcamp im chinesischen Fuyang, um seine Internetabhängigkeit zu kurieren. Dort starb er – vermutlich an Misshandlungen, die laut Kritikern zum normalen Erziehungs-Repertoire solcher Einrichtungen zählen.

iPhone 8: Telekom bietet wieder Reservierung an

heise online Newsticker - 16. August 2017 - 12:30
Mit dem Reservierungs-Service will der Netzbetreiber schon frühzeitig das Interesse an Apples 2017er iPhones ausloten. Kunden sollen "bevorzugt" beliefert werden.

ADCI Solutions: New employee adaptation

Planet Drupal - 16. August 2017 - 12:15

What makes any web development team strong? Right, it's people who are the most important part of the success. So, how to shape a great team member out of a newbie?

Here is a small note on how an integration process is set in our Drupal team. We will guide you through all the stages: from an interview to team-building events.

 

Check out if you included all essential adaptation steps into your workflow.

 

 

 

Apples HyperCard wird 30: Viele Stacks per Browser zugänglich

heise online Newsticker - 16. August 2017 - 12:00
Zum 30. Jubiläum der Programmierumgebung für Classic Mac OS hat das Internet Archive zahlreiche HyperCard-Stacks gesammelt, die sich nun im Browser ausführen lassen.

EU-US Privacy Shield: Beschwerdeformulare für Betroffene veröffentlicht

heise online Newsticker - 16. August 2017 - 11:30
Das seit August 2016 geltende Abkommen für die Übermittlung personenbezogener zwischen der EU und den USA räumt Betroffenen verschiedene Rechte sowie Beschwerdemöglichkeiten ein. Die passenden Formulare gibt es online.

Apple-Milliarden: Irland fürchtet sich vor Verlusten

heise online Newsticker - 16. August 2017 - 11:00
Mindestens 13 Milliarden Euro muss das kleine Land bunkern, während das Berufungsverfahren im Steuerstreit mit der Europäischen Kommission läuft. Nun versucht Irland, sich gegen ein eventuelles Investmentminus abzusichern.