Wednesday, April 16, 2014

Setting up ox for mongo

As per http://oxformongo.org/docs/Installation...

Made a virtual host in apache httpd.conf:

<VirtualHost *:80>

        ServerName ox.com

        ServerAlias www.ox.com *.ox.com

        DocumentRoot "/Library/WebServer/Documents/ox/app-blank/webroot"

</VirtualHost>

Modded /etc/hosts to add:

127.0.0.1 ox.com

127.0.0.1 www.ox.com

Put ox in:

/Library/WebServer/Documents/ox

Restart apache.

Inside app-blank:

chmod -R 775 tmp

Changed app-blank/config/app.php to reflect:

$mongo_config = array(

'set_string_id' => TRUE,

'persistent' => TRUE,

'host' => 'localhost', <--make sure this is not the same as your server alias

'database' => 'ox',

'port' => '27017',

'login' => '',

'password' => '',

'replicaset' => '',

);

Also in config/framework.php:

if (!defined('DIR_FRAMEWORK')) {

define ("DIR_FRAMEWORK",'/Libarary/WebServer/Documents/ox/ox/');

}

Started mongod with this command:

mongod --dbpath /Library/WebServer/Documents/ox/data/db/

And on mongo shell I just did:

use ox

to make the 'ox' database referenced in the app.php config file.

Having to install PHP's pear so I can install the mongo extension for PHP to make this work. In my /Users/me/Downloads/ I did:

curl -O http://pear.php.net/go-pear.phar

then

sudo php -d detect_unicode=0 go-pear.phar

as per

http://pear.php.net/manual/en/installation.getting.php

Installing pear I'm using these lcoations:

1. Installation base ($prefix) : /usr/bin/pear

2. Temporary directory for processing : /tmp/pear/install

3. Temporary directory for downloads : /tmp/pear/install

4. Binaries directory : /usr/bin/pear/bin

5. PHP code directory ($php_dir) : /usr/bin/pear/share/pear

6. Documentation directory : /usr/bin/pear/docs

7. Data directory : /usr/bin/pear/data

8. User-modifiable configuration files directory : /usr/bin/pear/cfg

9. Public Web Files directory : /usr/bin/pear/www

10. Tests directory : /usr/bin/pear/tests

11.        Name of configuration file : /Users/me/.pearrc

But it throws this ridiculous warning:

** WARNING! Old version found at /usr/bin/pear, please remove it or be sure to use the new /usr/bin/pear/bin/pear command

The 'pear' command is now at your service at /usr/bin/pear/bin/pear

** The 'pear' command is not currently in your PATH, so you need to

** use '/usr/bin/pear/bin/pear' until you have added

** '/usr/bin/pear/bin' to your PATH environment variable.

So I then edited /Users/me/.profile and appended :/usr/bin/pear/bin to one of my path exports. Fine. That didn't work.. had to do it to .bash_profile. Ahh, that worked. I guess .profile is a vestige of some yesteryear time? Does it only get run at login? Mine is at least four years old.

Anyway according to this mongodb-user Google group message now I do:

pecl install mongo

then add:

extension=mongo.so

to the end of your php.ini

I had to sudo it.

A bunch of stuff flies by. It asks:

Build with Cyrus SASL (MongoDB Enterprise Authentication) support? [no] :

...to which I pressed Enter (no).

A bunch more stuff... A LOT... flies by.

Finally I modified php.ini and restarted apache again. Progress is made, now I'm getting:

404 Error

File (root/index)was not found

if I just go to my URL http://ox.com/. However if I go to the URL http://ox.com/root/ then I get the basic page.

I note that in Ox_FlatAction.php I set DEBUG=TRUE and I see that in ll. 91-93:

$file = DIR_CONSTRUCT . $dir . DIRECTORY_SEPARATOR . $flat_file;

if($this->flat_file_dir) {

$file = $this->flat_file_dir . DIRECTORY_SEPARATOR . $flat_file;

}

So if flat_file_dir is specified as it is when in routes.php l. 6:

Ox_Router::add(WEB_ROOT, new Ox_FlatAction('root'));

So basically when the constructor of Ox_FlatAction gets called on its ll. 54-58:

public function __construct($file_dir=null, $layout = null)

{

$this->flat_file_dir = $file_dir;

$this->layout = $layout;

}

Then $flat_file_dir gets set to /root/ and then in ll. 91-93 above file gets made to be root/index which does not exist because it's referencing the base file system.

I guess we need a rewrite directive in httpd.conf? Well conveniently oxformongo.org's installation doc does not actually show the .conf file text (it's just blank white space :/_).

Anyway not gonna worry about it because they also say in their routes doc that "to set up the route for the webroot, we do:

        Ox_Router::add(WEB_ROOT, new Ox_FlatAction());

...which is different from the base project which had Ox_FlatAction('root'), as you'll note above. Well OK. Now it's working :D

Tuesday, March 11, 2014

RAML

Brian turned me on to RAML: something for describing RESTful APIs in YAML evidently. I noted that it should have stood for RAML API Markup Language.

Friday, March 7, 2014

Wineskin

Haven't been able to get Wineskin to work with lineage15.com's Windows client, not sure why but once it launches, it says the binary is expired. If I set the date to 2010 then I it tries to launch but it just shows a jumbled screen that looks like it was rendered by a defective GPU, and throws an error about not being able to find GameGuard. Weird.

I finally got things going using Oracle's free VirtualBox with Windows XP. It actually runs great!

SSH with Sourcetree

I got SSH working with SourceTree to connect to a private github repo using an alternate keypair (i.e. another one than my id_rsa).

This involved adding the following text to ~/.ssh/config:

Host git-as-USERNAME

HostName DOMAIN.com

User USERNAME

IdentityFile ~/.ssl/USERNAME

And of course generating the USERNAME keypair I referred to this guide, which led to these commands:

ssh-keygen -t rsa -C "your_email@example.com" -f output_keyfile

SourceTree kept asking me for my password even after I set things up to where command line git was working right in the terminal. To fix this I had to format my repo URL with ssh:// in the beginning as suggested by Atlassian.

Wednesday, March 5, 2014

How I got Server Working, Etc.

Used the default settings of l1j-en for opcodes and it worked with lineage15.com's Windows one.

Got a pull from the SDL-based Intel Mac client attempt of Doors-Software.com's Thomas Epperson (uglyoldbob). It's a C++ based project that uses a makefile. His git repo is based on Windows and has Linux and Mac branches. I fixed a memory leak that was crashing the Mac Intel version. Maybe it wasn't crashing for him due to using ARC? Haven't found out yet, but I wasted many hours trying to get that thing into XCode and just could not get it to go. That's its whole own essay.

I finally got the Mac version built just using make. Had to swap out Opcodes.java and ClientThread.java back to what they are on his tikal_antharas_native branch of l1j-en. I can't stop thinking that it would make more sense to use the other opcodes that we know work. I also learned that his client is very early-stage without working sprites or many other things. What he's done so far is incredible but there is clearly much more work to be done. It would be very interesting of course but I'm wondering how much it would be worth to do.

More later.