Posts

Read through all values in an array in PostgreSQL

Same applies to Greenplum: select col1,array1 from schema.table WHERE 'value_to_search_for'= ANY(array1); array1 is a column in the table with type name[] in this case

Flash bios Dell Latitude E4300 running Fedora 17

I did not figure this out on my own. I cobbled together information from a few sources. Run the first six steps from here  (listed below). To get my new menu item to show up upon boot, so I could actually flash the bios, I started with 3.2 here . I simply added the menuentry {} section listed in step 2 below. I then ran grub2-makeconfig. Get the bios update from Dell (exe file) Get biosdisk from the Dell projects site [1] Get "memdisk" (Fedora: "syslinux" package) modify the biosdisk script, set the "baseDir" variable (first line after the comments) to the directory to which you extracted the biosdisk archive. The other option is to copy dosdisk.img to the default location ("/usr/share/biosdisk"). Create a bootdisk as root: "./biosdisk mkimage <exe filename>" After the last step there should be a img file in /tmp (e.g. "E4300A24.img") which contains the bios flasher program. Move that file to /boot. As roo...

Time machine backups fail on new Toshiba drive

I did not develop this solution on my own. I found it in the Apple discussion forums , specifically this thread . Here are the details. I purchased a new external drive, the Toshiba Canivo Basics 1.5TB model number  HDTB115XK3BA at Best Buy. I then follow the directions here to copy my old backup to the new drive. I went to back it up after the transfer and it immediately failed. The transfer had completed while I was at work so it had been 6+ hours since the transfer completed. That was plenty of time for the new hard drive to go to sleep. Turns out this is a habit of Toshiba drives from what I've been reading. I unchecked the option Put the hard disk(s) to sleep when possible in System Preferences/Engergy Saver and rebooted but that didn't fix the problem. I then came across a post about creating a crontab job to touch a file every minute to keep the drive away. Brilliant. So I now have the following crontab job that runs as the user I log in with every day. * * * * * to...

Greenplum external table single column of data

Had to work with some data that was one column of data in a fixed width format. Solution was to create an external table that was one column then use substr function to pull out the data. External table: CREATE EXTERNAL TABLE trmtmp_ext_table (     col1 text ) LOCATION (         'gpfdist://host-1:port/path/trmtmp.out',         'gpfdist://host-2:port/path/trmtmp.out',         'gpfdist://host-3:port/path/trmtmp.out' ) FORMAT 'text' LOG ERRORS INTO trmtmp_err_ext_table SEGMENT REJECT LIMIT 5 ROWS; View of the external table: DROP VIEW trmtmp_view_ext_tbl; CREATE VIEW trmtmp_view_ext_tbl AS ( SELECT     substr(col1,1,2) AS col1,     substr(col1,3,5) AS col2 FROM       trmtmp_ext_table ); Extrapolate from there.

Backup script for Linux or OS X

A simple backup script for backing up my laptop. I have an OS X and Linux laptop so I wanted one script to put on both of them: #!/usr/bin/env homedir="$(echo $HOME)" dom=$(date +%d) ################### # START CONFIGURATION ################### # On the 15th of the month run an rsync --delete to clean out old file. Otherwise just run a regular rsync. if [ ${dom} -eq 15 ]; then   rsynccmnd="rsync --delete -avhz --stats --progress" else   rsynccmnd="rsync -avhz --stats --progress"fi # Path to the exclude file host=$(uname -a|cut -d ' ' -f 1) if [ "${host}" = "Darwin" ]; then  # OS X  excludefile="path to exclude file for OS X"  #EXAMPLE  # excludefile="${homedir}/Documents/Backup/backuplaptop_exclude_osx.txt" else  # Linux  #excludefile="path to exclude file for Linux"  #EXAMPLE  # excludefile="${homedir}/Documents/Backup/backuplaptop_exclude_linux.txt" fi # ...

Data skew in Greenplum

Running this on a Greenplum DB 4.2 system will show you where you have data skew > 10%. From the Greenplum admin guide gp_skew_idle_fractions: select * from gp_toolkit.gp_skew_idle_fractions where siffraction > 0.1; sifoid: objectid of the table sifnamespace: schema name sifrelname: table name siffraction: The percentage of the system that is idle during a table scan, which is an indicator of uneven data distribution or query processing skew. For example, a value of 0.1 indicates 10% skew, a value of 0.5 indicates 50% skew, and so on. Tables that have more than 10% skew should have their distribution policies evaluated.

FTP and OS X

Just ran into something I haven't seen before. I was attempting to upload information to an ftp site. I opened Finder, entered ftp://sitename, and a connection was made and a new finder window opened. Tried to rsync in a terminal over to the /Volume/sitename but was told it was read-only. Same result when dragging and dropping in Finder. Ran ftp sitename from a Terminal and it all worked. I was able to put files on the server. Guess I need to lookup up and figure out what in the heck Finder does different than command line ftp. UPDATE: Ok, after some searching I learned Finder mounts FTP as read-only. Don't know why but at least I now know.