Author's posts

Unable to create rails application with sqlserver

Could not find “config/databases/sqlserver.yml” in any of your source paths. Your current source paths are: $HOME/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/generators/rails/app/templates Error: Template sqlserver.yml file missing. Solution: Need to update sqlserver.yml file in the specific location to fix this issue. Step1: Download sqlserver.yml configuration file. Step2: Extract the downloaded zip file. Step3: Copy extracted sqlserver.yml configuration file into the location which …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/04/unable-to-create-rails-application-with-sqlserver/

YII – set default settings within module and controller

Which helps to overwrite default settings of module and controller. To set default controller, view, layout and theme. Set default controller within module [php] /** * @var string the default controller. */ public $defaultController = ‘controller_name’; [/php] To Set default layout, theme and views within controller, use the following commands. [php] /** * @var string …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/04/yii-set-default-settings-within-module-and-controller/

Hadoop Error: Shuffle Error: Exceeded MAX_FAILED_UNIQUE_FETCHES; bailing-out.

If we face the following error while running hadoop jobs http://<masternode ip>:50030/jobtracker.jsp Error: “Shuffle Error: Exceeded MAX_FAILED_UNIQUE_FETCHES; bailing-out.” Description: Respective box name <machine name> is not updated in all the cluster configuration files (hadoop and /etc/hosts) Steps to resolve: Step 1: Stop all the hadoop services in master node hduser: /usr/local/hadoop/bin/stop-all.sh Step 2: Edit the …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/hadoop-error-shuffle-error-exceeded-max_failed_unique_fetches-bailing-out/

Installation of Yii

YII – Yes It Is YII is a high-performance PHP framework best for developing large-scale Web applications. Download the latest stable version from http://www.yiiframework.com/ Extract the folder and place it under the webroot location Eg., /var/www/ in linux and htdocs in windows php <path to yii folder>/framework/yiic.php webapp <applicationname> Additionally set the path for php in …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/installation-of-yii/

Installing Django on Ubuntu

About Django: Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Developed by a fast-moving online-news operation, Django was designed to handle two challenges: the intensive deadlines of a newsroom and the stringent requirements of the experienced Web developers who wrote it. It lets you build high-performing, elegant Web …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/installing-django-on-ubuntu/

How to automate whodidit behaviour and timestamps in yii ActiveRecord model?

To automate whodidit and timestamps in yii activerecord model using beforesave() method. If the rule validation got success then only the beforesave() method will invoke. Without satisifying rule() in activerecord model, this method will not work. [php] protected function beforeSave() { if(parent::beforeSave()) { if($this->isNewRecord) { $this->created_on = time(); $this->created_by = (int)Yii::app()->user->id; } $this->updated_on = time(); …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/how-to-automate-whodidit-behaviour-and-timestamps-in-yii-activerecord-model/

How to automate timestamps in activerecord using yii

There are many ways to automate the setting of timestamps in yii ActiveRecord models. In this we are representing three ways here. 1) Update via model’s rules: [php] /** * @return array validation rules for model attributes. */ public function rules() { return array( array(‘title’,’length’,’max’=>255), array(‘title, created_at, updated_at’, ‘required’), array(‘updated_at’,’default’, ‘value’=>new CDbExpression(‘NOW()’), ‘setOnEmpty’=>false,’on’=>’update’), array(‘created_at,updated_at’,’default’, ‘value’=>new …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/how-to-automate-timestamps-in-activerecord-using-yii/

mysql2 gem for windows error

By  installing  Development Kit and MySql Connector: To install Development Kit: 1. Left double-click the self-extracting executable (SFX)  to install the DevKit artifacts into. For example, C:DevKit. 2. cd <DEVKIT_INSTALL_DIR> 3. ruby dk.rb init to generate the config.yml. Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/mysql2-gem-for-windows-error/

What’s the difference between list, tuples and dictionaries in Python?

Lists Lists are what they seem – a list of values. Each one of them is numbered, starting from zero – the first one is numbered zero, the second 1, the third 2, etc. You can remove values from the list, and add new values to the end. Example: Your many cats’ names. [code] "A …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/whats-the-difference-between-list-tuples-and-dictionaries-in-python/

Execute Shell file in linux server

chmod Command: Run Shell Script In Linux Set an executable permission using the chmod command as follows: [code]chmod +x file.sh[/code] Now your can run your .sh file as follows: Execute Shell Script Using . ./ (dot space dot slash) [code]./file.sh[/code] You can also execute a unix shell script by specifying the interpreter in the command …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/execute-shell-file-in-linux-server/