Archive for November, 2009

A.I. algorithms

Thursday, November 26th, 2009

This will be a tiny post.

I’m excited since I got 2 artificial intelligence algorithms working. Both are related to graph navigations on a discrete world (depth and breadth first search). One of them with a fun twist to get different paths each time it gets called.

Both work ok, one finds the least nodes route (not always the shortest length) and the other finds a random one (sometimes the shortest path, others the least nodes, etc.)

Now it’s time to get into tree’s algorithms so I may get the path with the less length and variations from it.

Probably I’ll be publishing a demo within a couple of weeks… I’m really happy… and tired hahahaha

I know some of you guys are used to these algorithms, I’m not so I’m proud of myself.

A.I. Graphs

Wednesday, November 18th, 2009

So I already coded an A.I. PHP script using graphs.

I used it to figure out a path for the subway stations here in Mexico. As for now it calculates the path with the least stations visited which looks ok for some cases but then there are sometimes when the best path would be the one with the shortest distance traveled and even those occasions where you might not want to walk through too many connections.

So I found myself with three approaches:

1. Less stations.

2. Smallest distance.

3. Less connections needed.

I just made a script to get all the data needed (distance, cost, connections, neighbor station,etc) so now I’ll be digging into the proper A.I. logic to figure out how to solve this. As soon as I finish it I’ll publish a demo.

Managing SVN repositories

Monday, November 16th, 2009

Now that I have an SVN server and I’m making extensive use of my repos I was asked by a friend to create a repo for a small project he has. Since the project was for the company he works for then aI became aware that I couldn’t just put up a repo and expect he didn’t take a look at my personal projects.

Since his repo would be on the same folder as mine I needed a way to keep his eyes away from my projects and still allow him full control of his own.

This is the easiest solution I came up to.

Under my repos folder I created a repo for my friend called “friendrepo”:

svnadmin create friendrepo

Then assigned the proper owner and group so my apache could handle it:

chown -R user:group friendrepo

Then I created a domain name for him to use in no-ip.org: svn.friendscompany.no-ip.org

Added the proper lines to httpd.ini to handle the domain, then added a folder to be pointed by that domain which looks something like this:

/var/www/html/friendrepo

also changed the owner and group to those of my http server.

After that I created a soft link to my friends repo and voilá!!!! It’s done!

Next I just added the users he asked me and there he goes! now he has a repo on my server and he can’t see my repos!!!

I’ll keep playing with SVN to see if there’s an easier way.

The SVN (Subversion) experience

Monday, November 9th, 2009

Wow! it’s been a while since the last time I posted a comment.

Mainly because of dev projects and other stuff that kept me busy and away from my blog.

While developing some stuff I found myself in real problems when a client asked me to change some code to the way it was a couple of months… WHAT?! all this work and now they wanted me to rollback! ok, that shouldn’t be difficult… well it took me almost a couple of weeks.

For the past months I’ve been involved in a couple of projects for a company called Impremedia. One thing I learned from them is keeping track of my code through their SVN server. When my client asked me to rollback a piece of code I wished I had an SVN to make my life simpler. After finishing the rollback I proposed myself to get an SVN server up and running ASAP and moving all my codes there.

After a couple of failed attemps Voila! my SVN server is up and running!

It took me a week to solve problems, edit and reedit conf files, start-stop-starting services and testing the server and finally it’s up. I’ll be moving all my source codes to it these week so I’m really reeeeaaaally happy!

What did I had to do?

Ok, It’s been a long way but I’ll resume all  to the minimum.

Get acces to your box

Get httpd(apache) installed and running. Version 2.2 worked for me.

Install subversion.

Install dav_module and dav_svn_module.

Now it’s time for big decisions. Choose a folder where you would like to set your repository. Let’s suppose you want it under your web folder files (/var/www/html/) and you want to call it “svnrep”.

Go to /var/www/html/ and create the dir svnrep (mkdir svnrep).

Make it available for the httpd with a command that looks like this:

chown -R user:group /var/www/html/svnrep

Ok, that’s the repositories main directory. You noticed i said repositories? yes, this way you’ll be able to create many repositories in a blink.

Let’s enable the apache conf file.

Go ahead, open the httpd.conf file, get to the modules section and add the following:

LoadModule dav_module modules/mod_dav.so

Now let’s configure apache to be aware of the repositories.

Go to your virtual host section and add this lines :

<VirtualHost *:80>

ServerName svn.mydomain

ServerAdmin user@mydomain

<Location />

DAV svn

SVNParentPath /var/www/html/svnrep

</Location>

</VirtualHost>

Once you added that “domain” restart your httpd.

If everything went fine your server will restart gracefully, the next thing you’ll want to do is creating a repository. Go ahead to /var/www/html/svnrep.

Assuming you want to create a repo called “myfirstproject” you’ll type:

svnadmin create myfirstproject

That will set the project files and configurations.

Then you’re done! next thing is importing your files to the repo and voilá!

Please visit this link to get more detailed info about installation and configuration of SVN.