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.

Thursday, February 27, 2014

Lineage 1 Server Stuff

Been trying to get this to work. Spent most of yesterday. Built the server from the trunk.

But I keep getting the version mismatch error.

Figured out that you have to change the FIRST_PACKET to the 2.70C one and then Mac Crack of Time will be happy. This is the key packet that is sent by Lineage15. They send the version packet 0x32, not 0x7D. At least that's what it appears. Weird.

I also noticed there is a Tikal Antharas server project on github by uglyoldbob and specialdarkwolf. Uglyoldbob is who runs Doors Software and has made a special Mac client that supposedly lets you run the Mac version on Intel, though I couldn't get it to even get me to the login screen on most attempts.

It could have been my router setup since I had ports 2000 & 2001 directing to my computer, maybe that was messing things up. Or maybe there are other ports that need to be configured.

I think uglyoldbob is the same dude who runs the Frisky Cow private server, but I'm not 100% sure.

I suspect my issues relate to ClientThread.java. There are various versions with the different FIRST_PACKETs. I found this one too that has a different one, on the Google Code site. It later gets updated to something newer. It also mentions a 3.2 English Version check and has an "Opcodes.S_OPCODE_INITPACKET" value inserted there, something that's not in the milestone build! This is DarkWolf's and it's from his latest commit of the DarkWolf3.2 branch. It was from late 2012 I think. I haven't tried compiling it yet. In src/server/encryptions/java the value of the S_OPCODE_INITPACKET is 125, which is 0x7D like it's set everywhere. That further confuses me because then why does my client think it's an older version? Or I guess Tikal Antharas *is* 3.2. I guess that would make sense because it's supposedly "Episode 1.2" of "Season 3.0". But then 3.0's version must be something other than 7D, right? O.o.

So I found Darkwolf3.2 branch and got it by doing:

svn checkout http://l1j-en.googlecode.com/svn@781 l1j-darkwolf

I built that in Eclipse. I notice he has done a lot of custom shit in here vs. the main trunk. Nice.

I deleted my db and now I made the milepost 6:

mysql -p -u root l1jdb < l1jdb_m6.sql

Also I realized mysql was not in my path so I added it to /etc/profile.

I made serverstart.sh executable. Had to replace out the backslashes with regular slashes in there. (Un-windows-ize it). Also had to replace ; with :. Final result:

#!/bin/bash

# exit codes of GameServer:

# 0 normal shutdown

# 2 reboot attempt

while :: do

[ -f log/java0.log.0 ] && mv log/java0.log.0 "log/`date +%Y-%m-%d_%H-%M-%S`_java.log"

[ -f log/stdout.log ] && mv log/stdout.log "log/`date +%Y-%m-%d_%H-%M-%S`_stdout.log"

java -Xms1024m -Xmx1024m -cp l1jen.jar:lib/c3p0-0.9.1.2.jar:lib/mysql-connector-java-5.1.17-bin.jar:lib/javolution.jar:lib/bonecp-0.7.1.jar:lib/slf4j-api-1.6.1.jar:lib/slf4j-simple-1.6.1.jar:lib/guava-r09.jar l1j.server.Server > log/stdout.log 2>&1

[ $? -ne 2 ] && break

# /etc/init.d/mysql restart

sleep 10

done

When the client connects to lin 1.5 on port 2001, first they handshake. Then the client PSH: 0x4400. Server ACK. Client PSH: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855. That's the result of:

cksum -a sha256 /dev/null

(according to Hackpedia).

Anyway, server PSH: 0a000101000000 then 255.255.255. ... etc. a bunch of times for 473 bytes. Then the client went and talked to geotrust?? Anyway.

Later server does the standard first packet bullshit:

0032EC90C65CB13C2C28F6651DDD56E3EF

Then the client comes back with

0E 00 9F 41 51 02 90 56 7A 9B C4 49 E6 C8

And the server's all like

1E (30?)

Then

00 2F D3 D2 92 62 5B 88 53 98 9F 31 05 BF 86 55 45 6A 6D C3 2B C4 D7 8C 4D FF F8 56 78

That was with Tikal Antharas client. I think. Lets try a virgin Crack!

Client comes back on mine with:

0A 00 A7 05 AE 47 2A 13 C0 01

So that's different. Why? I got an exception when I used the 3.0 key:

char peer1_0[] = {

0x12 };

char peer1_1[] = {

0x00, 0x32, 0xec, 0x90, 0xc6, 0x5c, 0xb1, 0x3c,

0x2c, 0x28, 0xf6, 0x65, 0x1d, 0xdd, 0x56, 0xe3,

0xef };

char peer0_0[] = {

0x0e, 0x00, 0x84, 0x5a, 0x4a, 0x19, 0x70, 0x49,

0x9a, 0x09, 0xc9, 0x47, 0x71, 0xef };

char peer1_2[] = {

0x0a, 0x00, 0xa7, 0x05, 0xae, 0x47, 0x2a, 0x13,

0xc0, 0x01 };

When I connected TA with 0x32 it gave version mismatch. The mid flush was commented.

Sunday - Test 7

I put in the Darkwolf 3.2 opcodes. I'm also using 0x7d version and Darkwolf first packet. No mid flush.

Version mismatch!

With mid flush: same.

Found a set of C versions here on a TW board. Trying with mid flush on their 3.1.

Sunday, January 26, 2014

Learning about DBs

In Oracle we have LOBs, which could be a big JSON object response you want to store. The we have marts which are slices of that data to build tables against.

"Set up your DB with the series of LOBs, then warehouse the data and use surrogate keys to cross-query." What does this mean exactly?