How to get application url in symfony

$sf_request->getUriPrefix().$sf_request->getRelativeUrlRoot().$sf_request->getPathInfoPrefix();

In symfony version 1.4

$request->getUriPrefix().$request->getRelativeUrlRoot().$request->getPathInfoPrefix();

configure database using propel

$ ./symfony configure:database --name=propel --class=sfPropelDatabase "mysql:host=localhost;dbname=dbname" username userpassword

How to get the allowed option list in drupal theme template or view file

If you want to get the option list of the content type that you have created , then you can get the list as follows:

$content_field = content_fields(‘whatever_the_field_name_is’);
$allowed_values = content_allowed_values($content_field);

So the $allowed_values will give you the array of the option list with the key value association.

Note: The “whatever_the_field_name_is” is the field name that you had specified while adding the field, you can get the field name from your content type .

How to add select option in drupal while creating content type

Whenever you create any content type in drupal ( version 6 and above) and you required a filed of type select list, then you can provide the allowed values of the select option in two ways

CASE 1 :

option 1
option 2
option 3

CASE 2 :

1|option 1
2|option 2
3|option 3

Each new option has to be entered on a new line
So enternally the select list generated would be as follows
In case 1 :

<select>
<option value=”option 1″>option 1</option>
<option value=”option 2″>option 2</option>
<option value=”option 3″>option 3</option>
</select>

In case 2 :

<select>
<option value=”1″>option 1</option>
<option value=”2″>option 2</option>
<option value=”3″>option 3</option>
</select>

Replace multiple space with single space in PHP

If you want to replace multiple space with single space from a string you can use preg_replace function for this. Refer the below example

preg_replace(“!\s+!”,” “,$yourstring);

For example
$yourstring = “This contain space”;
$modifiedString = preg_replace(“!\s+!”,” “,$yourstring);
echo $modifiedString;
// This contain space // output

How to get symfony project base url in template file

To get the base url of your symfony project , you can use the below in your template file.

$sf_request->getUriPrefix().$sf_request->getRelativeUrlRoot()

And to get your current app URL.

$sf_request->getUriPrefix().$sf_request->getRelativeUrlRoot().$sf_request->getPathInfoPrefix();

Self join criteria in symfony

For Example :
SELECT tbl1.id FROM tbl1 a LEFT JOIN tbl1 b ON a.somecolumnname = b.somecolumn ORDER BY a.somecolumn DESC

The criteria would be as follow

$c=new Criteria();
$c->addAlias(‘a’, ‘tbl1’);
$c->addAlias(‘b’, ‘tbl1’);
$c->addSelectColumn(‘b.id’);
$c->addSelectColumn(‘a.tbl1_id’);
$c->addDescendingOrderByColumn(‘a.somecolumn’);
$c->addJoin(‘a.somecolumnname’,’b.somecolumn’,Criteria::LEFT_JOIN); // Specify your criteria LEFT, RIGHT or INNER
$rs = tbl1Peer::doSelect($c);

Thanks Cheers 🙂

Hacker Group Anonymous Vows To Destroy Facebook On November 5 2011

Hacktivist group Anonymous, which has been responsible for cyber-attacks on the Pentagon, News Corp, and others, has vowed to destroy Facebook on November 5th (which should ring a bell).
Citing privacy concerns and the difficulty involved in deleting a Facebook account, Anonymous hopes to “kill Facebook,” the “medium of communication [we] all so dearly adore.”
This isn’t the first time Anonymous has spoken out against social networks.
After Google removed Anonymous’ Gmail and Google+ accounts, Anonymous pledged to create its own social network, called AnonPlus.
The full text of the announcement, made on YouTube and reported by Village Voice, is below:

Operation Facebook

DATE: November 5, 2011.

TARGET: https://facebook.com
Press:
Twitter : https://twitter.com/OP_Facebook
http://piratepad.net/YCPcpwrl09
Irc.Anonops.Li #OpFaceBook
Message:

Attention citizens of the world,

We wish to get your attention, hoping you heed the warnings as follows:
Your medium of communication you all so dearly adore will be destroyed. If you are a willing hacktivist or a guy who just wants to protect the freedom of information then join the cause and kill facebook for the sake of your own privacy.

Facebook has been selling information to government agencies and giving clandestine access to information security firms so that they can spy on people from all around the world. Some of these so-called whitehat infosec firms are working for authoritarian governments, such as those of Egypt and Syria.

Everything you do on Facebook stays on Facebook regardless of your “privacy” settings, and deleting your account is impossible, even if you “delete” your account, all your personal info stays on Facebook and can be recovered at any time. Changing the privacy settings to make your Facebook account more “private” is also a delusion. Facebook knows more about you than your family. http://www.physorg.com/news170614271.html http://itgrunts.com/2010/10/07/facebook-steals-numbers-and-data-from-your-iph….

You cannot hide from the reality in which you, the people of the internet, live in. Facebook is the opposite of the Antisec cause. You are not safe from them nor from any government. One day you will look back on this and realise what we have done here is right, you will thank the rulers of the internet, we are not harming you but saving you.

The riots are underway. It is not a battle over the future of privacy and publicity. It is a battle for choice and informed consent. It’s unfolding because people are being raped, tickled, molested, and confused into doing things where they don’t understand the consequences. Facebook keeps saying that it gives users choices, but that is completely false. It gives users the illusion of and hides the details away from them “for their own good” while they then make millions off of you. When a service is “free,” it really means they’re making money off of you and your information.

Think for a while and prepare for a day that will go down in history. November 5 2011, #opfacebook . Engaged.

This is our world now. We exist without nationality, without religious bias. We have the right to not be surveilled, not be stalked, and not be used for profit. We have the right to not live as slaves.

We are anonymous
We are legion
We do not forgive
We do not forget
Expect us

Please follow SAI on Twitter and Facebook.
Follow Ellis Hamburger on Twitter.