10 Mart 2017 Cuma

php file_get_contents türkçe karakter çözümü

Aşağıdaki fonksiyon php ile herhangi bir sayfanın verilerini çekerken ya da mevcut text üzerinde çalışırken aldğınız türkçe karakter hatalarını gidererek yeni bir çıktı verir.

function file_get_contents_utf8($fn) {
 $content = file_get_contents($fn);
 return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-9', true));
}

11 Ocak 2017 Çarşamba

How to convert djvu files to pdf on Ubuntu ?

We need "ddjvu" command to convert the files. The following command converts your djvu files into pdf quickly:
ddjvu -format=pdf -quality=80 file.djvu output.pdf
 If you want to see the flow, you can add "-verbose" to end of the above code.

Enjoy!

14 Aralık 2016 Çarşamba

Ubuntu server prevent serving .git directory

Add the followings into /etc/apache2/apache2.conf file

<Directorymatch "^/.*/\.git/"> 
Order deny,allow 
Deny from all
</Directorymatch>

30 Kasım 2016 Çarşamba

Postgresql 9.* remote access

First find pg_hba.conf and postgresql.conf files in your terminal with

locate pg_hba.conf

and then add the following line to pg_hba.conf
 host all all 0.0.0.0/0 md5.
After this, open  postgresql.conf file and change the line
#listen_addresses='localhost'
with
listen_addresses='*'.
Finally, just restart postgresql service with
sudo service postgresql restart.
Enjoy!

5 Ekim 2016 Çarşamba

How to fix /usr/bin/env: node: No such file or directory error

If you get this error while installing NodeJS, your Linux distro (like Ubuntu) probably uses "nodejs" instead of "node". For solution of the problem, make a symlink and it should work:

ln -s /usr/bin/nodejs /usr/bin/node

Enjoy!