Category: Linux

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/

Permanent link to this article: https://blog.openshell.in/2013/01/ssh-login-without-password/

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/

Export Hive data into CSV file

Use the following command used to export hive data into CSV file. set hive.io.output.fileformat = CSVTextFile; INSERT OVERWRITE LOCAL DIRECTORY ‘dir_path’ SELECT FIELD1, FIELD2, FIELD3 FROM TABLE1;

Permanent link to this article: https://blog.openshell.in/2013/01/export-hive-data-into-csv-file/

How to reload your bashrc file

How to reload your bashrc file Here’s a quick way to reload your bachrc file without having to invoke a new shell. [code] [root@user]# source ~/.bashrc or [root@user]# . ~/.bashrc [/code]

Permanent link to this article: https://blog.openshell.in/2013/01/how-to-reload-your-bashrc-file/

YII Primary Key error

Error: Table “user” does not have a primary key. Solution: The crud command requires primary key to be defined in your tables. If you are working with legacy tables and can’t specify primary key, you can declare it in primaryKey() method of your model class. override method primaryKey in protected/models/User.php [php] public function primaryKey() { …

Continue reading

Permanent link to this article: https://blog.openshell.in/2012/04/yii-primary-key-error/

PHP characters limitation

Characters limitation will helps to display limited number of characters to display. [php] function limit_characters( $str, $n ) { if ( strlen ( $str ) <= $n ) { return $str; } else { return substr ( $str, 0, $n ) . ‘…’; } } [/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-characters-limitation/

Setting up dual ip address in ubuntu

Hi, here is a simple way to setup dual ip in your ubuntu system if you already have eth0 as 192.168.0.10 then if you want 192.168.1.10 then use the following command to bring up a alias but this is temporary sudo ifconfig eth0:0 192.168.1.11 up To have a permanent dual ip update the /etc/network/interfaces file like the below …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/setting-up-dual-ip-address-in-ubuntu/

Using Dialup modems in ubuntu

hi all, Everyone will be familiar with configuring wired and wireless network in Ubuntu. But still at some point of time we may have the need to use dialup modem in ubuntu. here is a simple way to configure dialup modems in ubuntu. The following command will install gnome-ppp which is a gui based configuration tool for …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/using-dialup-modems-in-ubuntu/