Archive for the ‘Repositories’ Category

Tip for a SVN project

Monday, May 9th, 2011

Ok, this is the scenario:

There is a huge project hosted on a SVN repo. I’m to start a new project based on that one… No, I’m not allowed to create a new branch. And I must upload this project to a new SVN repo.

So checking out the project is easy. Now that I have the project in my Mac I want to be able to check it into the new SVN repo, the only thing is that when I checked out the project it downloaded to mi machine with a whole bunch of “.svn” folders.

Now, there are 2 different ways to get a clean copy of a project from a repo.

1. Do an export instead of a checkout, this will give you a project copy without the annoying “.svn” folders.

2. Do a regular checkout and then delete all the “.svn” folders.

On my humble opinion it’s better to do an export. If you do a checkout you can delete the “.svn” folders manually but be aware if you have lots of folders because an “.svn” folder will be created within each of your project’s folder so if you have a project with 10 folders and each one with two subfolders you’ll have to go into each f them to delete the “.svn” folders manually… it’s easy but it might take a lot of time and resources you might not have.

To speed up things it’s better to do the following:

Go to your project’s folder and run the following command:

find . -name ".svn" -type d -exec rm -rf {} \;

It will search for all directories called “.svn” and delete them as well as it’s contents.
I found this to be very useful and I really use it frequently but I keep forgetting it so I’m posting it here 😀

call to undefined function json_decode

Sunday, February 14th, 2010

This sucks!

Again my dev env works perfectly and the production environment keeps throwing weird messages.

I’m using php json_decode to (you guessed it) decode  a json string. The server throws this ugly message!

What should I do?! Ok I realized my dev env uses PHP 5.2…. the production server uses 5.1.6. What does that have to do? Well for some reason PHP 5.1.6 doesn’t have json support, in order to support the calls you should either upgrade php or pear install it.

I tried updating to php 5.2, and didn’t worked so I ended installing the pear support.

Remember to include the proper paths.

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.

Managing yum repositories (Dag)

Saturday, September 5th, 2009

So I got a memcached project working fine on my dev env. I showed it to my boss and told him all about the advantages of having memcached working on a production server so he gave me green light to implement it.

Since we have a dedicated hosting package (Codero, former Aplus) I thought It’ll be easier to ask our hosting provider to install memcached on our servers… they mailed us back saying that it would be considered advanced support and we’ll be charged 99dlls if we wanted to install it… of course we said no. We had ssh access so we were able to do it and spare the money 😀

Since on my dev env I just did yum installs I had the idea it’ll be the same on prod server, WRONG!

Th thing is that they have the default yum repositories and memcached was found on Dag repo so I needed to add it to get memcached. Looked for info over the web and found this web with the proper instructions.

I’m on a CentOS server so I’ll put here a brief description of what I did.

1. go to /etc/yum.repos.d/

2. create a file called dag.repo with this content:

[dag]

name=Dag RPM Repository  for Red Hat Enterprise Linux

baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag

gpgcheck=1

enabled=1

3. download the GPG key to your server and import it with the following command:

rpm –import RPM-GPG-KEY.dag.txt

4. congratulate yourself!

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Now I was able to install the memcached server and the memcached php module:

yum install memcached

yum install php-pecl-memcache

Then I just restarted httpd and done!

Hope this is helpful.