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 …
January 2013 archive
Permanent link to this article: https://blog.openshell.in/2013/01/loop-mysql-result-set-multiple-times-or-twice-in-php/
Jan 15
SSH Login without password
Steps to ssh login into remote server without entering password. ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys. 1) Create public and private keys using ssh-keygen thangaraj@thangaraj-Insp:~$ ssh-keygen -t dsa Generating public/private dsa …
Permanent link to this article: https://blog.openshell.in/2013/01/ssh-login-without-password/
Jan 15
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: …
Permanent link to this article: https://blog.openshell.in/2013/01/cassandra-basic-commands/
Jan 15
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/
Jan 01
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/