Tuesday, February 9, 2021

Hello? Hello? Is this thing on?

 I may or may not be reviving this old blog. We'll see. There will be two broad areas that will be somewhat compartmentalized here. First will be stuff relevant to Buddhism and Zen. Secondly there will be some IT/science/geek stuff.

Like I said, we'll see. Won't we?



Monday, December 2, 2013

How to add a line break at the end of a bunch of lines in Sublime Text editor

I found the solution (copied below) here:
http://stackoverflow.com/questions/14509001/shortcut-to-paste-multiple-lines-sublime-text-2

The solution was posted by Rachel Gallen, a web designer in Ireland.
Ctrl+C, Ctrl+X and Ctrl+V let you copy/cut/paste lines if you don't select anything. So, Ctrl+X doesn't "delete" a line, it cuts it. To delete a line, the default shortcut is Ctrl+Shift+K :)

Highlighting a bunch of lines then hitting Cmd (Ctrl?) +Shift+L gives you multi-cursors on each line. I do that, followed by Cmd + Right arrow (End?) to get easily get a cursor at the end of a series of lines to simultaneously type something after each.

Ctrl+Shift+J expands the selection to the indentation level of the current line. So if you want to select a block of code with the same indentation it's really useful. 

Alt + F3 select all occurrences of current word for multiple editing. Very useful.  A few written about in more detail: http://whiletruecode.com/post/7-handy-text-manipulation-tricks-sublime-text-2

Friday, November 29, 2013

Ruby on Rails on Ubuntu 12.04 virtual machine

CAUTION: A WORK IN PROGRESS!!!!

0. set up virtual machine using VMWare Player 6 and ubuntu 12.04 LTS Desktop iso
0a. 100 GB disk space
0b. 4 GB RAM
0c. bridged network
0d. point to iso file

1. follow the "step-by-step" instructions at:
http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/

sudo apt-get update
sudo apt-get install git
sudo apt-get install curl
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
rvm install 1.9.3
rvm use 1.9.3 --default
gem install rails
mkdir rails-proj; cd rails-proj
rails new testrrr_app
cd testrrr_app
rails server
NOW USE A BROWSER TO GO TO localhost:3000


2. pick up at section 1.2.2 in Hartl with the command:
rvm use 1.9.3@rails3tutorial2ndEd --create --default

3. gem update --system 1.8.24

4. create and edit .gemrc file as per "listing 1.1" and "listing 1.2"

5. gem install rails -v 3.2.14

Monday, November 25, 2013

The Eight Quarks of Object Orientation (a la Armstrong)

In 2006, Deborah J. Armstrong published an article in which she attempts to address the fact that "we do not yet thoroughly understand the fundamental concepts that define the OO approach."

Her contribution to a resolution of this problem was a meta-study of 239 published sources from 1966 to 2005, out of which "88 asserted that a specific set of concepts characterize the OO approach." From these 88 sources, she further isolated "39 concepts ... comprising the OO approach." And of those 39 concepts, "eight were identified by the majority of the sources:
  1. inheritance
  2. object
  3. class
  4. encapsulation
  5. method
  6. message passing
  7. polymorphism
  8. abstraction."

Armstrong then proceeds to give an overview of each of these eight core OO concepts. Her entire paper is freely available online, and is worth reading (and rereading) in full. Below is my own executive summary (after a few explanations concerning my own methodology).

For five of Armstrong's eight core concepts I have selected only a brief snippet that, at least to me, conveys the essential meaning. In two of these cases (Inheritance and Object), the snippets I have selected are not original to Armstrong, and for these I provide the source that Armstrong cites in her paper. In three other cases (Method, Message Passing, and Polymorphism), the snippet I chose was Armstrong's own summary definition.

In two other cases (Class and Abstraction), I decided that, even in this briefest of overviews, a mere snippet wouldn't suffice, and so I quote all (or nearly all) of Armstrong's discussion of the given term.

Finally, in one case (Encapsulation), I honestly did not find what Armstrong had to say especially enlightening. And so I chose a snippet from another source, Joel Murach's Java Programming (4th edition).

Armstrong's full online paper is located here: http://cacm.acm.org/magazines/2006/2/5991-the-quarks-of-object-oriented-development/fulltext. The full citation for Armstrong's paper is:
The quarks of object-oriented development
By Deborah J. Armstrong
Communications of the ACM, Vol. 49 No. 2, Pages 123-128 10.1145/1113034.1113040

The Eight Quarks of Object Orientation (a la Armstrong):
  1. Inheritance: "a relation between classes that allows for the definition and implementation of one class to be based on that of other existing classes [10]."
  2. Object: "an object is as an instance of a class [1]."
  3. Class: " ... a class is a set of objects described by the same declaration [8, 9] and is the basic element of OO modeling. Some have conceptualized a class as an encapsulation of data and procedures, which can be instantiated in a number of objects [3]. Others have defined a class as a set of objects that share a common structure and common behavior [1].  A class does several things: at runtime it provides a description of how objects behave in response to messages; during development it provides an interface for the programmer to interact with the definition of objects; in a running system it is a source of new objects [8]. Based on these definitions, a class is: a description of the organization and actions shared by one or more similar objects."
  4. Encapsulation: "Encapsulation ... means the class controls which of its fields and methods can be accessed by other classes." Murach, Java Programming (4ed), p. 189
  5. Method:  "a way to access, set or manipulate an object's information."
  6. Message passing: "the process by which an object sends data to another object or asks the other object to invoke a method."
  7. Polymorphism: "the ability of different classes to respond to the same message and each implement the method appropriately."
  8. Abstraction: "The earliest application of structural abstraction to programming languages was in the 1950s with symbolic assemblers. Data abstraction is possible in classical development, but it is enforced in the OO approach [9]. Many authors define abstraction in a generic sense as a mechanism that allows us to represent a complex reality in terms of a simplified model so that irrelevant details can be suppressed in order to enhance understanding [4, 5, 12]. Others have conceptualized abstraction as the act of removing certain distinctions between objects so that we can see commonalities [6]. Based on these definitions, abstraction is: the act of creating classes to simplify aspects of reality using distinctions inherent to the problem."

Finally, here are all of the references that Armstrong provides in her paper:
1. Booch, G. Object Oriented Analysis and Design with Applications. Benjamin/Cummings, Redwood City, CA, 1994.
2. Byard, C. Object-oriented technology a must for complex systems. Computer Technology Review 10, 14 (1990), 15–20.
3. Dershem, H.L. and Jipping, M.J. Programming Languages: Structures and Models. PWS Publishing Company, Boston, MA, 1995.
4. Henderson-Sellers, B. A Book of Object-Oriented Knowledge. Prentice-Hall, Englewood Cliffs, NJ, 1992.
5. Ledgard, H. The Little Book of Object-Oriented Programming. Prentice-Hall, Upper Saddle River, NJ, 1996.
6. Morris, M.G., Speier, C., and Hoffer, J.A. An examination of procedural and object-oriented systems analysis methods: Does prior experience help or hinder performance?" Decision Sciences 30, 1 (Winter 1999), 107–136.
7. Page-Jones, M. and Weiss, S. Synthesis: An object-oriented analysis and design method. American Programmer 2, 7–8 (1989), 64–67.
8. Robson, D. Object-oriented software systems. Byte 6, 8 (Aug. 1981), 74–86.
9. Rosson, M. and Alpert, S.R. The cognitive consequences of object-oriented design. Human Computer Interaction 5, 4 (1990), 345–379.
10. Stefik, M. and Bobrow, D.G. Object-oriented programming: Themes and variations. The AI Magazine 6, 4 (Winter 1986), 40–62.
11. Wirfs-Brock, R.J. and Johnson, R.E. Surveying current research in object-oriented design. Commun. ACM 33, 9 (Sept. 1990), 104–124.
12. Yourdon, E., Whitehead, K., Thomman, J., Oppel, K. and Nevermann, P. Mainstream Objects: An Analysis and Design Approach for Business. Yourdon Press, Upper Saddle River, NJ, 1995.



Monday, November 4, 2013

Oracle 12c on Linux Part Deux: SQL Developer

Assuming that you have successfully installed Oracle 12c on your Linux box (and if you don't know how to accomplish that, look here), one of the next things you'll probably want to do is to get SQL Developer up and running.

In the next post (Part Three) I'll talk about how to access the sample schemas, which, as of 12c, are now tucked away inside "pluggable" databases.

1. Install Java (specifically JDK 7u45 & NetBeans 7.4, or something more or less equivalent). The download can be found here: http://www.oracle.com/technetwork/java/javase/downloads/index.html. Follow the installation instructions found here: http://www.oracle.com/technetwork/java/javase/downloads/jdk-7-netbeans-install-433844.html#linux

2. Download SQL Developer 4 rpm file. The download is here:  http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/sqldev-download-v4-1925679.html

3. Install SQL Developer following the instructions found here: http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/sqldev-install-linux-1969676.html

4. During the installation you should probably accept all the defaults, at least as far as where things are to be installed (/usr/local/). If you get a "DISPLAY" error at this point (or at any other point) refer to step #5 in the previous post.

5. Once the installation completes, log in as the oracle user and just execute "sqldeveloper". The first time you fire up SQL Developer it will ask you where your JDK is, and you should enter something like this: /usr/local/jdk1.7.0_45.

6. That's it! I really should be that simple. As long as you know your way around Linux, and you have installed Oracle properly in the first place, there should be no problems. But if you do run into any problems feel free to leave a comment and I will see if I can help you out!

Sunday, November 3, 2013

Oracle 12c Cheat Sheet for Linux (part one)

This blog post will cover the basic steps that will get you to the point where you have Oracle12c up and running on a Linux system. I am assuming Oracle Linux, but I have also verified that (with a few tweaks here and there, perhaps) things work pretty much the same with CentOs.

In Part Two I will talk about accessing "pluggable" databases (which you need to get to the sample schemas, such as "hr", etc), and also getting SQL Developer up and running.

1. Install latest version of Oracle Linux. I did this on a virtual machine using Vmware Workstation 10 running on Windows 8 Pro. More details are here : Installing Oracle Linux on a virtual machine.

2. Apply Oracle's set up scripts via yum (see https://blogs.oracle.com/wim/entry/easily_install_oracle_rdbms_12cr1) for some more details:

sudo yum install oracle-rdbms-server-12cR1-preinstall

3. Create directory /home/OraDB12c and download the two installation zip files here. (look here if you don't know how to do this: http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html).

4. IMPORTANT: Before installation you must manually create /oradata as root (or at least this was the case when I did it - despite the claim that the "setup" scripts were supposed to take care of this kind of thing):

mkdir /oradata
chown oracle /oradata
chgrp oinstall /oradata

5. Depending on what other configuration you have done on your linux box, there might be one more mthing before the install! Execute this command as root:

xhost +SI:localuser:oracle

6. Now run the installation script as the "oracle" user. The script is called "runInstall", and it should be found in the directory /home/OraDB12c/database. If you get a "DISPLAY" error, see step #5 above. During installation there is a step that requires manually running some more scripts (AS ROOT). These scripts get installed as part of the installation process - you will be prompted to do this at the appropriate time.

7. After installation completes successfully you must still manually set the the environment variables ORACLE_HOME, ORACLE_BASE, and ORACLE_SID, and also update your path (and when updating the path you should explicitly add ORACLE_HOME/bin). Here is what I put in my .bashrc file (for the "oracle" user) to accomplish this:

ORACLE_SID="orcl"; export ORACLE_SID
ORACLE_HOME="/home/oracle/app/oracle/product/12.1.0/dbhome_1/"; export ORACLE_HOME
ORACLE_BASE="/home/oracle/app/oracle/product/12.1.0/"; export ORACLE_BASE
PATH=$PATH:$ORACLE_BASE:$ORACLE_HOME:$ORACLE_HOME/bin; export PATH


7. At this point you should log in as the "oracle" user and you should be able to fire up sqlplus as usual:

sqlplus / as sysdba

8. If that doesn't work then you can either google the error message(s) you get, and/or leave a comment below and I'll try to help you out!

9. Note that Oracle has apparently changed the default locations for ORACLE_HOME and ORACLE_BASE. If you are unsure about what to set these environment variables to, check out this blog post by Kevin Closson: "Using Linux /proc To Identify ORACLE_HOME and Instance Trace Directories."

Here is the two step process for discovering where ORACLE_HOME is using /proc:

Step 1: ps -ef | grep lgwr | grep -v grep

Step 2: ls -l /proc/<PID>/exe

In my case the oracle home turned out to be, very reasonably, /home/oracle/app/oracle/product/12.1.0/dbhome_1/. In other words, it is the same as the "old style" ORACLE_HOME, but with "/u01/" replaced by "/home/oracle/". ORACLE_BASE is just the directory immediately above ORACLE_HOME.