After short time googling, I found out that Maxmind doesn’t allow anonymous download of their free GeoIP2 databases because of a California Consumer Privacy Act (CCPA). See source
To search a string part (needle) in string (haystack), you can easily use the PHP strpos function. But this function doesn’t exist in TypoScript.
The following TypoScript return true if the needle is found in the haystack. This can be used in an if condition.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cObject=COA
cObject{
1=LOAD_REGISTER
1{
# search for http (or https).
needle=http
# search in
haystack.field=header_link
# split haystack by the needle
# result is a haystack without a needle, if found
findNeedleInHaystack.cObject=TEXT
findNeedleInHaystack.cObject{
data=REGISTER:haystack
split.token.data=REGISTER:needle
}
}
# compare REGISTER:haystack and result of REGISTER:findNeedleInHaystack
# if both are the same, nothing was found
10=TEXT
10{
# true will be returned, if the needle was found inside haystack
value=true
if{
value.data=REGISTER:haystack
equals.data=REGISTER:findNeedleInHaystack
# if the same, then negate the return value
negate=1
}
}
}
The above COA will return true if http is found in the header_link field. I used this to add ATagParams for external link, in assumption that link with http(s) is an external link.
In version 2 of php_cs_fixer some parameters and rules are renamed. Upgrade guide can be see on their Github page. This how-to is accordingly updated.
Applying PSR-2 coding style manually is really no fun and wasting time. A short visit in Github and there’s a tool which detects and fixes the coding style. The tool is called php-cs-fixer.
I’ll show you how to get the tool and use it to easily reformat all PHP file in project.
How hard is it, to write a PHP script to allow user to download a file? really easy, one would say. Just send the appropriate HTTP header and echo the file content.
Basically that’s all I need to force download per PHP. But somehow Android stock browser (Chrome) only downloads and creates a 0 kB file. Other browser (tested with Firefox on Android) saves the file correctly.
For those who use Google Webmaster Tool, they might find Google “duplicated content” warning. This is caused by slightly different URL, which is found by search engine.
Like:
1
http://domain.tld/google
and
1
http://domain.tld/google/
are interpreted as 2 different pages by search engine. So how do we resolve this?
the easiest tool to monitoring a server is munin. It’s easy to install and has lots of plugins. Installing munin on a server, which is to be monitored, is not really a smart move. Seeing a raspberry pi laying on a closet and do nothing, gives me the idea to use it to monitor my vServer. The problem is how to configure munin-node to communicate with munin, which is behind a dynamic IP. But one step after the other :)
First move is to grab a SD-Card and flash Raspbian from Raspberry Pi website. This is an easy task.
another day, another problem. Extbase is becoming main framework for TYPO3 extension, because it’s really easy to create a frontend plugin to show (listing or detail view) of a records. Since it’s MVC framework, Extbase create a complex URL for each record.
Usually a view in extbase is always called from a controller. but what if, an action in your controller is called as an eID and only parts of the template needs to be rendered? Partial is an option, but I have a code snippet, which uses the
I have been using Mac since 10.5 Leopard, but somehow I just spot this problem today. If you make an archive from Terminal using tar and extract it on other system (Windows or Linux), you’ll find dot underscore (._*) file in the archive. For every file there’ll be one ._ file for it.
Using the realurl extension TYPO3 generate human-readable URL. If the visitor visits the page using uppercase of the URL, TYPO3 can generate the page (HTTP 200). if a search bot (Google) found this URL and indexed it, Google will declare the page as “double content” and punishes your page rank. How do we deal with this? Continue reading redirect URL to lowercase