Using WhatsApp via API

Despite all data protection concerns, WhatsApp is still the German favorite messenger app. In addition to the special WhatsApp Business App , Facebook has also created an official interface, the WhatsApp Business API, to make it more interesting for companies. If you want to send WhatsApp messages programmatically from your web application, there are other ways as well.

.­.­.

Blur the page behind the overlay using CSS

If you use elements such as overlays (which is the rule in times of GDPR actionism) and want to soften the area behind the overlay, for example, you often come across the problem of the stacking context . For example, if you have elements positioned absolutely or in a fixed position, they are suddenly displayed differently than without an applied filter. But there is a remedy.

.­.­.

Quick Tip: Split Testing with Apache

You don't have to use a powerful tool like Google Optimize for simple URL split tests, but you can also solve Apache via .htaccess. The following code snippet distributes https://vielhuber.de/test1.php (variant 1) and https://vielhuber.de/test2.php (variant 2) its visitors equally to both versions for the two pages. The randomization is based on the current server time.

.­.­.

About the notation of branched functions

When notating function definitions with case distinction, we use curly braces. We will pursue the simple question of whether this representation can be eliminated and the function can be traced back to a notation that can do without it. For example, can the function

$$f: \mathbb{R} \to \mathbb{R}, f(x) = \left\{\begin{matrix} 42, & \text{falls } x = 0 \\ x, & \text{sonst} \end{matrix}\right.$$

with the help of the four basic arithmetic operations using a one-line term?

.­.­.

Date series in Google Sheets

When visualizing data in Google Sheets, one encounters the problem that the \(x\) axis cannot automatically fill in the missing gaps for text values (such as calendar weeks). To solve the problem, one generates a continuous date series, counts the occurring cells themselves and then visualizes the cumulated totals.

.­.­.

Quick Tip: PHP clearstatcache

Find the error:

72aaa2dbd201d49fc2ee429ebf68f15b

.­.­.

Google Translation API Hacking

As part of its Google Cloud, Google offers the Google Translation API with a usage-based cost structure. In addition, there is an undocumented API that can be used without a key, but which denies service after only a few requests. When using the website translation function of Google Chrome, it is noticeable that pages can be translated here in very good quality without any noticeable limitation.

.­.­.

Quick Tip: Git Auto-Tagging

If you link Github with Composer , a version number must be assigned via git tag . The following command line command determines the current day and increases it (according to SemVer ) by a version number. For example, version 1.1.0 follows after 1.0.9. If no tag is assigned, the version is automatically tagged with 1.0.0. Tools like flimsy or git hooks shorten this desert of symbols.

8cd852c96ec1e60e8a5ac1f3614b2397

.­.­.

Edit MySQL trigger

Unfortunately,MySQL does not offer the ALTER TRIGGER function. To edit an existing trigger, you must first delete it and then regenerate it. The CREATE TRIGGER statement can be read indirectly via the information_schema. This allows us to change triggers indirectly. To do this, make your changes in the result of the following SELECT command (previously change database and trigger name) and execute the query.

.­.­.

Trigger change events in VanillaJS

VanillaJS has been virtually on a par with jQuery since ES6 and is now far superior in all areas. this makes it worthwhile to gradually migrate legacy code away from jQuery. however, you have to be careful when triggering manual change events. for example, document.addEventListener does not trigger on jQuery.change(). the following overview summarizes the special features.

.­.­.

Control cookies with PHP and JS

The setting of cookies by your own or third-party scripts can be finely controlled with the help of PHP and JavaScript. Although this is not a sufficient solution for the implementation of cookie solutions after the court ruling against Planet49 (here it is crucial that tracking tools such as Google Analytics do not even track and consequently do not set cookies), it can make sense be to generally whitelist / blacklist cookies.

.­.­.

Deactivate devices via script in Windows

In order to save electricity or reduce your own monitoring paranoia, it is advisable to completely disconnect devices that are not in use on your own computer. Devices such as sound boxes or webcams can be deactivated / activated in the classic way via the device manager. The whole thing also works via script. The standard way of doing this used to be devcon . Windows 10 now offers a more convenient way to do this via PowerShell .

.­.­.

Skype Background Blur

Skype has a nice, somewhat hidden feature: when watching a video broadcast, simply click on the video button and use the"Blurmy background" function to automatically blur the background. Using artificial intelligence, this works with any camera, even without depth information. The whole thing then looks more professional and hides private or for the conversation unimportant things in the background.

.­.­.

SVG Export from Illustrator

SVGs play a central role in today's web. not only have they displaced icon fonts, but they also offer the possibility of manipulation via CSS or JavaScript. if you want to save a vector graphic for the web from Adobe Illustrator as SVG, you have to make some settings to avoid pitfalls and reduce loading times, which I will present in the following article.

.­.­.

Project Euler: Lattice paths

Project Euler is a series of exciting programming problems that often have a mathematical background. the problems are often set up in such a way that you have to develop sophisticated algorithms to reach the goal in a reasonable runtime. today we solve problem 15: Lattice paths, where you get to the solution with simple combinatorial means.

.­.­.

Automatic WordPress updates

WordPress has implemented background updates natively since version 3.7 and automatically activated them for minor releases. With the help of filters you can control the behavior more precisely what exactly is updated automatically. A permanent, fully automatic installation of all minor, major, plugin, theme and translation updates is not planned, but can easily be done otherwise.

.­.­.

OPcache PHP Bootup Optimization

For websites based on WordPress, Joomla or Laravel, for example, which do not have any user-specific content, it is recommended to keep all pages in a static HTML cache and to regenerate the cache manually (or automatically) only when changes are made in the backend. However, if the page contains dynamic content that depends on sessions and cookies or even language and location, the use of OPcache is suitable.

.­.­.

Google Sheets: Expanding Formulas

In order to extend formulas to whole columns within Google Sheets, it is recommended to use the useful function ARRAYFORMULA, which unfortunately does not work in combination with some other important functions like QUERY or INDIRECT, which leaves a complete individual programming of the logic using Google Apps Script or alternatively copying the formula manually down to the last line.

.­.­.

The Simpson Paradox

The Simpson's paradox is one of the easily understandable and at the same time astonishing phenomena in statistics. It occurs whenever groups of data show a particular trend, but that trend is reversed when the groups are combined. With the help of a simple example, the paradox can be understood immediately.

.­.­.

Quick tip: Google Tag Manager

The Google Tag Manager has established itself as the de facto standard for the integration of tracking scripts. In this way, on the one hand, responsibilities (online marketing vs. programming) are clearly separated and, on the other hand, you can quickly set up and modify tracking via an additional deployment channel. Here are two little tips for setting up triggers.

.­.­.

Quick tip: FRITZ! Box WLAN hotspot

From FRITZ! OS 07.10 onwards, if the internet fails, the FRITZ! Box can temporarily use the wireless hotspot of a cell phone as a fallback. The function is hidden under Internet> Access data> Internet provider> Existing access via WLAN . The FRITZ! Box then works as a router itself and provides a network with its own address range. When the Internet is available again, you simply reset the setting. I also had to check the options WLAN> Radio network> 2.4 GHz frequency band active and Internet> Access data> IPv6> IPv6 support active .

.­.­.

flower of life

the flower of life is a well-known, flower-like, geometric pattern that has been found in temples, manuscripts and pop culture for thousands of years. the pattern also plays a role in esotericism. we will leave all that aside at this point and concentrate on the simple construction of the geometric form, which is composed of several evenly distributed, overlapping circles.

.­.­.

Email delaying in Outlook

Despite all the prophecies of doom surrounding slack and discord, e-mail as an asynchronous communication medium is one of the world's dominant business communication media. In addition to Merlin Mann's Inbox Zero, there are numerous other strategies for dealing with the daily flood of e-mails, including e-mail delaying, i.e. delayed delivery of e-mails.

.­.­.

A spiral of numbers

For the past few days, I've been studying the following question on StackExchange about a spiral of integers. We are looking for a closed formula for the coordinates of the \(n\) -th element in the following integer spiral, which expands from the origin outwards and further and further into infinity:

..  9 10 11 12
23  8  1  2 13
22  7  0  3 14
21  6  5  4 15
20 19 18 17 16
.­.­.

Read rights in Google Sheets

When working with Google Sheets , fine, user-based rules for editing worksheets, columns and rows can be defined within a spreadsheet. Unfortunately, there is no way to restrict reading rights. However, this would be very helpful in many scenarios. So you only show your customers those tickets that concern them or the employees only the projects they are working on.

.­.­.

Yarn plug'n'play

npm is the default package manager for Node.js. Facebook has long been developing an alternative package management solution called Yarn . Yarn seems to be slowly disappearing from the Github readmes as the standard solution and the stats on the official site show that only a fraction of the packages are carried out by Yarn. Nevertheless, it is worth thinking outside the box.

.­.­.

Convert PDF to LaTeX


The typesetting system \(\TeX\) was developed in 1977 by the legendary Donald E. Knuth, and the software package \(\LaTeX\) is still part of the standard repertoire for creating scientific papers today. The following two tools can be used to convert already generated PDFs as well as handwritten notes into TeX fully automatically. The results are quite promising.

.­.­.

The simulation argument

Nick Bostrom's simulation argument is impressively simple and clearly formulated. it doesn't try to prove that we live in a simulation, but instead elegantly formulates three possibilities, one of which must be true. Elon Musk has a similar thesis, which has made the idea known to a broad public. the official paper is already over 14 years old and just as many pages short. yet the central statement is easy to understand and compact.

.­.­.

Critical bug when using WPML + ACF

the powerful plugins WPML for multilingualism and advanced custom fields for own fields are part of the basic equipment of many installations. it's annoying when malfunctions with data loss occur in interaction. the bug reports on this topic are already several years old and unanswered(here and here and here and here and here). i've taken a closer look at the problem.

.­.­.

File upload in the Facebook In App Browser

On some Android phones, both the Facebook and Instagram In App browsers (as of today) behave incorrectly if an upload field within an advertised or linked landing page had the accept attribute specified. As a result, the button had no function. If you open the page in the external, normal browser outside of the Facebook app, everything is fine. This is annoying (especially since it has been reported for a long time), but can be solved with a workaround.

.­.­.

Chrome Devtools: Move DOM elements

Google Chrome's developer tools are among the most powerful on the browser market. New features pour in every month, which Google presents in compressed form on YouTube . But often it is the little things in life that delight. If you want to delete DOM elements in Google Chrome, you can do this with the delete key. But only today did I notice that DOM elements can also be moved easily using drag & drop:

.­.­.

Quick tip: git status --r

A golden rule in the git universe is: "Do commit early and often". If the night was a little longer, or if you just want an overview of the current situation on your own computer, the command takes you

d8a38f92d0baa14f9d4568826c13ad46

a "git status" for all repositories that are located in the current folder or in any subfolder and accumulates the values ​​in a nice overview:

.­.­.

LAMP stack in the Windows Subsystem for Linux

In the search for the optimal development environment, Windows 10 offers not only complete solutions such as XAMPP, WAMP and MAMP, a native installation by hand, but also virtualization solutions such as Vagrant(Scotch Box) and Docker(Devil Box, Laradock), but all solutions failed - except for one - due to my requirements such as free configurability, real wildcard SSL certificates, access from all end devices in the local network, and high stability and performance.

.­.­.

Tricks for Laravel Eloquent Relationships

a strength of laravel is the elegant syntax. if you have a lot of models and relations in laravel (due to a lot of tables in the database), traversing can often end up in less elegant code. over the time, three small extensions have proven to be very useful for me, which i want to introduce briefly below. for this purpose, we only use some inheritance, magic methods and custom collections.

.­.­.

Prevent public access to .git

Version management Git is now standard in almost every web project and in every environment (including production). Git always creates the subfolder .git and if this is on the level of the public folder of the website, you can publicly access sensitive files (for example, calling /.git/logs/HEAD shows the last commits) . It explains in detail how you can clone a third-party (!) Git repository without a directory listing.

.­.­.

Node.js / npm / Composer without root

in an older blog post i described how to host node.js for free using heroku. now i show a way how to install node.js, npm and composer on any other shared host without root privileges with just a few lines of code. you can install packages, deploy vue.js applications or just start an express.js server. we always work in the user directory and use nvm - the node package manager.

.­.­.

Bug in associative arrays in PHP <7.2

In PHP <7.2 you can create arrays that can no longer be accessed properly:

91367d1c4636fd753b381406024e303c

You can do some things with it.

.­.­.

Execute commands directly after SSH connection

The following command establishes a connection to a server via SSH, executes some commands (for example, changes to a subdirectory and sends a git status ) and leaves the shell open. The .bashrc file is loaded, which enables colored subshells. The trick is to save a temporary file / tmp / initfile with the desired commands, to start a subshell (in our case bash) with the command --init-file. Within this initfile, the same file is deleted again immediately so as not to leave any traces.

.­.­.

Network drive as administrator

If you integrate a network drive in Windows Explorer, this does not apply system-wide but only for the current user account. This means that you cannot access this network drive in an application that runs with administrator rights. This can be changed easily: Create a new DWORD (32 bit) named EnableLinkedConnections with the value 1 in the registry under HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Policies \ System and restart. Integrated network drives are then visible everywhere.

.­.­.

Quick Tip: Mount folder as drive

If you want to quickly reach a local folder under Windows that you use again and again, you can simply assign it your own drive letter. There is only a detour via "Connect network drive" because you cannot specify the path C: \ Users \ David \ Downloads, for example. As a solution, enter the so-called administrative share of the drive, which exists by default for every folder: In the above example this would be \\ localhost \ c $ \ Users \ David \ Downloads .

.­.­.

trap frogs

a frog jumps around on the number ray and you try to catch it. jumping and catching always alternate. the frog starts at position \(s \in \mathbb{Z}\) and at every move it jumps a distance of \(z \in \mathbb{Z}\) (if \(z>0\), it jumps to the right, others if to the left). \(z\ ) is the same at every jump. catching consists of giving an integer position. you don't know \(z\ ) or \(s\ ). we show that there is a way to always catch the frog.

.­.­.

Long file names under Windows 10

It is not only when using npm under Windows that you come across a limit that is now almost 30 years old, which limits the paths to folders and files to a maximum of 255 characters. This is not NTFS's fault, but LFN . This leads to annoying bugs and incompatibility between operating systems. In the times of WSL this is a regrettable condition, which luckily you can fix yourself in the registry for some time.

.­.­.

Laravel queues on localhost

In the PHP framework Laravel within production environments, workers and supervisors ensure that the jobs stored in, for example, Redis are processed. If you want to be completely independent of this on localhost, you can either use the sync driver to always execute the jobs immediately. This has the disadvantage that the current PHP process is blocked and the request hangs until the job has been processed.

.­.­.

Quick Tip: Bundle target actions in Google Analytics

With the help of the JavaScript library analytics.js from Google Analytics, any events on websites can be tracked. These events are, for example, an exact measurement of the length of stay, the maximum scroll depth of the visitors or other individual actions such as submitting forms. If you want to evaluate advertising campaigns or carry out A / B tests later, for example, you create so-called target projects.

.­.­.

Pragmatic Cache Invalidation

Server-side rendering is now part of the standard repertoire of websites and applications. even browsers like google chrome tend to cache as much as possible to minimize loading times of further calls. cache invalidation of css/js/image files can be solved with the help of mod_pagespeed, Expires/Cachecontrol header, a cache manifest or very pragmatically and directly by individual parameters behind the file name.

.­.­.

Bitbucket and SSH keys

The provider Bitbucket does not offer (even in the paid tariffs Standard and Premium) the possibility to store SSH keys with write permissions on repository level. Storing your personal SSH key on the production server is not an option, because from there you have access to all other projects you are currently working on. Although there are so-called Access Keys, they only allow read permissions.

.­.­.

Windows Sysinternals via network drive

The tools from Sysinternals by Mark Russinovich should not be missing on any Windows computer. If you always want to have the latest version at hand, you can integrate it as a network drive. The command net use s: \\ live.sysinternals.com \ DavWWWRoot on the command line is sufficient (as a normal user). Then nice tools like PsList, PsKill or the Process Explorer are portable on the drive S.

.­.­.

Quick Tip: Google Sheets and Calendar Weeks

When outputting calendar weeks on a specific date, you have to be careful in Google Sheets (just like in Microsoft Excel). The function = CALENDAR WEEK (TODAY ()) calculates using the American standard, for which the first day of the year is always assigned to calendar week 1. In Germany this is defined differently: Here the first calendar week is the week from which at least 4 days fall into the new year. In Google Sheets you can solve the problem (in addition to other, exciting alternatives like = SHORTEN ((TODAY () - DATE (YEAR (TODAY () - REST (TODAY () - 2; 7) +3); 1; REST (TODAY ( ) -2; 7) -9)) / 7) and the modified = CALENDAR WEEK (TODAY (); 21) ) easily with the specially designed function = ISOWEEKNUM (TODAY ()) .

.­.­.

Self-signed SSL certificates in Chrome 58

Since Let's Encrypt, encrypted web pages have become standard nowadays. SSL certificates are also indispensable for local development (for example, navigator.geolocation requires SSL encryption locally as well). Since version 58 of Chrome, support for CN (Common Name) has been abandoned and SAN (Subject Alternative Name) has been made mandatory instead. As a result, Chrome suddenly no longer accepts all SSL certificates created in the traditional way.

.­.­.

Twice the age of two people

Consider two persons \(A\) and \(B\) who do not have the same birthday on the same day and who are \(A\) younger than \(B\). Show: There are exactly two age constellations \(a,b \in \mathbb{N}\) for which holds: \(2\cdot a = b\). We first set \(d \in \mathbb{R}^+\) as the age difference between \(A\) and \(B\) at the birth of \(A\) with \( d = d_0 + d_1 \), \( d_0 \in \mathbb{N}_0, d_1 \in \mathbb{R}, d_1 \in [0;1[\). We now consider any time \(x \in \mathbb{R}^+\) after the birth of \(A\) with \(x = x_0 + x_1\), \(x_0 \in \mathbb{N}_0, x_1 \in \mathbb{R}, x_1 \in [0;1[\).

.­.­.

Git and empty folders

Since Git knows that it doesn't know folders, but only files, empty folder structures don't end up in the repository, but since many frameworks and projects require them, they should end up there. A common practice is to create so-called placeholder files (often called .gitkeep) that implicitly specify the folder structure. These files can be easily created and additionally, if desired, make sure that other files in the folders are ignored.

.­.­.

Free Node.js hosting with Heroku

hosting for node.js is still not very widespread, especially in the german-speaking world. here, the american cloud company heroku offers a remedy - and even for free. you always notice the paradigm "build apps... not infrastructure" and yet you have hardly any restrictions. we implement a small cronjob based on phantomJS as an example, which scans a website every day and sends the page title via email.

.­.­.

The Cantorese pairing function

In addition to the diagonal arguments , Georg Cantor also developed the Cantor pairing function \(\mathbb{N}^2 \to \mathbb{W}, \quad c(x,y) = \binom{x+y+1}{2}+x = z\) , which encodes any two numbers \(x,y \in \mathbb{N}\) in a new number \(z \in \mathbb{N}\) . For example, \(c(3,4)=\binom{3+4+1}{2}+3 = \binom{8}{2}+3=\frac{8!}{6!\cdot 2!} +3 = 31 = z\) a unique coding of the numbers \(3\) and \(4\) in the number \(31\) . Show: The set of values \(\mathbb{W} = \mathbb{N}\) , ie \(z\) assumes all natural numbers.

.­.­.

The earth and the pea

\(r_1 = 6370km\) at the earth (as a sphere with \(r_1 = 6370km\) ) and a pea (as a sphere with \(r_2 = 2mm\) ) and \(r_2 = 2mm\) a rope over the equator so that it lies tightly on the surface. Now you lengthen both ropes by one meter each. Both ropes should now lie fully extended over the equator again - they no longer lie completely on the surface, but hover over the equator. How high above the surface does the rope float above the earth, how high above the pea?

.­.­.

Probabilities on the analogue clock

In how much % of the time of a day are all three hands of an analogue watch located in the right half of the dial? First of all, the hour hand is located on the right side of the dial in 12 of 24 hours (50%). Of this time, the minute hand is located on the right side in 6 of 12 hours (25%). Of these 6 hours, the second hand spends 3 hours on the right side (12.5%).

.­.­.

Laravel: Work with Eloquent Relationships

Laravel makes communication with the database a lot easier with Eloquent. When working with Eloquent Relationships you should be aware when calling dynamic variables (with the help of the magic methods of PHP) that the instances of the models do not reflect new changes, but are stored permanently when they are first called.

.­.­.

Bitbucket: Delete folder from git history

There is a hard limit of 2 GB when hosting Git on Bitbucket - if this is exceeded, you only have read-only access to the repository. To prevent this, you can, for example, retroactively remove large folders or files from your commits. But also in other cases (if access data has entered the history or node_modules has slipped back to master) you have to retrospectively manipulate the history of Git, contrary to its nature.

.­.­.

Integrate SSL Certificate from DomainFactory to IIS

In the age of Let's Encrypt , encrypted websites are now standard. However, wildcard or extended certificates with particularly trustworthy owner validation are also often required. The provider DomainFactory offers inexpensive SSL certificates that can also be used externally. The setup on a current IIS succeeds without CSR with the help of OpenSSL . In the following I will briefly show which steps are required for this.

.­.­.

Paradoxical winning strategy in guessing numbers

In 1987, Thomas M. Cover posed the following astounding question in "Open Problems in Communication and Computation": Player \(X\) writes two different and randomly chosen natural numbers \(A\) and \(B\) on two different pieces of paper and places them face down on a table. Player \(Y\) now randomly chooses one of these pieces of paper, sees the number and must now decide whether this number is smaller or larger than the other number that is still face down on the table.

.­.­.

Soccer & Linear Algebra

When a soccer game starts, the ball lies in the center of the field and is then moved around the field for 45 minutes by shifting and turning. At the beginning of the second half the ball is again on the center of the field. We show with simple means of linear algebra that either an infinite number of points on the surface are always in exactly the same position as in the original state or exactly 2.

.­.­.

Laravel: Blade Template Debugging

When debugging blade templates in Laravel 5.*, you often get meaningless error messages referring to cached views. But all of them used to be better: The debugging view in version 4 contained more helpful functions and was also visually more beautiful. With a few lines of code, you can get this functionality back with the help of whoops ("PHP errors for cool kids").

.­.­.

Harmonious display of logos with JavaScript

whether references, partners or customers - there are many cases where you want to display several logos next to each other in a harmonious way. the proportions of the logos are usually not uniform. often you follow your gut feeling when it comes to the size representation in the design, but there is also an exact calculation method of a visually appealing representation by equating the areas of the logos. in the following example, this can be done with a few lines of JavaScript.

.­.­.

Check variables in PHP / JS for existence

During your daily work with variables in PHP and JavaScript you often come across the query whether a variable is empty. It is worth knowing the native functions and their differences for checking. Annoyingly, there is no simple method to intuitively check whether a variable exists or not. What is meant by this is illustrated in the following matrix. However, small helper functions can be used to retrofit the desired function.

.­.­.

Mass telephone calls with sipgate.io

With sipgate .io S ipgate has created an exciting cloud API which offers a wide range of possibilities around internet telephony. One account is free of charge, and in the Feature Store you can set any free sender number. The documentation of sipgate.io is still expandable, but with a little bit of reading into the official Sipgate API you can quickly realize exciting things.

.­.­.

Recursion in SQL

Relational database management systems based on SQL are only conditionally suitable for hierarchical or recursive queries. In this case other systems like ArangoDB are better (there was a great talk about this at the GOTO 2016). But you can also create recursive queries in SQL using Common Table Expressions and thus query e.g. classic parent/child tables for all ancestors and descendants.

.­.­.

WordPress: Disable archive pages

According to w3techs.com , around 27.4% of all websites worldwide are currently operated with the help of WordPress. In very many cases, these are not blogs. WordPress automatically generates numerous, often unused URLs and produces so many links indexed by Google that the website operator did not even have on the screen. All of this can be deactivated with a simple command.

.­.­.

Rename PDF form fields in bulk

If you get into the predicament of renaming thousands of form field names like I did, you can use the JavaScript console included in Acrobat, where you can not only execute arbitrary JavaScript code, but also access all contents within the PDF (including form fields). Since there is no native renaming function in the JS-API, the form fields are copied with all their properties and created with new names.

.­.­.

Shopware: repair variant changes

In Shopware 5, a known problem has still not been resolved: If you create an article with mutually dependent variants with mutually exclusive configuration options, it can happen that some combinations cannot be selected in the front end and therefore cannot be ordered. With the help of a plugin, the problem can be easily fixed at the moment.

.­.­.

A line for the infinity of prime numbers

There are numerous proofs of the infinity of prime numbers - the well-known theorem of Euclid from the Book of Elements is not missing in any basic lecture on number theory. 2015 Sam Northshield published in the American Mathematical Monthly (issue 122) a no less elegant proof of contradiction in the form of a one-liner, which I do not want to withhold from you (with short comments).

.­.­.

Pretty up Windows command line

You can visually enhance the despicable Windows Command Prompt with a few simple steps. You can not only customize the command line in terms of color and size, but also extend its functionality (increase the buffer, install a large set of UNIX tools). Although the command prompt does not come close to PowerShell 6.0 or the new Windows 10 Bash Shell, it can be used for everyday tasks.

.­.­.

Dynamic URLs in Joomla

In content management systems, URLs are often not always fixed in advance and are therefore not statically created in advance (as a contribution or menu item), but address objects from the database. Similar to WordPress ( as described here ), it is also possible in Joomla to build dynamic URL structures (independent of the internal alias system). Either JRouter can be used here - or you can use a one-liner in .htaccess.

.­.­.

JavaScript PasteJacking

Modern browsers can use JavaScript to read and write to the user's clipboard, i.e. they can manipulate it. The underlying technology is already old hat, but it is only recently that more and more attacks (under the name "PasteJacking") have been circulating on the net, which take advantage of this possibility to the disadvantage of the inexperienced user. An implementation in JavaScript is banal.

.­.­.

Swap columns in PostgreSQL

Swapping SQL table columns is part of the standard repertoire with MySQL - this is not (yet) supported with PostgreSQL. Although the official wiki devotes its own article to the problem, it does not show any practical solution that also supports views, indices and triggers. The following class does this job (for both MySQL and PostgreSQL) either on the command line - or alternatively directly in Laravel 5.

.­.­.

Quick Tip for the Windows-Explorer

If you want to quickly open the command prompt in a folder in Windows Explorer, you right-click (one level up) on the folder and hold down the Shift key and select "Open command prompt here" from the context menu. I just found out another, faster method when you are inside the folder: Here you click into the current folder path, type "cmd" and confirm with Enter.

.­.­.

WordPress Categories: Tree View / Inheritance

If you work with hierarchical categories (taxonomies) in WordPress, you will notice that, on the one hand, the display of the checked categories in the backend is confusing and, on the other hand, posts do not automatically end up in the parent category if they are placed in the child category. Both can be straightened out with just a few lines of code using the powerful hook system (in the form of an action and a filter).

.­.­.

PHP 7 and the spaceship operator

Besides new features like type hinting for scalar datatypes or the optimized performance, PHP 7 also brings many new, useful language extensions, and finally the "spaceship operator" has made it into the world of PHP (Ruby and Perl programmers have known it for a long time). \($a <=> $b\) returns \(0\) if both operands are equal, \(1\) if the left one is larger and \(-1\) otherwise .

.­.­.

IIS 7.5 PHP FastCGI timeout

If you integrate PHP via FastCGI on the IIS 7.5, each script is aborted after 600 seconds (i.e. 10 minutes) by default. A change of the known variable "max_execution_time" in the php.ini has no influence on this, you (also) have to adjust the FastCGI settings. For this, the IIS offers a comfortable interface for managing the relevant variables.

.­.­.

Paradox of Stochastics

Conditional probability theory entails beautiful tasks with counterintuitive solutions. In addition to the well-known sibling problem, I will now briefly deal with another example: "I now have two children. One of them is a boy and was born on a Thursday. What is the probability that the other child is also a boy?"

.­.­.

Git, Shopware and empty folders

the file version management system git is slim, fast, and portable. git always handles objects, namely files. folders are only created if there are files in them, otherwise git doesn't capture them in the first place. this has unpleasant side effects in some projects. for example, the shop system shopware relies on strict adherence to the folder structure to function.

.­.­.

Shopware: Individual shipping costs

Shopware has a powerful shipping cost module that you can specifically intervene in the calculation. In our case, we want to implement the following scenario: The shipping costs per article are initially determined according to the weight of the article (the weight limits are specified). Only for special exceptions should it be possible to set fixed shipping costs for each item.

.­.­.

Bring your own device

You can hardly ignore it if you want to work flexibly and independently: the cloud. There are probably quite a number of people who are already using the cloud without realizing it. With streaming, for example, all content is stored in the cloud and can be accessed when required. Netflix is ​​an example here that is becoming increasingly popular in Germany. Or the synchronization of desktop PCs or laptops with all mobile devices is also largely done via the cloud.

.­.­.

Dynamic permalinks in WordPress

The WordPress permalink system can be adapted very well to your own needs with the help of structure tags . The setting% postname% is probably the most common and practicable solution. However, if you want to implement real dynamic links, you first have to expand the system with your own code.

.­.­.

Corrupt hyperlinks in Word and Excel

One would think that when opening hyperlinks from a Word/Excel document, the default browser would be started with the desired URL, but strangely enough, this is not the case - which leads to unpleasant side effects and makes links for session/cookie-based log-in protected pages in said Office programs impossible.

.­.­.

A paradox for Father's Day

On this Father's Day, a daughter gives her father a self-painted picture that her father has long wished for. The daughter says: "I am giving you the picture that you wished for, and my gift will be a surprise". The father trims and reflects on the truth of this statement.

.­.­.

Integrate dynamic scripts with and without HTTPS

If you include unencrypted scripts in the <head> area and call up a page with an existing SSL certificate encrypted, these scripts are blocked and therefore not executed. If you simply omit the protocol, all scripts are automatically called in encrypted form if the website is accessed via https: // - otherwise unencrypted.

.­.­.

Usability in drop-down menus

When working with multi-dimensional dropdown menus, one often runs into the problem that wrong submenus are opened accidentally or the desired submenu is accidentally closed. This effect occurs when the mouse pointer leaves the corresponding menu at the top level while navigating to an already expanded submenu.

.­.­.

Shopware: Deactivate variants automatically

In Shopware, when a sales item is sold, the whole item is deactivated for a real order exactly when all variants have a stock level less than or equal to 0. To realize this also on a variant basis, I have programmed a small plugin, whose Bootstrap.php I provide below.

.­.­.

Double password query with SSL

The following constellation always has an unpleasant side effect: If you protect your site with htaccess / htpasswd and at the same time force an SSL connection, you always need to enter the same password twice (once for http and again after successful entry for https). With the help of the configuration sections introduced in Apache 2.4, the problem can easily be dealt with.

.­.­.

Multi-line strings in JavaScript

When programming with JavaScript, you often stumble over the missing possibility to realize multi-line strings by entering them in the code. While the task is no problem in other languages such as PHP or Ruby, JavaScript can only be solved with workarounds, the use of which depends on personal taste and browser support.

.­.­.

Artificial intelligence - does it already exist?

Anyone who looks around at the technical innovations of the last two years will find words like smart technologies or artificial intelligence (AI) again and again. But on closer inspection, we see that most devices are still far from artificial intelligence. Smart home systems such as those from Amazon or Google are particularly often associated with AI.

.­.­.

The technology behind online casinos

for a few years now, they have literally been sprouting up out of the ground: online casinos. countless providers make it possible for gambling fans to indulge in their favourite pastime around the clock on the internet. those who used to like going to the casino in the past can now save themselves the trouble of going and simply switch on their computer. but how exactly does this principle actually work?

.­.­.

mail () in PHP with UTF-8 and umlauts

Sending emails with PHP is best implemented with powerful classes such as PHPMailer . Convenient wrapper functions make it possible to use UTF-8 content, embed images and send encrypted attachments with just a few lines of code. If you want to save yourself the overhead and, contrary to the recommendation, use the PHP function mail () , you will run into problems when using umlauts and UTF-8 at the latest.

.­.­.

Google PageSpeed Insights vs. Google Analytics

Validation tools such as the W3C Markup Validation Service or Google PageSpeed Insights are helpful to objectively evaluate the code and performance of a website. Especially Google influences a whole industry with concepts like above the fold - and also gives strict but useful guidelines in terms of image compression and caching. But it can happen that Google steps on its own feet.

.­.­.

Welcome JavaScript 2.0

JavaScript dominates the web - and ECMAScript, the core of the language is growing up. the new specification (ES6 or JS2), which is expected in the middle of this year, brings a lot of new features that you can already try out today. Firefox currently brings the best support, but polyfills through so-called transpilers like Google Traceur are also possible. Below is a short overview of the new features of ES6.

.­.­.

0,99999... = 1?

Whether at school or at university: An interesting question that \( 0,99999... = 1 \) and then includes the question of whether the following equation is true: \( 0,99999... = 1 \) . Although infinity \(0,99999... = A\) in the left part of the equation, we give it a name: \(0,99999... = A\) . After multiplication by the factor \(10\) and simple algebraic transformations, we get a first astonishing insight.

.­.­.

SQL: poor performance despite index

Just now I was confronted with the following performance problem of a SQL database: In a SQL table called "users" with ~1,000,000 entries, it took an unbearable 28 seconds to determine the number of registrations on today's day. In the "created" column, the times of the registrations were stored in the format "Y-m-d H:i:s".

.­.­.

Small chess problem

Besides the well-known knight problem and queen problem, there are many other exciting questions in the world of chess. I have touched on two small curiosities in a previous blog entry. If you deal with chess problems mathematically, you will soon realize that mathematics provides very simple and enlightening answers to many questions.

.­.­.

Files available online with OneDrive

If OneDrive, Dropbox, Google Drive, OwnCloud, box.net: Regardless of the box in which you store your files - the services are almost the same. The clients available for all desktop and mobile systems, the standard unencrypted files and the sharing options differ only marginally. But the OneDrive, which has been integrated into the system since Windows 8.1, has a special feature: only files available online.

.­.­.

PHP: File access with umlauts under Windows

Files on web servers should always be without spaces (not "this is a picture.jpg"), without umlauts or special characters (not "football.jpg"), without backslashes (not "Arbeit \ Auto.jpg") and in lower case (not "" test.JPG "). Recently, however, I had to access and process a large number of files with any file name for a customer project.

.­.­.

SQL query for determining a ranking list

Today I came across the following task while working on a customer project: Take a SQL table "user" with the columns "id" and "score" and determine a ranking of all users sorted by "score", in which users with the same score get the same ranking. By using user-defined variables this task can be solved intuitively and easily.

.­.­.

Facebook SDK: Check tokens on the server

When working with the Facebook SDK (more precisely when implementing a Facebook login function within a REST interface), the transmitted token that the client has received from Facebook must first be checked for validity by the server before further operations are performed.

.­.­.

Chrome DevTools: Addressing DOM elements

Whether Chrome, Firefox, Opera, Safari or even Internet Explorer: While well-engineered developer tools were a unique selling point of Firefox and the popular Firebug plug-in until a few years ago, powerful developer tools are now part of the standard scope of every browser in which there is a lot to discover gives.

.­.­.

Access to the file system using SQL

I just came across a nice option in MySQL to tap into the file system and obtain valuable information, for example about the existence of files and folders or their contents. This can be very helpful as an alternative to the php function file_exists , since the information about the existence of the file (s) can still be used in the query for further sorting and aggregation functions.

.­.­.

Animated backgrounds with canvas

animated vector backgrounds can bring variety to a web landscape dominated by full-screen photos and videos. it would be nice if loading times as well as broad hardware and software support went hand in hand with this. one solution is called canvas. the JavaScript-controlled HTML element is supported by all current browsers and can be displayed with high performance on mobile devices.

.­.­.

Fixed aspect ratio for HTML elements

As a web developer, one is often embarrassed to work with HTML elements that by themselves - in contrast to the img element, for example - have neither a fixed size nor a fixed aspect ratio. Often you want to achieve that these objects behave responsively, but the proportion between width and height is maintained. CSS does not offer an intuitive solution here by default. But with the help of the vertical padding property you can achieve your goal.

.­.­.

Court ruling on the use of stock photos

After the Regional Court of Cologne back rowed in the RedTube scandal last week and must never have approved the publication of the disputed IP addresses, it delivers another highly controversial and questionable judgement with its decision 14 O 427/13: The originator of stock photos of a certain picture agency must also be named via the direct access to his pictures via their URL.

.­.­.

Adieu Block & Inline - Welcome HTML5

The new features of the HTML5 specification are numerous and many of them are already supported by the majority of the browser landscape - in the following I will highlight an interesting change to the rules for nesting elements. HTML has always distinguished between block and inline elements. For example, the Document Type Definition of HTML4 names h1, p, and div as block elements and a, span, img as inline elements.

.­.­.

HTTP logging to IIS and Apache

Both Apache on Unix systems and IIS on Windows systems log HTTP requests out-of-the-box in file form. Requests to your own website should not only be evaluated and analyzed manually and automatically (e.g. by log file analyzers such as AWStats) on a regular basis to protect against hacking attacks. The paths of the relevant log files in common configurations are as follows:

  • /var/log/apache2/access.log (Example: Ubuntu 12.04, Apache 2.2)
  • C:\inetpub\logs\LogFiles\W3SVC1\u_ex<YYMMDD>.log (Example: Windows Server 2012 R2, IIS 8.5)
.­.­.

Joomla, IIS and the directory rights

When integrating Joomla 3.2 on a Windows Server 2008 R2 with IIS 7.5, problems with directory rights often arise, which are often inadequately resolved with settings that are too generously chosen. The following solution is safe and fully functional:

  • The group IIS_IUSRS needs the following permissions for C:\inetpub\wwwroot\: read & execute, view folder contents, read, write
  • The IIS_IUSRS group needs the rights for C: \ Windows \ Temp \: Read & Execute, Show folder contents, Read, Write
  • The user IUSR must be in the group IIS_IUSRS (Computer Management > Local Users and Groups > Groups)

If you need additional special directory permissions for all files uploaded via PHP (e.g. for SSH or FTP), set them also for the folder C:\Windows\Temp\. If you upload a file via PHP, PHP copies this file first into the temporary and then into the final path. If the file ended up in the temporary directory, it inherits its permissions and keeps them after moving it into the final directory.

.­.­.

Anonymous on the net: Impossible?

In times of the NSA scandal, not only net-savvy users are asking themselves the question of whether and how they can move anonymously on the net to escape the data collection mania of the authorities and secret services. However, this often leads to mistakes and false assumptions. A central misconception is the reduction of anonymity to the concealment of the IP address.

.­.­.

McFIT - new logo, new image

The discount fitness chain McFIT has given itself a makeover. In the past, a bright yellow mascot in the form of a banana adorned the blue lettering, now a yellow bow on an anthracite-colored background is skilfully looped into one another, thus forming an abstract structure. The FDP colors blue and yellow give way not only to the logo, but also to all other McFIT brand print items.

.­.­.

Photoshop: travel back in time

When the brothers Thomas and John Knoll started developing Adobe Photoshop in 1987, I was not yet born. Today, in 2013, the software is one of the most popular programs in general and the undisputed market leader in image processing. Thanks to Adobe and the Computer History Museum, the software will now be preserved for posterity in a very special form.

.­.­.

Curiosities in the game of kings

Chess has fascinated for centuries - its rules are easy to learn and its incredible depth is only accessible to experienced players (of whom I unfortunately do not count). In the following, I will deal with two entertaining questions: Is it possible, by a correct sequence of moves, to reach a position in which the black king is attacked by two white queens at the same time? Is this also possible by two white rooks?

.­.­.

Docu-soap instead of blockbuster: 48fps

Movies are usually recorded and played back at 24 frames per second - but the almost 100 year old standard format "24p" seems to wobble. In order to prevent the unpleasant side effects (eg the strong jerking during medium-fast camera pans) of the 24fps projection, work has been done for a long time on doubling the frame rate to 48 frames per second and more.

.­.­.

Spell check on websites

Automated spelling and grammar checking is now standard equipment in word processing programs - but checking the spelling of a website automatically has been relatively cumbersome up to now. Google Chrome is taking a first step in this direction with an integrated check in multi-line input fields (textarea). Now there is a service that makes this possible for entire websites.

.­.­.

Phone numbers in links - a security risk?

A few weeks ago I reported on how you can enable your visitors to open the phone app on mobile devices by tapping a phone number. Now a possibility has emerged to irrevocably block the SIM card or to reset the device to factory settings without the user having to do anything.

.­.­.

Interesting e-mail curiosities

Should domain names and email addresses always be lowercase to make sure you get where you want to go? Or is this completely irrelevant? For example, Google's mail servers have curious settings with interesting effects, which I will briefly introduce in the following article.

.­.­.

Design of the stock exchange prices in the daily topics

I closely follow the design of various programs on German television. Hardly any program retains its corporate design permanently. The evening ritual of the meeting in front of the television screen at 10:15 p.m. on the topics of the day has been causing me stomach ache lately: For some months now, a completely confusing color scheme has been chosen for the presentation of the current stock exchange prices.

.­.­.

Link phone numbers correctly

If you optimize your own web presence for mobile devices, you should not only pay attention to different screen sizes, optimized loading times and special features in the operation (such as hover effects), but also to the special capabilities of the devices.

.­.­.

Duplicate content on blogs

The same content on different websites is punished by Google in many cases - nevertheless the Google algorithm is intelligent and recognizes whether the elements in the header and footer remain the same or whether entire test passages can be reached twice under different URLs. The exciting question is how Google deals with blog article overview pages.

.­.­.

Increase security of WordPress

The security of the currently most popular content management system WordPress can be significantly increased by turning two small set screws. This requires only 5 minutes and two lines of code. Although the problem can be solved with a variety of plugins, I deliberately limit myself to plugin-free solutions here.

.­.­.