KahelAMP!

Life, Linux and Web Development in KahelOS… OK, in general…

Symfony 1.4 on Git (update)

with 2 comments

Quite frankly, I wasn’t happy with the procedure on the howto. It is unfriendly for those starting out in Git or Symfony. Been working (quietly) on simplifying, and found a better way, another good news is its already on Sourceforge.net. I’ve still have to work out the stable branches and the hooks, though. But here’s a preview:

  1. Assuming you’ve your symfony project directory and navigated there, initialize git on the project and clone symfony in lib/vendor/symfony:


    $ git init
    $ git clone git://symfony-git.git.sourceforge.net/gitroot/symfony-git/symfony-git lib/vendor/symfony

  2. Now, add symfony to your project’s git index as a submodule and also have its submodules initialized:


    $ git submodule add git://symfony-git.git.sourceforge.net/gitroot/symfony-git/symfony-git lib/vendor/symfony/
    $ git submodule foreach --recursive 'git submodule init && git submodule update'

  3. Check that everything’s ok so far (should display symfony’s version info):


    $ lib/vendor/symfony/data/bin/symfony -V

  4. Perform your initial project commit:


    $ git commit -m 'Initial commit; initialized symfony-git (1.4)'

  5. Initialize your symfony project and commit changes:


    $ lib/vendor/symfony/data/bin/symfony generate:project sf-git.test
    $ git add .
    $ git commit -m 'Initialized symfony project'

  6. Initialize your symfony application and commit changes:


    $ ./symfony generate:app frontend
    $ git add .
    $ git commit -m 'Initialized frontend application'

Written by agi

March 30, 2010 at 11:25 am

Posted in lamp

Tagged with , , , , ,

Internet Commemoration

leave a comment »

Today (it’s yesterday actually, it’s 8 past 12 on my review of this piece) commemorated the 16th anniversary of the first ever Internet connection of Philippines. My memories turned in to the moment when I first experienced it and felt exhilarated by it… and the lessons of those experiences.

The year was 1995. Since my fourth grade, I already understood that despite what one hear, read or see on the media, technological advances are still slow to reach provincial areas. There was a time, when I thought if it would be better if I grew some place else? Finally, the first computer shop opened in our town. I thought it would be a lot of fun, snicker-net and all. Unfortunately, they didn’t liked kids hanging out there.

No use for that, I was left wondering if there existed even one BBS in our little town. On a grander stage, there’s this Internet I kept encountering on reading the latest computer literature (which was also hard to come by). There’s nothing left to do but imagine.

Summer vacation then was almost arriving. If I remember correctly, my father was on vacation early because of school recognitions and graduations. One afternoon for wanting to explore the much mysterious Internet…

I’m on DOS/Windows 3.11 on a brand new 486DX4-100Mhz (16Mb of RAM). I popped in a Compuserve CD. I’m beginning to feel I skipped school for nothing. Finally, after two hours of tweaking I finally got it working. Oh, the sweet melody of a modem dialing up. I got frequent disconnects, but I did one 30-minute continuous surfing just browsing what can be found on the other side of “the computer”.

  • If I grew up somewhere else, ‘understand and improvise’ would not be much in my person
  • With specs like that at time, I should have felt like a hotshot… but
  • I really don’t got anyone to compare with (the computers at the shop had 386 and paperwhite VGAs) which says much about my father’s tendency not to be thrift on his kids
  • It was a humility lesson in disguised, as my mom put it, “Don’t boast just be thankful…” Yup, Windows 95 came around after a few months
  • My father never scolded me for skipping school, but he does when I fail a exam
  • (this is bad actually, but) I learned skipping school without failing… subjects as a compromise…
  • He always encouraged me, even if it means I frequently disassembled the computer and burned some chips and fuses (I’m sure he felt sometimes a bit stung because he, which I realized only later, must have spent some real fortune at those times)
  • Yes, I was scolded for that afternoon but from my mother. It never occurred to me that overseas calls were different from long distance calls. (Peace mom…)

From what I’ve seen at that point until now, I believe that the Internet was meant bring us closer as one human society. I also would like to believe that it’s doing that job quite well and inch by inch succeeding to a degree of perfection. Yet, it won’t be if we forget or ignore simplest unit of our society… Clue? No, it’s not an IT term.

I’ve read somewhere that what is written on the Internet will surely survive longer than its author. I hope this one will. I hope my child’s children will one day stumble on this. This is my piece for my Dad: thank you for everything you’ve done, do and doing for us.

Happy birthday Dad. We love you “dakal dakal” :-)

Written by agi

March 30, 2010 at 12:47 am

Posted in rants

Tagged with

Gimp Recipe: Background Noise

leave a comment »

Open GIMP and create a new 100×100 image. Fill her up with a color, say a shade of grey.

Now, add some noise by selecting RGB Noise under Filters > Noise. Good values I have tried are 0.6 for all channels, anything higher than that would make the edges obvious when tiling for a page background. Also don’t forget Correlated noise for smoother edges during tiling.

Finally save your image and have fun. See here for a demo.

Written by agi

March 24, 2010 at 10:36 pm

Posted in lamp

PHP Summit: Lesson #1

leave a comment »

Never assume the second up to the sixth degree has at least the intention of good will to you.

And so it was that I was told of an invitation to talk at an open source conference. It really wrung me up to be able to have this kind of  opportunity again. Unfortunately, although I was very excited to be able to share and impart something to a lot of people, preparation was what killed me.

I can’t recount here the events and reasons that transpired as some are just inappropriate to be said in a blog post. Let’s not dwell on that and just to pretend to agree that there were factors (and laziness itself) that drove me to procrastinate against preparing a presentation.

The worst of them, however, was assuming a friend’s friend will at least be accommodating if not a friend. So thus, I decided to do something different that the audience will or may appreciate and can draw inspiration from but would not require me making a detailed presentation as I already lack time to do so: a hands-on talk.

“We’re ready for you.. Are you ready?” Yes, I am… just to find out in the midst of my session that my laptop wasn’t really working with your projector (I would not have started in fairness to the crowd), and that I will now have to become the object of your jokes just to save your own faces and please your sponsor.

Please understand that I bear no grudges to you and would like to thank you :-) you’ve let me learn some of my weaknesses the painful way. I’ll even buy you beer if I get the chance. Again my thanks. Also kudos to this guy from your group, I believe his name is Edison: I’m forever in debt for your help.

However, I still would like to apologize to the audiences who paid. It’s sad you paid a large sum, but please do not direct your displeasure at me on that grounds. I wasn’t paid and would continue doing so. Yet, you guys didn’t deserve my performance back there. I promise to improve and be ready for you the next time around.

I also still would like to interest you on git :-) Here are some links for you:

http://nathanj.github.com/gitguide/

http://www.lostechies.com/blogs/jason_meridth/archive/2009/06/01/git-for-windows-developers-git-series-part-1.aspx

http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html

Written by agi

February 1, 2010 at 8:35 pm

Posted in lamp, rants

Tagged with , , , , ,

symfony not working after a Plugin Update

leave a comment »

Sometimes, even if you think you know your way around things, you can’t help but laugh for not noticing that you are actually going a long way around a problem.

I’ve recently updated a community favorite plugin, sfDoctrineGuardPlugin, and symfony CLI suddenly doesn’t work. The following line had shown up on my logs:

PHP Warning: require(/srv/http/sf_project/plugins/sfDoctrineGuardPlugin/lib/task/sfGuardCreateAdminTask.class.php): failed to open stream: No such file or directory in /srv/http/sf_project/lib/vendor/symfony-1.4/lib/autoload/sfSimpleAutoload.class.php on line 123

Upon source code history review, it shows that sfGuardCreateAdminTask.class.php has been removed on r25546. From I’ve pieced together after googling around vaguely suggests that the cache should have been cleared first prior to updating any symfony plugin.

I did just that. I’ve reverted to an old revision, then cleared the cache with a ./symfony cc, then reset to the current revision. Presto, symfony still works. I happily continued working on my project.

A couple of hours later, on my break I started laughing at myself (just a little, didn’t want to look crazy)… Why?

Written by agi

January 11, 2010 at 11:17 pm

Posted in lamp

Tagged with , ,

doctrine:build Errors

leave a comment »

SQLSTATE[HY000]: General error: 1005 Can't create table 'db.#sql-57ef_a3' (errno: 150). Failing Query: "ALTER TABLE item ADD CONSTRAINT item_uom_id_uom_id FOREIGN KEY (uom_id) REFERENCES uom(id)". Failing Query: ALTER TABLE item ADD CONSTRAINT item_uom_id_uom_id FOREIGN KEY (uom_id) REFERENCES uom(id)

I encountered these types of errors when I was on the model conceptualization stage of a symfony project. The quickest fix I found was to set the problematic tables to MyISAM, then gradually opted to set the option globally at the expense of row-level locking.

You can do this either in the schema.yml or ProjectConfiguration.php. The error can still persist when setting this configuration in schema.yml and referencing a plugin table (such as sfGuardUser).

schema.yml

options:
  type: MyISAM

ProjectConfiguration.php

class ProjectConfiguration extends sfProjectConfiguration
{
  ...

  public function configureDoctrineConnection(Doctrine_Connection $connection)
  {
    $connection->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE, 'MyISAM');
  }
}

MyISAM is generally considered faster and more stable than InnoDB, however latest benchmarks show that InnoDB is gaining ground against MyISAM. Most web applications and frameworks are also going on the direction of InnoDB. I investigated on this issue further while writing this article.

detect_relations: true

myExample:
  columns:
    id: integer
    sf_guard_user_id: integer

The example above will result in an error on an old (pre r25546) revisions of sfDoctrineGuardPlugin as sfGuardUser:id is defined as an integer(4) field. Changing sf_guard_user_id to integer(4) will clear the error. So when having issues such as these but definitely want to stay with InnoDB:

  1. Check the key type on the referenced table.
  2. Adjust your foreign key type accordingly.
  3. Rebuild your models.

Written by agi

January 11, 2010 at 9:51 pm

Posted in lamp

Tagged with , , ,

Local KahelOS Dev

leave a comment »

1. Created ‘kahelos’ directory in development root and navigated there

$ mkdir kahelos
$ cd kahelos

2. Initialized git and configured pertinent settings

$ git init
$ git config user.name 'Alec Joseph Rivera'
$ git config user.email 'agi@kahelos.org'
$ git remote add sf ssh://cbsparkx@kahelos.git.sourceforge.net/gitroot/kahelos/kahelos

Before the remote add, I had to enable git feature on the sourceforge project site.

3. Created a ‘kernel26′ git submodule

3a. Created a ‘kernel26′ directory and navigated there

$ mkdir kernel26
$ cd kernel26

3b. Initialized git and configured pertinent settings

$ git init
$ git config user.name 'Alec Joseph Rivera'
$ git config user.email 'agi@kahelos.org'
$ git remote add sf ssh://cbsparkx@kahelos.git.sourceforge.net/gitroot/kahelos/kernel26

Before the remote add, I had to manually created another git tree on the sourceforge project.

3c. Downloaded kernel26′s package build information (tarball) from Arch’s subversion repository and extracted

3d. Done first commit on ‘kernel26′

$ git add .
$ git commit -m 'Initial forking of arch-kernel26-r61953'

3e. Gone back to ‘kahelos’ to add the submodule

$ cd ..
$ git submodule add ssh://cbsparkx@kahelos.git.sourceforge.net/gitroot/kahelos/kernel26 kernel26

4. Done first commit on ‘kahelos’

$ git add .
$ git commit -m 'Initial commit with kernel submodule'

5. Proceeded to create another ‘src’ submodule on ‘kernel26′ for the Linux kernel source.

5a. Created a ‘src’ directory and navigated there

$ mkdir kernel26/src
$ cd kernel26/src

5b. Initialized git and configured pertinent settings (for the third time)

$ git init
$ git config user.name 'Alec Joseph Rivera'
$ git config user.email 'agi@kahelos.org'
$ git remote add origin git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6-stable.git
$ git remote add sf ssh://cbsparkx@kahelos.git.sourceforge.net/gitroot/kahelos/kernel26-src

Before the remote add, I had to manually created another git tree on the sourceforge project again.

5c. Fetched the kernel’s git tree

$ git fetch

This step called for a coffee break

5d. Branched the recent stable kernel version

$ git branch usopp v2.6.32.2

5e. Returned to ‘kernel26′ to submodule ‘src’

$ cd ..
$ git submodule add ssh://cbsparkx@kahelos.git.sourceforge.net/gitroot/kahelos/kernel26-src src

6. Done second commit on ‘kernel26′

$ git add .
$ git commit -m 'Added kernel source submodule'

7. Done second commit on ‘kahelos’

$ cd ..
$ git add kernel26
$ git commit -m 'Added source submodule'

8. Pushed commit to ‘kahelos’, ‘kernel26′ and ‘kernel26-src’

$ git push sf master
$ cd kernel26 && git push sf master
$ cd src && git push sf usopp

Now, ready to fork and have fun!!!

Written by agi

January 6, 2010 at 10:05 pm

Posted in kahelos

Tagged with ,

Do IT Right

with one comment

Now that the Christmas vacation’s done, I’d like to start off with some few rants, errr…, observations on communities – musings on comments from different blogs and forums I’ve read. A fair disclaimer though, what I say here are my own opinions and not of the KahelOS team/community or the company I work for. Without further ado, my first installment:

“Do IT right…”

The speaker was intending to suggest the IT (the business of or process around the concept) can be done better with a FLOSS solution, not imply someone’s doing something wrong. Yes, it was really intended to be a commercial, a commercial of the public service type.

But as it happen, this statement has been frequently misinterpreted by a lot of people in the wrong crowd. These are people who I would have thought should have been open-minded about it, since I’d like to believe we’re all on the same side of the boat.

I’m not ranting on this because I must have been angered or frustrated and felt that the team didn’t deserved to be attacked about this. I’m the type of person that can appreciate these kind of experiences because one or a bond is strengthened from then. Provided, of course, that we survived such.

It’s a small psyche aspect I want to explore here: almost everything can have another meaning depending on who’s listening, and it can turn to a negative if one, even subconsciously, has already a negative opinion about the topic or a negative idea on his/her person.

It’s an unlucky coincidence that a simple should-be harmless statement would touch a nerve. The question “are you implying we’re doing something wrong?” could have been reciprocated with a slightly questioning “no, you are. aren’t you?”.

But it wasn’t. “Defend but avoid attacking, try as much as possible only on technical merits” was the predominating motto of those days. I hope KahelOS community will strive hard and stay that way even if and on the day comes it will be larger enough to be also called an influential floss project/technology.

If we hold fast to this, then we’re doing it, the community, right.

Written by agi

January 6, 2010 at 11:39 am

Posted in rants

Tagged with

Symfony 1.4 on Git HOWTO Update

with 3 comments

Some insufficiencies showed on while me working on my own project. Mostly related to git miscellany. Download the updated PDF here – symfony-1.4_on_git-howto. Also, there will be a follow-up HOWTO for plugins. Stay tuned.

Written by agi

December 4, 2009 at 2:13 pm

Posted in lamp

Tagged with , ,

Symfony 1.4 on Git HOWTO (Part 2)

leave a comment »

5. Initialize your Symfony project.

 $ lib/vendor/symfony-1.4/data/bin/symfony generate:project {project_name}

Note that Symfony also creates a symfony script at your project root directory. You can use that instead of referring back to lib/vendor/…, which can be really repetitive.

6. Initialize a project application. Repeat for other applications if project consists of more than one application.

 $ ./symfony generate:app {app_name}

7. Configure git scm on project root and add user information. Signing key and remote repository are optional (team/public project), although they are recommended for obvious reasons.

 $ git init
 $ git config user.name {real_name}
 $ git config user.email {email_address}

 $ # git config user.signingkey {gpg_key}
 $ # git remote add origin {repo_url}

8. Add git exclude information. Files to be excluded are normally editing backup copies and vendor files (which are already gitted). Special care is also needed for cache and log directory because git don’t track empty directory but can introduce symfony errors later.

 $ echo '*~' >> .git/info/exclude

 $ touch cache/.ignore log/.ignore
 $ echo -e '*\n!.ignore' > cache/.gitignore
 $ echo -e '*\n!.ignore' > log/.gitignore

9. Perform your initial commit. Optionally, you can also pushed your newly initialized repository to the remote repo if you’ll be working with a team or just making it available publicly.

 $ git add .
 $ git commit -a -m 'Initial commit.'
 $ # git push origin master

10. Configure your httpd configuration with virtual hosting as appropriate, and don’t forgot to alias /sf to lib/vendor/symfony-1.4/data/web/sf. Refer to the LAMP HOWTO for the procedures. Upon (re)starting your httpd, you should be able now to see the Symfony Congratulations page.

Download PDF here

Written by agi

December 3, 2009 at 6:08 pm

Posted in lamp

Tagged with , ,

Follow

Get every new post delivered to your Inbox.