• Martin Thoma
  • Home
  • Categories
  • Tags
  • Archives
  • Support me

Recent Posts

Languages for Back Ends

Languages for Back Ends

What programming language would I use for the back end of a big, new project in a startup which wants to offer a web service? Sure, on the client side there is pretty much only JavaScript (including variants like CoffeeScript and TypeScript) in combination with HTML and CSS. I've used … Read More »
Increase the maximum file upload size in PHP

Increase the maximum file upload size in PHP

Create a test.php with the following content to check your current maximum upload size. Search your php.ini in the Apache folder: $ find /etc -name 'php.ini' /etc/php5/cli/php.ini /etc/php5/apache2/php.ini Edit it. Set upload_max_filesize and post_max_size to whatever you want … Read More »
SQL Injections

SQL Injections

SQL is a language that allows prorammers to access data in databases. Most of the time (always?) you pass your queries in form of strings to the database. In online services it is quite common that the programmer formulates a template and the user fills in variables. Example: IMDb Take … Read More »
Solving linear equations with Gaussian elimination

Solving linear equations with Gaussian elimination

Please note that you should use LU-decomposition to solve linear equations. The following code produces valid solutions, but when your vector $b$ changes you have to do all the work again. LU-decomposition is faster in those cases and not slower in case you don't have to solve equations with the … Read More »
Google Code Jam Templates

Google Code Jam Templates

Here are some templates that are a good start for Google Code Jam. C++ #include #include #include using namespace std; int main(void) { /* number of test cases */ unsigned short int testcases; cin >> t; for(int i=1; i <= t; i++) { //loops for each case for (int … Read More »
PHP: A strange language

PHP: A strange language

Automatic conversion Strings to numbers $ php -a php > var_dump(123 == '123ax'); bool(true) php > var_dump('123' == '123ax'); bool(false) MD5 hashes This one seems to be fixed. It doesn't work in PHP Version 5.4.6-1ubuntu1.2 (released 16.08.2012). It was a problem in PHP 5.3.5 … Read More »
Comparing Dates in PHP and MySQL

Comparing Dates in PHP and MySQL

Sometimes you need to know compare PHP dates. You need to know what is later or if both dates are the same. PHP time formats and functions PHP knows these time / date formats: UNIX Timestamp: Integer - The number of seconds after 1970. Related functions are int `mktime([ int \$hour = date … Read More »
PHP: PEAR MDB2

PHP: PEAR MDB2

PEAR is short for PHP Extension and Application Repository. It provides a very easy method to get some common classes. PEAR MDB2 is a database class. It is a successor of PEAR DB. I took a look at version 1.4.1 which is currently the … Read More »
Benchmarking PHP

Benchmarking PHP

I used ApacheBenchmark (ab) to make a few Benchmark tests I was interested in. If you like to view some more, go to www.phpbench.com. The most important options are: -n: Number of requests to perform -c: Number of multiple requests to make An empty file: moose@pc07:~$ ab … Read More »
  • Martin Thoma - A blog about Code, the Web and Cyberculture
  • E-mail subscription
  • RSS-Feed
  • Privacy/Datenschutzerklärung
  • Impressum
  • Powered by Pelican. Theme: Elegant by Talha Mansoor