Archive for July, 2010

Integrating mediawiki with a symfony project symfony 1.3

I needed to add a mediawiki to a secure module in my symfony project

This is how I did it.

  • I downloaded mediawiki into my web dir web/wiki
  • After installation, I edited the LocalSettings.php, I added this block to secure the wiki.
    It is the same theory as a batch file:
require_once('../../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'dev', true);
sfContext::createInstance($configuration);

$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();

if(!sfContext::getInstance()->getUser()->isAuthenticated()) {
    sfContext::getInstance()->getController()->redirect("http://".$_SERVER['HTTP_HOST']."/user/login");
}

4 Comments

Specifying MySQL port on MediaWiki

>>>quoted from this site
http://microrants.blogspot.com/2007/08/specifying-mysql-port-on-mediawiki.html

MySQL listens on port 3306/tcp by default. MediaWiki’s 1.7.1 configuration is a bit misleading when it comes to specifying the database port. This excerpt is from LocalSettings.php:

$wgdBserver = “localhost”;
$wgDBname = “mw0″;
$wgDBuser = “my_user”;
$wgDBpassword = “my_pass”;
$wgDBprefix = “mw_”;
$wgDBtype = “mysql”;
$wgDBport = “3308″; // <— DOES NOT work for MySQL

The value in $wgBDport is only used with PostgreSQL. To specify a MySQL connection port different than 3306, use the syntax server:port on $wgdbServer. For instance:

$wgdBserver = “localhost:3308″;

BUT! there’s another catch: when the server is defined to “localhost”, MySQL will default to connecting via socket. If you are changing the port in hopes of getting WikiMedia to connect to another running instance of MySQL, chances are that it will still connect to the “default” one. To force a TCP connection use the loopback IP address instead of “localhost”:

$wgdBserver = “127.0.0.1:3308″;

No Comments

adding a batch file in symfony 1.3

create your file and add this to the top ,


require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
sfContext::createInstance($configuration);

// Remove the following lines if you don't use the database layer
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();

// add code here

No Comments

Bush Flowers hdr

No Comments

How to set an form error in the action. symfony 1.4

I have a field (company_abn).

I validate this field via web services in the action, so I need to set an error message in the action.

Here is how I did it..

            $register_parameters = $request->getParameter('user');
            $this->form->bind( $register_parameters );
            //do your abn validation stuff

            if(!$abn_valid){
                //set the value of the 'company_abn' field to invoke the 'required' error message
                $register_parameters['company_abn'] = '';
                //rebind the form to make it so that, isValid() will = false
                $this->form->bind( $register_parameters );
                //set your new error message for this widget
                $this->form->getValidator('company_abn')->setMessage('required', 'Your ABN is not Valid');

             }

2 Comments

Jamie Lidell – I Wanna Be Your Telephone

Good on ya Jamie.. another funk bomb

No Comments

Error: The connection to the server was reset while the page was loading. symfony 1.4

This has to help someone out there. I kept getting this error and had no idea why

I had found the double $ sign in my __toString method.. doh!

public function __toString(){
   return $$this->getName();
}

No Comments

Abstracts light drawing

No Comments

Jquery Dock Menu

I found this jQuery menu that mimicks the mac dock menu, very nice…

>>>

If you are a big Mac fan, you will love this CSS dock menu. It is using Jquery library and Fisheye component from Interface and some of my icons. It comes with two dock position: top and bottom. This jQuery dock menu is perfect to add on to my iTheme. Here I will show you how to implement it to your web page.

No Comments

Creating Triangles in CSS

I came across this page by Jon Rohan, and his css method of creating triangles:

How it works

Few people realize when a browser draws the borders, it draws them at angles. This technique takes advantage of that. One side of the border is colored for the color of the arrow, and the rest are transparent. Then you set the width of the border to something large, the ones above are 20px. To demonstrate here is a div with all sides colored.

<div class="css-arrow-multicolor"></div>

.css-arrow-multicolor {
  border-color: red green blue orange;
  border-style:solid;
  border-width:20px;
  width:0;
  height:0;
}

No Comments