Move SVN Repository

Just moved my SVN Repository and used following commands;
On the old machine:
svnadmin dump /svn/repository/path > repo.dump
tar -zcf repo.tar.gz repo.dump
scp repo.tar.gz user_name@new.machine.com:~/repo.dump

On the new machine:
cd ~
tar -zxf repo.tar.gz
svnadmin create /svn
svnadmin load /svn < repo.dump

Pretty simple, isn't? :)

TDK Theft

Just before making a nice word game, you've gotta have a huge and nice word list. I can't say it's such a clean word list which Turk Dil Kurumu provides, but it's definitely huge! So, we better start with some theft :)

Here how it goes;
1- Set up the a database to collect: Created one more table with simply two fields [id, word]. Of course shouldn't forget to set "word" field as Unique not to deal with duplicate data.
2- PHP part: Just a short script which contains an insert command and small security stuff so nobody else can write additional words.
3- Automated part: I just love greasemonkey. I makes you rule any site you'd like. Just some javascript skills and any site is at your service. Here goes the greasemonkey script I wrote (modify 33rd line).

3a- XPather: If you're good with XPath stuff, it won't take how to figure out what we will read on the pages. Here is what I use to get all words on TDK's pages;
//table[@id='tblOrtaAlan']/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td/p
You may get shorter or better ones. As l..

SMPP with jsmpp

After checking some variations of SMPP 3.4 libraries, I chose jsmpp for the Bulk-SMS system I was writing. God bless Maven, no more necessity of downloading, placing and linking. Simply added following dependency to pom.xml and voila!

<dependency>

<groupId>jsmpp</groupId>
<artifactId>jsmpp</artifactId>
<version>2.1.0</version>
</dependency>

Every SMPP server has its own rules, like I had 3 SMS limitation per second. All the SMS transmission will result failure in case of trying more than limits. Using threadpool and threads is simply clever idea if there are thousands of SMS messages waiting for sending and yet you deal with timeouts on single thread systems. With using threaded system you may avoid timeout waitings and keep sending messages on other threads. Still mind the limitations though.
There are quite much of settings, I'll simply write the one which works for me :) Sending contains two simple code parts.


1. Connect
session.connectAndBind("XXX.XXX.XXX.XXX", // SMPP Server IP

16001, //Port
new BindParameter(BindType.BIND_TRX, // bindType
"XXX",
..

Free Hosting

After having so much verification and activation pain at 000webhost.com, solution was just before my eyes; their suggested partner 0fees. This 0fees.net site works really way better than I thought (or after decreasing all my expectations to bottom line after seeing 000webhost). First of all the activation doesn't require any administrator approval or any unnecessary time consuming procedures. Register, activate and use! Easy and nice cpanel (vista), supports PHP and MySQL with mostly all necessary services enabled. I should remember this site.

AJAX time!

Time to try some AJAX techniques to deal with comments. Not that I think there will be millions of comments, but hope dies the last :]

It is of course easier than JSON. All you gotta do is a normal PHP file for returning whatever you'd like to fill your DIV with and a javascript function for calling that PHP file.

Of course same as in JSON calling, I preferred to use PrototypeJS. Here is example I use in this site for calling an AJAX script to replace my comments div;


function getComments(id) {
new Ajax.Request('ajax.php', {
method:'get',
parameters: {getComments: id},
onSuccess: function(transport){
$('comments' + id).innerHTML = transport.responseText;
}
});
}

JSON

Just developed the administration and of course using some JSON objects was crucial. To make it happen I there are some simple steps;

1- Do we have JSON support on the server?

Simply put "<?php echo phpinfo();?>" in a php file and check if you have JSON enabled.

2- Encode the variable(s) you want to return.

With JSON enabled server, you get to use function "json_encode($variable)". Create your mixed variable and return the result.
Warning: Do NOT forget to set headers.
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');


3- Don't try to discover America twice.

Getting JSON item with an AJAX query and trying to parse it is of course discovered and coded many times. Use any javascript framework you like to have some easy coding. I used on my page PrototypeJS. Quite stable and perfectly helpful script. Here goes an example from my site to get an idea how to use.


new Ajax.Request('json.php', {
method:'get',
parameters: {blogId: val},
requestHeaders: {Accept: 'application/json'},
onSuccess: function
..

Welcome to my website

Hopefully soon I'm gonna fill this site, again :)

Mysql UTF8 Export / Import

I guess I better write it down since I keep making the same mistake again and again each time I export and forget to check the damn utf8 charset.

There is this SET NAMES 'utf8' COLLATE 'utf8_general_ci' command that has to be at the beginning of the file, so the import works smoother. Also using ANSI file isn't such a good idea, better to use UTF8 formatted file to get what you see in file.

Mysql Create User & Grant

Aaand the other command I keep googling each time..
CREATE USER 'username'@'192.168.1.1' identified by '8F7RzbKTmM76FADe';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'192.168.1.1' WITH GRANT OPTION;
flush privileges;

Centos on SadeceHosting

- yum -
wget repo.sadecehosting.com/yum/yumc5x64.sh;sh yumc5x64.sh

- mysql 5.5 -
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
yum install libmysqlclient15 --enablerepo=webtatic
yum remove mysql mysql-*
yum install mysql55 mysql55-server --enablerepo=webtatic
service mysqld start
mysql_upgrade
(if needed)
mysql_install_db
mysql_secure_installation