Archive for June, 2006

Simple Basic UNIX – more advanced vi tips

Problem Continuing along with more vi tips, these can help you out of a jam or just save you time – going back to command line, etc.Saving a file, which is read-only? Running java, Perl, PHP from within vi. Solution Example Have you ever edited a file, made your changes only to find the file [...]

Login without password SSH

Problem Solution Example Reference Excellent article on linuxproblem.org – very concisely describes how to setup SSH and create the authorized keys file. This will allow a user on one system, to connect as a user on the other system – without the need for a password.http://www.linuxproblem.org/art_9.html

Creating favicon.ico

Problem Solution Example Reference Kewl tip on creating a favicon.ico with ppmtowinico – thanks to linuxproblem.org. http://www.linuxproblem.org/art_19.html

Blogging Tip – do your quotes turned to dots when pasting

Problem One annoying thing I recently discovered, when copying code from my blogs (yes I use my own tips too! ), quotes seem to turn into dots. Both for single and double quotes. Solution The answer to this was explained in a blogging book, that apparently the quotes on a keyboard refer to feet and [...]

Simple Basic MySql – beginning mysql mysqlshow

Problem You want to perform command line display of mysql dbs with mysqlshow. Solution Is this demo, I show the options for mysqlshow.mysqlshow is a real easy way to quickly view your dbs, tables and rows. Example Show Databases[marcus@bagend ~]$ mysqlshow -i -u’root’ -p’xxxxxx’+—————+| Databases |+—————+| demo || mysql || test |+—————+Show number of tables [...]

Simple Basic MySql – beginning mysql db management

Problem You want to know how to do the following, through mysql command line interface:Connect to the mysql daemonShow the databases your user has accessShow tables defined under that dbShow schema for given table Solution Example mysql -u'username' -p'password' -h'mysql_host'mysql_host is optional if the daemon is running on the same host.Show databasesshow databases;Show tablesshow tables;Describe [...]

Simple Basic Java Software – analysing arguments from command line

Problem You want a simple bit of java code that takes arguments from the command line and displays them. Solution Good demo on how to obtain and handle java arguments.public class Arguments { public static void main(String argv[]) { if(argv.length > 0) { System.out.println("args exec w " + argv.length + " args"); for(int i=0;i Example [...]

Useful UNIX tip – generate 512 bytes of random data with dd

Generate 512 bytes of random data, using UNIX dd (disk to disk) command. Using /dev/random blocks waiting for truly random data, whereas /dev/urandom just pumps out whatever is available. You need to escape the control characters, or else it will trash your screen. cat -ve escapes these control characters for you. dd bs=1 count=512 if=/dev/urandom [...]