SSH AutoComplete on OSX

I am a very heavy user of SSH, like everyday all day type of user. I know a couple cool SSH tricks like port forwarding and mapping remote drives. One thing that always bugged me was the lack of auto complete when I was on my OSX machine. You see with SSH, you can define a bunch of individual host and configurations unique to those host in a file called .ssh/config. It's a great tool to have and when you do have some host define, on a Linux machine, you can type in the command ssh, then the first couple if letters of the host and hit tab. It will act as any tab completion does for commands and fill in as much of the hostname as it can before it requires some other unique identifier. However, this cool autocomplete feature didn't happen naturally of my OSX box.

Through the years, I've had an idea of what I needed to do to create my own script to handle it. There is the complete command, the trick is grepping the config file and pulling out the right information. I decided to be lazy and just manually created several alias for my ssh server. The alias approach worked, but this grew into a very long list of alias and wasn't very efficient. So tonight I decided I was going to write the script to meet my needs and about 2 clicks on Google links later, I found someone who had actually already completely done it. Nem W. Schlecht posted his script on a Macworld hints forum a couple years ago. Here is a link to that original thread http://goo.gl/Wd4Z5 but the piece of magic that did the trick is below. As a added bonus, it also creates auto complete from servers it finds in your known_host file. I will repost his post, not just the code, because he has some wise advice on where to place the code

The macports suggestion is a good one, but IMO, includes too much. If you don't have macports installed, you can add the following to your .bash_profile (I wouldn't add it to my .bashrc, since that gets read in by cron jobs and remote commands).

There are a couple improvements here. First, this will also read in aliases in your ~/.ssh/config file. Secondly, it will ignore commented out entries in your ~/.ssh/known_hosts file. Finally, this is a function and not a static list. Thus, it is immediately aware of any new additions to either file (although on really slow machines it will be slower than a static list).

_complete_ssh_hosts ()
{
        COMPREPLY=()
        cur="${COMP_WORDS[COMP_CWORD]}"
        comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
                        cut -f 1 -d ' ' | \
                        sed -e s/,.*//g | \
                        grep -v ^# | \
                        uniq | \
                        grep -v "\[" ;
                cat ~/.ssh/config | \
                        grep "^Host " | \
                        awk '{print $2}'
                `
        COMPREPLY=( $(compgen -W "${comp_ssh_hosts}" -- $cur))
        return 0
}
complete -F _complete_ssh_hosts ssh

Don't forget you need to "source" you file to get the new command to load in your terminal or you can close your terminal window and open a new one.

Posted via email from shocm

Goodbye OpenOffice, Hello LibreOffice

After years of being an advocate for the for the Open Source approach and philosophy behind OpenOffice, which for years lead the way as a alternative solution to more proprietary office suites, I've forced to reevaluate my recommendation of the OpenOffice suite. After Sun was acquired by Oracle, Oracle's direction for the OpenOffice suite seemed shaky and not really inline with the community. This is where the power of Open Source shines, the OpenOffice was forked and a new project was started by the name of LibreOffice (http://www.libreoffice.org/ / http://www.documentfoundation.org/download/)

There is a good step by step on how to remove OpenOffice and install LibreOffice on your Ubuntu box on the txwikinger Blog http://goo.gl/PF9T6

 

Posted via email from shocm

Darwin’s Finches, 20th Century Business, and APIs: Evolve Your Business Model

This is a really good talk about APIs and their place as a real business model. It's a little long but has a lot of great point and examples for both the very geeky and the very business minded individuals.
I've often had discussion around the open API approach vs Open Source approach and if open API's might not be a good substitution for a business who, for whatever reason, don't want to go Open Source with their model.
Sam Ramji does a great job of outlining exactly how you should think of yourself in an API world as a business. He touches on how to iterate the growth of an API model and listen to the users of it.
Great talk in general, if this type of stuff interest you please give it a watch. It's about 45 minutes long. He also made the slides and content available through Creative Commons.

Posted via email from shocm

The wife's holiday "Skittle Popcorn" making process has begun

It has become somewhat of a holiday tradition around our house that the wife makes her famous "Skittle Popcorn" in which she infuses the wonderful taste of Skittles onto light and fluffy popcorn. It's all sorts of goodness I assure you. This year she is channeling the "mad scientist" in her and will experiment with other candy and popcorn combinations such as Red Hots. Should be interesting. 

Posted via email from shocm

Two of my favorite things in life, Sony and Batman

Nice article posted on the Sony Electronics Blog  ( http://blog.discover.sonystyle.com/interview-with-comic-book-legend-jim-lee ) that has an interview with Jim Lee from DC Universe Online  which is going to be a cool game that lets you be a hero (and maybe even a villain) in the DC Universe. I am a huge Batman fan so there is no question I will be giving this a look. The trailer moves on the sites are pretty intense http://www.dcuniverseonline.com/

Posted via email from shocm

Nasty Bug – Ubuntu 10.04 on VMWare Fusion OSX

Came across a nasty little bug when I installed the latest Ubuntu 10.04 (LTS) into a virtual machine using VMWare Fusion 3.02 on my OSX box. This was a fresh install and the install itself went smooth, the problem occured when the initial login screen appeared. Although my mouse worked just fine and I was able to click on the user to log in, I wasn't able to type anything. My keyboard was completely unusable within the virtual machine. I was not able to type any input via the keyboard.

After doing some Googling I discovered that once you got past the login screen the keyboard would work fine. The only way to login was to initiate the on-screen keyboard and type in your password. You can bring up the on-screen keyboard by clicking on the Universal Access icon on the lower right hand side of the screen and choosing "Use on-screen keyboard". One side note here, when I first checked the box to use the on-screen keyboard, the keyboard would flash and disappear. What I needed to do was keep the box check and reboot the machine, when the login screen returned, the keyboard was there.

Once I logged in the physical keyboard worked fine. I was able to use it in all the applications and didn't notice any problems, but once I logged out and returned to the login screen, again no input from the physical keyboard. Now I needed to fix this.

What didn't work 🙁

At this point I go into basic trouble resolution mode and decided to start by reinstalling and upgrading the VMWare tools. Not going to get into a step by step here how to do that but the short of it is after reinstalling the VMWare tools and rebooting I was stuck in the same situation and needed to use the on-screen keyboard to log in. Next obvious step, apply all patches to the Ubuntu desktop, did this, rebooted, still no go.

What did work 🙂

Clearly, you are not reading this article to learn how not to fix it. Trust me after doing enough searches there are plenty discussion threads out there with "This doesn't work for me either, anyone fix this yet?" to keep you reading for hours. I found a couple good links that I will post at the end of this article that got things resolved. The short answer is I logged into the machine, fired up and console window, type in the command
[bash]
sudo dpkg-reconfigure console-setup
[/bash]
For keyboard I selected "Apple" and then just selected the defaults for everything else. Once I exited the configuration wizard, I restarted the machine and all was right with the Ubuntu world again. Did a couple reboots to make sure and everything seems to be working fine now.

One more side note

This issue  occurred on a clean install of the current Ubuntu 10.04 LTS release. I had been previously running the beta version of the 10.04 release which worked fine and never had a problem with the keyboard input. However, after patching that box today, same issue occurred.

The Links

Two links basically lead me to my resolution

[Nagios] Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!

System: Ubuntu 9.10 | Nagios 3.x

This is another post that is more of a note to myself than anything else. Been doing a lot of Nagios configuring and decided to implement the ability to push commands from the web interface. I followed the basic instructions to configure "External Commands" but after doing and going to the web interface to test it, I got the following error message;

Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!

The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands. An error occurred while attempting to commit your command for processing.

The file was there so I did what any good geek should do, I did a quick google search. The closet thing I could find was some commands to fix the issue on Debian systems. Since I was running Ubuntu, which is for all intensive purposes Debian, I figured I would try it.  So I ran the following set of command;

sudo /etc/init.d/nagios3 stop
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
sudo /etc/init.d/nagios3 start

This worked like a charm and the web interface began accepting commands.

Sony Electronics Creates Open Source Development Community

Last week Sony open the doors to a new web site, as well as a new approach for the organization, called Sony DeveloperSony Developer is meant to become a hub for Open Source development efforts for Sony Electronic products.

Currently, Sony has enabled the community for "SNAP" which is an application framework for consumer electronic devices. From the SNAP site;

"SNAP stands for Sony's Networked Application Platform and is part of an emerging new ecosystem for making downloadable applications available to networked devices like TV’s, Blu-ray Disk players and other Consumer Electronic products. SNAP is in the very early stages of development and has a lot of room to grow"

This will open an avenue that will allow developers to get their applications onto SNAP enabled devices such as televisions. SNAP is based on the GNUstep community, whose origin dates back to the OpenStep standard developed by NeXT Computer Inc (now Apple Computer Inc.) which also implements the extensions added by Apple in the form of Cocoa. The main language on GNUstep for SNAP is ObjectiveC and the SNAP development web site points a lot of great resources on ObjectC from beginners guide to optimization.

Sony offers a guides and a SDK for download to start with your development efforts. It's mentioned on the SNAP web site that some good examples of applications would be "Games, Widgets (weather, news, traffic, etc), remote controls, social apps, media sharing apps, media players, home automation". Also according to the web site Sony will be hosting contest in the future for SNAP developers with prizes ranging from Sony televisions to Sony Walkman.

Another section of the Sony Developer Web site will be the dash section, which is currently unavailable but from what I've heard should be opened in the coming weeks. dash is the Sony new Personal Internet Viewer. Developed with Flex, Sony is hoping to encourage and foster application developed on the dash product.

‘report_activate_error’: RubyGem version error

So from time to time I will post small things to my blog that I just want to keep track of or remember how I did something. This is one of those post. I should prefix this post to anyone who happens to come across it and read it, I am by no means a "Rails Developer" and as a matter of fact, I ran into this problem working through a "How to" books.

The issue

I am running OSX 10.6.2 and although I had Ruby on Rails working on it at one time, some how, some where it broke. Now there is nothing more frustrating to a n00b who is trying to work through a tutorial on how to learn a new programming language and not being able to get past the first chapter because something about the base install of the programming language that you don't know anything about and you're trying to learn, wont work.

The Actual Error

When I try to create my first controller this is what happens

  1. ruby script/generate controller main welcome

And this is what the system kicked out to me
  1. /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks': RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError)</p>
  2. <p>from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process'<br />
  3. from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'<br />
  4. from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'<br />
  5. from /Users/eric/Dropbox/Code/Rails/r4music1/config/environment.rb:9<br />
  6. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br />
  7. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'<br />
  8. from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1<br />
  9. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br />
  10. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'<br />
  11. from script/generate:3

Sidebar
Naturally, the first thing I do is start hitting Google and start clicking on links. A lot of similar issues with a wide variety of solutions. From just doing a simple 'sudo gem update', to making sure rake is installed, to making sure you have the correct rake version installed. None of which worked for me. Finally, I stumbled onto Wojno' Site and following the steps in his post I manage to resolve my problem.

The Fix
If you didn't want to click on Wonjno's link here are the steps that fixed my problem. Had to change a couple of things because my install paths were a little different since I was running a different OS.
We begin by uninstalling the problem package

  1. sudo gem uninstall rack

When prompted, make sure you remove all versions of the rack packages. Now this is one place where my experience differed a little. I ended up getting prompted to uninstall rails itself. I'm a brave soul, that didn't scare me, so yeah I uninstalled it.
Here is what that looked like
  1. <br />
  2. sudo gem uninstall rack<br />
  3. Remove executables: rackup in addition to the gem? [Yn] &nbsp;Y<br />
  4. Removing rackup<br />
  5. You have requested to uninstall the gem: rack-1.0.0<br />
  6. actionpack-2.3.3 depends on [rack (~> 1.0.0)]<br />
  7. actionpack-2.3.5 depends on [rack (~> 1.0.0)]<br />
  8. If you remove this gems, one or more dependencies will not be met.<br />
  9. Continue with Uninstall? [Yn] &nbsp;Y<br />
  10.  

OK, that was a little scary but we will fix it.
I did manually remove the directory for the older version of rack
  1. <br />
  2. sudo rm -rf /Library/Ruby/Gems/1.8/gems/rack-1.0.1/<br />
  3. </bash><br />
  4. Now we reinstall things. Don't forget we need to reinstall the rails itself<br />
  5. <code lang="rails"><br />
  6. sudo gem install -v=2.3.5 rails<br />
  7. sudo gem install rack<br />
  8.  

After that, life was good, at least for me. If you found this article and actually read it in hopes that it helped fix your issue, well then I hope you had some success as well.

Posted via web from shocm

My First Linux Servers at Work – 2002

Buddy of mine posted a video he had of me when I first worked for Sony as a consultant. Took this video right before I was leaving the gig, sometime in 2004 2002, and we were walking through one of our data centers. Of course the one proud points of achievement I wanted to point out was the fact that I had finally implemented Linux in the environment. Now of course, I am back at Sony and 90% of the environment I am is responsible for is Linux based.

Posted via web from shocm's posterous

Sony Pictures Imageworks Releases Open Source Shading Language (OSL) to Development Community

CULVER CITY, Calif., Jan. 14 /PRNewswire/ -- Sony Pictures Imageworks, the award-winning visual effects and digital character animation unit of Sony Pictures Digital Productions, released the Alpha version of its source code for OSL, its Open Shading Language, it was announced today by Rob Bredow, Chief Technology Officer of Sony Pictures Imageworks.OSL is a fundamentally different approach to shader languages for visual effects and computer animation rendering.  OSL was designed to enable and support the latest developments in rendering technology.  Unlike previous shader languages, OSL assumes a rendering system that can perform ray tracing, and provides for natural global illumination and a demand for physical accuracy.  All of which is significantly different from the assumptions made years ago when most of the current shader languages were first developed.

Sony Pictures Imageworks initially developed OSL for use with its in-house renderer in the production of animated feature films and visual effects. The language specification released today was developed with input by other visual effects and animation studios, including Rhythm & Hues, who also wish to use it. The code is now available through Imageworks' Open Source website at http://opensource.imageworks.com/

Imageworks announced its Open Source program last August and has spent the past several months preparing OSL for use on its upcoming films.

This early release of code follows the model of the most successful open source programs in which development from this point forward will be done "in the open" for others to watch, use and contribute to as desired. OSL is licensed under a "production friendly" open source license.  Imageworks is optimistic that OSL will be adopted broadly by those needing a modern shading language for production needs.

"We're excited to be sharing OSL with the world," said Rob Bredow.   "Our goal is to follow the model of the most successful open source software by making our development public.  This provides the very best opportunities for collaboration and adoption.  Even though it's in its early stages, there is a lot of sophisticated groundwork already laid in OSL. We look forward to the response from the computer graphics community"

OSL TAKES A DIFFERENT APPROACH

According to Imageworks' OSL lead developer Larry Gritz, one of the industry's foremost experts in shading and rendering, shaders in other languages compute the color of an object as viewed from a particular direction.  In this way, the shader is a black box to the renderer -- all the renderer can do is execute the shader, for a particular direction, and get the result.

What distinguishes OSL from prior languages is that the material properties of surfaces, explicit descriptions of how light is scattered by them, are treated as a first-class concept that the shaders compute and that the renderer can then manipulate and reason about.  The renderer can evaluate these properties, i.e., figure out the outgoing radiance in any particular direction.  This is just one of many things OSL can do. It also "importance samples" these surfaces, which is helpful for efficient global illumination because it lets the renderer send the rays in the places that count the most, instead of just groping around in the hopes of finding important light paths.   Because sampling and evaluation are de-coupled from the shader execution, OSL allows a renderer to reorder computations in really interesting ways that could greatly improve speed and/or image quality.

Also, OSL is very consistent with physical units throughout, which not only improves the ability to accurately simulate materials and lights, but it also solves some longstanding problems in production, such as matching results between area light sources, emissive geometry visible to GI, and HDRI environment maps. These matches are now possible with OSL.

About OSL (Open Shading Language)

Open Shading Language (OSL) is a small but rich language for programmable shading in advanced renderers and other applications. OSL is similar to C, as well as other shading languages; however, it is specifically designed for advanced rendering algorithms with features such as radiance closures, BRDFs, and deferred ray tracing as first-class concepts.

The OSL project includes a complete language specification, a compiler from OSL to an intermediate assembly-like byte code, an interpreter that executes OSL shaders on collections of points in a SIMD manner, and extensive standard shader function library. These all exist as libraries with straightforward C++ APIs, and so may be easily integrated into existing renderers, compositing packages, image processing tools, or other applications. Additionally, the source code can be easily customized to allow for renderer-specific extensions or alterations, or custom back-ends to translate to GPUs or other special hardware.

For more information and access to OSL, visit http://opensource.imageworks.com

ABOUT SONY PICTURES IMAGEWORKS

Sony Pictures Imageworks Inc. is the Academy Award® winning, state-of-the-art visual effects and animation unit of Sony Pictures Digital Productions. The Imageworks production environment supports live-action visual effects and character animation, all-CG animation, Imageworks 3D stereoscopic, and  Imageworks Interactive, a full service creative group that produces websites and supports digital marketing for the studio and outside clients.

Imageworks' achievements have been recognized by the Academy of Motion Picture Arts and Sciences with Oscars® for its work on SPIDER-MAN™ 2 and the CG animated short film THE CHUBBCHUBBS!. In 2008, SURF'S UP was nominated for the Academy Award for Best Animated Feature. In 2007, two of Imageworks' projects, SUPERMAN RETURNS and the all-CG animated feature MONSTER HOUSE, were nominated for Academy Awards in the Outstanding Achievement in Visual Effects and Best Animated Feature respectively. With those two nominations, Imageworks became the first studio to be recognized in the same year in these distinct areas, an indication of the diversity and quality of the company's capabilities. Other Oscar® nominated projects include THE CHRONICLES OF NARNIA: THE LION, THE WITCH AND THE WARDROBE, SPIDER-MAN™, HOLLOW MAN, STUART LITTLE and STARSHIP TROOPERS, for a total of ten nominations.

Imageworks' most recently completed projects include 2012, CLOUDY WITH A CHANCE OF MEATBALLS, G-FORCE, WATCHMEN, VALKYRIE, BODY OF LIES, EAGLE EYE, HANCOCK, SPEED RACER, BEOWULF, and I AM LEGEND.  Upcoming projects include ALICE IN WONDERLAND and CATS AND DOGS 2.

Imageworks maintains operations in Culver City, CA; Novato, CA; Albuquerque, New Mexico; and Chennai, India.

Sony Pictures Imageworks Inc. is a division of Sony Pictures Digital Production Inc.

For more information, please visit www.imageworks.com.

SOURCE Sony Pictures Imageworks

RELATED LINKS
http://www.imageworks.com

Always have to call out where my Sony world and my Open Source world overlap.

Posted via web from shocm's posterous