Monday, January 9, 2012

American History: Infuriating, enlightening, and thought provoking

So I Just started my next Quarter and right now I'm taking an Introduction to UNIX class, and one on American History. Thankfully I love both, so it is actually quite interesting. Right off the bat however I knew American History would be hard, simply because I have a hard time reading about all the injustice that went on to build this country, yet I'm supposed to feel proud to be an American.

It is literally infuriating to me when I read about how bad people were treated, when the early settlers and immigrants were themselves escaping persecution. Even in today's world it's so sickening to see people so willing to step on the backs of others just to get ahead in this artificially inflated society we all live in. If you think about it, our planet Earth is roughly 4.5 billion years old, and we have absolutely no historical record beyond the last few thousand years at best. What this likely means is that our civilization will end up erased from Earths history books, which means all this greed and power hungry ego trips will be for nothing anyways; we have a short time here on this planet, it's sad to see so many choose to live it hurting others instead of helping and enjoying what this planet offers, together in harmony.

I also have a hard time thinking about how these immigrants, first settlers included, pushed their ideals onto a people who were much more in harmony with their surroundings and views. The new people felt that these savages couldn't have a high level grasp on what it meant to be civil, and religious, and therefore felt it necessary to force their views upon them:

In response to Missionaries attempting to convert Native Americans to Christianity, one Crow Inidian explained

"We found there were too many kinds of religion among white men for us to understand, and that scarcely any two white men agreed which was the right one to learn. This bothered us a good deal until we saw that the white man did not take his religion any more seriously than he did his laws, and that he kept both of them use when they might do him good in his dealings with strangers. These were not our ways. We kept the laws we made and lived our religion."

Let that be a life lesson to those who need it: someone with different views, opinions, and beliefs does not necessarily have a lack of understanding. Quite the contrary, you may be so blinded by your own ideals, that you lack the comprehension needed to grasp the bigger picture. In the case of this Crow Indian, his people didn't pollute their ways with things they didn't believe and live, I wonder how much better of a world we might live in had people so open minded graced us with a lasting presence much earlier on in US History.

Just my 2c...

Sunday, July 3, 2011

Going rounds with moms iMac ... again...

So my moms (1st gen, for which the warranty is expired) iMac has crashed yet again. This is the third major fault with the hardware in 4 years. Needless to say we won't be buying any Mac computers anytime soon. This time however we lucked out (unlike the first time where her HD crashed) as it appears to be the video adapter or display going out again (we just got that exact problem fixed ~1.5yr ago). So I decided to retrieve her files so when she gets a new computer we can safely copy them over.

As much as I'm really not a fan of Macs anymore, there is one really cool feature they offer. It's something called, "Target Disk Mode" (although I hear, unfortunately, it may be in the process of being phased out) which is a very helpful tool for system maintainers. When the firmware and hard drive are still functioning you can start up your Mac in a special 'Mode' that allows it to be viewable to another computer as just a plain 'ol external Firewire hard drive. What this means is you can, browse the contents of the drive, copy over files etc... in the event that the HD needs to be wiped and OS reinstalled. The 'host' computer needs to be something with a Firewire port and preferably Mac OS X or Linux operating system. It can be done using Windows, but out of the box Windows does not support reading or writing to the HFS+ filesystem (which Mac uses) so you won't be able to read the disk. You can buy software to do it, however if this is a one time thing, there's no sense in that. (If you don't have another working Mac or Linux installed, you can safely use Ubuntu Linux ( Ubuntu has a Windows installer which lets you install Ubuntu just as you would any other Windows application (it sets up dual booting so you can select Ubuntu Linux or Windows when the install is complete). Later on if you don't want it you can remove it via Windows normal Add/Remove Programs just like any other application) You also need a male-to-male Firewire 400 cable (these are unfortunately quite expensive for what they are). Here's the setup I was working with:

- Ubuntu 10.10 x64 (my 'host' Desktop computer w/ a Firewire 400 port)
- Mac OS X Leopard 10.5 (my moms old computer, this is a 1st gen 20" Intel based iMac)
- 6ft male-to-male Firewire 400 cable

First things first, I disconnected all devices from the iMac and left just the wireless mouse/keyboard. Turn on the iMac and immediately press and HOLD the 'T' key on the keyboard. You'll see a grey screen with a giant Firewire icon bouncing around. If you see that you're in "Target Disk Mode" the iMac is done. (If you don't, power it off, this time after you power it on wait a couple seconds for the startup 'chime' then press and hold T, that should do it)

Next I turned on my Linux desktop and plugged the Firewire cable into the iMac and then my Linux desktop box. Ubuntu mounted it as a normal external Firewire hard drive and opened Nautilus for me to browse. I immediately ran into some trouble accessing all of her directories. Even though the drive was mounted with 'read/write' options, which was confirmed with the 'mount' command:

altf2o@ubuntu1010pd:~$ mount
/dev/sdd2 on /media/Macintosh HD type hfsplus (rw,nosuid,nodev,uhelper-udisks)

I could not access any of her folders. I could see and copy files from her root user directory stored in /Users/: /media/Macintosh HD/Users/Mom/ but all the subfolders; Desktop, Documents, Downloads, Pictures, Music, etc... all gave the same error (I found a lot of folks looking for help because of this error. All the solutions seemed a bit strange to me, hence this post):

command line error:
altf2o@ubuntu1010pd:/media/Macintosh HD/Users/Mom/$ cd Desktop/
bash: cd: Desktop/: Permission denied

In Nautilus:
The folder contents could not be displayed.

You do not have the permissions
necessary to view the contents of "Desktop".

It's because all the files were owned by the user/group with the ID:  501/501. Originally I thought to create a user/group with that uid/gid but there's actually a simpler solution: just use sudo or get a root shell with sudo su, copy them to a local folder, and change their permissions. I preferred getting a root shell so I could browse and make sure I got everything. So as my user (altf2o) on my Linux host computer I created a new folder to hold all her files:

altf2o@ubuntu1010pd:~$ mkdir MomsiMacBackup
altf2o@ubuntu1010pd:~$ sudo su
[sudo] password for altf2o: ***enter my pizz-ass-word***

Now go to our mounted Firewire drive and copy everything over:

root@ubuntu1010pd:/home/altf2o# cd /media/Macintosh HD/Users/Mom/
root@ubuntu1010pd:/media/Macintosh HD/Users/Mom/# cp -R * /home/altf2o/MomsiMacBackup

Once that completes we should have a copy of her ENTIRE directory (including sub directories) in /home/altf2o/MomsiMacBackup/ folder. Now all that's left is to change the permissions so my main user/group (altf2o:altf2o) owns all the files:

root@ubuntu1010pd:/media/Macintosh HD/Users/Mom/# cd /home/altf2o/MomsiMacBackup
root@ubuntu1010pd:/home/altf2o/MomsiMacBackup# chown -R altf2o:altf2o *

And that's it, we can verify with a simple:  ls -l  , command and it should show the 'user/group' as:

altf2o  altf2o

for the owner of all the files in all directories. Now, as usual, be sure to exit your root shell:

root@ubuntu1010pd:/home/altf2o/MomsiMacBackup# exit

I was able to browse around and copy any other files from the file system that needed to be backed up. Keep in mind there may be some directories such as temporary files, internet caches, etc... that you don't need, you can simply browse around in your root shell and copy only those that you need. I used the 'cp -R *' because I figure just grab everything now, restore what I want later. There is an old common sense rule of thumb in computer repair: When in doubt, BACK UP EVERYTHING! It's far better to delete something the person doesn't need later on, than explain how the files they DO need are gone because you didn't think to back them up.

(NOTE: For safe keeping I also made a compressed archive of the folder and stored it on my more permanent external storage, just in case the DVD I burned has issues. The command I used to create the archive was (I prefer bzip2, but gzip will work fine):

altf2o@ubuntu1010pd:~$ tar cjfv MomsiMacBackup.tar.bz2 MomsiMacBackup/

Then just copy it to any media you like, DVD, Network File Share, Tape, etc... for safe keeping. I like adding the whole folder this way because when we go to uncompress the archive it will extract to the folder:  MomsiMacBackup/ , which will be created if not present.)

Monday, October 11, 2010

That state of current "popular music" is pathetic...

So i used to be a HUGE fan of the Black Eyed Peas. I could even stand some of Fergies solo stuff. But this latest trend of "the beat is banging" ... "this beat is..." crap is tired. I cannot put into words, seriously, how absolutely sad it is that absolute crap has become popular. The pop worlds of Britney Spears were bad enough, at least it had lyrics. Now we have an entirely new era of sloppy dance beats with about 5 words repeated over and over. Combine that with absolutely horrible use of this "auto-tune" sound, and we have the current music industry. If you want to create mindless music, please leave it to the clubs where everyone is so drunk, the beat is all they hear anyways. If you want to use any type of synthesizer on your vocals, please refer to Zap and Roger to see how its done CORRECTLY! If your ability to sing depends on thousands of dollars of equipment to engineer it into something that doesn't resemble a cat in heat, then you don't deserve to be where you're at. Ugh... I have about 1,000 more cents to give, but i'll leave it at 2.

Sunday, October 25, 2009

Installing Oracle 10g Express Edition + ZendCoreForOracle PHP + Java + Tomcat 6 on Ubuntu 9.04

I recently wanted to see what all the hype over Oracle was all about. I will say i was very pleasantly surprised! They have a fantastic suite of utilities and products to make real database work and administration a breeze. So after some digging i found out they offer their 10g EE for free with a few limitations. Here's the basic run down taken from:

    * What is Oracle Database 10g Express Edition?
          o Oracle Database 10g Express Edition (Oracle Database XE) is an entry-level, small footprint starter database which is:
          o Free to download
          o Free to develop & deploy
          o Free to distribute (including ISVs)
          o Oracle Database XE is built using the same code base as Oracle Database 10g Release 2 product line—Standard Edition One, Standard
            Edition, and Enterprise Edition—and is available on 32-bit Windows and Linux platforms.

    * Who should use Oracle Database XE?
          o Oracle Database XE is the perfect choice for many different groups, including:
          o Developers working on PHP, Java, .NET, and other applications that require a database
          o DBAs who need a free starter database for training and deployment
          o Independent Software Vendors (ISVs) who want to embed an Oracle database in their application or product to extend customer value at no
            additional cost
          o Educational institutions and students who need a free starter database for their curriculum.

    * Can I use Oracle Database XE for free development?
          o Yes. There are no database license costs associated with developing applications for Oracle Database XE which offers the complete
            integrated set of Oracle Database programming interfaces including:
          o SQL, PL/SQL
          o Java, C, and PHP
          o Windows .Net
          o Oracle Application Express
          o C++, ODBC, OLE DB

    * Can I use Oracle Database XE for free deployment?
          o Oracle Database XE is free for runtime usage with the following limitations:
          o Supports up to 4GB of user data (in addition to Oracle system data)
          o Single instance only of Oracle Database XE on any server
          o May be installed on a multiple CPU server, but only executes on one processor in any server
          o May be installed on a server with any amount of memory, but will only use up to 1GB RAM of available memory

    * Can I distribute Oracle Database XE?
          o Yes. Oracle Database XE can be freely distributed as a standalone database or as part of a third-party application or product, provided
            the criteria defined above is adhered to.

So as you can see for someone like myself who's just starting out in the world of Enterprise Class database administration and hopefully someday development, what Oracle offers here is outstanding. I doubt any of my home test projects will come close to 4GB of data, and yet i still get a rich, full featured RDBMS to boot, not bad.

So my motivation? Well as stated i'd like to learn about managing large Enterprise Scale datasets. I'd like to continue at my current job and advance in that direction, ultimately leading to actual development of in house or 3rd party applications. Since my favorite languages are C and PHP (and learning Java) that's what i set my focus on. Developing in C with Oracle is very easy, PHP connectivity to Oracle with ZendCoreForOracle
is easy, or using Java and Tomcat6. So i set out to get this running on my Ubuntu 9.04 development box. I had to tweak here and there so i decided to write my steps down incase someone could make use of them. Unfortunately there were way to many late night Google searches to remember all my sources. The bulk of this is from each packages own install documentation with tidbits from various Open Source communities. For those who continue to contribute, thank you for all your hard work.

- For this example i installed Ubuntu 9.04 Desktop in a Virtual Machine using VirtualBox from Sun Microsystems.
    15GB HD
    384MB RAM
    64MB Video RAM
(NOTE: To install Oracle 10g XE you need at least a 768MB swap file. I recommend doing custom partitions, adding 1GB swap file, and simply assigning the rest to /)

- So first of all lets grab the files we'll need, just save them to your desktop: - Navigate to "Downloads > Zend Core For Oracle" and
    (NOTE: You will HAVE to sign up to download, it is fast and free.) - Oracle has some of the best documentation and tutorials i've ever seen.
    (NOTE: You will HAVE to sign up to download, it is fast and free.)
      * From Homepage > Database > Express Edition (under "Oracle Database Editions and Options" section)
      * FREE DOWNLOAD - Here is where you actually download Oracle 10g XE
      * You'll want this version: Oracle Database 10g Express Edition (Western European) (unless you're out of the US or don't speak English,
        in which case how are you reading this 0_o?!)
      * Since we're on Ubuntu and it uses Debian's package management system, we simply grab the *.deb file AFTER clicking that we Accept the
        license agreenment up top.

- Update apt

    sudo apt-get update

- Run ALL Ubuntu updates and restart if needed before beginning this tutorial.
- Version i'm using:
    * Ubuntu 9.04              
      (NOTE: I've also installed Ubuntu 9.10 Karmic RC on my Aspire One netbook (Netbook Remix edition) this same tutorial worked flawlessly.)
    * Oracle 10g XE            
    * ZendCore for Oracle      
- Once that's complete and we've saved our files to our desktop, lets begin!

- This tutorial installs several services with no mention of securing them. I don't offer a firewall tutorial or anything else that would make these "secure." Please understand this setup is on my HOME completely internal virtual image which is only on while i'm developing. If you plan on putting this on an actual physical server you have in your home that should be fine, but i would still try and secure it especially if you have a WAP of any kind connected to your LAN. If you plan on putting this on a corporate\company Intranet most definitely learn to secure the box and it's services before deploying, even in a test environment. If you're putting this on a box that's WAN exposed, i really hope you're not reading this message for advice. Consider yourself warned, these tools are great out of the box, but there's always potential to be broken into. I make no claim that this tutorial will prevent that, you're using it at your own risk!

- Open a terminal window:

      Applications > Accessories > Terminal

- First we need to ensure we do NOT have Apache2 or libapache2-mod-php5 installed, these conflict with the ZendCoreForOracle PHP version that we downloaded (they may offer a multi-threaded version for purchase, free appears single threaded only). Please ensure if you're NOT doing this in a VM be cautious. Backup your web server and ALL config. files for it before just trashing things.

      dpkg -l | grep apache2
      dpkg -l | grep php

does either return a value? If so, the following two commands are ALL we care to remove, otherwise move on:

      sudo apt-get remove apache2
      sudo apt-get remove libapache2-mod-php5

- Next we want to navigate to our desktop and install a dependency, libaio1 and Oracle 10g XE.

      cd Desktop ; ls
      sudo apt-get install libaio1
      sudo dpkg -i oracle-xe_10.2.0.1-1.0_i386.deb

- Now we setup inital Oracle configuration. For me when i'm testing something in a virtual machine i use an easy pw like:  pass123 , or similar. Obviously if you're deploying this on a more public server, even internally, please choose SANE passwords.

      sudo /etc/init.d/oracle-xe configure

      * Leave default port (8080)
      * Leave default listener port (1521) 
      * Enter and confirm your Oracle password

      (NOTE: This is used to log into the sys and system administration accounts)

      * Leave default 'y' to startup on boot 
      * It'll startup the Oracle Net Listener, and say, "Configuring Database...."

      (NOTE: Configuring the database may take a while, especially in a VM on a slow host PC)

- Now we test our new installation. Point your browser to the following URL:


      You should see a web page titled "Application Express Login" and "ORACLE Database Express Edition" on the top.

- If you don't, you b0rk3d something, go back and re-install it. Now since i'm sure we remembered our password we set, lets login as the sys user:

      pw (whatever you set)

      Should see "Administration", "Object Browser", "SQL" etc...

- Next since the free version of ZendCoreForOracle PHP is single threaded lets install and test a single threaded version of Apache for Ubuntu:

      sudo apt-get install apache2-mpm-prefork

      (NOTE: When starting and stopping Apache2 it may complain about being unable to determine servers fully qualified domain name and wants to use for 'ServerName' that's fine, it will function fine.)

- Verify Apache installed ok by going to the following URL:


      Should see "It Works!" if so move on.

- Now lets install and test ZendCoreForOracle

      tar -xvzf ZendCoreForOracle-2.5.0-linux-glibc21-i386.tar.gz
      cd ZendCoreForOracle-2.5.0-linux-glibc21-i386/
      sudo ./install -g

      (NOTE: -g is a graphical install. Run ./install , alone for a list of options)

      * (hit enter)
          (Read agreement)
      * (hit enter)
      * (hit enter)
          (Yes to accept license)
      * (hit enter)
          (Leave default install location to /usr/local/Zend)
      * (enter web gui pw)
          (I make it same as Oracle for testing, use down arrow to navigate to "Verify Password" box)
      * (hit enter)
      * (hit enter)
      * (hit enter)
          (Leave install / configure at defaults)
          (NOTE: Here you can install Zend Core bundled Apache, however i prefer to install what comes with Ubuntu, i know
          it's been tested in THIS environment)
      * (hit enter)
          (Since we have apache and /etc/init.d/apache2 is it, and it's default just hit enter)
      * (hit enter)
          (Leave it on Yes, to auto detect and configure Apache2)
      * (hit enter)
          (Yes Apache2 start command is: /etc/init.d/apache2 start)
      * (change htdocs)
          (By default Apache2 serves files from /var/www ZendCoreForOracle just needs that value. Use down arrow to change fields)
      * (hit enter)
          (Keep default Apache Module, as installation method)

  Now it's going to download the components it needs and install them, shouldn't take but a few moments on a moderately fast connection.

      * (select Finish installation)
      * (hit enter)

- Now that ZendCoreForOracle is installed we test it by going to:


      Should see: Zend Core(tm) for Oracle login

- Again we should remember our password. One of the things Oracle tutorials will recommend is you turn on debugging info while developing, it does
  help greatly. Lets do that first. Log into Zend Core and navigate to:

      Configuration > (expand) Error Handling and Logging > (set to On) display_errors > Save Settings > Logout

  then restart Apache2:

      sudo /etc/init.d/apache2 restart

- Another thing Oracles tutorials have you do is make a public_html folder available from your home directory via the userdir module in Apache 2.2.
  So as you develop an application it's accessible from: http://localhost/~user/. In Apache 2.2 this is how you turn that on:

      sudo a2enmod userdir
      sudo /etc/init.d/apache2 restart

- Now we're going to create a couple test files and our directory to hold them in.

      cd ~
      mkdir public_html
      cd public_html
      nano index.html

            Add the following:
                Hello World!

      nano test.php

            Add the following:

- Now test our locally served directories are working, including PHP support (replacing 'user' with your user name):


  (NOTE: You can also copy these files to /var/www , and see regular content is served just fine as well)

- Now lets get Java and Tomcat6 up and running. We need the full JDK for a full development environment, so lets start with Java:

      aptitude search jdk
        (mine is: sun-java6-jdk)
      sudo apt-get install sun-java6-jdk

      (Read license agreenment, tab to OK)
      (hit enter)
      (select Yes hit enter)
  to test:

      java -version
- To get tomcat:

      aptitude search tomcat
      sudo apt-get install tomcat6

  I've used Tomcat 6 before and it works great out of the box on Ubuntu. Only thing to keep in mind is Oracle is listening on port 8080
  (tomcats default). So we edit our Tomcat config to use a different port:

      sudo nano /etc/tomcat6/server.xml

  Look for the line:

      <Connector port="8080" protocol="HTTP/1.1"
          ... />
  and change 'port' to something else, i use: 8081 to keep it simple. Restart

      sudo /etc/init.d/tomcat6 restart

  (NOTE: I would highly recommend installing Tomcat6's examples and docs
   great resource)

      sudo apt-get install tomcat6-examples tomcat6-docs
- Last i use the following to make sure everything is up and running. BUT!!!! first things first! The scariest thing after a huge setup like this, reboot! :). After that each of the following should "just work" if not backtrack and see if you missed something:

      http://localhost/               (Default Apache2 served from /var/www should say "It Works!")
      http://localhost/~user/         (Our index.html file served from our ~/public_html folder)
      http://localhost/~user/test.php (Our test.php file served from our ~/public_html folder)
      http://localhost/ZendCore       (ZendCoreForOracle Web GUI Login)
      http://localhost:8080/apex      (Oracle 10g XE Login)
      http://localhost:8081/          (Tomcat6 instance)
- If you made it through all that, congrats! and enjoy!

Happy Coding,

- When starting Oracle Tutorials you have to unlock the HR account. I may have missed it but it wasn't to obvious so here's how to do it incase you want to "get ahead" and be ready to jump into their Application Express tutorials:

        (Login as 'sys' with the system password)
      Administration > Manage Database User > HR
      Set PW to 'hr' and confirm
      Change "Account Status" to Unlocked
      Click Alter User
  Now when you start with tutorials your HR user will be setup correctly to grab and manipulate the default dataset that comes with the database.

- Helpful links:
  (NOTE: If you start with the first link, and head strait down, you'll have a VERY good grasp of all that you actally get with, and can do in Oracle 10g XE. It's truly amazing)

  * Getting started guide:
  * Online self-study tutorial:
  * Create Oracle 10g XE application:
  * All online docs in HTML\PDF form:
  * PHP Manual:
  * Tomcat6 Documentation and Examples:
    (If you installed Tomcat6 examples & docs)
  * Beginning Java