Making a flash applet with an embedded PDF document

  1. Searched Google for “pdf to flash converter”
  2. Landed on website: “http://www.swftools.org/”
  3. Downloaded source code “swftools-2011-01-23-1815.tar.gz”
  4. Compiled code for my machine
  5. I now have a utility “pdf2swf” available on the console
  6. Usage: pdf2swf [-options] file.pdf -o file.swf

Once we convert the pdf to a swf flash file (let’s call it “hello_world.swf”) we can embed this file inside a browser. However, this will display our pdf document in a very basic format.

To take our exercise further we can embed our flash file inside (another flash applet – that in turn is embedded in an html file). The wrapper flash applet we will be using is called “Flex Paper” and is a sophisticated and customizable flash based pdf “viewer”.

We can download this viewer from 1.4.1 Flash Version (release notes).

After downloading and extracting the folder we will find within it a html file titled “FlexPaperViewer.html” with a reference to a “Paper.swf”. We will change this reference to our file “hello_world.swf”.

By the end of this exercise we have successfully:

  1. Converted a PDF document to a flash document titled “hello_world.swf”
  2. Downloaded a flash based PDF Viewer called “Flex Paper”
  3. Embedded our hello_world.swf file inside the PDF Viewer
  4. Prepared an html page (that came with the Flex Paper download) that has the PDF Viewer embedded within it.

We can now launch the html page in our browser and view the original PDF with a rich set of functionality.

Interestingly the PDF Viewer “Flex Paper” is open-source and comes with API that can be used to customize functionality we want to provide through the viewer.

    A basic how-to for "Screen"

    Screen is a console session management tool. It allows the user to create a “console session” that can be detached from and re-attached to at a later point in time.

    HOW-TO Use screen

    • Install screen by: “sudo aptitude install screen”
    • Launch screen by: “screen”
    • Name current session by: “screen -S s1”
    • Detach from session by: closing the console window
    • Reattach to session by: “screen -d -r s1”

    Note: “s1” is the name we gave to the session. 

      Navigating our global future (Ted Talk)

      http://video.ted.com/assets/player/swf/EmbedPlayer.swf

      Technology will be powerful by a magnitude in the future allowing for tremendous solutions in areas such as genetics & health; it will help us find a solution to many of our problems. At odds to this trend however is growing complexity and lack of predictability that the future brings, with inherent systemic risk to our interconnected globe. Risks such as the spread of pandemic viruses or the impact of the stock market crash in an interconnected global economy. And so, we will have to weave through these challenges our future brings very carefully.

      Important notes on Oracle Listeners

      A couple of important points.

      First, the listener is a server side only process. It’s entire purpose in life is to receive requests for connections to databases and set up those connections. Once the connection is established, the listener is out of the picture. It creates the connection. It doesn’t sustain the connection. One listener, with the default name of LISTENER, running from one oracle home, listening on a single port, will serve multiple database instances of multiple versions running from multiple homes. It is an unnecessary complexity to try to have multiple listeners or to name the listener as if it belongs to a particular database. That would be like the telephone company building a separate switchboard for each customer.

      Additional notes on the listener: One listener is capable of listening on multiple ports. But please notice that it is the listener using these ports, not the database instance. You can’t bind a specific listener port to a specific db instance. Similarly, one listener is capable of listnening on multiple IP addresses (in the case of a server with multiple NICs) But just like the port, you can’t bind a specific ip address to a specific db instance.

      Second, the tnsnames.ora file is a client side issue. (but beware that a ‘client’ process, such as exp, can run on the server machine. It is still a ‘client’) It’s purpose is for address resolution – the tns equivalent of the ‘hosts’ file further down the network stack. The only reason it exists on a host machine is because that machine can also run client processes.

      Assume you have the following in your tnsnames.ora:

      larry =
      (DESCRIPTION =
      (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
      )
      (CONNECT_DATA =
      (SERVICE_NAME = curley)
      )
      )

      Now, when you issue a connect, say like this:

      $> sqlplus scott/tiger@larry

      tns will look in your tnsnames.ora for an entry called ‘larry’. Finding it, tns sends a request through the normal network stack to (PORT = 1521) on (HOST = myhost) using (PROTOCOL = TCP), asking for a connection to (SERVICE_NAME = curley).

      Where is (HOST = myhost) on the network? When the request gets passed from tns to the next layer in the network stack, the name ‘myhost’ will get resolved to an IP address, either via a local ‘hosts’ file, via DNS, or possibly other less used mechanisms. You can also hard-code the ip address (HOST = 123.456.789.101) in the tnsnames.ora.

      Next, the standard networking process delivers the message to port 1521 on myhost. Hopefully, there is a listener on myhost configured to listen on port 1521, and that listener knows about SERVICE_NAME = curley. If so, the listener will spawn a server process to act as the intermediary between your client and the database instance. Communication to the server process will be on a randomly selected available port. At that point the listener is out of the process and continues to user port 1521 to await other connection requests.

      What can go wrong?

      First, there may not be an entry for ‘larry’ in your tnsnames. In that case you get “ORA-12154: TNS:could not resolve the connect identifier specified” No need to go looking for a problem on the host, with the listener, etc. If you can’t place a telephone call because you don’t know the number (can’t find your telephone directory (tnsnames.ora) or can’t find the party you are looking for listed in it (no entry for larry)) you don’t look for problems at the telephone switchboard.

      Maybe the entry for larry was found, but myhost couldn’t be resolved to an IP address (say there was no entry for myhost in the local hosts file). This will result in “ORA-12545: Connect failed because target host or object does not exist”

      Maybe there was an entry for myserver in the local hosts file, but it specified a bad IP address. This will result in “ORA-12545: Connect failed because target host or object does not exist”

      Maybe the IP was good, but there is no listener running: “ORA-12541: TNS:no listener”

      Maybe the IP was good, there is a listener at myhost, but it is listening on a different port. “ORA-12560: TNS:protocol adapter error”

      Maybe the IP was good, there is a listener at myhost, it is listening on the specified port, but doesn’t know about SERVICE_NAME = curley. “ORA-12514: TNS:listener does not currently know of service requested in connect descriptor”

      Third: If the client is on the same machine as the db instance, it is possible to connect without referencing tnsnames and without going through the listener.

      Now, when you issue a connect, say like this:

      $> sqlplus scott/tiger

      tns will attempt to establish an IPC connection to the db instance. How does it know the name of the instance? It uses the current value of the enviornment variable ORACLE_SID. So…

      $> export ORACLE_SID=fred
      $> sqlplus scott/tiger

      It will attempt to connect to the instance known as “fred”. If there is no such instance, it will, of course, fail. Also, if there is no value set for ORACLE_SID, the connect will fail.

      check executing instances to get the SID

      [oracle@vmlnx01 ~]$ ps -ef|grep pmon|grep -v grep
      oracle 4236 1 0 10:30 ? 00:00:00 ora_pmon_vlnxora1

      set ORACLE_SID appropriately, and connect

      [oracle@vmlnx01 ~]$ export ORACLE_SID='vlnxora1
      [oracle@vmlnx01 ~]$ sqlplus scott/tiger
       
      SQL*Plus: Release 10.2.0.4.0 - Production on Wed Sep 22 10:42:37 2010
       
      Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
       
       
      Connected to:
      Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
      With the Partitioning, OLAP, Data Mining and Real Application Testing options

      Now set ORACLE_SID to a bogus value, and try to connect

      SQL> exit
      [oracle@vmlnx01 ~]$ export ORACLE_SID=FUBAR
      [oracle@vmlnx01 ~]$ sqlplus scott/tiger
       
      SQL*Plus: Release 10.2.0.4.0 - Production on Wed Sep 22 10:42:57 2010
       
      Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
       
      ERROR:
      ORA-01034: ORACLE not available
      ORA-27101: shared memory realm does not exist
      Linux Error: 2: No such file or directory
       
       
      Enter user-name:

      Now set ORACLE_SID to null, and try to connect

      [oracle@vmlnx01 ~]$ export ORACLE_SID=
      [oracle@vmlnx01 ~]$ sqlplus /scott/tiger
       
      SQL*Plus: Release 10.2.0.4.0 - Production on Wed Sep 22 10:43:24 2010
       
      Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
       
      ERROR:
      ORA-12162: TNS:net service name is incorrectly specified

      Ok, that is how we get from the client connection request to the listener. What about the listener’s part of all this?

      The listener is very simple. It’s job is to listen for connection requests and make the connection (server process) between the client and the database instance. Once that connection is made, the listener is out of the picture. If you were to kill the listener, all existing connections would continue. The listener is configured with the listener.ora file, but if that file doesn’t exist, the listener is quite capable of starting up with all default values. One common mistake with the listner configuration is to specify “HOST=localhost” or “HOST=127.0.01”. This is a NONROUTABLE ip address. LOCALHOST and ip address 127.0.0.1 always mean “this machine on which I am sitting”. So, all computers are known as “localhost” or “127.0.0.1”. If you specify this address, the listener will only be capable of receiving requests from the machine on which it is running. If you specified that address in your tnsnames file – on a remote client machine – the request would be routed to the machine on which the requesting client resides. Probably not what you want.


      source: http://forums.oracle.com/forums/thread.jspa?threadID=2155354&tstart=0

      A strategy behind the Oracle Database

      Interesting features of Oracle Database that I discovered:

      • Support for non-standard data types has been included enabling the database to support audio, video and other data types.
      • A wrapper over the network layer: A component of the Oracle Software is built to handle multiple network protocols including TCP/IP and others.
      • Oracle Spatial is a new component of the software that stores and processes data related to the space coordinates of objects. Where these objects can be large in scale such as a bridge or small in scale such as circuit boards.

      The Oracle Corporation is moving towards making the database agnostic to variety at the data type, network protocol and even the business intelligence layer (being able to process spatial data) and possibly all other layers.

      The use of virtualization

      Virtualization takes place by creating a container that is allocated a subset of the systems resources. With these resources the container can host an independent operating system.

      Since the container cannot access resources outside of it we are able to isolate the virutalized operating system from accessing and interfering with the environment of the host operating system and thus secure the resources of the host against the virtualized system.

      Chroot is one of the methods to create such a virtual environment.

      I used chroot for the purpose of installing a 32 bit (development environment) OS over a 64 bit host OS so I could access its 32 bit libraries and environment to compile, link and test code for a 32 bit (production environment) OS.

      How to use Open Source Software for a business model

      Business model of an IT company based on open-source software (OSS): can be to take varied components (delivering a specific function) and integrate them to create a new product.

      An example:
      1. Take a virtual machine
      2. Install Centos on it
      3. Install a network monitoring tool on it

      All OSS. The new product is a VM Image that can be deployed on any OS (those that support the VM/emulator) and (with a little configuration) will serve as a tool to monitor the network. 

      The pricing that’s associated with OSS licenses allows one to mark any price on the product they create.