dracoblue.net

Fast clicktracking with nginx logs

When your web site is static (generated upfront or cached in varnish/nginx), you cannot update view/hits/download counters on each request. This click tracking needs to be done with additional requests.

Let's say our download urls look like this:

http://example.org/download-file/craur/craur-1.2.0.zip
Continue reading ...

In linux, nginx, open source, ubuntu by DracoBlue @ 13 Dec 2013 | 328 Words

Running static blog with nginx

If you created your blog without php/ruby (e.g. with jekyll or middleman, you need a webserver to serve the page.

If you host it with nginx, this is a very basic template:

server {
    listen               *:80;
    server_name          example.org;

    gzip             on;
    gzip_min_length  1000;
    gzip_types       text/plain application/xml application/json text/css application/x-javascript;
    gzip_disable     "MSIE [1-6]\.";

    root   /home/example/live/_site/;

    index index.html;
}
Continue reading ...

In jekyll, linux, nginx, open source, ubuntu by DracoBlue @ 12 Dec 2013 | 247 Words

Compile SAMP Scripts with pawncc.exe on linux

If you want to create scripts for San Andreas Multiplayer, you usually compile them on your windows PC.

But since you might want to automate it on a linux machine (e.g. to test your scripts on travis-ci), the pawncc.exe won't run on linux out of the box.

I am aware of the fact, that the team of the pawn language provides a native linux compiler called pawncc on their website, but the resulting .amx files do not work with the samp server.

To get our ubuntu linux box ready for compiling samp pawn scripts, we need some essentials.

Continue reading ...

In linux, open source, pawn, samp, ubuntu, wine by DracoBlue @ 11 Dec 2013 | 470 Words

Gotchas, when parsing xml/html with php

Since Craur is able to parse XML/HTML easily (by using DOMDocument, BUT not XPath under the hood), you might want to know from what diversity of headaches it safes you.

DOMDocument::loadXML/loadHTML and UTF-8: It does not like non-utf8 strings.

You have to work around this, by using iconv/mbstring:

<?php
$xml_string = iconv($encoding, 'utf-8', $xml_string);
$node = new DOMDocument('1.0', 'utf-8');
$is_loaded = $node->loadXML($xml_string, LIBXML_NOCDATA | LIBXML_NOWARNING | LIBXML_NOERROR);
if (!$is_loaded)
{
    throw new Exception('Invalid xml: ' . $xml_string);
}
Continue reading ...

In craur, html, open source, php, xml by DracoBlue @ 10 Dec 2013 | 971 Words

Generating/Parsing csv files with craur

In the previous blog post we looked at parsing/generating xml with craur.

Today we'll check, how you can parse csv (even xlsx) files with craur. Craur is a json/xml/csv/xlsx to json/xml/csv/xlsx conversion library.

Usually you might use fgetcsv or some custom code to parse csv, but with craur we have a a simple api for any of those formats, with a consistent api when it comes to throwing exception.

Continue reading ...

In craur, csv, open source, php by DracoBlue @ 09 Dec 2013 | 443 Words

Page 8 - Page 9 - Page 10

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About