Crockford on JavaScript – Section 8: Programming Style & Your Brain

I just finished watching this excellent video on improving one’s programming style in javascript, and thought others might enjoy it as well. Enjoy.

Advertisements

Tinting Your Hillshade in ArcMap

My posts have been noticeably absent of geomatics content, so today I’ll share a tutorial that I read on tinting a hillshade in ArcMap. The tutorial is available at the following ESRI Blog post. I’ve used this technique in the past, and it’s a great way to keep your base map crisp and colourful (crisp example), instead of the typical dull appearance produced when a semi-transparent DEM layer is placed over a hillshade (dull example).

The tutorial uses pansharpening to fuse a hillshade raster with a DEM that has had a colour ramp applied to it and broken in to RGB layers. It may take a few attempts to get the final result you want, but the result is an excellent way to make your base layer really stand out. Give it a try, you may be surprised how much your hillshade’s appearance is improved.

Quick Tip: Exploring Your Bash History

Typically when you type a shell command its recorded in the bash history. If you ever needed to see what you typed in the past, a useful tool is the history command. By typing history in the shell it will display a list of commands (commonly the last 500) in the shell.

Example:
user@computer:~$ history
1 ls
2 mkdir testdir
3 cd testdir/
4 vi testdoc
5 ls
6 cd ..
7 rm -r testdir/
8 history

One of the benefits of the history command is if there is a command in your history you wish to execute again. You can do so by typing !<history number>.

Example:
Using the history list above, typing !2 would execute the command mkdir testdir again.

Quick Tip: Saving Scalable Vector Graphics From A Website

I’ve recently learned an interesting tip regarding the saving of SVG (scalable vector graphics). If you want to save a copy of a svg from a website, you can do so by performing the following steps;

Steps to Save an SVG:

  1. Open up the source of the website (right click on the website and select view page source)
  2. Completely copy the svg element code (make sure to copy all lines of code found between the open svg tag <svg> and the closing svg tag </svg>
  3. Paste the svg element code in to a new text document
  4. Save the text document with the extension .svg

The result is a perfect copy of the svg element seen on the website, which you can open in most vector graphic programs and if desired saved into other graphic file formats (eg. png, gif, jpg, etc).

Note: If you don’t have a vector graphic program, give Inkscape a try.

Quick Tip: Disk Usage in Terminal

When investigating your disk usage, there are two simple terminal commands which can make your life easier.

The first command df, provides a usage report for your file system, providing a list of partitions and the amount of space which has been used and how much space is available in each.

eg. df

Another command that can provide more specific information on disk usage is the du command. This command will provide a list of each file and directory and the amount of disk spaced used by each, with the total disk usage for the specified directory/file provided at the end of the output.

eg. du /home

Like most terminal commands, a number of arguments can be used in conjunction. One very useful argument is the -h argument, which provides the output of both commands in a human readable format. An examples of using this argument can is shown below,

df -h
du -h /home

Coming Out From My Rock and Found a Dwarf Fortress Update!

Wow, I must have been under a rock these last 4 months, because I just found out that Dwarf Fortress was updated for the first time in over 2 years. YA!

A screen-shot of Dwarf Fortress's main menu screen

A screen-shot of Dwarf Fortress’s main menu screen

If you haven’t played this free and amazing game, I recommend it. It has a steep learning curve, but once you understand the basic mechanics, it begins to show off it’s charm pretty quickly. It’s a game about creating/managing a fortress for dwarfs, and surviving the harsh reality that is their lives. LOTS of things can go wrong with a fortress, and the appeal of the game comes from both the challenge of surviving and seeing how your story evolves.

You can download the game from Bay 12 Games. Also many graphics sets exist if you want a more graphical appearance than the default ASCII characters, which you can get from here. Lastly, if you haven’t played this game before, be prepared to spend some time upfront to learn how to play. When I started out with this game, I found a great video tutorial series by Captnduck on You Tube which was very helpful. He’s also added some recent videos regarding the update, which I haven’t seen but may be helpful for older players as well.

Anyway I’m off to see what’s changed in Dwarf Fortress. Happy gaming everyone!