Warning: preg_match(): Unknown modifier 't' in /kunden/362380_80937/vielhuber.de/wp-content/plugins/gtbabel/src/Host.php on line 84
Blog > Vielhuber David

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 series of dates, counts the cells themselves and then visualizes the accumulated sums.

.­.­.

Quick Tip: PHP clearstatcache0420

Find the mistake:

72aaa2dbd201d49fc2ee429ebf68f15b

.­.­.

As part of its Google Cloud, Google offers the Google Translation API with a usage-based cost structure . There is also an undocumented API that cannot be used without a key , but refuses to work after a few requests. When using the website translation function of Google Chrome, it is noticeable that pages can be translated in very good quality without any noticeable limitation.

.­.­.

Quick Tip: Git Auto Tagging0220

If you link Github with Composer , it is mandatory to assign a version number 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.0.0 follows after 1.0.9. If no tag has been assigned, the version is automatically tagged with 1.0.0. Tools like flimsy or git hooks shorten this desert of characters.

8cd852c96ec1e60e8a5ac1f3614b2397

.­.­.

Edit MySQL trigger0220

MySQL does not offer an 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 . We can use a detour to change triggers. To do this, you make your changes in the result of the following SELECT command (change database and trigger name beforehand) and execute the query.

.­.­.

Trigger change events in VanillaJS1219

VanillaJS has been on par with the veteran jQuery in almost all areas since ES6 and is now far superior. So it is worth gradually migrating 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 JS1119

The setting of cookies by your own or third-party scripts can be finely controlled using 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 track at all and therefore do not set any cookies as a result), it can make sense be to whitelist / blacklist cookies in general.

.­.­.

Deactivate devices via script in Windows1019

In order to save electricity or reduce your own surveillance paranoia, it is advisable to completely disconnect unused devices on your own computer from the electricity. Devices such as sound boxes or webcams can be de / activated in the classic way using the Device Manager. The whole thing also works via script. In the past, the standard way of doing this was devcon . Windows 10 now offers a more convenient way to do this via PowerShell .

.­.­.

Skype Background Blur0919

Skype has a nice, somewhat hidden function: For video transmissions, the background can be automatically disarmed by clicking on the video button and the function " Blur my background ". With the help of artificial intelligence, this works with any camera even without depth information. The whole thing then appears more professional and hides private or non-essential things in the background.

.­.­.

SVG export from Illustrator0919

SVGs play a central role in today's web. Not only have they replaced icon fonts, 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 introduce in the following article.

.­.­.

Project Euler: Lattice paths0919

Project Euler is a series of exciting programming problems that often have a mathematical background. The problems are often such that sophisticated algorithms have to be developed in order to reach their goal in a reasonable time. Today we are solving problem 15: Lattice paths , where the solution can be found with simple combinatorial means.

.­.­.

WordPress has implemented background updates natively since version 3.7 and automatically activated them for minor releases. You can use filters to control the behavior more precisely, which is updated automatically. A permanent, fully automatic installation of all minor, major, plugin, theme and translation updates is not provided, however, it is easy to do otherwise.

.­.­.

OPcache PHP bootup optimization0919

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

.­.­.

In order to extend formulas to entire columns within Google Sheets, the use of the useful function ARRAYFORMULA is recommended . Unfortunately, this does not work in combination with some other important functions such as QUERY or INDIRECT , which is why a complete individual programming of the logic with the help of Google Apps Script or alternatively the manual copying of the formula down to the last line remains.

.­.­.

The Simpson paradox is one of the most easily understandable and at the same time amazing phenomena in statistics. It always occurs when groups of data indicate a particular trend, but this trend reverses when the groups are combined. The paradox can be understood immediately using a simple example.

.­.­.

Google Tag Manager has become the de facto standard for the integration of tracking scripts. On the one hand, this clearly separates the responsibilities (online marketing vs. programming) and, on the other hand, you can quickly set up and modify tracking via another deployment channel. Below are two small tips for setting up triggers.

.­.­.

Quick tip: FRITZ! Box WLAN hotspot0619

As of FRITZ! OS 07.10, there is a temporary possibility that the FRITZ! Box uses the WLAN hotspot of a cell phone as a fallback if the Internet is down. The function is hidden under Internet> Access data> Internet provider> Existing access via WLAN . The FRITZ! Box then works itself as a router and provides a network with its own address range. If the Internet is available again, you simply reset the setting. I also had to actively check the options WLAN> Radio network> 2.4 GHz frequency band active and Internet> Access data> IPv6> IPv6 support .

.­.­.

Flower of Life0519

The flower of life is a well-known, flower-like, geometric pattern that has been found in temples, manuscripts for thousands of years and for some time in pop culture. The pattern also plays a role in esotericism. We ignore all of this at this point and concentrate on the simple construction of the geometric shape, which is made up of several evenly distributed, overlapping circles.

.­.­.

Email delaying in Outlook0519

The asynchronous communication medium e-mail is - despite all the doom calls around Slack and Discord - the dominant communication medium in the business area worldwide. In addition to Merlin Mann's Inbox Zero, there are numerous other strategies for dealing with the daily flood of emails, including so-called email delaying, i.e. the delayed delivery of emails.

.­.­.

A spiral of numbers0519

For the past few days, I've been asking 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 extends from the origin to the outside to 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
.­.­.

When working with Google Sheets , fine, user-based rules for editing spreadsheets, 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 the tickets that affect them or the employee only the projects on which they are working.

.­.­.

Yarn Plug'n'Play0419

npm is the default package manager for Node.js. Facebook has long developed an alternative package management solution called Yarn . Yarn seems to be slowly disappearing from the Github Readmes as a 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 looking outside the box.

.­.­.

Convert PDF to LaTeX0419

The typesetting system $$\TeX$$ was developed in 1977 by the legendary Donald E. Knuth . The software package $$\LaTeX$$ is still part of the standard repertoire when creating scientific papers. With the following two tools, already generated PDFs and handwritten notes can be converted into TeX fully automatically. The results are very promising.

.­.­.

The simulation argument0419

Nick Bostrom's simulation argument is impressively simple and clearly worded. It does not try to prove that we live in a simulation, but instead elegantly formulates three options, one of which must be true. Elon Musk also has a similar thesis, which made the idea known to the general public. The official paper is over 14 years old and as many pages short. The central message is easy to understand and compact.

.­.­.

Critical bug when using WPML + ACF0319

The powerful plugins WPML for multilingualism and Advanced Custom Fields for your own fields are part of the basic equipment for many installations. It is annoying when there are malfunctions with data loss. The bug reports on the topic are several years old and have not been answered ( here and here and here and here and here ). I took a closer look at the problem.

.­.­.

Using the notation of branched functions0219

When defining function definitions with case differentiation, curly braces are used. We investigate the simple question of whether this representation can also be eliminated and the function can be traced back to a notation that can do without it. For example, the function

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

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

.­.­.

On some Android phones, both the Facebook and Instagram in-app browsers (as of today) behave incorrectly if an upload field has specified the accept attribute within a advertised or linked landing page. The button was therefore without function. If you open the page in the external, normal browser outside 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 elements0119

Google Chrome’s developer tools are among the most powerful on the browser market. Every month new features patter in, 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 button. But only today I noticed that DOM elements can also be easily moved using drag & drop:

.­.­.

Quick Tip: git status --r0119

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

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

.­.­.

LAMP stack in the Windows Subsystem for Linux1118

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

.­.­.

Tricks for Laravel Eloquent Relationships0918

One of Laravel's strengths is its elegant syntax. If you have a large number of models and relationships in Laravel (due to the many tables in the database), traversing can often end up in less elegant code. Over the course of time, three small extensions have proven themselves for me, which I will briefly introduce below. We only use some inheritance, magic methods and custom collections.

.­.­.

In almost every web project and in every environment (including production), Git version management has become standard. Git always creates the .git subfolder and if this is at the level of the public folder of the website, you can access sensitive files publicly (for example, calling /.git/logs/HEAD shows the last commits) . This explains in detail how you can clone an external (!) Git repository without directory listing.

.­.­.

Node.js / npm / composer without root0818

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 hosters without root rights with a few lines of code. You can use it to 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 0818

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

91367d1c4636fd753b381406024e303c

Now you can do some things with it.

.­.­.

Execute commands directly after SSH connection0718

The following command connects to a server via SSH, executes some commands (for example, changes to a subdirectory and issues a git status ), leaving 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. The same file is immediately deleted within this initfile so that no traces are left.

.­.­.

If you connect a network drive in Windows Explorer, this does not apply system-wide, but only to the current user account. This means that you cannot access this network drive in an application that runs with administrator rights. It's easy to change: 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. Then integrated network drives are visible everywhere.

.­.­.

Quick Tip: Include folders as drives0618

If you want to quickly reach a local folder in Windows that you use again and again, you can simply assign it a drive letter of your own. This can only be done via "Connect network drive" via a detour, because you cannot specify the path C: \ Users \ David \ Downloads, for example. The solution is given by the so-called administrative release of the drive, which exists as standard for each folder: In the example above, this would be \\ localhost \ c \$ \ Users \ David \ Downloads .

.­.­.

Catch frogs0518

A frog jumps around on the number line and you try to catch it. Jumping and catching always alternate. The frog starts at position $$s \in \mathbb{Z}$$ and with every move it jumps a distance of $$z \in \mathbb{Z}$$ (if $$z>0$$ it jumps to the right, otherwise to the left). $$z$$ is the same for every jump. Snapping consists of specifying an integer position. You don't know either $$z$$ or $$s$$ . We show that there is a way to always catch the frog.

.­.­.

Long file names on Windows 100418

Not only when using npm under Windows, you reach an almost 30 year old limit that limits the paths to folders and files to a maximum of 255 characters. It's not NTFS's fault, it's LFN . This leads to annoying bugs and incompatibility between operating systems. In times of WSL, this is an unfortunate condition, which fortunately can be fixed in the registry for some time.

.­.­.

Laravel cues on localhost0418

In the PHP framework Laravel within productive environments, workers and supervisors ensure that the jobs stored in Redis, for example, are processed. If you want to be completely independent of this on localhost, 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 goals in Google Analytics0218

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 later want to evaluate advertising campaigns or carry out A / B tests, for example, you create so-called target projects.

.­.­.

Pragmatic cache invalidation0118

Server-side rendering is now part of the standard repertoire of websites and applications. Browsers like Google Chrome also tend to cache as much as possible to minimize the loading times of further calls. The cache invalidation of CSS / JS / image files can be solved with the help of mod_pagespeed , Expires / Cache control header, a cache manifest or very pragmatic and directly through individual parameters behind the file name.

.­.­.

Bitbucket and SSH keys0118

The provider Bitbucket offers (also in the paid tariffs Standard and Premium) no possibility to store SSH keys with write rights at the repository level. Storing your personal SSH key on the production server is not an option, since otherwise you can access all other projects that you are currently working on. There are so-called access keys , but these only allow read access.

.­.­.

Windows Sysinternals via network drive1217

Mark Russinovich's Sysinternals tools should not be missing on any Windows computer. If you always want to have the latest version on 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). Subsequently, nice tools such as PsList, PsKill or the Process Explorer are available on the S drive.

.­.­.

Quick Tip: Google Sheets and Calendar Weeks1117

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 it is defined differently: Here the first calendar week is the week from which at least 4 days fall on the new year. In Google Sheets you can solve the problem (in addition to other exciting alternatives like = SHORT ((TODAY () - DATE (YEAR (TODAY () - REST (TODAY () - 2; 7) +3); 1; REST (TODAY ( ) -2; 7) -9)) / 7) and the modified = CALENDAR WEEK (TODAY (); 21) ) with the function = ISOWEEKNUM (TODAY ()) especially designed for this.

.­.­.

Self-signed SSL certificates in Chrome 581117

Encrypted websites have been standard since Let's Encrypt . Even with local development, SSL certificates are hard to imagine ( navigator.geolocation, for example, requires SSL encryption locally). Since version 58 of Chrome, support for CN (Common Name) has been abandoned and SAN (Subject Alternative Name) has become mandatory. As a result, Chrome suddenly no longer accepts all SSL certificates created in the conventional way .

.­.­.

Double age of two people1017

Consider two people $$A$$ and $$B$$ who are not born on the same day and $$A$$ younger than $$B$$ . Show: There are exactly two age constellations $$a,b \in \mathbb{N}$$ for which the following applies: $$2\cdot a = b$$ . We first set $$d \in \mathbb{R}^+$$ as the age difference of $$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 point in 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 folders0917

Since it is well known that Git does not know folders but only files, empty folder structures do not end up in the repository. However, since many frameworks and projects absolutely need 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, if desired, can also ensure that other files in the folders are ignored.

.­.­.

Free Node.js hosting with Heroku0917

Hosting for Node.js is still not very common, especially in the German-speaking countries. The American cloud company Heroku offers a remedy here - and even for free . You always notice the paradigm "Build apps ... not infrastructure" and still have hardly any restrictions. As an example, we implement a small cron job based on PhantomJS that scraps a website every day and sends the page title by email.

.­.­.

Cantor's mating function0817

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$$ takes on all natural numbers.

.­.­.

The earth and the pea0817

Consider the earth (as a ball with $$r_1 = 6370km$$ ) and a pea (as a ball with $$r_2 = 2mm$$ ) and $$r_2 = 2mm$$ a rope over the equator so that it lies tightly on the surface. Now you extend both ropes by one meter each. Both ropes should now be completely extended again over the equator - but they are no longer 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 analog clock0817

What% of the time in a day are all three hands of an analog clock in the right half of the dial? First you look at the hour hand, which is on the right side in 12 of 24 hours (50%). From this time, the minute hand is on the right in 6 out of 12 hours (25%). Of these 6 hours, the second hand spends 3 hours on the right (12.5%).

.­.­.

Laravel: Working with Eloquent Relationships0717

With Eloquent, Laravel makes communication with the database much easier. When working with Eloquent Relationships , when calling dynamic variables (using the magic methods of PHP), you should be aware that the instances of the models do not reflect new changes, but instead store them permanently when they are called up for the first time.

.­.­.

Bitbucket: delete folder from Git history0717

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, for example, retrospectively 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 onto master again), you have to retrospectively manipulate the history of Git contrary to its nature.

.­.­.

Integrate SSL certificate from DomainFactory on IIS0617

In times of Let's Encrypt , encrypted websites have become the standard. Wildcard or extended certificates with particularly trustworthy holder 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 show you briefly which steps are necessary.

.­.­.

Paradoxical winning strategy when guessing numbers0417

Thomas M. Cover asked the following astonishing question in "Open Problems in Communication and Computation" in 1987: Player $$X$$ writes two different and randomly chosen natural numbers $$A$$ and $$B$$ on two different ones Note and place them face down on a table. Player $$Y$$ now randomly selects one of these pieces of paper, sees the number and has to decide whether this number is smaller or larger than the other number that is still face down on the table.

.­.­.

Football & Linear Algebra0417

When a football game kicks off, the ball lies on the center of the field and is then moved and rotated across the field for 45 minutes. At the beginning of the second half, the ball is again on the center of the field. Using simple means of linear algebra, we show that either there are always infinitely many points on the surface at exactly the same position as in the original state, or exactly 2.

.­.­.

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

.­.­.

Harmonious representation of logos with JavaScript0417

Whether references, partners or customers - there are many cases in which you want to display several logos side by side in harmony. The size ratios of the logos are mostly inconsistent. Often one follows one's gut feeling when designing the size in the design, but there is also an exact calculation method for a visually appealing representation by equating the areas of the logos. In the following example, you can do this with a few lines of JavaScript.

.­.­.

Check variables in PHP / JS for existence0317

When working with variables in PHP and JavaScript on a daily basis, you will often be asked whether a variable is empty. It is worth knowing the native functions and their differences for checking. Annoyingly, there is no easy way to intuitively check whether a variable is present or not. The following matrix shows what this means. Small helper functions can be used to retrofit what you want.

.­.­.

Bulk phone calls with sipgate.io0317

With sipgate.io, Sipgate has created an exciting cloud API with which you have a multitude of options for all aspects of Internet telephony. An account is free of charge, and there is also a free option in the Feature Store to set any free sender number . The documentation from sipgate.io is still expandable, but with a little reading into the official Sipgate API you can quickly realize exciting things.

.­.­.

Recursion in SQL0317

Relational database management systems based on SQL are only suitable to a limited extent for hierarchical or recursive queries. Other systems like ArangoDB are better here (there was a great talk about this at GOTO 2016 ). But you can also create recursive queries in SQL using common table expressions and thus query classic parent / child tables for all ancestors and descendants.

.­.­.

WordPress: Deactivate archive pages0217

According to w3techs.com , WordPress currently operates around 27.4% of all websites worldwide. In 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 bulk0117

If, like me, you get stuck in renaming thousands of form field names, the JavaScript console included in Acrobat is a good choice. In this you can not only execute any JavaScript code, but also access all content within the PDF (including form fields). Since there is no native function for renaming in the JS-API, the form fields with all properties are copied and created with a new name.

.­.­.

Shopware: Repair variant changes1216

A known problem is still not solved in Shopware 5: If you create an article with mutually dependent variants with mutually exclusive configuration options, it can happen that some combinations cannot be selected and therefore cannot be ordered in the frontend. With the help of a plugin, the problem can currently be easily remedied.

.­.­.

One line for the infinity of the prime numbers1116

There is ample evidence of the infinity of prime numbers - the well-known Euclid theorem from the Book of Elements is not lacking in any basic lecture on number theory. In the 2015 American Mathematical Monthly (issue 122) Sam Northshield published a no less elegant proof of contradiction in the form of a one-liner, which I will not withhold from you (with brief comments).

.­.­.

Prettify Windows command line0916

The nasty Windows prompt can be optically upgraded with a few simple steps. So you can not only change the color and size of the command line, but also expand it functionally (increasing the buffer, installing a large set of UNIX tools). Although the prompt does not come close to the PowerShell 6.0 or the new Windows 10 Bash Shell , it does not have to hide itself for everyday tasks.

.­.­.

Dynamic URLs in Joomla0916

In content management systems, URLs are often not always fixed in advance and are therefore not created statically 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 (regardless of the internal alias system). Either JRouter is a good choice - or you can use a one-liner in .htaccess.

.­.­.

JavaScript PasteJacking0616

Modern browsers can use JavaScript to read and write to the user's clipboard, which means they can also be manipulated. The underlying technology is already old hat, but only recently there have been more and more attacks (under the name "PasteJacking") on the Internet that take advantage of this possibility for the inexperienced user. An implementation in JavaScript is banal.

.­.­.

Swap columns in PostgreSQL0416

The swapping of SQL table columns is part of the standard repertoire in MySQL - this is not (yet) supported in PostgreSQL. The official wiki dedicates its own contribution to the problem, but does not show a 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 Windows Explorer0416

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

.­.­.

WordPress categories: tree view / inheritance0316

If you work with hierarchical categories (taxonomies) in WordPress, you will find that, on the one hand, the display of the checked categories in the backend is confused and, on the other hand, articles do not automatically end up in the parent category if you are placed in the child category. Both can be bent 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 Operator1215

In addition to new features such as type hinting for scalar data types or optimized performance , PHP 7 also brings with it many new, useful language extensions. The "Spaceship Operator" has finally made it into the world of PHP (Ruby and Perl programmers have known this for a long time). $$a b$$ returns $$0$$ if and only if both operands are the same, $$1$$ if the left one is larger and otherwise $$-1$$ .

.­.­.

IIS 7.5 PHP FastCGI timeout1215

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

.­.­.

The conditional probability theory brings with it beautiful tasks with counter-intuitive solutions. In addition to the well-known sibling problem, I will now briefly deal with another example: "I now have two children. One child 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 folders0815

The file version management system Git is slim, fast and portable. Git always deals with objects, namely files. Folders are only created when there are files in them, otherwise Git does not even record them. This has unsightly side effects in some projects. For example, the Shopware shop system relies on strict adherence to the folder structure in order to function.

.­.­.

Shopware: Individual shipping costs0815

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

.­.­.

You can hardly get past it now 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 knowing it. With streaming, for example, all content is stored in the cloud and can be called up when required. Netflix is ​​an example here that is becoming increasingly popular in Germany. Or the synchronization of desktop PC or laptop with all mobile devices is also largely done via the cloud.

.­.­.

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

.­.­.

Corrupt hyperlinks in Word and Excel0615

One would think that when opening hyperlinks from a Word / Excel document, the standard browser is started with the desired URL. Strangely enough, this is not the case - which leads to unsightly side effects and makes links for session- / cookie-based, login-protected pages in the said office programs impossible.

.­.­.

On today's Father's Day, a daughter gives her father a self-painted picture that the father had long wanted from her. The daughter says: "I will give you the picture you requested and my gift will be a surprise". The father is startled and ponders the truth of this statement.

.­.­.

Integrate dynamic scripts with and without HTTPS0415

Do you bind in <head > - Area scripts unencrypted and calls 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 encrypted when the website is accessed via https: // - otherwise unencrypted.

.­.­.

When working with multidimensional dropdown menus, you often encounter the problem that incorrect submenus are opened accidentally or the desired submenu is closed accidentally. This effect occurs when the mouse pointer leaves the corresponding menu at the upper level when navigating to an already expanded submenu.

.­.­.

Shopware: Deactivate variants automatically0315

In Shopware , the entire article for a sales item is deactivated for a real order if and only if all variants have an inventory less than or equal to 0. In order to implement this on a variant basis, I have programmed a small plugin, the Bootstrap.php of which I will provide below.

.­.­.

The following constellation always leads to an unsightly side effect: If you protect your site with htaccess / htpasswd and at the same time force an SSL connection, you always need the same password twice (once for http and once successfully entered for https). With the help of the configuration sections introduced in Apache 2.4, the problem can be easily mastered.

.­.­.

Multi-line strings in JavaScript0315

When programming with JavaScript, one often stumbles upon the lack of the possibility of realizing multi-line strings by entering them in the code in multiple lines. While the task in other languages ​​such as PHP or Ruby is not a problem, JavaScript can only be managed with workarounds, the use of which depends on personal taste or browser support.

.­.­.

Artificial intelligence - does it already exist?0320

If you take a look at the technical innovations of the past two years, you will always find words like smart technologies or artificial intelligence (AI). But when we take a closer look, 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 casinos0315

For a few years now they have been sprouting up: online casinos. Countless providers enable gambling fans to indulge in their favorite pastime around the clock on the Internet. If you used to like going to the casino in the past, you can save yourself the way today and simply switch on the computer. But how exactly does this principle work?

.­.­.

mail () in PHP with UTF-8 and umlauts0215

Emailing with PHP is best done with powerful classes like PHPMailer . Convenient wrapper functions make it possible to use content in UTF-8 with a few lines of code, to embed images and to send attachments in encrypted form. If you want to save the overhead and, contrary to the recommendation, use the PHP function mail () , you will encounter problems at the latest when using umlauts and UTF-8.

.­.­.

Validation tools such as the W3C Markup Validation Service or Google PageSpeed ​​Insights are helpful for objectively evaluating the code and performance of a website. Google in particular influences an entire industry with concepts such as above the fold - and also sets strict but useful guidelines in terms of image compression and caching. However, it can happen that Google steps on its feet.

.­.­.

Welcome JavaScript 2.00115

JavaScript dominates the web and ECMAScript, the core of the language grows up. The new specification (ES6 or JS2), which is expected in the middle of this year, brings with it numerous innovations that can already be tried out today. Firefox currently has the best support , but polyfills by so-called transpilers such as Google Traceur are also possible. The following is a brief overview of the new features of ES6.

.­.­.

0,99999... = 1?1214

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 multiplying by the factor $$10$$ and simple algebraic transformations, we get a first astonishing finding.

.­.­.

SQL: poor performance despite index1214

I was just faced with the following performance problem of an SQL database: In an SQL table called "users" with ~ 1,000,000 entries, the determination of the number of registrations today took an intolerable 28 seconds. In the "created" column, the times of registration were saved in the format "Ymd H: i: s".

.­.­.

Small chess problem1114

In addition to the well-known knight problem and women's problem, there are many other exciting questions in the world of chess. I touched on two small curiosities in a previous blog entry . If you deal with chess problems mathematically, you quickly find that mathematics provides very simple and illuminating answers to many questions.

.­.­.

Files available online with OneDrive1014

Whether OneDrive , Dropbox , Google Drive , OwnCloud , Box.net : No matter in which box 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 OneDrive, which has been integrated into the system since Windows 8.1, has one special feature: only files available online.

.­.­.

PHP: File access with umlauts under Windows0914

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 "Work \ Auto.jpg") and in lower case (not " test.JPG "). Recently, however, I had to access and process a large number of predefined files of any file name for a customer project.

.­.­.

SQL query to determine a ranking list0814

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

.­.­.

Facebook SDK: Check token on the server side0814

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 carried out .

.­.­.

Whether Chrome, Firefox, Opera, Safari or even Internet Explorer: After mature developer tools were a unique feature of Firefox and the popular plugin Firebug 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.

.­.­.

I just came across a nice possibility in MySQL to tap into the file system and to get valuable information, for example about the existence of files and folders or their contents. This can be very helpful as an alternative for 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 canvas0614

Animated vector backgrounds can add variety to a web landscape characterized by fullscreen photos and videos. It would be nice if loading times as well as a broad support of hardware and software go hand in hand. One solution is: canvas. The HTML element controlled by JavaScript is supported by all current browsers and reproduced with high performance on mobile devices.

.­.­.

Fixed aspect ratio for HTML elements0414

As a web developer, you are often embarrassed to work with HTML elements that - by contrast, for example, in contrast to the img element - do not have a fixed size or a fixed aspect ratio. Often you want to ensure 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 get to your goal.

.­.­.

Court ruling on the use of stock photos0214

After the Cologne Regional Court backpedaled in the RedTube scandal last week and had never allowed the publication of the controversial IP addresses, decision 14 O 427/13 once again delivers a highly controversial and questionable verdict: The author of Stock- Photos of a particular photo agency must also be called up by directly calling up their photos via their URL.

.­.­.

Adieu Block & Inline - Welcome HTML50114

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

.­.­.

HTTP logging on IIS and Apache0114

Both Apache on Unix and IIS on Windows systems log HTTP requests out-of-the-box in file form. Requests on your own website should not only be evaluated and analyzed regularly and manually, not only to protect against hacking attacks (e.g. using a log file analyzer such as AWStats ). The paths of the relevant log files in widely used configurations are, for example, 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 rights1113

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

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

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

.­.­.

Anonymous on the net: impossible?0913

In the age of the NSA scandal, it is not just network-savvy users who are asking themselves whether and how one can move anonymously on the Internet in order to avoid the data rage of the authorities and secret services. However, this often leads to errors and incorrect assumptions. A central misconception is the reduction of anonymity to the concealment of the IP address.

.­.­.

McFIT - new logo, new image0613

The discount fitness chain McFIT is giving itself a new face. In the past, a bright yellow mascot in the shape of a banana adorned the blue lettering, now a yellow bow on an anthracite-colored background skilfully intertwines, thus forming an abstract structure. The FDP colors blue and yellow not only give way to the logo, but also to all other McFIT prints.

.­.­.

Photoshop: travel back in time0513

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 the field of image processing. Thanks to Adobe and the Computer History Museum for posterity, the software will now be preserved in a very special form.

.­.­.

Oddities in the game of kings0313

Chess has been fascinating for centuries - its rules are easy to learn and its incredible depth is only accessible to experienced players (unfortunately I do not count among them). In the following I deal with two entertaining questions: Is it possible to get to a position through a correct move sequence in which the black king is attacked by two white queens at the same time? Is this also possible with two white towers?

.­.­.

Documentary soap instead of blockbuster: 48fps1212

Movies are usually recorded and played back at 24 frames per second - but the almost 100-year-old standard format "24p" seems to shake. In order to prevent the unsightly side effects (e.g. the strong jerking during medium-speed camera pans) of the 24fps projection, it has been working for a long time to double the frame rate to 48 frames per second and more.

.­.­.

Spell check on websites1112

Automated spelling and grammar checking is now standard in word processing programs - but checking the spelling of a website automatically has previously been relatively cumbersome. 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 also makes this possible for entire websites.

.­.­.

Phone numbers in links - a security risk?1012

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

.­.­.

Interesting email curiosities0912

Should domain names and email addresses always be in lower case to ensure that you can get where you want to go? Or is this completely irrelevant? Google's mail servers, for example, have strange settings with interesting effects, which I will briefly introduce in the following article.

.­.­.

Design of stock market prices in the daily topics0912

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

.­.­.

If you optimize your own website for mobile devices, you should not only pay attention to different screen sizes, optimized loading times and special features in operation (such as hover effects), but also to the special capabilities of the devices. This includes (some people may have forgotten) also making calls.

.­.­.

Duplicate content on blogs0912

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 header and footer are 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 WordPress security0912

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

.­.­.

Warning

: preg_match(): Unknown modifier 't' in /kunden/362380_80937/vielhuber.de/wp-content/plugins/gtbabel/src/Host.php on line 84