Category: Windows

Microsoft Windows operating system.

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/

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/

Install Java plugin in mozilla firefox

Install Java plugin in mozila firefox Go to the download page at java.com. Click the Free Java Download button. Click the Agree and Start Free Download button to download the Java installer to your computer. After the download is complete, close Firefox. Open the file you downloaded to start the Java installation. For more information …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/install-java-plugin-in-mozilla-firefox/

How to install pear php in ubuntu?

Installing pear php in ubuntu machine helps  you to use existing libraries to make our development easy. In terminal, run the following command: [code] sudo apt-get install php-pear [/code]

Permanent link to this article: https://blog.openshell.in/2013/02/how-to-install-pear-php-in-ubuntu/

Loop mysql result set multiple times or twice in php

First we will select something from the database and loop through it like so: [php] $result = mysql_query("SELECT * FROM my_table"); while($row = mysql_fetch_assoc($result)) { // inside the loop } [/php] Problem: if you want to loop through the same result set again, you will get an error because the internal pointer is currently at …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/01/loop-mysql-result-set-multiple-times-or-twice-in-php/

Cassandra basic commands:

Create keyspace: create keyspace Keyspace1; Create column family: // This command is used to create column family and mention comparator, default_validation_class and key_validation_class to insert rows for undefined column. create column family column_family1 with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type; Update column family: update column family column_family1 with column_metadata = [ {column_name: first, validation_class: UTF8Type}, {column_name: …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/01/cassandra-basic-commands/

How to find php exec() function run without error

Use the following method to trace exec() function in PHP. Syntax: [php] exec($command, $output, $return_value); [/php] example1: [php] $command = "ls"; exec($command, $output, $return_value); // $output will contains list of files as array. // $return_value will be zero. [/php] Output: Array ( [0] => File1.txt [1] => File2.txt ) 0 example2: [php] $command = "l2"; …

Continue reading

Permanent link to this article: https://blog.openshell.in/2012/11/how-to-find-php-exec-function-run-without-error/