January 2013 archive

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/